Raspberry and interpreted function in simulink
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Jan Szlek
el 20 de Jul. de 2017
Comentada: Jan Szlek
el 8 de Oct. de 2017
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
Respuesta aceptada
Walter Roberson
el 19 de Sept. de 2017
Please do not use "image" as a variable name; it confuses other programmers who think it must be referring to the image() function.
To generate code to execute on the Raspberry Pi, you will need to get rid of all of the graphics in the routine in their current form. The only graphics possible on the Pi are through the SDL Video Block. In other words, to display something you need to create an image of it. You would start with the input image and you would use the insertShape Computer Vision call. Your plot() calls are really just inserting markers; you can use insertMarker for that.
You will also need to make some changes to the order of your code to be able to generate code for it. For example you will need to have
DANE=zeros(1,10);
before you start assigning to DANE(1) and so on. The first assignment to a variable locks in the size and data type of the variable for model generation purposes.
7 comentarios
Walter Roberson
el 27 de Sept. de 2017
Could you attach one of the images by itself without the model and other extraneous information?
Más respuestas (0)
Ver también
Categorías
Más información sobre Raspberry Pi Hardware en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




