HOW TO CROP MULTIPLE IMAGES

I have multiple images in .bmp format and i need to crop them. the parameters of cropping[Xmin,Ymin,width,height] are present in the text file. please help me doing this. THANK YOU

1 件のコメント

Adam
Adam 2016 年 11 月 23 日
read the .bmp files:
doc imread
read the text file if you need it automated. No idea what format that is in but e.g.
doc textscan
can be used for this or other functions in the See Also of that.
Crop the image which can presumably just be done with basic indexing operations:
doc colon
Save them if needed
doc imwrite

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

回答 (1 件)

Image Analyst
Image Analyst 2016 年 11 月 23 日

0 投票

This is a FAQ, so read the FAQ for code samples: http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F
Inside the loop, put imcrop() and imwrite().

2 件のコメント

HARSHA DARA
HARSHA DARA 2016 年 11 月 24 日
編集済み: HARSHA DARA 2016 年 11 月 24 日
i am having all the parameters of the images in single excel file and text file (each line having parameters of each image). and all the images in single file numbered 1,2,3,4,.....please provide me with the exact code for this.Thank you.
Image Analyst
Image Analyst 2016 年 11 月 24 日
You want me to copy and paste code from the FAQ here for you? It's simply this:
[num, strings, raw] = xlsread(filename)
files = dir(....
for k = .....
% FAQ code
croppedImage = imcrop(.....
imwrite(croppedImage, newFilename);
end
That's essentially it. I'm sure you can get it. You just have to get your cropping parameters and decide upon a new filename.

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

カテゴリ

ヘルプ センター および File ExchangeImage Processing Toolbox についてさらに検索

質問済み:

2016 年 11 月 23 日

コメント済み:

2016 年 11 月 24 日

Community Treasure Hunt

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

Start Hunting!

Translated by