how to display result from matlab to LCD
4 次查看(过去 30 天)
显示 更早的评论
how to display the final result into LCD arduino?
here is my code for the image processing which assigned to count the number of blackheads.
i want the LCD to display the number of blackhead counted.
and what about the code for the arduino?
I = imread('psm1.png');
figure
imshow (I);
Im=I,
rmat=Im(:,:,1);
gmat=Im(:,:,2);
bmat=Im(:,:,3);
subplot(2,2,1),imshow(rmat);
title('Red');
subplot(2,2,2),imshow(gmat);
title('Green');
subplot(2,2,3),imshow(bmat);
title('Blue');
subplot(2,2,4),imshow(I);
title('Original');
levelr=0.52;
levelg=0.52;
levelb=0.52;
i1=imbinarize(rmat,levelr);
i2=imbinarize(gmat,levelg);
i3=imbinarize(bmat,levelb);
Isum=(i1&i2&i3);
figure,
subplot(2,2,1),imshow(i1);
title('Red');
subplot(2,2,2),imshow(i2);
title('Green');
subplot(2,2,3),imshow(i3);
title('Blue');
subplot(2,2,4),imshow(Isum);
title('Sum of All Colour');
Icomp = imcomplement (Isum);
Ifilled = imfill(Icomp,'holes');
figure, imshow(Ifilled);
se=strel('disk',20);
Iopenned=imopen(Ifilled,se);
imshow(Iopenned);
Iregion=regionprops(Iopenned, 'centroid');
[labeled,numObjects]=bwlabel(Iopenned,4);
stats = regionprops (labeled, 'Eccentricity','Area','BoundingBox');
areas = [stats.Area];
eccentricities = [stats.Eccentricity];
idxOfSubjects=find(eccentricities);
statsDefects=stats(idxOfSubjects);
figure,imshow(I);
hold on;
for idx = 1: length(idxOfSubjects)
h = rectangle('Position',statsDefects(idx).BoundingBox);
set(h,'EdgeColor', [.75 0 0]);
hold on;
end
if idx<10
title([ ' ',num2str(numObjects),' blackheads detected']);
end
hold off;
1 个评论
Talent Mukaro
2020-5-26
Hie, kindly advice how you solved this? I'm facing the same problem. Email tmmatuhwa@gmail.com or app +263783581256. Thank you
回答(1 个)
Joris Naudin
2020-5-26
Hi,
Did you downloaded an add-on for communicating Arduino with Matlab ? Then you can check some examples.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!