dividing image into blocks
-
I am new in c++, can Anybody tell me how one can divide image into blocks. I have yuv format image saved in byte memory. I want to divide it into 16x 16 blocks The image size is 144x176. I want to process further each block for calculating motion estimation . Thanks koreno
-
I am new in c++, can Anybody tell me how one can divide image into blocks. I have yuv format image saved in byte memory. I want to divide it into 16x 16 blocks The image size is 144x176. I want to process further each block for calculating motion estimation . Thanks koreno
Seeing as it's in a non-Windows format, I assume you have a bunch of raw pixel data. Surely, you just need to create 16x16 blocks of memory ( well, 48x16 ) and copy the data across ? Christian Graus - Microsoft MVP - C++
-
Seeing as it's in a non-Windows format, I assume you have a bunch of raw pixel data. Surely, you just need to create 16x16 blocks of memory ( well, 48x16 ) and copy the data across ? Christian Graus - Microsoft MVP - C++
I have a video sequence foreman.yuv.I can read frame separately, But my questions is still there , The data is in byte memory in an array, while i need a 16x16 block in raster form . I know it is not difficult question but I could have idea how i will use loop to acquire the refereces to each block in the image . koreno
-
I have a video sequence foreman.yuv.I can read frame separately, But my questions is still there , The data is in byte memory in an array, while i need a 16x16 block in raster form . I know it is not difficult question but I could have idea how i will use loop to acquire the refereces to each block in the image . koreno
What do you mean by 'in raster form' ? Do you need it to be RGB ? I'm not sure what the overall format is here, but YUV is still a format where one triple is a pixel, right ? So, you just need to copy out the triples for the pixels you want. Which means working in blocks of 48, and then working out the number of bytes in a row in order to jump by rows. Christian Graus - Microsoft MVP - C++
-
I am new in c++, can Anybody tell me how one can divide image into blocks. I have yuv format image saved in byte memory. I want to divide it into 16x 16 blocks The image size is 144x176. I want to process further each block for calculating motion estimation . Thanks koreno
this should be no problem if u know it's data format. I don't know what format u are reffering to, so lets assume the pixels are arranged in lines and are 4 bytes. Now u can just read the blocks in a double loop:
int bx = block_x*block_width;
int by = block_y*block_height;
for(int x=0; x<16; x++) {
for(int y=0; y<16; y++) {
int pixel = data[(y+by)*img_width+(x+bx)];
}
}HTH, :-)