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 commentaire

Vignesh
Vignesh le 3 Mar 2012
Déplacé(e) : DGM le 29 Déc 2023
How to find the motion vector of a macroblock?

Connectez-vous pour commenter.

Réponses (2)

Sean de Wolski
Sean de Wolski le 28 Fév 2012

1 vote

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

5 commentaires

Vignesh
Vignesh le 28 Fév 2012
Déplacé(e) : DGM le 29 Déc 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 le 28 Fév 2012
Déplacé(e) : DGM le 29 Déc 2023
imshow(G{1,1}) %show first block
Vignesh
Vignesh le 28 Fév 2012
Déplacé(e) : DGM le 29 Déc 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 le 28 Fév 2012
Déplacé(e) : DGM le 29 Déc 2023
g(i) or g{i} for a cell array. g[i] is not a valid syntax in MATLAB.
Vignesh
Vignesh le 1 Mar 2012
Déplacé(e) : DGM le 29 Déc 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..

Connectez-vous pour commenter.

Image Analyst
Image Analyst le 28 Fév 2012

1 vote

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.

Question posée :

le 28 Fév 2012

Déplacé(e) :

DGM
le 29 Déc 2023

Community Treasure Hunt

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

Start Hunting!

Translated by