Skip main navigation

Get 30% off one whole year of Unlimited learning. Subscribe for just £249.99 £174.99. T&Cs apply

Practical: Getting and setting image pixel values using Python OpenCV

A practical on getting and setting pixel values in an image using Python OpenCV
It’s common to process and analyse images purely using Python, rather than through via Fiji. The OpenCV library is one way to do this.

This practical shows you how to install OpenCV if you haven’t already, then how to open images and manipulate pixel values within them.

All the instructions are in the attached pdf in the Downloads section below.

The example image used in the practical that you should save as ‘roots.jpg’ is below:

Image of roots on blue paper for use in the practical

The sample script ‘open_image.py’ can be downloaded from our Github repository at https://github.com/nlmellor/PhenoDataCampp/tree/main/ImageAnalysis/code.

Please let us know how you get on in the comments below.

This article is from the free online

Introduction to Image Analysis for Plant Phenotyping

Created by
FutureLearn - Learning For Life