Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV Convert C++ to Java

Hi all,

I have the following code written in c++:

vector<Vec4i> hierarchy;
vector<vector<Point>> contours;
findContours(temp, contours, hierarchy, RETR_EXTERNAL, CHAIN_APPROX_SIMPLE);
double refArea = 0;
int numObjects = hierarchy.size();
if(hierarchy.size() > 0) {
    //do stuff
 for(int i = 0; i >= 0; i = hierarchy[i][0]) {
       //do more stuff
 }
}

I want to convert this to java for opencv android programming, but am unsure how. If anyone can help, that would be much appreciated!

OpenCV Convert C++ to Java

Hi all,

I have the following code written in c++:

vector<Vec4i> hierarchy;
vector<vector<Point>> contours;
findContours(temp, contours, hierarchy, RETR_EXTERNAL, CHAIN_APPROX_SIMPLE);
double refArea = 0;
if(hierarchy.size() > 0) {
     int numObjects = hierarchy.size();
if(hierarchy.size() > 0) {
    //do stuff
 for(int i = 0; i >= 0; i = hierarchy[i][0]) {
       Moments moment = moments((Mat)contours[i]);
       double area = moment.m00;
       //do more stuff
 }
}

I want to convert this to java for opencv android programming, but am unsure how. If anyone can help, that would be much appreciated!