How to divide a grayscale image in two blocks

조회 수: 1 (최근 30일)
Nourou
Nourou 2014년 8월 10일
답변: Image Analyst 2014년 8월 10일
Hi,
Please I want to divide a grayscale image into two halves? Then, after dividing it make each half independent, say
A = top half and
B = the bottom half.
So that I can extract features from each half.
I read some similar questions, and get a code as:
n=fix(size(B,1)/2) //B is the grayscale image
C=B(1:n,:,:);
D=B(n+1:end,:,:)
figure,imshow(C)
figure,imshow(D)
It's almost working, but the results are 2 blank images(C and D).
Really need your help asap, thank you all!
  댓글 수: 1
Ahmet Cecen
Ahmet Cecen 2014년 8월 10일
There is no reason why the above shouldn't work. I can't suggest anything further without seeing the image. Attach the original image as a .mat file.

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

답변 (1개)

Image Analyst
Image Analyst 2014년 8월 10일
Maybe somehow they got to be floating point. Use
imshow(C, []);
imshow(D, []);

Community Treasure Hunt

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

Start Hunting!

Translated by