16-10-2012, 12:07 PM
I have 40 images of different sizes for my work. I would like to read the image , convert to gray and make uniform size ,say, 128x128. I like to have the matlab code for the above
Sakthi
Reasearch student
place images in current directory and run this prog
dirData = dir('*.jpg'); %# Get the selected file data
fileNames = {dirData.name}; %# Create a cell array of file names
for iFile = 1:numel(fileNames) %# Loop over the file names
newName = sprintf('%1d.jpg',iFile); %# Make the new name
movefile(fileNames{iFile},newName); %# Rename the file
end
after that run this prog in same directory
q=1;
p=1;
for i=1:10
oq=imread(strcat(num2str(q),'.jpg'));
odprz=imresize(oq,[150 150]);
imwrite(odprz,strcat(num2str(p),'.png'));
q=q+1;
p=p+1;
end
get .png files that u needed
THANKS A LOT...THIS IS MY LONG TERM DOUBT...FEEL VERY HAPPY...I THINK I GET INTO ONE OF MY SUCCESS STEP
What is odprz ?
Since we can't use different variables..