public static void extract(DMatrixRMaj src, int srcY0, int srcX0, DMatrixRMaj dst, int dstY0, int dstX0, int numRows, int numCols) { for( int y = 0; y < numRows; y++ ) { int indexSrc = src.getIndex(y+srcY0,srcX0); int indexDst = dst.getIndex(y+dstY0,dstX0); System.arraycopy(src.data,indexSrc,dst.data,indexDst, numCols); } } }
/** * Used to get found camera matrix for a view * @param view Which view * @param cameraMatrix storage for 3x4 projective camera matrix */ public void getCameraMatrix(int view , DMatrixRMaj cameraMatrix ) { cameraMatrix.reshape(3,4); CommonOps_DDRM.extract(P,view*3,0,cameraMatrix); for (int col = 0; col < 4; col++) { cameraMatrix.data[cameraMatrix.getIndex(0,col)] *= pixelScale; cameraMatrix.data[cameraMatrix.getIndex(1,col)] *= pixelScale; } }
depths.data[depths.getIndex(row,col)] /= norm;
/** * Extracts the row from a matrix. * @param a Input matrix * @param row Which row is to be extracted * @param out output. Storage for the extracted row. If null then a new vector will be returned. * @return The extracted row. */ public static DMatrixRMaj extractRow(DMatrixRMaj a , int row , DMatrixRMaj out ) { if( out == null) out = new DMatrixRMaj(1,a.numCols); else if( !MatrixFeatures_DDRM.isVector(out) || out.getNumElements() != a.numCols ) throw new MatrixDimensionException("Output must be a vector of length "+a.numCols); System.arraycopy(a.data,a.getIndex(row,0),out.data,0,a.numCols); return out; }