Normalized grayscale histogram Matlab

Source: Internet
Author: User

Image histogram describes the statistical characteristics of each gray level of the image, he represents the image of each gray level and the gray level of the corresponding relationship between the frequency, because the gray level is not continuous, natural, gray histogram is a discrete function. The horizontal axis is the gray level G, the ordinate is Ng, if the total pixel is N, the gray level is l,pg=ng/n. Then ng--g constitute a grayscale histogram, pg--g form a normalized grayscale histogram.

Using Matlab, Imhist (I), imhist (i,n) means that the grayscale level is evenly divided into n small intervals, [Counts,x]=imhist (...) Returns the number of pixels in each grayscale interval and the corresponding vector between the gray cells. Use STEM (x,counts) to draw a grayscale histogram.

I=imread (' pout.tif ');
L=rgb2gray (I); the percent is converted to our familiar two-value image, which is the two-value grayscale image.
[M,n]=size (L);
[Counts,x]=imhist (l,32);
counts=counts/m/n;
Stem (x,counts);

Effect:


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.