图像直方图含义 [英] Image histogram meaning

查看:92
本文介绍了图像直方图含义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图了解什么是图像直方图,但我陷入其中.我希望能得到一个简单的解释以及强度值的含义,因为我不知道它是什么.

I tried to understand what is image histogram but I'm stuck in it. I would appreciate an easy explanation for it and the meaning of intensity value because I don't know what is it.

推荐答案

我想Matlab帮助功能将通过一些示例很好地说明这一点,因此这应该永远是您的第一站.但是,这是我的尝试:

I guess the Matlab help function will have a pretty good explanation with some examples, so that should always be your first stop. But here's my attempt:

图像由像素组成.为了简单起见,我们考虑一个灰度图像.每个像素对眼睛都有一定的亮度,用该像素的强度值表示.为简单起见,我们假设强度值可以是0到7之间的任何(整数)值,0是黑色,7是白色,而中间的值是不同的灰色阴影.

An image is composed of pixels. For simplicitly let's consider a grayscale image. Each pixel has a certain brightness to the eye, which is expressed in the intensity value of that pixel. For simplicity, let's assume the intensity value can be any (integer) value from 0 to 7, 0 being black, 7 being white, and values in between being different shades of gray.

图像直方图告诉您图像中每个强度值(或一系列强度值)的像素数.横轴显示可能的强度值,纵轴显示每个强度值的像素数.

The image histogram tells you how many pixels there are in your image for each intensity value (or for a range of intensity values). The horizontal axis shows the possible intensity values, and the vertical axis shows the number of pixels for each of these intensity values.

因此,假设您有一个全黑的2x2图像(只有4个像素),在matlab中,它看起来像[0 0; 0 0],因此所有强度值均为0.此图像的直方图将在强度值0(水平轴)上显示一个高度为4(垂直轴)的条形图.同样,如果所有像素均为白色,则[7 7; 7 7],您会在强度值7处获得一个高度为4的单条.如果一半像素是白色,则另一半是黑色,例如[0 0; 7 7]或[0 7; 7 0]或类似值,您会在直方图中得到两个高度2的条,分别位于强度值0和7.如果图像中有四个不同的强度值,例如[2,5; 0,6],您将获得四个强度分别为1的条形.

So, suppose you have a 2x2 image (only 4 pixels) that is completely black, in matlab this looks like [0 0; 0 0], so all intensity values are 0. The histogram for this image will show one bar with height 4 (vertical axis) at the intensity value 0 (horizontal axis). In the same way, if all pixels were white, [7 7; 7 7], you would get a single bar of height 4 at the intensity value 7. If half the pixels were white, the other half black, e.g. [0 0; 7 7] or [0 7; 7 0] or similar, you would get two bars of height 2 in you histogram, located at intensity values 0 and 7. If you have four different intensity values in the image, e.g. [2, 5; 0, 6], you will get four bars of height 1 at the respective intensity values.

它仅用于处理像这样的小图像,您可以在其中轻松地手动计算像素数.例如:

It helps just to play around with a small image like this, in which you can easily count the number of pixels by hand. For example:

image=[2,5,3; 1,0,6; 3,2,1];
subplot(1,2,1)
imshow(image, [0 7]); % see: help imshow
subplot(1,2,2)
histogram(image, (0:8)-0.5)  % see: help histogram

这篇关于图像直方图含义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆