Take off pads

asked 2013-05-28 20:48:32 -0500

residentelvio gravatar image

I have to translate to C this code of matlab

       % take off the pads
       x = (1 + padSize) : (rows - pad8Size);
       y = (1 + padSize) : (cols - padSize);
       rpad=rpad(x,y);

1st and 2nd create 2 array, but I don t know how I have to delete it from rpad Mat object It can be something like(subtract every element)

        for(int i=1+pad;i<=rows-pad;i++){
         for(int j=1+pad;i<=cols-pad;j++){
                subtract(rpad,x,rpad);
               subtract(rpad,y,rpad);}}

Or something like(delete the external element)

          int a=(rows-pad)-(1+pad);
          int b=(cols-pad)-(1+pad);
          rpad.create(img.rows - a,img.cols - b,original.type());
          img.copyTo(rpad);
edit retag flag offensive close merge delete