How can I specify row alignment reading an image or creating Mat object?
Hello, I need to specify row alignment reading an image. I can do it by hands computing new width in accordance with particullar stride (source code you can find below).
Mat srcImg, alignedImg, roiImg;
Size size;
// read initial image
srcImg = imread(argv[1]);
// compute new width (aligment with the stride = 32)
size.width = ((srcImg.size().width - 1) & -32) + 32;
size.height = srcImg.size().height;
// create new image
alignedImg.create(size, srcImg.type());
// adjust ROI
roiImg = alignedImg.adjustROI(0, 0, 0, srcImg.size().width - size.width);
// copy initial image into ROI
srcImg.copyTo(roiImg);
// release memory
srcImg.release();
alignedImg.release();
Is there a way to set row alignment reading an image or creating Mat object automatically without additional memory allocation and copying data?
Thanks!