Image processing commands give black screen display on Raspberry PI (with live camera)
7 次查看(过去 30 天)
显示 更早的评论
Hi,
I work with "Image processing toolbox" and I use a Raspberry Pi as the target device. I would like to deploy an edge detection algorithm to Raspberry and display the result images in each cycle but it gives only a black screen. (I use a camera for the image input.) When I run the algorithm on the host computer and the Raspberry only for I/O ports, the code works well, the camera screen is good and the edge detection part works well, too.
My experiences with the error:
- When I only use the "rgb2grey" command and I comment out the "edge" command, the algorithm works fine, there is no black screen. The greyscale images are shown on the Raspbian.
- When I add the "edge" command and deploy it to Raspberry, I can run the ".elf" file and the program starts, but the camera screen only shows a black screen.
- There is no error message when I deploy the code to the Raspberry, it writes "Succesfully deployment".
- (I tried the algorithm with few more command from "Image processing toolbox", for example, I used the "imfill" command instead of "edge" command, the result were the same, the camera screen were black on the Raspberry.)
What's wrong with these commands, that cause a black screen display?
The code is:
function edgeDetection()%#codegen
% Create a connection to the Raspberry Pi hardware (I only changed the IP address and password in the forum)
r = raspi('172.%%.%%.%%%','pi','%%%%');
%Define the webcam
w = webcam(r, 'UVC Camera (046d:0825) (usb-0000:01:00.0-1.3):');
% Run the edge detection algorithm on the images captured from the Raspberry Pi camera module.
for k = 1:300
img = snapshot(w);
gray_img = rgb2gray(img);
edges = edge(gray_img);
displayImage(r,edges,'Title','Edge Detection'); %Display the images on the target hardware in each cycle
end
end
I hope that my descrption is clear about the problem.
Thanks for any answer,
Roland
1 个评论
Prasanth Sunkara
2020-11-26
Hi Ronald,
displayImage expects a matrix of data type double in deployment workflow. "edge" function would return a logical matrix. Could you please try converting your "edges" variable to double data types and then pass it to displayImage?
Eg: >> edges = 255 * double(edges);
Hope this helps!
Thanks,
Prasanth
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!