Hi, i try to fill a contour with a list of points with some code like this:
However I have not found out how the second parameter of the call mImgProc.fillPoly1, the "pts of java.utils.list" must be set up. Whatever I write there throw a run tim eexception that parameters cannot be cast to whatever. The find contours method works okay.
Thanks for help
B4X:
Dim contours as List
contours.Initialize 'reset and find the contours again
mImgProc.findContours(ContourMat, contours, hierarchy, mImgProc.RETR_External,mImgProc.CHAIN_APPROX_SIMPLE, offset)
For i=0 To contours.Size-1
Dim mat As OCVMatOfPoint = contours.Get(i)
a = mImgProc.contourArea(contours.Get(i),False) 'true means closed shape, which is not always the case
If a>5 Then 'there must be an aera of some size, otherwise it is just a line
Dim pnt() As OCVPoint = mat.toArray
Dim pntlist As List
pntlist.Initialize2(mat.toList)
mImgProc.fillPoly1(ContourMat,[B]pntlist[/B] ,grayscalarwhite)
Log("i: "&i&", area: " & a &" number of points: "&pnt.Length ) 'the area is only the white pixels, not the encompassing area
End If
Next
Thanks for help