I have a 600x600 image ( Image) and i am cutting into pieces of 200x200 (piecesImages),by creating 3x3 blocks (Height = 3 , Width =3).
Mat pieceImageFrame (200,200,CV_32F);
vector<Rect> piecesImagesRois;
vector<Mat> piecesImages;
piecesImagesRois.reserve( Width * Height );
piecesImages.reserve( Width * Height );
for( int i = 0; i <ImageSize.height - Height; i+= pieceImageSize.height )
{
for( int j = 0; j < ImageSize.width - Width; j+= pieceImageSize.width )
{
Rect myrect = Rect( j,i, pieceImageSize.width, pieceImageSize.height );
pieceImageFrame = Image( rect );
piecesImages.push_back( pieceImageFrame.clone() );
piecesImagesRois.push_back(rect);
}
}
Now, I would expect to be able to access every image until :
piecesImages[ 0 ].at<float>( 199,199)
but as I can see I am able to access:
piecesImages[ 0 ].at<float>( 300,239999 ) !!
I would expect a grabage value but the values seem ok!