Perform operations on multiple images?

3 ビュー (過去 30 日間)
Julian
Julian 2012 年 10 月 2 日
Hello!
I am very new to MATLAB and, unfortunately, never did any coding before in my life. Which is now coming back at me. I am trying to get along by reading old postings and tutorials, but somehow I just don't get a grip on programming... So I very much hope you can help me.
I wrote some very basic operations into the editor...
blank=imread('xxx1.jpg':)
tab=imread('xxx2.jpg')
white=255*ones(320,320,3); %create matrix with maximum intensity
white_uint8=uint8(white); %converte white to unit8
negative=white_uint8-blank; %negative image of blank; define blank?
cleaned=tab+negative; %remove noise by adding inversed matrix
gray_level=graythresh(cleaned);
binary=im2bw(cleaned,gray_level); %convert to binary image
But now I don't just want to perform these operations on the image xxx2, but on several hundred others. How can I bring MATLAB to repeating this code on other images from the same, but also from other directories?
I found an old question here concerned with a similar topic, but I have to admit I didn't really get what the answer was...
I really hope you can help me.
Julian

回答 (2 件)

Walter Roberson
Walter Roberson 2012 年 10 月 2 日

Image Analyst
Image Analyst 2012 年 10 月 2 日
I don't know what the similar prior question was, or why you could not understand it. I have an image segmentation demo at http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862 - maybe that will help you. You can also upload your image to tinypic.com or another one from here: http://www.mathworks.com/matlabcentral/answers/7924-where-can-i-upload-images-and-files-for-use-on-matlab-answers if you want anyone to take a look at your images. Your algorithm is essentially doing background subtraction. Whether that will work for you, or is the theoretically best way to compensate for variable background, depends on the source of the image. Background subtraction is appropriate for x-ray and fluorescence. For most reflected light situations, background division is more appropriate. Some situations (surveillance, tracking) are more complicated, particularly if something in the moving objects is the same intensity or color as the background. Anyway, to process a bunch of image files, you can use the code examples given in the FAQ Walter referred you to.

カテゴリ

Help Center および File ExchangeImages についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by