how to get a* and b* channel for entire leaf image .

조회 수: 1(최근 30일)
Keerthi  D
Keerthi D 2020년 8월 24일
댓글: Keerthi D 2020년 10월 1일
I have a set of 1500 images of tomato leaf and i want to covert them from RGB to Lab( only need a*,b* channel),then i want to access and save a,b values for each images.
I tried some code.that is given below.but i get pnly the a,b value for one image.how to get entire images?please help me find that.
my code is,
fontSize=10;
location='C:\Users\Keerthi Dev\Downloads\dataset'; %folder in which your images exists
ds=imageDatastore(location); %create datastore for all images in your folder
new_folder='C:\Users\Keerthi Dev\Documents\MATLAB\leafdataset'; %new folder
k=1;
while hasdata(ds)
img=read(ds); %read image from datastore
scale=imresize(img,[256 256]);
fileName=sprintf('image_%d.jpg',k);
fullFileName=fullfile(new_folder,fileName);
imwrite(scale,fullFileName);
%size(scale)
k=k+1;
%lab conversion
labImage = rgb2lab(scale);
%a = labImage(:, :, 2);
subplot(1, 2, 1);
imshow(labImage(:, :, 2),[]);
title('A channel', 'FontSize' ,20);
%b = labImage(:, :, 3);
subplot(1, 2, 2);
imshow(labImage(:, :, 3),[]);
title('B channel', 'FontSize' ,20);
end
ouput is :
  댓글 수: 2
Keerthi  D
Keerthi D 2020년 10월 1일
Can you please explain through the code sir.

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

답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by