フィルターのクリア

How to divide an image in two blocks

3 ビュー (過去 30 日間)
Jack Sparrow
Jack Sparrow 2013 年 2 月 2 日
コメント済み: Image Analyst 2019 年 4 月 26 日
How can I divide an 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.
  2 件のコメント
Nourou
Nourou 2014 年 8 月 8 日
編集済み: Image Analyst 2014 年 8 月 8 日
Hi Jack, Azzi,
Please I need a clarification about the usage of the following method:
im=imread('yourimage')
n=fix(size(im,1)/2)
A=im(1:n,:,:);
B=im(n+1:end,:,:)
imshow(A)
figure
imshow(B)
I try to use it on a grayscale image, but the results are 2 blank images. Please how can I edit your code to make it divide my image. I know you use it with a rgb image.
Thank you!
Image Analyst
Image Analyst 2014 年 8 月 8 日
編集済み: Image Analyst 2014 年 8 月 8 日
A and B are probably double for some reason. Try
imshow(A, []);
imshow(B, []);
Start your own question if you need more help.

サインインしてコメントする。

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 2 月 2 日
im=imread('yourimage')
n=fix(size(im,1)/2)
A=im(1:n,:,:);
B=im(n+1:end,:,:)
imshow(A)
figure
imshow(B)
  10 件のコメント
zohreh nezami
zohreh nezami 2017 年 6 月 22 日
thank you
suma g
suma g 2018 年 4 月 2 日
sir u have given for left half and right half of the image... very helpful.i want to segment the face image into upper and bottom half of the face ... upper- forehead,eyes and eyebrows & lower- nose lips and chin CAN U GIVE ME SOME IDEA

サインインしてコメントする。

その他の回答 (1 件)

utkarsh kumar
utkarsh kumar 2019 年 4 月 26 日
hi i am having a doubt in understanding the code.....in the below code
im=imread('yourimage')
n=fix(size(im,1)/2)
A=im(1:n,:,:);
B=im(n+1:end,:,:)
imshow(A)
figure
imshow(B)
What is the meaning of the highlighted one .
Thanks
  1 件のコメント
Image Analyst
Image Analyst 2019 年 4 月 26 日
It says A is equal to rows 1 through n, all columns, all color rows. The colon means "all" if it's by itself, or "to" if it's in an expressions like 1:n.
So if n is the middle row, A will be the top half. Then B picks up from one row below the middle row. It says B equals all rows from one row below the middle row to the last row, and all columns and all color channels. If it's grayscale, having an extra : in there for the third index will not hurt - it will just ignore it.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeFeature Detection and Extraction についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by