35

我认为这可能是一个愚蠢的问题,但是在阅读了很多关于图像处理的内容并进行了很多搜索之后,我看到的每个关于图像处理的示例都使用灰度来工作

我知道灰度图像只使用一个颜色通道,通常只需要 8 位来表示,等等......但是,当我们有彩色图像时为什么要使用灰度?灰度的优点是什么?我可以想象那是因为我们需要处理的位更少,但即使在今天使用更快的计算机,这也是必要的吗?

我不确定我是否清楚我的疑问,我希望有人能回答我

非常感谢您

4

5 回答 5

26

正如张约翰所解释的:

亮度在区分视觉特征方面更为重要

John 还给出了一个很好的建议来说明这个特性:拍摄给定的图像并将亮度平面与色度平面分开。

为此,您可以使用 ImageMagick单独的运算符,将每个通道的当前内容提取为灰度图像

convert myimage.gif -colorspace YCbCr -separate sep_YCbCr_%d.gif

这是它在示例图像上给出的内容(左上:原始彩色图像,右上:亮度平面,底行:色度平面):

在此处输入图像描述

于 2012-10-06T16:33:20.190 回答
24

To elaborate a bit on deltheil's answer:

  1. Signal to noise. For many applications of image processing, color information doesn't help us identify important edges or other features. There are exceptions. If there is an edge (a step change in pixel value) in hue that is hard to detect in a grayscale image, or if we need to identify objects of known hue (orange fruit in front of green leaves), then color information could be useful. If we don't need color, then we can consider it noise. At first it's a bit counterintuitive to "think" in grayscale, but you get used to it.
  2. Complexity of the code. If you want to find edges based on luminance AND chrominance, you've got more work ahead of you. That additional work (and additional debugging, additional pain in supporting the software, etc.) is hard to justify if the additional color information isn't helpful for applications of interest.
  3. For learning image processing, it's better to understand grayscale processing first and understand how it applies to multichannel processing rather than starting with full color imaging and missing all the important insights that can (and should) be learned from single channel processing.
  4. Difficulty of visualization. In grayscale images, the watershed algorithm is fairly easy to conceptualize because we can think of the two spatial dimensions and one brightness dimension as a 3D image with hills, valleys, catchment basins, ridges, etc. "Peak brightness" is just a mountain peak in our 3D visualization of the grayscale image. There are a number of algorithms for which an intuitive "physical" interpretation helps us think through a problem. In RGB, HSI, Lab, and other color spaces this sort of visualization is much harder since there are additional dimensions that the standard human brain can't visualize easily. Sure, we can think of "peak redness," but what does that mountain peak look like in an (x,y,h,s,i) space? Ouch. One workaround is to think of each color variable as an intensity image, but that leads us right back to grayscale image processing.
  5. Color is complex. Humans perceive color and identify color with deceptive ease. If you get into the business of attempting to distinguish colors from one another, then you'll either want to (a) follow tradition and control the lighting, camera color calibration, and other factors to ensure the best results, or (b) settle down for a career-long journey into a topic that gets deeper the more you look at it, or (c) wish you could be back working with grayscale because at least then the problems seem solvable.
  6. Speed. With modern computers, and with parallel programming, it's possible to perform simple pixel-by-pixel processing of a megapixel image in milliseconds. Facial recognition, OCR, content-aware resizing, mean shift segmentation, and other tasks can take much longer than that. Whatever processing time is required to manipulate the image or squeeze some useful data from it, most customers/users want it to go faster. If we make the hand-wavy assumption that processing a three-channel color image takes three times as long as processing a grayscale image--or maybe four times as long, since we may create a separate luminance channel--then that's not a big deal if we're processing video images on the fly and each frame can be processed in less than 1/30th or 1/25th of a second. But if we're analyzing thousands of images from a database, it's great if we can save ourselves processing time by resizing images, analyzing only portions of images, and/or eliminating color channels we don't need. Cutting processing time by a factor of three to four can mean the difference between running an 8-hour overnight test that ends before you get back to work, and having your computer's processors pegged for 24 hours straight.

Of all these, I'll emphasize the first two: make the image simpler, and reduce the amount of code you have to write.

于 2012-10-08T05:08:55.263 回答
4

我不同意灰度图像总是比彩色图像更好的暗示。这取决于处理的技术和总体目标。例如,如果您想计算水果盘图像中的香蕉数量,那么当您拥有彩色图像时,分割会容易得多!

由于用于获取它们的测量设备,许多图像必须是灰度的。想想电子显微镜。它正在测量不同空间点的电子束强度。AFM 在拓扑上测量样品上各个点的共振振动量。在这两种情况下,这些工具都返回一个奇异值——一个强度,因此它们隐含地创建了一个灰度图像。

对于基于亮度的图像处理技术,它们通常可以充分应用于整体亮度(灰度);但是,在许多情况下,拥有彩色图像是一种优势。

于 2014-10-24T21:12:00.360 回答
1

二进制可能太简单了,不能代表图片字符。颜色可能太多并影响处理速度。

因此,选择灰度,它在两端的中间。

于 2014-04-04T17:34:50.630 回答
1

首先开始图像处理,无论是灰度图像还是彩色图像,最好专注于我们正在应用的应用程序。除非和其他情况,如果我们随机选择其中之一,则会在我们的结果中产生准确性问题。例如,如果我想处理垃圾桶的图像,我更喜欢选择灰度而不是彩色。因为在 bin 图像中,我只想使用优化的边缘检测来检测 bin 图像的形状。我不关心图像的颜色,但我想正确地看到 bin 图像的矩形形状。

于 2018-07-28T08:53:10.323 回答