001// 002// This file is auto-generated. Please don't modify it! 003// 004package org.opencv.dnn; 005 006import java.util.ArrayList; 007import java.util.List; 008import org.opencv.core.Mat; 009import org.opencv.core.MatOfFloat; 010import org.opencv.core.MatOfPoint; 011import org.opencv.core.MatOfRotatedRect; 012import org.opencv.dnn.Model; 013import org.opencv.utils.Converters; 014 015// C++: class TextDetectionModel 016/** 017 * Base class for text detection networks 018 */ 019public class TextDetectionModel extends Model { 020 021 protected TextDetectionModel(long addr) { super(addr); } 022 023 // internal usage only 024 public static TextDetectionModel __fromPtr__(long addr) { return new TextDetectionModel(addr); } 025 026 // 027 // C++: void cv::dnn::TextDetectionModel::detect(Mat frame, vector_vector_Point& detections, vector_float& confidences) 028 // 029 030 /** 031 * Performs detection 032 * 033 * Given the input {@code frame}, prepare network input, run network inference, post-process network output and return result detections. 034 * 035 * Each result is quadrangle's 4 points in this order: 036 * - bottom-left 037 * - top-left 038 * - top-right 039 * - bottom-right 040 * 041 * Use cv::getPerspectiveTransform function to retrieve image region without perspective transformations. 042 * 043 * <b>Note:</b> If DL model doesn't support that kind of output then result may be derived from detectTextRectangles() output. 044 * 045 * @param frame The input image 046 * @param detections array with detections' quadrangles (4 points per result) 047 * @param confidences array with detection confidences 048 */ 049 public void detect(Mat frame, List<MatOfPoint> detections, MatOfFloat confidences) { 050 Mat detections_mat = new Mat(); 051 Mat confidences_mat = confidences; 052 detect_0(nativeObj, frame.nativeObj, detections_mat.nativeObj, confidences_mat.nativeObj); 053 Converters.Mat_to_vector_vector_Point(detections_mat, detections); 054 detections_mat.release(); 055 } 056 057 058 // 059 // C++: void cv::dnn::TextDetectionModel::detect(Mat frame, vector_vector_Point& detections) 060 // 061 062 public void detect(Mat frame, List<MatOfPoint> detections) { 063 Mat detections_mat = new Mat(); 064 detect_1(nativeObj, frame.nativeObj, detections_mat.nativeObj); 065 Converters.Mat_to_vector_vector_Point(detections_mat, detections); 066 detections_mat.release(); 067 } 068 069 070 // 071 // C++: void cv::dnn::TextDetectionModel::detectTextRectangles(Mat frame, vector_RotatedRect& detections, vector_float& confidences) 072 // 073 074 /** 075 * Performs detection 076 * 077 * Given the input {@code frame}, prepare network input, run network inference, post-process network output and return result detections. 078 * 079 * Each result is rotated rectangle. 080 * 081 * <b>Note:</b> Result may be inaccurate in case of strong perspective transformations. 082 * 083 * @param frame the input image 084 * @param detections array with detections' RotationRect results 085 * @param confidences array with detection confidences 086 */ 087 public void detectTextRectangles(Mat frame, MatOfRotatedRect detections, MatOfFloat confidences) { 088 Mat detections_mat = detections; 089 Mat confidences_mat = confidences; 090 detectTextRectangles_0(nativeObj, frame.nativeObj, detections_mat.nativeObj, confidences_mat.nativeObj); 091 } 092 093 094 // 095 // C++: void cv::dnn::TextDetectionModel::detectTextRectangles(Mat frame, vector_RotatedRect& detections) 096 // 097 098 public void detectTextRectangles(Mat frame, MatOfRotatedRect detections) { 099 Mat detections_mat = detections; 100 detectTextRectangles_1(nativeObj, frame.nativeObj, detections_mat.nativeObj); 101 } 102 103 104 @Override 105 protected void finalize() throws Throwable { 106 delete(nativeObj); 107 } 108 109 110 111 // C++: void cv::dnn::TextDetectionModel::detect(Mat frame, vector_vector_Point& detections, vector_float& confidences) 112 private static native void detect_0(long nativeObj, long frame_nativeObj, long detections_mat_nativeObj, long confidences_mat_nativeObj); 113 114 // C++: void cv::dnn::TextDetectionModel::detect(Mat frame, vector_vector_Point& detections) 115 private static native void detect_1(long nativeObj, long frame_nativeObj, long detections_mat_nativeObj); 116 117 // C++: void cv::dnn::TextDetectionModel::detectTextRectangles(Mat frame, vector_RotatedRect& detections, vector_float& confidences) 118 private static native void detectTextRectangles_0(long nativeObj, long frame_nativeObj, long detections_mat_nativeObj, long confidences_mat_nativeObj); 119 120 // C++: void cv::dnn::TextDetectionModel::detectTextRectangles(Mat frame, vector_RotatedRect& detections) 121 private static native void detectTextRectangles_1(long nativeObj, long frame_nativeObj, long detections_mat_nativeObj); 122 123 // native support for java finalize() 124 private static native void delete(long nativeObj); 125 126}