I`ve loaded a video. Then i divided the video into individual frames. Now i want to divide each frame into a group of blocks. After dividing them into blocks, i want to compare the blocks of one frame with the blocks of another frame, to know whether they are matching.
1. How to divide frame into blocks? 2. How to read the blocks(pixel values of the frames)? 3. How to compare the blocks?

1 Kommentar

Vignesh
Vignesh am 3 Mär. 2012
Verschoben: DGM am 29 Dez. 2023
How to find the motion vector of a macroblock?

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Sean de Wolski
Sean de Wolski am 28 Feb. 2012

1 Stimme

perhaps mat2cell(), blockproc() or a double for-loop.

5 Kommentare

Vignesh
Vignesh am 28 Feb. 2012
Verschoben: DGM am 29 Dez. 2023
I used mat2cell function.
>> i=imread('D:\\Frames\\image1.jpg');
>> a=240;
>> b=320;
>> g=mat2cell(i,[a a],[b b],3);
>> g
g =
[240x320x3 uint8] [240x320x3 uint8]
[240x320x3 uint8] [240x320x3 uint8]
So, in g, do i have 4 blocks of that image, now? If i want to see the image of these individual blocks , how to see them? Pls help...
Sean de Wolski
Sean de Wolski am 28 Feb. 2012
Verschoben: DGM am 29 Dez. 2023
imshow(G{1,1}) %show first block
Vignesh
Vignesh am 28 Feb. 2012
Verschoben: DGM am 29 Dez. 2023
Thanks frd.. I could seperate a single frame into blocks now. But i`m not able to get all the frames, divided into blocks. I used the below syntax.
>> for j=1:n
i=imread('D:\\Frames\\image%d.jpg',j);
g[j]=mat2cell(i,[a a],[b b],3);
??? g[j]=mat2cell(i,[a a],[b b],3);
|
Error: Unbalanced or unexpected parenthesis or bracket.
Sean de Wolski
Sean de Wolski am 28 Feb. 2012
Verschoben: DGM am 29 Dez. 2023
g(i) or g{i} for a cell array. g[i] is not a valid syntax in MATLAB.
Vignesh
Vignesh am 1 Mär. 2012
Verschoben: DGM am 29 Dez. 2023
I managed to divide all the frames into blocks.. Now i`m trying to calculate the motion vectors of each block. For that, i need to find Mean Square error(MSE), which needs the location of each block(x,y). How to find the location of blocks? I tried my best to find it..

Melden Sie sich an, um zu kommentieren.

Image Analyst
Image Analyst am 28 Feb. 2012

1 Stimme

Depends on how you define blocks. Perhaps you want quadtree decomposition if you want blocks of variable size. It's in the Image Processing Toolbox.

Gefragt:

am 28 Feb. 2012

Verschoben:

DGM
am 29 Dez. 2023

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by