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);

1 件のコメント
Albert Chen
2023 年 8 月 10 日
Please refer this post:
https://www.mathworks.com/matlabcentral/answers/891992-imread-error-in-raspberry-pi-deployment
回答 (0 件)
参考
カテゴリ
Help Center および File 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!