Name: Towards AI Legal Name: Towards AI, Inc. Description: Towards AI is the world's leading artificial intelligence (AI) and technology publication. Read by thought-leaders and decision-makers around the world. Phone Number: +1-650-246-9381 Email: pub@towardsai.net
228 Park Avenue South New York, NY 10003 United States
Website: Publisher: https://towardsai.net/#publisher Diversity Policy: https://towardsai.net/about Ethics Policy: https://towardsai.net/about Masthead: https://towardsai.net/about
Name: Towards AI Legal Name: Towards AI, Inc. Description: Towards AI is the world's leading artificial intelligence (AI) and technology publication. Founders: Roberto Iriondo, , Job Title: Co-founder and Advisor Works for: Towards AI, Inc. Follow Roberto: X, LinkedIn, GitHub, Google Scholar, Towards AI Profile, Medium, ML@CMU, FreeCodeCamp, Crunchbase, Bloomberg, Roberto Iriondo, Generative AI Lab, Generative AI Lab VeloxTrend Ultrarix Capital Partners Denis Piffaretti, Job Title: Co-founder Works for: Towards AI, Inc. Louie Peters, Job Title: Co-founder Works for: Towards AI, Inc. Louis-François Bouchard, Job Title: Co-founder Works for: Towards AI, Inc. Cover:
Towards AI Cover
Logo:
Towards AI Logo
Areas Served: Worldwide Alternate Name: Towards AI, Inc. Alternate Name: Towards AI Co. Alternate Name: towards ai Alternate Name: towardsai Alternate Name: towards.ai Alternate Name: tai Alternate Name: toward ai Alternate Name: toward.ai Alternate Name: Towards AI, Inc. Alternate Name: towardsai.net Alternate Name: pub.towardsai.net
5 stars – based on 497 reviews

Frequently Used, Contextual References

TODO: Remember to copy unique IDs whenever it needs used. i.e., URL: 304b2e42315e

Resources

Our 15 AI experts built the most comprehensive, practical, 90+ lesson courses to master AI Engineering - we have pathways for any experience at Towards AI Academy. Cohorts still open - use COHORT10 for 10% off.

Publication

Image Intensity Manipulation
Latest

Image Intensity Manipulation

Last Updated on January 6, 2023 by Editorial Team

Last Updated on March 27, 2021 by Editorial Team

Author(s): Akula Hemanth Kumar

Computer Vision

Image Intensity Manipulation
Photo by Jonathan Bowers on Unsplash

What counts as intensity manipulation

  • Explicit changes to pixel values in any of the channels.
  • Mathematical operations on images.
  • Brightness changes.
  • Contrast changes.
  • Gamma manipulation.
  • Histogram equalization
  • Advanced manipulation-filtering, enhancements etc.

Load Image using OpenCV

import numpy as np
import cv2
from matplotlib import pyplot as plt
img = cv2.imread(folder_path + "imgs/chapter3/man.jpg", 0);
plt.imshow(img, cmap = "gray");
plt.show()

Adding a constant value to input image using Opencv

img = cv2.imread(folder_path + "imgs/chapter3/man.jpg", 0);
##########################FOCUS############################
img = cv2.add(img, 120);
###########################################################
plt.imshow(img, cmap = "gray");
plt.show()

Subtracting a constant value to input image using Opencv

img = cv2.imread(folder_path + "imgs/chapter3/man.jpg", 0);
##########################FOCUS############################
img = cv2.subtract(img, 120);
####################################################################
plt.imshow(img, cmap = "gray");
plt.show()

Mean Subtraction from Image

Method 1

  • Split Image into its channels.
  • For each channel calculate its mean.
  • Subtract that mean from each pixel in that channel

Method 2 (Used in Deep Learning)

  • Split all images into their respective channels

For each channel of all images.

  • Find mean of that channel for each image.
  • Find mean of all the means calculated.

Applications

  • Part of batch normalization.

Negative images

Negative of Gray Scale

Negative of RGB images

Adding two images

Direct adding

Weighted Adding

Subtracting two images

Brightness

  • The quality or state of giving out or reflecting light.
  • Brightness is a relative term. It depends on your visual perception.
  • Brightness can be defined as the amount of energy output by a source of light relative to the source we are comparing it to.

Contrast

  • Contrast is the difference in luminance or color that makes an object ( or its representation in an image or display) distinguishable.
  • Visualized as difference between maximum and minimum pixel intensity in an image.
  • Contrast is determined by the difference in the color and brightness of the objects within the same field of view.

Manipulating contrast in an image

Gamma

  • Gamma correction, or often simply gamma, is a non linear operation used to encode and decode luminance.
  • All color and Gray Scale digital image files contain gamma data.
  • Gamma is about translating between digital sensitivity and human eye sensitivity , providing many advantages on one hand but adding complexity on the other hand.
  • Gamma optimizes the contrast and brightness in the midtones.

Manipulating gamma using Opencv

Histogram equalization

Histogram

  • A histogram is a graph. A graph that shows frequency of anything.
  • Image pixel histogram represents frequency of pixels having certain intensity values.

Histogram equalization

  • Histogram equalization is used to enhance contrast.
  • This method increases the global contrast of Images.

Histogram visualization using Numpy

Histogram Equalization using OpenCV

You can find the complete jupyter notebook here.

If you have any questions, you can reach Abhishek . Feel free to reach out to him.

I am extremely passionate about computer vision and deep learning. I am an open-source contributor to Monk Libraries.

You can also see my other writings at:

Akula Hemanth Kumar – Medium


Image Intensity Manipulation was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.

Published via Towards AI


Take our 90+ lesson From Beginner to Advanced LLM Developer Certification: From choosing a project to deploying a working product this is the most comprehensive and practical LLM course out there!

Towards AI has published Building LLMs for Production—our 470+ page guide to mastering LLMs with practical projects and expert insights!


Discover Your Dream AI Career at Towards AI Jobs

Towards AI has built a jobs board tailored specifically to Machine Learning and Data Science Jobs and Skills. Our software searches for live AI jobs each hour, labels and categorises them and makes them easily searchable. Explore over 40,000 live jobs today with Towards AI Jobs!

Note: Content contains the views of the contributing authors and not Towards AI.