Class SegmentationModel

java.lang.Object
org.opencv.dnn.Model
org.opencv.dnn.SegmentationModel

public class SegmentationModel extends Model
This class represents high-level API for segmentation models SegmentationModel allows to set params for preprocessing input image. SegmentationModel creates net from file with trained weights and config, sets preprocessing input, runs forward pass and returns the class prediction for each pixel.
  • Constructor Details

    • SegmentationModel

      protected SegmentationModel(long addr)
    • SegmentationModel

      public SegmentationModel(String model, String config)
      Create segmentation model from network represented in one of the supported formats. An order of model and config arguments does not matter.
      Parameters:
      model - Binary file contains trained weights.
      config - Text file contains network configuration.
    • SegmentationModel

      public SegmentationModel(String model)
      Create segmentation model from network represented in one of the supported formats. An order of model and config arguments does not matter.
      Parameters:
      model - Binary file contains trained weights.
    • SegmentationModel

      public SegmentationModel(Net network)
      Create model from deep learning network.
      Parameters:
      network - Net object.
  • Method Details

    • __fromPtr__

      public static SegmentationModel __fromPtr__(long addr)
    • segment

      public void segment(Mat frame, Mat mask)
      Given the input frame, create input blob, run net
      Parameters:
      frame - automatically generated
      mask - Allocated class prediction for each pixel
    • finalize

      protected void finalize() throws Throwable
      Overrides:
      finalize in class Model
      Throws:
      Throwable