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?Parth Kapoor– Parth Kapoor2014-04-15 10:32:46 +00:00Commented Apr 15, 2014 at 10:32
-
i am using opencv for androiduser2064024– user20640242014-04-15 10:37:59 +00:00Commented 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!Parth Kapoor– Parth Kapoor2014-04-15 10:47:27 +00:00Commented Apr 15, 2014 at 10:47
-
docs.opencv.org/java/2.4.2/index-all.htmluser2064024– user20640242014-04-15 10:59:43 +00:00Commented Apr 15, 2014 at 10:59
-
Lastly, do you need NDK for this or not?Parth Kapoor– Parth Kapoor2014-04-15 11:05:19 +00:00Commented Apr 15, 2014 at 11:05
Add a comment
|
1 Answer
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.
4 Comments
user2064024
what should be the values for Mat hierarchy, int mode, int method
AmmarCSE
@user2064024, I have updated my solution to answer your question.
user2064024
ok thankyou does List contours it generates is same as we get in matlab by using bwconncomp () function ?
user2064024
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 ??