001// 002// This file is auto-generated. Please don't modify it! 003// 004package org.opencv.imgproc; 005 006import org.opencv.core.Algorithm; 007import org.opencv.core.Mat; 008import org.opencv.core.Size; 009 010// C++: class LineSegmentDetector 011/** 012 * Line segment detector class 013 * 014 * following the algorithm described at CITE: Rafael12 . 015 * 016 * <b>Note:</b> Implementation has been removed due original code license conflict 017 */ 018public class LineSegmentDetector extends Algorithm { 019 020 protected LineSegmentDetector(long addr) { super(addr); } 021 022 // internal usage only 023 public static LineSegmentDetector __fromPtr__(long addr) { return new LineSegmentDetector(addr); } 024 025 // 026 // C++: void cv::LineSegmentDetector::detect(Mat _image, Mat& _lines, Mat& width = Mat(), Mat& prec = Mat(), Mat& nfa = Mat()) 027 // 028 029 /** 030 * Finds lines in the input image. 031 * 032 * This is the output of the default parameters of the algorithm on the above shown image. 033 * 034 * ![image](pics/building_lsd.png) 035 * 036 * @param _image A grayscale (CV_8UC1) input image. If only a roi needs to be selected, use: 037 * {@code lsd_ptr->detect(image(roi), lines, ...); lines += Scalar(roi.x, roi.y, roi.x, roi.y);} 038 * @param _lines A vector of Vec4i or Vec4f elements specifying the beginning and ending point of a line. Where 039 * Vec4i/Vec4f is (x1, y1, x2, y2), point 1 is the start, point 2 - end. Returned lines are strictly 040 * oriented depending on the gradient. 041 * @param width Vector of widths of the regions, where the lines are found. E.g. Width of line. 042 * @param prec Vector of precisions with which the lines are found. 043 * @param nfa Vector containing number of false alarms in the line region, with precision of 10%. The 044 * bigger the value, logarithmically better the detection. 045 * <ul> 046 * <li> 047 * -1 corresponds to 10 mean false alarms 048 * </li> 049 * <li> 050 * 0 corresponds to 1 mean false alarm 051 * </li> 052 * <li> 053 * 1 corresponds to 0.1 mean false alarms 054 * This vector will be calculated only when the objects type is #LSD_REFINE_ADV. 055 * </li> 056 * </ul> 057 */ 058 public void detect(Mat _image, Mat _lines, Mat width, Mat prec, Mat nfa) { 059 detect_0(nativeObj, _image.nativeObj, _lines.nativeObj, width.nativeObj, prec.nativeObj, nfa.nativeObj); 060 } 061 062 /** 063 * Finds lines in the input image. 064 * 065 * This is the output of the default parameters of the algorithm on the above shown image. 066 * 067 * ![image](pics/building_lsd.png) 068 * 069 * @param _image A grayscale (CV_8UC1) input image. If only a roi needs to be selected, use: 070 * {@code lsd_ptr->detect(image(roi), lines, ...); lines += Scalar(roi.x, roi.y, roi.x, roi.y);} 071 * @param _lines A vector of Vec4i or Vec4f elements specifying the beginning and ending point of a line. Where 072 * Vec4i/Vec4f is (x1, y1, x2, y2), point 1 is the start, point 2 - end. Returned lines are strictly 073 * oriented depending on the gradient. 074 * @param width Vector of widths of the regions, where the lines are found. E.g. Width of line. 075 * @param prec Vector of precisions with which the lines are found. 076 * bigger the value, logarithmically better the detection. 077 * <ul> 078 * <li> 079 * -1 corresponds to 10 mean false alarms 080 * </li> 081 * <li> 082 * 0 corresponds to 1 mean false alarm 083 * </li> 084 * <li> 085 * 1 corresponds to 0.1 mean false alarms 086 * This vector will be calculated only when the objects type is #LSD_REFINE_ADV. 087 * </li> 088 * </ul> 089 */ 090 public void detect(Mat _image, Mat _lines, Mat width, Mat prec) { 091 detect_1(nativeObj, _image.nativeObj, _lines.nativeObj, width.nativeObj, prec.nativeObj); 092 } 093 094 /** 095 * Finds lines in the input image. 096 * 097 * This is the output of the default parameters of the algorithm on the above shown image. 098 * 099 * ![image](pics/building_lsd.png) 100 * 101 * @param _image A grayscale (CV_8UC1) input image. If only a roi needs to be selected, use: 102 * {@code lsd_ptr->detect(image(roi), lines, ...); lines += Scalar(roi.x, roi.y, roi.x, roi.y);} 103 * @param _lines A vector of Vec4i or Vec4f elements specifying the beginning and ending point of a line. Where 104 * Vec4i/Vec4f is (x1, y1, x2, y2), point 1 is the start, point 2 - end. Returned lines are strictly 105 * oriented depending on the gradient. 106 * @param width Vector of widths of the regions, where the lines are found. E.g. Width of line. 107 * bigger the value, logarithmically better the detection. 108 * <ul> 109 * <li> 110 * -1 corresponds to 10 mean false alarms 111 * </li> 112 * <li> 113 * 0 corresponds to 1 mean false alarm 114 * </li> 115 * <li> 116 * 1 corresponds to 0.1 mean false alarms 117 * This vector will be calculated only when the objects type is #LSD_REFINE_ADV. 118 * </li> 119 * </ul> 120 */ 121 public void detect(Mat _image, Mat _lines, Mat width) { 122 detect_2(nativeObj, _image.nativeObj, _lines.nativeObj, width.nativeObj); 123 } 124 125 /** 126 * Finds lines in the input image. 127 * 128 * This is the output of the default parameters of the algorithm on the above shown image. 129 * 130 * ![image](pics/building_lsd.png) 131 * 132 * @param _image A grayscale (CV_8UC1) input image. If only a roi needs to be selected, use: 133 * {@code lsd_ptr->detect(image(roi), lines, ...); lines += Scalar(roi.x, roi.y, roi.x, roi.y);} 134 * @param _lines A vector of Vec4i or Vec4f elements specifying the beginning and ending point of a line. Where 135 * Vec4i/Vec4f is (x1, y1, x2, y2), point 1 is the start, point 2 - end. Returned lines are strictly 136 * oriented depending on the gradient. 137 * bigger the value, logarithmically better the detection. 138 * <ul> 139 * <li> 140 * -1 corresponds to 10 mean false alarms 141 * </li> 142 * <li> 143 * 0 corresponds to 1 mean false alarm 144 * </li> 145 * <li> 146 * 1 corresponds to 0.1 mean false alarms 147 * This vector will be calculated only when the objects type is #LSD_REFINE_ADV. 148 * </li> 149 * </ul> 150 */ 151 public void detect(Mat _image, Mat _lines) { 152 detect_3(nativeObj, _image.nativeObj, _lines.nativeObj); 153 } 154 155 156 // 157 // C++: void cv::LineSegmentDetector::drawSegments(Mat& _image, Mat lines) 158 // 159 160 /** 161 * Draws the line segments on a given image. 162 * @param _image The image, where the lines will be drawn. Should be bigger or equal to the image, 163 * where the lines were found. 164 * @param lines A vector of the lines that needed to be drawn. 165 */ 166 public void drawSegments(Mat _image, Mat lines) { 167 drawSegments_0(nativeObj, _image.nativeObj, lines.nativeObj); 168 } 169 170 171 // 172 // C++: int cv::LineSegmentDetector::compareSegments(Size size, Mat lines1, Mat lines2, Mat& _image = Mat()) 173 // 174 175 /** 176 * Draws two groups of lines in blue and red, counting the non overlapping (mismatching) pixels. 177 * 178 * @param size The size of the image, where lines1 and lines2 were found. 179 * @param lines1 The first group of lines that needs to be drawn. It is visualized in blue color. 180 * @param lines2 The second group of lines. They visualized in red color. 181 * @param _image Optional image, where the lines will be drawn. The image should be color(3-channel) 182 * in order for lines1 and lines2 to be drawn in the above mentioned colors. 183 * @return automatically generated 184 */ 185 public int compareSegments(Size size, Mat lines1, Mat lines2, Mat _image) { 186 return compareSegments_0(nativeObj, size.width, size.height, lines1.nativeObj, lines2.nativeObj, _image.nativeObj); 187 } 188 189 /** 190 * Draws two groups of lines in blue and red, counting the non overlapping (mismatching) pixels. 191 * 192 * @param size The size of the image, where lines1 and lines2 were found. 193 * @param lines1 The first group of lines that needs to be drawn. It is visualized in blue color. 194 * @param lines2 The second group of lines. They visualized in red color. 195 * in order for lines1 and lines2 to be drawn in the above mentioned colors. 196 * @return automatically generated 197 */ 198 public int compareSegments(Size size, Mat lines1, Mat lines2) { 199 return compareSegments_1(nativeObj, size.width, size.height, lines1.nativeObj, lines2.nativeObj); 200 } 201 202 203 @Override 204 protected void finalize() throws Throwable { 205 delete(nativeObj); 206 } 207 208 209 210 // C++: void cv::LineSegmentDetector::detect(Mat _image, Mat& _lines, Mat& width = Mat(), Mat& prec = Mat(), Mat& nfa = Mat()) 211 private static native void detect_0(long nativeObj, long _image_nativeObj, long _lines_nativeObj, long width_nativeObj, long prec_nativeObj, long nfa_nativeObj); 212 private static native void detect_1(long nativeObj, long _image_nativeObj, long _lines_nativeObj, long width_nativeObj, long prec_nativeObj); 213 private static native void detect_2(long nativeObj, long _image_nativeObj, long _lines_nativeObj, long width_nativeObj); 214 private static native void detect_3(long nativeObj, long _image_nativeObj, long _lines_nativeObj); 215 216 // C++: void cv::LineSegmentDetector::drawSegments(Mat& _image, Mat lines) 217 private static native void drawSegments_0(long nativeObj, long _image_nativeObj, long lines_nativeObj); 218 219 // C++: int cv::LineSegmentDetector::compareSegments(Size size, Mat lines1, Mat lines2, Mat& _image = Mat()) 220 private static native int compareSegments_0(long nativeObj, double size_width, double size_height, long lines1_nativeObj, long lines2_nativeObj, long _image_nativeObj); 221 private static native int compareSegments_1(long nativeObj, double size_width, double size_height, long lines1_nativeObj, long lines2_nativeObj); 222 223 // native support for java finalize() 224 private static native void delete(long nativeObj); 225 226}