C++ Code convert in Java or what does this line do ?
Hello everbody, iam completly new in openCV and train with the Book "Mastering OpenCV". But all examples are in C++. I want to import one example in Java for android and there is a line i dont unterstand and how to convert in Java.
//Find contours of possibles plates
vector< vector< Point> > contours; // <-- What does this line do ?
findContours(img_threshold,
contours, // a vector of contours
CV_RETR_EXTERNAL, // retrieve the external contours
CV_CHAIN_APPROX_NONE); // all pixels of each contour
//Start to iterate to each contour found
vector<vector<Point> >::iterator itc= contours.begin(); // Here again, what does it mean?
vector<RotatedRect> rects;
I do not understand these 2 lines. Maybe someone can help me or explain what these 2 lines do and how i can realize it in java ?
Best regards
since we're already talking about android, you might want to take a look at the color-blob-detection sample
Thanks a lot, i will now look at this! As far as i could find now: the first is a vector, filled with a vector that contains type of Points, declared as contours
But this i dont unterstand vector<vector<Point> >::iterator itc= contours.begin();
Now i will look at your link, berak. Thanks
there are no iterators in java, you probably will use indices or contours.get(i)
to convert these line in java, i found this: Multiple Vectors : private Vector <Vector <Point>> contours = new Vector <Vector <Point>> ();
@berak, thats not true, Java has since ver.1.2 iterators http://docs.oracle.com/javase/7/docs/api/java/util/Iterator.html
Maybe you mean that i cannot use iterators for vectors ?
;) ok. you win. (admittedly quite rusty with java)
on the other hand, findContours explicitly wants a List<MatOfPoint> in java, so you can stop worrying about vectors anyway
No thanks, both win :) you helped me a lot to find the right way and of course you were right. findContours want a List<MatOfPoint> And i got crazy about vectors :) in Java the function looks like
Imgproc.findcontours( [Mat Image] , [List<MatOfPoint>] , [Mat hierarchy] , [int mode] , [int method]
What does Mat hierarchy do ? At the moment 2 lines above I create a Mat with Mat mHierarchy = new Mat();
will this work without any problems ? or have I to create a specific Mat like defined cols rows etc...?
Mat mHierarchy = new Mat(); // will work perfectly
for the explanation, docs, again