Difference between two blocks of images?

조회 수: 1 (최근 30일)
Emmanuel
Emmanuel 2014년 10월 23일
편집: Emmanuel 2014년 10월 23일
How can I extract a block of pixels from an image and subtract it with another block of different image to find minimum disparity? my block size is 8. How do I proceed with this?
iteration = 0;
subsub = zeros(8);
subblock = zeros(8);
x = rgb2gray(imread('testimage.jpg'));
J = imresize(x, 0.7);
x0 = imrotate(J,30);
r = randi(225-7);
c = randi(225-7); //random block of size 8 from original image
subblock = x(r:r+7, c:c+7);
imshow(subblock);
block = size(x0);
k =1; m= 8;
for i =1:8: (block(1)-7)
for j = k:m
submatrix = x0(i,j); // creating a block from second image
end
for w = 1 : 8
for y = 1:8
diff = (subblock(w,y) - submatrix(w,y))^2; // subtracting two blocks
end
end
k = m+1; // to move to the next block
m = m+8;
end
When I run the code, my submatrix is always zero. Why is that? please help me

답변 (0개)

카테고리

Help CenterFile Exchange에서 Computer Vision with Simulink에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by