USB Web cam on Verdin Development Board V1.1 and Verdin iMX8M Plus

How to use USB Web camera To read videos and capture images in python application is possible?
In som:-Verdin iMX8M Plus ,Carrier Board :- Verdin Development Board V1.1,OS:- Linux

Greetings @saikumar,

We have general article on using cameras in TorizonCore here: How to use Cameras on Torizon | Toradex Developer Center

It also features an example application with cameras and opencv that could serve as a inspiration.

Best Regards,

Thank you for your inputs .
But i an using opencv in visual studio

the docker file :-

ARGUMENTS --------------------------------------------------------------------

Board architecture


For armv7 use:


Base container version

ARG BASE_VERSION=3.0.8-bookworm

ARG APP_ROOT=/home/torizon

FROM --platform=linux/${IMAGE_ARCH}
torizon/debian:${BASE_VERSION} AS Deploy


your regular RUN statements here

Install required packages

RUN apt-get -q -y update &&
apt-get -q -y install
python3-venv \

DO NOT REMOVE THIS LABEL: this is used for VS Code automation

# __torizon_packages_prod_start__
python3-opencv:arm64 \
# __torizon_packages_prod_end__

DO NOT REMOVE THIS LABEL: this is used for VS Code automation

&& apt-get clean && apt-get autoremove && \
rm -rf /var/lib/apt/lists/*

Create virtualenv

RUN python3 -m venv ${APP_ROOT}/.venv --system-site-packages

Install pip packages on venv

COPY requirements-release.txt /requirements-release.txt
RUN . ${APP_ROOT}/.venv/bin/activate &&
pip3 install --upgrade pip && pip3 install --break-system-packages -r requirements-release.txt &&
rm requirements-release.txt

copy the source code

COPY /src ${APP_ROOT}/src



Activate and run the code

CMD . ${APP_ROOT}/.venv/bin/activate && python3 src/ --no-sandbox

import opencv

Open the webcam (0 represents the default camera)

cap = opencv.VideoCapture(0)

while True:
# Capture frame-by-frame
ret, frame =

# Display the frame
opencv.imshow('Webcam', frame)

# Press 'q' to exit
if opencv.waitKey(1) & 0xFF == ord('q'):

Release the capture


i am getting error at import opecv

please help me to resolve the issue

i am getting error at import opecv

Could you elaborate what specific error you get?

Also how did you modify your torizonPackages.json file to add python3-opencv:arm64? If you’re running things in debug then you need to add this package to the debug container. It looks like you added it to only the release container which won’t do you any good if you’re running in debug. This page explains this more in detail: Add Dependencies and Tools to Existing Projects | Toradex Developer Center

On a final note, if you’re just trying to use the camera you don’t need to really mess with this opencv stuff to use a camera. OpenCV is for computer vision, if you just want to use a camera then you can just use Gstreamer. There’s many examples you can find online of Gstreamer.

Best Regards,