001//
002// This file is auto-generated. Please don't modify it!
003//
004package org.opencv.dnn;
005
006import org.opencv.core.Mat;
007import org.opencv.dnn.Model;
008import org.opencv.dnn.Net;
009
010// C++: class SegmentationModel
011/**
012 * This class represents high-level API for segmentation  models
013 *
014 * SegmentationModel allows to set params for preprocessing input image.
015 * SegmentationModel creates net from file with trained weights and config,
016 * sets preprocessing input, runs forward pass and returns the class prediction for each pixel.
017 */
018public class SegmentationModel extends Model {
019
020    protected SegmentationModel(long addr) { super(addr); }
021
022    // internal usage only
023    public static SegmentationModel __fromPtr__(long addr) { return new SegmentationModel(addr); }
024
025    //
026    // C++:   cv::dnn::SegmentationModel::SegmentationModel(String model, String config = "")
027    //
028
029    /**
030     * Create segmentation model from network represented in one of the supported formats.
031     * An order of {@code model} and {@code config} arguments does not matter.
032     * @param model Binary file contains trained weights.
033     * @param config Text file contains network configuration.
034     */
035    public SegmentationModel(String model, String config) {
036        super(SegmentationModel_0(model, config));
037    }
038
039    /**
040     * Create segmentation model from network represented in one of the supported formats.
041     * An order of {@code model} and {@code config} arguments does not matter.
042     * @param model Binary file contains trained weights.
043     */
044    public SegmentationModel(String model) {
045        super(SegmentationModel_1(model));
046    }
047
048
049    //
050    // C++:   cv::dnn::SegmentationModel::SegmentationModel(Net network)
051    //
052
053    /**
054     * Create model from deep learning network.
055     * @param network Net object.
056     */
057    public SegmentationModel(Net network) {
058        super(SegmentationModel_2(network.nativeObj));
059    }
060
061
062    //
063    // C++:  void cv::dnn::SegmentationModel::segment(Mat frame, Mat& mask)
064    //
065
066    /**
067     * Given the {@code input} frame, create input blob, run net
068     * @param mask Allocated class prediction for each pixel
069     * @param frame automatically generated
070     */
071    public void segment(Mat frame, Mat mask) {
072        segment_0(nativeObj, frame.nativeObj, mask.nativeObj);
073    }
074
075
076    @Override
077    protected void finalize() throws Throwable {
078        delete(nativeObj);
079    }
080
081
082
083    // C++:   cv::dnn::SegmentationModel::SegmentationModel(String model, String config = "")
084    private static native long SegmentationModel_0(String model, String config);
085    private static native long SegmentationModel_1(String model);
086
087    // C++:   cv::dnn::SegmentationModel::SegmentationModel(Net network)
088    private static native long SegmentationModel_2(long network_nativeObj);
089
090    // C++:  void cv::dnn::SegmentationModel::segment(Mat frame, Mat& mask)
091    private static native void segment_0(long nativeObj, long frame_nativeObj, long mask_nativeObj);
092
093    // native support for java finalize()
094    private static native void delete(long nativeObj);
095
096}