Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe

Image Capture in Beaglebone Black Using OpenCV (Part 12/15)

By Ashish Vara November 5, 2024

As I have already explained how to interface web cam with BBB here I will talk about capturing image using python script programming. It is simple tutorial where you can also add effects in the form of black and white image, motion detection, sharp picture etc. I have used opencv library which programs functions of real time computer and machine learning.

Required Tools:

  • Beaglebone Black
  • Web Cam

Setting Environment

Before  proceeding, create a set up as explained in how to interface web cam with BBB. Connect web cam with BBB through USB port. Connect with internet and power up BBB. You have remote access of BBB on desktop.

Prototype of Beaglebone Black based Security Camera

Fig. 1: Prototype of Beaglebone Black based Security Camera

First of all upgrade your kernel version.  (Ignore if already done).

Install the Opencv

Install the opencv on BBB from debian repository or official site. Here I have installed it from debian repository. Run the following commands from command prompt:

sudo apt-get install python-opencv
sudo apt-get install libopencv-dev

Install the Dependencies

You need to install some dependencies like build, image, video, GUI etc in BBB.

Step1: Install build dependency by running following instruction:

sudo apt-get install build-essential cmake

Step2: Install media I/O library by running following instruction:

sudo apt-get install zlib1g-dev libwebp-dev libpng-dev libjasper-dev libtiff5-dev libopenexr-dev libgdal-dev libjpeg-dev

 Step3: Install GUI library by running following instruction:

sudo apt-get install qt5-default libvtk6-dev

Step4: Install video I/O library by running following instruction:

sudo apt-get install libavcodec-dev libavformat-dev libdc1394-22-dev libswscale-dev libtheora-dev libxvidcore-dev libx264-dev libvorbis-dev yasm libopencore-amrnb-dev libopencore-amrwb-dev libv4l-dev libxine2-dev libtbb-dev

Getting Started With Program

Open the command terminal and create a new file using touch command with .py extension (i.e. image.py). Open the file with any text editor (i.e. nano, vim etc.) and write a code in python language.

Opencv is a great library of machine learning and computer science written in C, C++, java and python. It supports great functionality of image and video processing and works well on embedded Linux platform. You need to read the image from web cam device which is attached with BBB.  It will be zero if single webcam is connected. So just pass zero from function as the following:

cam = cv2.VideoCapture(0)

Image of Webcam Connected to Beaglebone Black

Fig. 2: Image of Webcam connected to Beaglebone Black

I created frame size of 1280 x 720 which works well with BBB. You can adjust frame size as per you wish which is supported by library. Set the frame size of image by following functions:

cam.set (cv2.cv.CV_CAP_PROP_FRAME_WIDTH, 1280)
cam.set (cv2.cv.CV_CAP_PROP_FRAME_HEIGHT, 720)

Now, capture the image from device (i.e web cam) by following function:

cam.read( )

Provide at least 10 ms delay after capturing image by following function:

cv2.waitKey(10)

If you want to show image on screen, run the following function:

cv2.imshow (“Test Picture”, img)

Save the image file with specific name by following function:

cv2.imwrite (“demopic.bmp”, img)

Circuit Diagrams

Circuit-Diagram-Beaglebone-Black-Security-Camera


Filed Under: BeagleBone, Electronic Projects
Tagged With: beaglebone black, opencv
 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

EE TECH TOOLBOX

“ee
Tech Toolbox: Internet of Things
Explore practical strategies for minimizing attack surfaces, managing memory efficiently, and securing firmware. Download now to ensure your IoT implementations remain secure, efficient, and future-ready.

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS EDABOARD.com Discussions

  • Reducing "shoot-through" in offline Full Bridge SMPS?
  • What is the purpose of using a VCVS?
  • Checking line impedance
  • Why do I hear whistling sounds in my vents?
  • Mains inverter with switching node going out on the mains cable!?

RSS Electro-Tech-Online.com Discussions

  • Why can't I breadboard this oscillator?
  • Failure of polypropylene motor-run capacitors
  • a point I can't understand about the sinc expression
  • Quick advice on remote car starter?
  • Wideband matching an electrically short bowtie antenna; 50 ohm, 434 MHz

Featured – RPi Python Programming (27 Part)

  • RPi Python Programming 21: The SIM900A AT commands
  • RPi Python Programming 22: Calls & SMS using a SIM900A GSM-GPRS modem
  • RPi Python Programming 23: Interfacing a NEO-6MV2 GPS module with Raspberry Pi
  • RPi Python Programming 24: I2C explained
  • RPi Python Programming 25 – Synchronous serial communication in Raspberry Pi using I2C protocol
  • RPi Python Programming 26 – Interfacing ADXL345 accelerometer sensor with Raspberry Pi

Recent Articles

  • AC-DC power supply extends voltage range to 800 V DC
  • Infineon’s inductive sensor integrates coil system driver, signal conditioning circuits and DSP
  • Arm Cortex-M23 MCU delivers 87.5 µA/MHz active mode
  • STMicroelectronics releases automotive amplifiers with in-play open-load detection
  • Convection-cooled power controller integrates EtherCat connectivity

EE ENGINEERING TRAINING DAYS

engineering

Submit a Guest Post

submit a guest post
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy

Search Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe