Getting a point from a contour opencv android
Hi everyone !
I am trying to extract a point from a contour in opencv android, but I can't seem to find an equivalent for cvGetSeqElem, so I don't really know what to do. Here is my code :
Imgproc.findContours(mGray, contours, new Mat(), Imgproc.RETR_LIST, Imgproc.CHAIN_APPROX_SIMPLE);
Mat maxContour = contours.get(idx);
for(int i=0; i< maxContour.total();i++)
{
Point v= ? //This is where I would write new Point(Imgproc.cvGetSeqElem(maxContour, i))
}`
Does someone know the android equivalent for cvGetSeqElem? Or some other way to extract the points?
Edit : The question is solved. I just thought I would post the working code in case someone is interested. I get the biggest contour detected and extract the points from it :
List<MatOfPoint>contours= new ArrayList<MatOfPoint>();
Imgproc.findContours(mGray, contours, new Mat(), Imgproc.RETR_LIST, Imgproc.CHAIN_APPROX_SIMPLE);
for (int idx = 0; idx < contours.size(); idx++)
{
MatOfPoint contour = contours.get(idx);
double contourarea = Imgproc.contourArea(contour);
if (contourarea > maxContourArea)
{
maxContour = contour;
maxContourArea = contourarea;
maxAreaIdx = idx;
}
}
points_contour = maxContour.toArray();
nbPoints = points_contour.length;
for(int i=0; i< nbPoints;i++)
{
Point v=points_contour[i];
}