Quantcast
Channel: OpenCV Q&A Forum - Latest question feed
Viewing all articles
Browse latest Browse all 19555

Contour opencv bigger than contour of threshold ?

$
0
0
Threshold image : [C:\fakepath\thresh.png](/upfiles/14616560554974494.png) Contour image: [C:\fakepath\contour.png](/upfiles/14616560954501138.png) This is my code: public class Test1 { public static void main(String[] args) { JFileChooser f = new JFileChooser("C:\\Users\\DinhThap\\Documents\\NetBeansProjects\\LicensePlateRecognition"); int result = f.showOpenDialog(f);//show dialog box to choose files File myfile = null; String path = ""; if (result == 0) { myfile = f.getSelectedFile();//selected file taken to myfile path = myfile.getAbsolutePath();//get the path of the file } Imshow.showMultiple("Gray", opencv_imgcodecs.cvLoadImage(path)); opencv_core.Mat grayScale = ImageOpenCvUtils.toGray(opencv_imgcodecs.imread(path)); //opencv_core.Mat grayScale = ImageOpenCvUtils.toMat(ImageOpenCvUtils.toGray(opencv_imgcodecs.cvLoadImage(path))); Imshow.showMultiple("Gray", grayScale); opencv_core.Mat maximizeContrast = ImageOpenCvUtils.maximizeContrastMat(grayScale, 1); //opencv_core.Mat gaussianFilter = ImageOpenCvUtils.toGaussianFilterMat(maximizeContrast, Conf.GAUSSIAN_SMOOTH_FILTER_SIZE, 0); opencv_core.Mat gaussianFilter = new opencv_core.Mat(); opencv_imgproc.bilateralFilter(maximizeContrast, gaussianFilter, 9, 18, 9/2); opencv_core.Mat threshold = ImageOpenCvUtils.toAdaptiveThresholdMat(gaussianFilter, 19, 9); Imshow.showMultiple("Gray", threshold); List listOfPossibleChar = DetectPlateMat.getPossibleCharsInScene(threshold); opencv_core.Mat imgContours = new opencv_core.Mat(threshold.size(), opencv_core.CV_8UC3, opencv_core.Scalar.BLACK); //opencv_imgproc.CV_AA opencv_imgproc.drawContours(imgContours, convertListToArrMat(listOfPossibleChar), -1, opencv_core.Scalar.WHITE); Imshow.showMultiple("Gaussian", imgContours); } }

Viewing all articles
Browse latest Browse all 19555

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>