Ask Your Question
0

Problem with copying a block of data

asked 2016-06-04 09:38:03 -0600

mmkhan gravatar image

I am trying to process an image frame in blocks of size 16 x 16. However, when I try to copy data in blocks I am only getting the data from the last block for each image. To verify if I am getting the data correctly I am displaying each block. Can anyone please point out my mistake. Thank you.

        for(int y=1; y<pels.y; y=y+block_size)
        {
            for(int x=1; x<pels.x; x=x+block_size)
            {
                difference_frame(Range(y,y+block_size-1),Range(x,x+block_size-1)).copyTo(Src);
                imshow("Block of Data",Src);
            }
        }
edit retag flag offensive close merge delete

Comments

  • why do you start counting at 1 ?
  • the "upper" value in a Range is excluded, so Range(y,y+block_size) would be correct
  • you're always writing to the same Src ??? (also, the thing you're writing to, is called "Src" ? no wonder, you're confused..)
  • if you want to see the different blocks using imshow, you need a waitKey() immediately after the imshow
berak gravatar imageberak ( 2016-06-05 01:20:56 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-06-05 03:39:52 -0600

mmkhan gravatar image

Thank you. I apologize for improper naming convention (Src as Matrix name). The problem was resolved by using waitKey(). Thank you for your help.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-06-04 09:38:03 -0600

Seen: 156 times

Last updated: Jun 04 '16