Hi,i am using the opencv findCountour function in finding the contour and draw the found contour on the image. The code seems to have no issue, however when i try to debug, it show the error that the variable "hierarchy" cannot be be find. I am not sure why is this so, help please, thank you.
The problem seems to be at the Imgproc.java file (this is imported from opencv)whereby the hierarchy is in red(meaning error).
public static void findContours(Mat image, List<MatOfPoint> contours, Mat mat, int mode, int method)
{
Mat contours_mat = new Mat();
findContours_1(image.nativeObj, contours_mat.nativeObj, hierarchy.nativeObj, mode, method);
Converters.Mat_to_vector_vector_Point(contours_mat, contours);
contours_mat.release();
return;
}
What I have tried:
part of the findContour code
List<MatOfPoint> contours = new ArrayList<>();
Imgproc.findContours(outputImage,contours, hierarchy,Imgproc.RETR_LIST,Imgproc.CHAIN_APPROX_SIMPLE);
Imgproc.drawContours(outputImage,contours,-1,new Scalar(0,255,0));