Can I output webcam feed from a Jetson Nano to multiple windows in MATLAB R2022a?
6 views (last 30 days)
Show older comments
MathWorks Support Team
on 21 Oct 2022
Answered: MathWorks Support Team
on 30 Jan 2023
I'm trying to use the "MATLAB Coder Support Package for NVIDIA Jetson and NVIDIA DRIVE Platforms" to pull the video feed from 2 webcams connected to a Jetson Nano. However, when I try to use the "image" function from this support package, only one window opens which displays the video from both streams (which causes a blinking effect when I try to put this in a loop). Is there a way to output each camera's video feed to a separate window?
Accepted Answer
MathWorks Support Team
on 21 Oct 2022
As of release R2022a, the "image" function from the MATLAB Coder Support Package for NVIDIA Jetson and NVIDIA DRIVE Platforms does not support multiple windows. However, one workaround is to capture an RGB image output array from each camera using the "snapshot" function, concatenate the RGB image output arrays and display them both in a single window. This workaround assumes that the camera outputs are the same resolution. The following is an example code for implementing this workaround:
% set up to read from webcams
hwobj = jetson;
c1 = camera(hwobj,"HD Pro Webcam C920",[640 480],'VideoDevice','/dev/video0');
c2 = camera(hwobj,"HD Pro Webcam C920",[640 480],'VideoDevice','/dev/video1');
d = imageDisplay(hwobj);
% take and save an image
img = snapshot(c1);
img2 = snapshot(c2);
% concatenate and output RGB image arrays
image(d, [img img2]);
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!