Raspberry and interpreted function in simulink
Show older comments
Hello,
I need your help to solve my problem. I have to realized project in simulink which is based on communication with raspberry pi 3. Please see the model in simulink:

Inside the subsystem is :

And the interpreted function is :
function [DANE]=DetekcjaKata(image)
vidFrame = image;
figure(1);imshow(vidFrame);
Rmin=15;
Rmax=45;
[centers, radii] = imfindcircles(vidFrame,[Rmin Rmax],'ObjectPolarity','dark','Sensitivity',0.75);
viscircles(centers, radii,'EdgeColor','b');
%%Wykrycie kół znaczników
if size(centers,1)==3
hold on
plot(centers(1,1),centers(1,2),'xr')
plot(centers(2,1),centers(2,2),'xg')
plot(centers(3,1),centers(3,2),'xw')
pkt_AB=[centers(1,1),centers(1,2);centers(2,1),centers(2,2)];
L1=line([centers(1,1),centers(2,1)],[centers(1,2),centers(2,2)]);
dl_1 = pdist(pkt_AB,'euclidean');
pkt_AC=[centers(1,1),centers(1,2);centers(3,1),centers(3,2)];
L2=line([centers(1,1),centers(3,1)],[centers(1,2),centers(3,2)]);
dl_2 = pdist(pkt_AC,'euclidean');
pkt_BC=[centers(2,1),centers(2,2);centers(3,1),centers(3,2)];
L3=line([centers(2,1),centers(3,1)],[centers(2,2),centers(3,2)]);
dl_3 = pdist(pkt_BC,'euclidean');
DANE(1)=centers(1,1);
DANE(2)=centers(1,2);
DANE(3)=centers(2,1);
DANE(4)=centers(2,2);
DANE(5)=centers(3,1);
DANE(6)=centers(3,2);
DANE(7)=dl_1;
DANE(8)=dl_2;
DANE(9)=dl_3;
DANE(10)=1;
else
DANE=zeros(1,10);
end
end
end
I have the error :

then I change the type of data to double like this :

I get the error :

This application is looking for three circles and give me the value "x" and "y" of a centroid of the circle. It is good working on a wideo file, but problem is with raspberry..
Please help me solve this problem..
Regards,
Jan
1 Comment
Jan Szlek
on 19 Sep 2017
Accepted Answer
More Answers (0)
Categories
Find more on Raspberry Pi Hardware 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!



