Gus Sabina
Gus Sabina

Reputation: 311

Capture an image from a USB camera and display it in the monitor

I'm trying to make an embedded-linux application that takes an image from a USB camera, write something on this image (boxes and text) and display the modified image in the monitor.

I see there are lot of frameworks and tools to do this, but I'm not sure what would be the best approach in this case, and I would love to have some directions in case someone has an advice. I was planing to use C++ but I could use be flexible on this.

Thanks Gus

Upvotes: 0

Views: 1405

Answers (1)

Mark Setchell
Mark Setchell

Reputation: 207465

You will need to get Video4Linux working anyway because OpenCV uses that underneath to acquire images, so you could use that to grab the image(s). You could then add text and boxes very simply with ImageMagick and that could be done from command-line with no programming required. You could then display them with feh or ImageMagick's display program, or any X11 viewer.

Let's say you acquired this image:

enter image description here

You could annotate it like this in a bash script at the command line:

convert input.png \
   -fill none  -stroke lime -draw "rectangle 10,50 200,300" \
   -fill white -undercolor '#00000080' -gravity SouthEast  -pointsize 72 -annotate +0+5 ' Funky Annotation '  result.png

enter image description here

OpenCV can take a lot of configuring and a long time to compile. You could add text and boxes in OpenCV but the fonts are not very configurable in OpenCV because it is more oriented towards Computer Vision (i.e. identifying objects and faces) rather generating and annotating images.

Your question is actually rather too broad for this site. Do you actually mean a single image, or a video? What sort of annotations do you mean? Is there a target frame-rate?

Upvotes: 1

Related Questions