How can I automatically crop all images?

조회 수: 2 (최근 30일)
Parham Babakhani Dehkordi
Parham Babakhani Dehkordi 2016년 5월 3일
댓글: Walter Roberson 2016년 5월 9일
Hello, I have 1080 images in one folder. All the images are the same in terms of pixel location. so, I want to automatically crop all 1080 in one code. for my first image I know that It must be cropped as
I=imcrop(I,[0 215 2500 255]);
Thus I know a rectangular with xmin,ymin,weidth, and height. I do not know how I can apply to all 1080 images (frames) this condition.any help would be appreciated.

채택된 답변

Walter Roberson
Walter Roberson 2016년 5월 4일

추가 답변 (1개)

Parham Babakhani Dehkordi
Parham Babakhani Dehkordi 2016년 5월 9일
Thank you Walter for your answer, I have another question. I have automatically crop the images and also I was able to have binary images for all 1080 images. What I really want to do is that. Imagine the first image, If I have a m*n matrix with values of 0 and 1, I want to take the average of each column for the whole raw.I mean, if I have, lets say, 250 column and 360 raw, I want to take the average value of the first column, the second and 360th. This procedure must be repeated for the whole 1080 images. How can we do that?
  댓글 수: 1
Walter Roberson
Walter Roberson 2016년 5월 9일
You can use mean() to get the per-row average. If you only need it for some columns you can extract them
mean(YourImage(:,[1 2 250])

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

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by