0

i am working in image processing and find the connected components in a image. in MATLAB i am using bwconncomp function but can anyone help me how can i do it in java or is there any direct function in OpenCv.

5
  • Hey this is not related to your question, actually I also trying to integrate OpenCV Java wrapper into one of my projects. Can you share your experience of doing the same? Are you using Native code or the wrapper JavaCV? Commented Apr 15, 2014 at 10:32
  • i am using opencv for android Commented Apr 15, 2014 at 10:37
  • Can you please share some of the references that you have regarding this. Some reference links etc. I will be grateful to you! Commented Apr 15, 2014 at 10:47
  • docs.opencv.org/java/2.4.2/index-all.html Commented Apr 15, 2014 at 10:59
  • Lastly, do you need NDK for this or not? Commented Apr 15, 2014 at 11:05

1 Answer 1

2

Take a look at FindContours

You can use it in Android with:

Imgproc.findContours(Mat image, 
        java.util.List<MatOfPoint> contours, 
        Mat hierarchy, 
        int mode, 
        int method)

The hierarchy parameter concerns image topology and nested contours, therefore, for simple contours you can just pass new Mat() and Imgproc.RETR_LIST and Imgproc.CHAIN_APPROX_NONE for mode and method respectively.

Sign up to request clarification or add additional context in comments.

4 Comments

what should be the values for Mat hierarchy, int mode, int method
@user2064024, I have updated my solution to answer your question.
ok thankyou does List contours it generates is same as we get in matlab by using bwconncomp () function ?
and after geting the connected components i have to make a label matrix as we do in matlab by using labelmatrix(countours) how can i do this in java ??

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.