Class MatSerializer

java.lang.Object
com.fasterxml.jackson.databind.JsonSerializer<org.bytedeco.opencv.opencv_core.Mat>
io.github.jspinak.brobot.json.serializers.MatSerializer
All Implemented Interfaces:
com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable

public class MatSerializer extends com.fasterxml.jackson.databind.JsonSerializer<org.bytedeco.opencv.opencv_core.Mat>
Custom Jackson serializer for OpenCV Mat objects.

Converts Mat to a JSON representation that includes matrix metadata and data. This prevents serialization errors when Mat objects are included in classes that need to be converted to JSON.

The serialized format includes: - rows: Number of rows - cols: Number of columns - type: OpenCV type constant - channels: Number of channels - depth: Bit depth - data: Base64-encoded matrix data

  • Nested Class Summary

    Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.JsonSerializer

    com.fasterxml.jackson.databind.JsonSerializer.None
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Class<org.bytedeco.opencv.opencv_core.Mat>
     
    void
    serialize(org.bytedeco.opencv.opencv_core.Mat mat, com.fasterxml.jackson.core.JsonGenerator gen, com.fasterxml.jackson.databind.SerializerProvider provider)
     

    Methods inherited from class com.fasterxml.jackson.databind.JsonSerializer

    acceptJsonFormatVisitor, getDelegatee, isEmpty, isEmpty, isUnwrappingSerializer, properties, replaceDelegatee, serializeWithType, unwrappingSerializer, usesObjectId, withFilterId

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MatSerializer

      public MatSerializer()
  • Method Details

    • serialize

      public void serialize(org.bytedeco.opencv.opencv_core.Mat mat, com.fasterxml.jackson.core.JsonGenerator gen, com.fasterxml.jackson.databind.SerializerProvider provider) throws IOException
      Specified by:
      serialize in class com.fasterxml.jackson.databind.JsonSerializer<org.bytedeco.opencv.opencv_core.Mat>
      Throws:
      IOException
    • handledType

      public Class<org.bytedeco.opencv.opencv_core.Mat> handledType()
      Overrides:
      handledType in class com.fasterxml.jackson.databind.JsonSerializer<org.bytedeco.opencv.opencv_core.Mat>