Detecting low contrast images with OpenCV, scikit-image, and Python
In this article, we are going to see how to detect low contrast images with OpenCV, scikit-image using Python
A low contrast image has the minimal distinction between light and dark parts, making it difficult to tell where an object’s boundary begins and the scene’s background begins. For example
The left one is low contrast and the right one is a high contrast image. Using low contrast image detection, you can programmatically detect images that are not sufficient for your image processing pipeline.
First Let’s see how we can manually see the contrast of a picture using histograms. The histogram for a high contrast image(Right) spans the entire dynamic range, but the histogram for a low contrast image(Left) just covers a narrow range, as seen below.
Now let’s do it programmatically using the is_low_contrast method of scikit-image library.
- Import all the libraries needed.
- Read the image in grayscale mode.
- Check if image is low contrast image or high contrast image using some threshold value provided.
Syntax: is_low_contrast(img,”threshold value”)
Example 1: Low contrast Image
Example 2: High Contrast Image
You can further find the contours on high contrast images for image preprocessing and extract the object from the image.
Please Login to comment...