how to read a saved image from raspberry pi and how to write an image on raspberry pi

7 次查看(过去 30 天)
greetings of the day,
one image (cameraman.tif) is saved in raspberry pi which is available in the path of "/home/pi/MATLAB_ws/R2021b/D/srinivas/practice". In order to read the saved image from raspberry pi, i used "imread" command. But it shows an error like "The function imread uses a precompiled shared library which is not supported on the chosen target." while deploy the code on raspberry pi.
Could you please provide the solution, how to read a saved image from raspberry pi.
The written code is
function edge_database()%#codegen
r=raspi('192.168.68.192','pi','1234');
s=imread('/home/pi/MATLAB_ws/R2021b/D/srinivas/practice/cameraman.tif');
kern = [1 2 1; 0 0 0; -1 -2 -1];
file_id=fopen('/home/pi/MATLAB_ws/R2021b/D/srinivas/practice/edge_database.txt','w+');
fprintf(file_id,'edge_database program executed successful');
h = conv2(s(:,:,2),kern,'same');
v = conv2(s(:,:,2),kern','same');
e = sqrt(h.*h + v.*v);
b = uint8((e > 100) * 240);
b=cat(3,b,b,b);
displayImage(r,[s,b],'Title','edge detection')
imwrite(b,'edgeimage.png');
fclose(file_id);
In the same manner, to write one processed image on raspberry pi, i used "imwrite" command. But it shows the error like "Function 'imwrite' not supported for code generation".
Could you please provide the solution, how to write a processed image on raspberry pi.
The written code is
function edge_database()%#codegen
r=raspi('192.168.68.192','pi','1234');
s=webcam(r);
s=snapshot(s);
kern = [1 2 1; 0 0 0; -1 -2 -1];
file_id=fopen('/home/pi/MATLAB_ws/R2021b/D/srinivas/practice/edge_database.txt','w+');
fprintf(file_id,'edge_database program executed successful');
h = conv2(s(:,:,2),kern,'same');
v = conv2(s(:,:,2),kern','same');
e = sqrt(h.*h + v.*v);
b = uint8((e > 100) * 240);
b=cat(3,b,b,b);
displayImage(r,[s,b],'Title','edge detection')
fclose(file_id);

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB Support Package for Raspberry Pi Hardware 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by