I'm trying to code the camera clibration for an android application and when I use the opencv method
Calib3d.findChessboardCorner(mImage, boardSize, pointbuf,Calib3d.CALIB_CB_ADAPTIVE_THRESH & Calib3d.CALIB_CB_FAST_CHECK & Calib3d.CALIB_CB_NORMALIZE_IMAGE);
it returns pointbuf which is a 1*40 matrix (40 because my chessboard is 8*5) in each element of this matrix there's a data array with the 80 coordinates (x,y) for each of the 40 points. Don't ask me why, I didn't write this fonction.
in order to create the matrix containing the 3d coordinates of these same points I needed to create the same type of matrix, exept that the data array will have 120 elements(x,y,z) for each of the 40 points. My problem is that i create a data array, I put the coordinates in it and then when I call data.put(i,j,data) to add this array to the matrix it only copies the 8 first elements. here's the code for the method that does this :
static Mat calcChessboardCorners(Size boardSize, float squareSize){
int put;
double n=boardSize.width*boardSize.height;
Mat corners=
new Mat(40,1,CvType.CV_32F);
int k=0;
float [] data = new float[120];
for( int i = 0; i < boardSize.width; i++ ){
for( int j = 0; j < boardSize.height; j++ ){
data[k]=(
float)i*squareSize;
data[k+1]=(
float)j*squareSize;
k+=3;
}
}
float [] data1=new float [120];
for (int l=0;l<n;l++){
put =corners.put(l, 0, data);
}
return corners;
}