[Digital Image Processing (iii)] grayscale transformation with Image Enhancement

Source: Internet
Author: User
Tags scalar scale image
As mentioned above, digital image processing is a method and technology used by computers to remove noise, enhance, restore, split, and extract features from digital images.
Its main objective is:
  1. Improve the visual quality of the image, such as brightness and color conversion, enhance and suppress certain components, and perform geometric transformation on the image to improve the image quality.
  2. The conversion, encoding, and compression of image data facilitate the storage and transmission of images.
  3. Extract certain features or special information contained in the image. These extracted features or information are often convenient for the computer to analyze the image. The process of extracting features or information is pattern recognition or computer vision preprocessing. Extracted features can include many aspects, such as frequency-domain features, gray-scale or color features, border features, regional features, texture features, shape features, topology features, and relational structures.
Image Enhancement (Enhancing useful information in images)
  1. Image enhancement is to emphasize or sharpen certain features of an image, such as edges, outlines, and contrast, for display, observation, or further analysis and processing.
  2. The primary goal of enhancement is to make the processed image more suitable for specific applications than the original image.
  3. Main Methods:
    • Space Domain:
      • Vertex operations (grayscale transformation and histogram correction)
      • Regional Operations (spatial filtering)
    • Frequency Domain:
      • High-pass filtering, low-pass filtering, and median filtering;

Gray-scale transformation (GST) is a processing method for point operations in spatial fields, the method of changing the gray value of each pixel in the original image point by point (and only related to the original gray value of the point). Its representation is as follows:
  • For input image f (x, y), output image g (x, y), T (in) is a grayscale transformation function, then G (x, y) = T (f (x, y )).

Its main objectives are as follows:
  • Improves image quality and makes the image display clearer.
  • Selectively highlight the features that interest the image or suppress unnecessary features so that the image matches the visual response features (image enhancement)

Its main applications are as follows:
  • Image Inversion
  • Contrast stretch
  • Gray-scale image segmentation (binarization)

Image inversion:
This method is suitable for enhancing the white or gray details in the dark area of the embedded image.
src = imread('Fig0303(a)(breast).tif');imshow(src);result = imadjust(src, [0 1], [1 0]);figure, imshow(result);


Contrast stretch:
(Normal linear transformation)
src = imread('Fig0316(a)(moon).tif');imshow(src);result = imadjust(src, stretchlim(src), [ ]);figure, imshow(result);


(Using logarithm transformation)
src = imread('Fig0305(a)(spectrum).tif');imshow(src);result = im2uint8( mat2gray( log(1 + double(src)) ) );figure, imshow(result);


Grayscale image segmentation (binarization ):
In the field of image processing, binary images have a small amount of computing and can reflect the key features of images, so they are widely used.
src = imread('Fig0409(a)(bld).tif');imshow(src);[row clumn] = size(src);for p = 1:row    for q = 1:clumn        if src(p,q)>=125            src(p,q)=255;        else            src(p,q)=0;        end    endendfigure,imshow(src);



  • Matlab function summary:

Imadjust ()
Imadjust is used in digital image processing to perform gray-scale transformation (adjust the brightness of a gray-scale image or the color matrix of a color image). This function maps the image to [0 1] First, for example, a uint8 image is multiplied by 255 to determine the value in the actual application.
Call format:
J = imadjust (I)
Convert Grayscale Images The brightness value in I maps to the new value in J and makes 1% of the data at low intensity and saturation, which increases the contrast value of output image J. This usage is equivalent to imadjust (I, stretchlim (I ))

J = imadjust (I, [low_in; high_in], [low_out; high_out])
Map the brightness value in image I to a new value in J, that is, the value between low_in and high_in is mapped to the value between low_out and high_out. Values below low_in and above high_in are cut out, that is, values below low_in are mapped to low_out, and values above high_in are mapped to high_out. Both of them can use an empty matrix []. The default value is [0 1].

J = imadjust (I, [low_in; high_in], [low_out; high_out], gamma)
Map the brightness value in image I to a new value in J, where gamma specifies the curve shape describing the relationship between I and j. If gamma is less than 1, this ing is biased towards a higher value (bright) output. If gamma is greater than 1, this ing is biased towards a lower value (dark) output. If this parameter is omitted, the default value is (linear ing ).

NEWMAP = imadjust (MAP, [low_in; high_in], [low_out; high_out], gamma)
Adjust the color palette map of the indexed image. If low_in, high_in, low_out, high_out, and gamma are both scalar values, this ing is applied to both R, G, and B components. Each color component has a unique ing. When low_in and high_in are both 1*3 vectors or low_out and high_out are both 1*3 vectors or gamma is 1*3 vectors. Adjusted color matrix NEWMAP It has the same size as map.

Rgb2 = imadjust (rgb1 ,...)
RGB image The red, green, and blue color palette of rgb1 are adjusted respectively. With the adjustment of the color matrix, each color palette has a unique ing value.

Stretchlim ()
Low_high = stretchlim (SRC, Tol)
This function finds the contrast of the contrast extended image, which can be used for imadjust (),
Tol = [low_fract high_fract] specifies the percentage of low-pixel and high-pixel saturation of the image.
If ToL is a scalar, Tol = low_fract, high_fract = 1-low_fract, and saturation is equal to the percentage of low and high pixel values.
If the toll is ignored in the parameter, the saturation level is 2%, and the default tol value is [0.01 0.99].
If Tol = 0 is selected, low_high = [min (I (:)); max (I (:))].

Mat2gray ()
Call format:
I = mat2gray (A, [Amin amax])
Normalize the data of image matrix A between Amin and amax, and change the values of other elements smaller than Amin to 0 and those greater than amax to 1. I = (a-AMIN)/(amax-AMIN)

I = mat2gray ()
Convert image matrix A to image Matrix I. After normalization, the values of each element in the matrix are within the range of 0 to 1 (including 0 and 1 ). I = (a-AMIN)/(amax-AMIN)

Im2uint8 ()
Function: converts the image data type to an unsigned eight-digit integer. If the input image is an unsigned eight-digit integer, the returned image and
The source image is the same. If the source image is not an unsigned eight-digit integer, this function returns an image of the same source image but of the uint8 data type.
(Adjust the image if necessary ).
Call format:
I = im2uint8 (SRC)
After the gray-scale image SRC data type is converted into an unsigned eight-digit integer, return. (But SRC does not change)

Rgb2 = im2uint8 (rgb1)
Convert the Data Type of a true-color image to an unsigned eight-digit integer and return it. Note that this does not convert a true color image into a black image or a black image, but only changes the image data type.

I = im2uint8 (BW)
Convert the BW data format of a binary image to the uint8 format. Because the image data of a binary image is only 0 and 1, the conversion effect here is only to map 1 to 255.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.