I want to resize the images of whole database and then replace it with the same images. The problem is how to create or access the database for images.

조회 수: 1 (최근 30일)
Here is the code I tried for resizing and replacing ...
Kindly help me thanks.
Database = imageSet('Palm','recursive');
for i=1:size(training,2)
for j = 1:training(i).Count
image=read(Database(i),j);
image=imresize(image,0.568);
Database((i),j)=image; %for replacing the same image
end
end
  댓글 수: 2
KSSV
KSSV 2018년 11월 12일
YOu have to save the image in a folder of your choice, using imwrite. And then in that folder use imageSet.
Ahmer Shahid
Ahmer Shahid 2018년 11월 13일
how can I store all images in new dataset like old dataset folder by folder.

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

채택된 답변

Walter Roberson
Walter Roberson 2018년 11월 12일
Database = imageSet('Palm','recursive');
for i=1:size(training,2)
Filenames = Database(i).Locations;
for j = 1:training(i).Count
image=read(Database(i),j);
image=imresize(image,0.568);
imwrite(image, Filenames{j}) ;
end
end
This code is not recommended. Every time you run it, it will shrink the files by the same factor. If there is a problem part way through such as a file permissions problem then you would need to move the files that had already been processed to a different directory or else they would get shrunken again.
It would be safer if you specified an output size instead of a scaling factor: then it would not matter how many times you ran the code on the same file.
  댓글 수: 3
Ahmer Shahid
Ahmer Shahid 2018년 11월 13일
I cannot get any location of image, The error remains same.
Is this supported in R2018a ?

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

추가 답변 (1개)

Kotresh S B
Kotresh S B 2019년 3월 12일
hello,
i need palm resize code please me
  댓글 수: 1
Ahmer Shahid
Ahmer Shahid 2019년 3월 13일
hello, I am use 'imresize' function to resize the images.
0.3 is the factor its mean 30% of the image.
image=imresize(image,0.3);

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

카테고리

Help CenterFile Exchange에서 Geometric Transformation and Image Registration에 대해 자세히 알아보기

태그

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by