Ask Your Question

Revision history [back]

Having problems with resize/subsample (without interpolation)


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++)

With a simple resize statement.

I tried to following:

  Mat channels_sum_reduced;
  Rect r=Rect(1,1,height-1,width-1);


But it didn't give the exact same results (and I really need it to be precise).

Can someone please correct me?