Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Raspberry Pi

You're reading from   Learning Raspberry Pi Unlock your creative programming potential by creating web technologies, image processing, electronics- and robotics-based projects using the Raspberry Pi

Arrow left icon
Product type Paperback
Published in Apr 2015
Publisher
ISBN-13 9781783982820
Length 258 pages
Edition 1st Edition
Languages
Concepts
Arrow right icon
Authors (2):
Arrow left icon
Serge Schneider Serge Schneider
Author Profile Icon Serge Schneider
Serge Schneider
Samarth Shah Samarth Shah
Author Profile Icon Samarth Shah
Samarth Shah
Arrow right icon
View More author details
Toc

A quick start to image processing


Once OpenCV is installed on your Raspberry Pi, you can start working on one of the widely used image processing library. In this section, you will learn how to perform basic image operations such as opening an image, reading an image, saving the image to other format and pixel manipulation, and so on. You will also learn about arithmetic operation on images, reading a video file, and opening a video file.

Reading and opening an image

One of the very basic operations in image processing is reading and opening an image.

  1. Open your terminal window and create a new folder titled chapter5 in which you will put all your code by executing the following command:

    cd /home/pi/
    mkdir chapter5
    
  2. Create a new python file using this code:

    nano readImage.py
    
  3. Copy any of the image file to the chapter5 folder. I had the test.jpg image in the folder. Copy the following command in the file using this code:

    #import the python opencv module
    import cv2
    #imread will read an image
    img=cv2...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image