Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You can replace

roiImg = alignedImg.adjustROI(0, 0, 0, srcImg.size().width - size.width);

with

roiImg = alignedImg.colRange(0,srcImg.cols);

(Note for colRange from the documentation: Start and end column of the extracted submatrix. The upper boundary is not included)

To have the image loaded directly as you desire, you would have to go one level down to the imdecode method, and test if giving the roiImg created as you did would work as expected, loading the image aligned. Of course, you need to know the image size in advance, otherwise you will have to write your own version of imdecode.