Having problems with resize/subsample (without interpolation)
Hi,
I'm trying to resize/subsample an image without interpolation.
To make things clearer, I would like to replace the following code:
int height_res=55; int width_res=55;
int start_ind=1;
Mat channels_sum_reduced=Mat::zeros(height_res,width_res,CV_32FC1);
for (size_t height_ind=start_ind; height_ind<height_res+start_ind; height_ind++)
{
for (size_t width_ind=start_ind; width_ind<width_res+start_ind; width_ind++)
{
channels_sum_reduced.at<float>(height_ind-start_ind,width_ind-start_ind)=channels_sum.at<float>(offset*height_ind,offset*width_ind);
}
}
With a simple resize statement.
I tried to following:
Mat channels_sum_reduced;
Rect r=Rect(1,1,height-1,width-1);
resize(channels_sum(r),channels_sum_reduced,Size(height_res,width_res),0,0,INTER_NEAREST);
But it didn't give the exact same results (and I really need it to be precise).
Can someone please correct me?
Thanks,
Gil.