Java convert MatOfPoint in MatOfPoint2f
Hello everybody... i am trying to convert an ArrayList(MatOfPoint) to an Arraylist(MatOfPoint2). Tried it with Arraylist.Add() and LinkedList.Addlast(). Same results :/ I make something wrong and iam blind of work at these lines :)
Since now i used:
Code :
//---------- Code
0 // Convert to MatofPoint2f
1 for(int i=0; i<contours.size(); i++){
2 contours.get(i).convertTo(mat2f, CvType.CV_32FC1);
3 System.out.println("Data : " + mat2f + " at Index : " + i);
4 contours2f.add(mat2f);
//---------
When i put the value of mat2f out on console ( line 3) , the values are correct like here for example :
//---------- Output of mat2f
Data : Mat [ 136*1*CV_32FC2, isCont=true, isSubmat=false, nativeObj=0x15bec140, dataAddr=0x15a31e30 ] at Index : 0
Data : Mat [ 156*1*CV_32FC2, isCont=true, isSubmat=false, nativeObj=0x15bec140, dataAddr=0x15a31e30 ] at Index : 1
Data : Mat [ 226*1*CV_32FC2, isCont=true, isSubmat=false, nativeObj=0x15bec140, dataAddr=0x15a31e30 ] at Index : 2
//---------
But when i try to Add them to the ArrayList contours2f ( line4 ). The output will be not the same. it seems so that inside, the same object is on every index. Please look here :
//-------- Output of contours2f that is type of ArrayList<MatOfPoint2f>
Mat [ 82*1*CV_32FC2, isCont=true, isSubmat=false, nativeObj=0x15bec140, dataAddr=0x15a38ce0 ] at Index : 0
Mat [ 82*1*CV_32FC2, isCont=true, isSubmat=false, nativeObj=0x15bec140, dataAddr=0x15a38ce0 ] at Index : 1
Mat [ 82*1*CV_32FC2, isCont=true, isSubmat=false, nativeObj=0x15bec140, dataAddr=0x15a38ce0 ] at Index : 2
Mat [ 82*1*CV_32FC2, isCont=true, isSubmat=false, nativeObj=0x15bec140, dataAddr=0x15a38ce0 ] at Index : 3
//-------
Maybe someone can help me ? I go crazy
Best regards and thanks for any help... bbx
--Update Added a picture from debugging. On the picture you can see the values of contours and the first 3 values of contours2f. I do not unterstand it :/
Debug Picture