Contour opencv bigger than contour of threshold ?

asked 2016-04-26 02:36:34 -0500

Dinh Thap gravatar image

updated 2017-12-31 02:16:43 -0500

Threshold image : C:\fakepath\thresh.png Contour image: C:\fakepath\contour.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<CharMat> 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);


}

}

edit retag flag offensive close merge delete

Comments

this does not look like opencv's java wrappers at all.

berak gravatar imageberak ( 2016-04-26 02:44:47 -0500 )edit

I used javacv which similar to opencv

Dinh Thap gravatar imageDinh Thap ( 2016-04-26 02:47:18 -0500 )edit
1

unfortunately, we cannot help you with unsupported, 3rd party api problems

berak gravatar imageberak ( 2016-04-26 02:49:12 -0500 )edit

YES. Thank you so much.

Dinh Thap gravatar imageDinh Thap ( 2016-04-26 03:44:08 -0500 )edit