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

Vignesh
Vignesh 2012년 3월 3일
이동: DGM 2023년 12월 29일
How to find the motion vector of a macroblock?

댓글을 달려면 로그인하십시오.

답변 (2개)

Sean de Wolski
Sean de Wolski 2012년 2월 28일

1 개 추천

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

댓글 수: 5

Vignesh
Vignesh 2012년 2월 28일
이동: DGM 2023년 12월 29일
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 2012년 2월 28일
이동: DGM 2023년 12월 29일
imshow(G{1,1}) %show first block
Vignesh
Vignesh 2012년 2월 28일
이동: DGM 2023년 12월 29일
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 2012년 2월 28일
이동: DGM 2023년 12월 29일
g(i) or g{i} for a cell array. g[i] is not a valid syntax in MATLAB.
Vignesh
Vignesh 2012년 3월 1일
이동: DGM 2023년 12월 29일
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..

댓글을 달려면 로그인하십시오.

Image Analyst
Image Analyst 2012년 2월 28일

1 개 추천

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.

질문:

2012년 2월 28일

이동:

DGM
2023년 12월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by