我已經應用全局閾值,自適應閾值,膨脹和腐蝕,但也不能得到預期的結果。如何清除OpenCV中使用Java的圖像中的小黑點?
Imgproc.threshold(source2, destination2, 147, 255,Imgproc.THRESH_BINARY);
Highgui.imwrite("threshold.jpg", destination2);
Imgproc.adaptiveThreshold(destination2, destination2, 255,
Imgproc.ADAPTIVE_THRESH_MEAN_C, Imgproc.THRESH_BINARY, 11,2);
Highgui.imwrite("Adpthreshold.jpg", destination2);
Mat destination3 = new Mat(source.rows(),source.cols(),source.type());double erosion_size = 0;
int dilation_size = 1;
Mat element = Imgproc.getStructuringElement(Imgproc.MORPH_CROSS, new Size(2*erosion_size + 1, 2*erosion_size+1));
Imgproc.erode(destination2, destination3, element);
Highgui.imwrite(