Resize row from Mat [closed]
I'm trying to resize the rows of a ROI Mat, witch is a polygon with different row size, to the half of the cols of the original Mat, and so I thought of run through all the rows of the Roi Mat and resize each one.
for (int j = 0; j < crop.rows; j++)
{
if(pointPolygonTest( contours[0], Point2f((float)i,(float)j), true) > 0)
//resize(crop.row(j), crop.row(j), Size(img.rows, img.cols/2), 0, 0, CV_INTER_LINEAR);
}
What am I doing wrong? Thank you!
Im not even sure if you can apply the resize function on a row, but in the current way you are doing it, it does not make sense. You are actually expanding a row to (img.rows, img.cols/2) which is not 1 single row anymore. If resize on a row even works, it should more looks like this: resize(crop.row(j), crop.row(j), Size(1, img.cols/2), 0, 0, CV_INTER_LINEAR); There is no guarantee that this actually works.
It doesn't... I have this image witch is a Mat with different row size and I want to stretch the rows to make them of constant length.
Btw, Im not sure if the input and output can be the same in resize. Maybe you need a new Mat for the output
Do you want to crop this image or resize it? Thats a difference. If you resize you still have the same image, just in another size. Cropping removes parts that you dont want to have in there anymore.
I already cropped the image, I want to resize the row lenght as the example in the image. I have to perform those modifications (c to d).