By using this site, you agree to the Privacy Policy and Terms of Use.
Accept
DatadanceDatadance
  • Home
  • News
  • Applications
  • Companies
  • Industries
  • Videos
  • More
    • Machine Learning
    • Legal & Ethics
    • Deep Learning
    • Community
Search
  • Privacy
  • Terms
  • Advertise
  • Contact
© 2023 Datadance. All Rights Reserved.
Reading: Let’s Start with Image Preprocessing using SKimage
Share
Sign In
Notification Show More
Latest News
Automated system teaches users when to collaborate with an AI assistant
News
Google’s Gemini Is the Real Start of the Generative AI Boom
ChatGPT
AI multi-speaker lip-sync has arrived
Companies
MIT engineers develop a way to determine how the surfaces of materials behave
News
Omid Scobie’s book Endgame sold 6,448 copies in its first five days
ChatGPT
Aa
DatadanceDatadance
Aa
  • News
  • Applications
  • Companies
  • Industries
  • Machine Learning
  • Videos
Search
  • Home
  • News
  • Applications
  • Companies
  • Machine Learning
  • Deep Learning
  • Industries
  • Legal & Ethics
  • Videos
Have an existing account? Sign In
Follow US
  • Privacy
  • Terms
  • Advertise
  • Contact
© 2023 Datadance. All Rights Reserved.
Datadance > Blog > Deep Learning > Let’s Start with Image Preprocessing using SKimage
Deep Learning

Let’s Start with Image Preprocessing using SKimage

News Room
Last updated: 2023/02/27 at 4:20 AM
News Room
Share
4 Min Read
SHARE

Image cropping involves extracting a portion of an image by specifying a crop region. In scikit-image, you can use slicing and indexing to crop an image. Here’s an example in Python:

Contents
Image Preprocessing – Brightness ManipulationConclusion

In this example, the input image is first loaded using the imread function. The crop region is specified by slicing the image along both dimensions, such that the first and last quarter of the rows and columns are removed.

Image flipping in Python can be performed using the “cv2.flip” function from the OpenCV library. The “cv2.flip” function takes two arguments: the input image and a flip code. The flip code specifies the flipping to be performed and can be one of the following values:

  • cv2.FLIP_HORIZONTAL: Flip the image horizontally
    cv2.FLIP_VERTICAL: Flip the image vertically
    cv2.FLIP_BOTH: Flip the image both horizontally and vertically

Flipping can be considered an extension of rotation, allowing left-right and up-down image flipping.

import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
# reading the image
image = imread('index.png')
image = np.array(image)
imshow(image)
plt.title('Original Image')

Now, what do you do if you have to flip the images, again read the image and now in order to flip it? let’s say we are doing left to right flip. I can easily do that using the “fliplr()” function.

# flip image left-to-right
flipLR = np.fliplr(image)
plt.imshow(flipLR)
plt.title('Left to Right Flipped')

Image Preprocessing

And these are the ways in which you can flip the images.

Image Preprocessing – Brightness Manipulation

Brightness manipulation in Python can be performed using the image library. The image library provides the exposure module, which includes the function of adjusting gamma that can be used to change the brightness of an image.

Images with different brightness can be used to make the model robust to changes in lighting conditions; this is important for systems that work in outdoor lightings, like CCTV cameras on traffic signals.

from skimage.exposure import adjust_gamma
# read the image
image = imread('index.png')
plt.title('Original Image')
imshow(image)

Image Preprocessing

I am going to change the gamma value, and that changes the strength of the image. So, this is my bright image.

# brighten the image
bright = adjust_gamma(image,gamma=0.5,gain=1)
imshow(bright)
plt.title('Brightened IMage')

Image Preprocessing

So, approximately I can make all of these changes to the image.

Conclusion

Scikit-image is a popular Python library for image processing that provides tools and functions for working with images. Here’s a summary of some of the critical features of image for image processing:

  1. Image I/O: image provides functions for reading and writing images to disk, including imread for reading an image and imsave for saving an image.
  2. Image restoration: image provides algorithms for restoring degraded images, including functions for removing noise and correcting for blurring or distortion.
  3. Image analysis: image provides functions for analyzing image properties, including histograms, gradient magnitude, and texture analysis.
  4. Image visualization: image provides functions for visualizing images and their properties, including plotting and displaying images, histograms, and other visual representations of image data.

Overall, image is a comprehensive and well-documented library for image processing that is widely used in scientific, medical, and industrial applications.

The media shown in this article is not owned by Analytics Vidhya and is used at the Author’s discretion. 

Read the full article here

Sign Up For Daily Newsletter

Be keep up! Get the latest breaking news delivered straight to your inbox.
I have read and agree to the terms & conditions
By signing up, you agree to our Terms of Use and acknowledge the data practices in our Privacy Policy. You may unsubscribe at any time.
News Room February 27, 2023
Share this Article
Facebook Twitter Copy Link Print
Share
Previous Article Automating the math for decision-making under uncertainty
Next Article Step-by-step Guide to Become a Data Scientist in Retail Industry
Leave a comment Leave a comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

- Advertisement -
Ad imageAd image

Latest News

Google’s Gemini Is the Real Start of the Generative AI Boom
ChatGPT December 7, 2023
AI multi-speaker lip-sync has arrived
Companies December 7, 2023
MIT engineers develop a way to determine how the surfaces of materials behave
News December 7, 2023
Omid Scobie’s book Endgame sold 6,448 copies in its first five days
ChatGPT December 7, 2023
ChatGPT, Cristiano Ronaldo and Barbenheimer: Top 25 most viewed Wikipedia pages of 2023 give fascinating insight into what interested people around the globe this year
ChatGPT December 6, 2023
Eric Evans to step down as director of MIT Lincoln Laboratory
News December 6, 2023

You Might also Like

Deep Learning

Exploring Pointwise Convolution in CNNs: Replacing Fully Connected Layers

November 24, 2023
Deep Learning

Mastering LeNet: Architectural Insights and Practical Implementation

November 22, 2023
Deep Learning

A Deep Dive into Model Quantization for Large-Scale Deployment

November 17, 2023
Deep Learning

Scaling Down, Scaling Up: Mastering Generative AI with Model Quantization

November 10, 2023
//

Datadance is your one-top news website for the latest artificial intelligence news and updates, follow us now to get the news that matters to you!

Quick Link

  • Privacy Policy
  • Terms of use
  • Press Release
  • Advertise
  • Contact

Top Topics

  • Applications
  • Companies
  • Deep Learning
  • Industries
  • Machine Learning

Sign Up for Our Newsletter

Subscribe to our newsletter to get our latest news instantly!

I have read and agree to the terms & conditions
DatadanceDatadance
Follow US

© 2023 Datadance. All Rights Reserved.

Join Us!

Subscribe to our newsletter and never miss our latest news, podcasts etc..

I have read and agree to the terms & conditions
Zero spam, Unsubscribe at any time.

Removed from reading list

Undo
Welcome Back!

Sign in to your account

Register Lost your password?