How do I plot the graph in standalone raspberry pi application in monitor connected to RPi
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have written the code for intensity calculation of images from the RPi camera board. The code was generated and deployed successfully on hardware. I could see the grayscale image but the plot was not getting displayed in the monitor. You help is highly appreciated.
I am attaching my code here.
function myIntensity2() %#codegen
%mypi = raspi('192.168.10.25','pi','raspberry');
mypi = raspi;
mycam = cameraboard(mypi);
meanValCIR = zeros(1,24000);
j=1;
pause(2)
while true
image = snapshot(mycam);
r2g = rgb2gray(image); %converting to grayscale
displayImage(mypi,r2g);
%meanVal = mean(r2g,1); %column wise average of whole image
%meanVal = 255-meanVal; %removing the un necessary values
%meanVal2 = mean(r2g,2);
%meanVal3(j) = mean(meanVal2);
%meanVal2 = 255-meanVal2;
%plotting the row wise mean values
% subplot(3,1,1)
%imshow(r2g)
%plot(meanVal3(:),'r.');drawnow
s = regionprops(r2g,'BoundingBox','Area'); %calculates the different centroids
thisRegion = s(1).BoundingBox;
croppedImage = imcrop(r2g,[thisRegion(1),thisRegion(2),thisRegion(3),thisRegion(4)]);
croppedImage = imresize(croppedImage,[100 100]);
%subplot(2,1,1);
%imshow(croppedImage);
%subplot(3,1,2)
%imshow(croppedImage)
meanValCI = mean(croppedImage,2);
meanValCIR(j) = mean(meanValCI);
%subplot(3,1,3)
%subplot(2,1,2)
figure;
plot(meanValCIR(1:j),'r');drawnow
xlabel('Time - (0.5 seconds) ');
ylabel('Intensity');
%xlim([0 1000]);
%ylim([0 200]);
xlim('auto');
ylim([0 200]);
j = j+1;
pause(0.5)
end
end
Is there any way to display the plot without writing the data to a file and accessing and plotting that file using python? My main aim was to get realtime plotting.
1 Kommentar
Antworten (0)
Siehe auch
Kategorien
Mehr zu MATLAB Support Package for USB Webcams finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!