Two methods of batch processing image in MATLAB

Source: Internet
Author: User


There are basically two methods: one is to unify your image once to rename such as: 1.jpg,2.jpg and so on, and then use the For loop in order to process it, such as the following statement: Imagine your image has 20 pairs:

Str= ' d:\ do bad \ good image \ '; % of my images placed in D disk, do the poor folder under the Good image folder under
For i=1:20
I=imread ([Str,num2str (i), '. bmp ']); % read each image sequentially
% to do your image processing in this place
End

Method Two:

The image unified method under a folder, do not need to be unified to rename, using the Uigetdir function to get the path of the image you are working on, and then the path of all the image processing, for example: I only work with BMP files

Srcdir=uigetdir (' Choose source directory. '); % Get the selected folder
CD (SRCDIR);
Allnames=struct2cell (dir (' *.bmp ')); % only 8-bit BMP files processed
[K,len]=size (Allnames); % Get BMP file Number
For Ii=1:len
% Take out files successively
NAME=ALLNAMES{1,II};
I=imread (name); % Read files
% then add your image handler here
End

MATLAB and C/A + + programming of the call from Matlab to C + + code http://www.linuxidc.com/Linux/2012-08/68148.htm

Realization of http://www.linuxidc.com/Linux/2013-05/84050.htm by two classification svm method in MATLAB

Take the whole function in MATLAB fix, floor, ceil and round http://www.linuxidc.com/Linux/2013-10/91161.htm

Matlab compiles cuda. cu file http://www.linuxidc.com/Linux/2014-04/100675.htm

This article permanently updates the link address : http://www.linuxidc.com/Linux/2014-06/103666.htm

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.