简体   繁体   中英

Android Watershed OpenCV

我的问题如何在Android Watershed OpenCv上计算图像中的对象?

Since you didn't tell us which line causes those problem, but i strongly assume you misused erode() and dilate().

You should pass 3rd parameter of each function with valid non-zero Matrix.(eg Kernel)

erode & dilate example

// You can change the size of kennel 
// if you want to change the range of erosion & dilation
Mat kelnel = Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size(2,2));

Mat fg = new Mat(img.size(),CvType.CV_8U);
Imgproc.erode(threeChannel, fg, kelnel);

Mat bg = new Mat(img.size(),CvType.CV_8U);
Imgproc.dilate(threeChannel, bg, kelnel);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM