how to display result from matlab to LCD
5 views (last 30 days)
Show older comments
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 Comment
Talent Mukaro
on 26 May 2020
Hie, kindly advice how you solved this? I'm facing the same problem. Email tmmatuhwa@gmail.com or app +263783581256. Thank you
Answers (1)
Joris Naudin
on 26 May 2020
Hi,
Did you downloaded an add-on for communicating Arduino with Matlab ? Then you can check some examples.
0 Comments
See Also
Categories
Find more on Fluid Dynamics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!