Skip to Content
Learning Robotics using Python - Second Edition
book

Learning Robotics using Python - Second Edition

by Lentin Joseph
June 2018
Beginner to intermediate
280 pages
6h 58m
English
Packt Publishing
Content preview from Learning Robotics using Python - Second Edition

Reading and displaying an image using the Python-OpenCV interface

The first example will load an image in grayscale and display it on the screen.

In the following section of code, we will import the numpy module for handling the image array. The cv2 module is the OpenCV wrapper for Python, which we can use to access OpenCV Python APIs. NumPy is an extension to the Python programming language, adding support for large multidimensional arrays and matrices, along with a large library of high-level mathematical functions to operate on these arrays (see https://pypi.python.org/pypi/numpy for more information):

#!/usr/bin/env python 
import numpy as np 
import cv2 

The following function will read the robot.jpg image and load this image in grayscale. ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning Robotics using Python

Learning Robotics using Python

Lentin Joseph
Python Robotics Projects

Python Robotics Projects

Prof. Diwakar Vaish

Publisher Resources

ISBN: 9781788623315Supplemental Content