Image Processing with Python
Jacob Deppen and David Palmquist
July, 2023
Thank you!
Thanks to Nisha and Mary for hosting and thank you for
coming.
Presenters
- Jacob Deppen,
deppen8
on GitHub
- David Palmquist,
quist00
on GitHub
Acknowledgements
- Current maintainer team: Kimberly Meechan, Ulf Schiller, Robert
Turner, Toby Hodges
- Content originally developed by Mark Meysenburg, Tessa Durham
Brooks, Dominik Kutra, Constantin Pape, and Erin Becker.
- Many community members have opened issues and pull requests to
improve the lesson.
Image Processing is stable!
Moved from “beta” to “stable” in January 2023.
Why teach this lesson?
- Images are everywhere.
- Image data is different to tabular / data frame data.
What’s in the lesson?
- Introduction to images in research.
- How images are represented by computers.
- Manipulating images using python and scikit-image library.
- Extracting data / statistics from images.
Key concepts
- Pixels
- Arrays
- Coordinates
- Channels
- Kernels
- Binary masks
What’s not in the lesson?
Lesson is a more “traditional” approach: easier to explain results,
less data-intensive, applicable to more domains.
What do I need to know?
- Bash shell skills
- Navigating directories using
pwd
, ls
,
cd <subdirectory>
, and cd ..
, Run a
Python script from the command line.
- Python skills
- Variables and types, lists, logic (
if
,
else
, etc.), basic file input / output
Lesson setup
- Data
- Software
- Anaconda (base environment includes all required packages) and
Jupyter Notebooks
Introduction to image processing
- What research questions can we answer with image processing?
- Morphometrics, also known as “measuring things in images”.
Optional breakout 1
- What research areas do you expect your learners to come from?
- Are there particular challenges in working with image data in these
areas?
Image basics
- Representation of images in computers.
- Images, arrays and pixels.
- How RGB is used to make colour images.
- File formats and compression.
If you are a computer, images are arrays
Image with pixel values overlaid
Image representation
RGB Image
|
Red channel
|
Green channel
|
Blue channel
|
Analyzing images
The distribution of intensity of colour in an image can tell us
things.
Plant Seedling
|
Histogram
|
Blurring
Original
|
Blurred
|
Thresholding
Blurred grayscale
|
Threshold applied
|
Connected components
Separating objects and getting information about them.
Labelled shapes
Getting statistics
Areas histogram
|
False positive objects
|
Morphometrics
- Properties of the shape of an object.
- skimage
regionprops
- Basic e.g., area, perimeter, center
- More complex e.g., eccentricity, bounding box
Capstone challenge
- Morphometrics for bacterial colonies.
- Brings together blurring, thresholding, and connected component
analysis.
Optional breakout 2
- What imaging tools are people in your field using?
- How does that fit in with an open source image processing
stack?