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: [email protected]
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 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

Take our 85+ 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!

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

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

Feedback ↓