⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 subject_34564.htm

📁 一些关于vc的问答
💻 HTM
字号:
<p>
序号:34564 发表者:hgr 发表日期:2003-03-31 14:42:31
<br>主题:帮忙找幅图
<br>内容:&nbsp;&nbsp;我在用c++编程编写图象压缩处理程序,我学过c语言,c++现学现买,急需bayer格式的图象,希望谁能帮忙一下,谢谢
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:xiongli 回复日期:2003-03-31 20:05:27
<br>内容:http://www.google.com/search?sourceid=navclient&amp;ie=UTF-8&amp;oe=UTF-8&amp;q=bayer+format<BR><BR><BR><BR>RGB "Bayer" Color and MicroLenses <BR><BR>Bayer color filter array is a popular format for digital acquisition of color images [1]. The pattern of the color filters is shown below. Half of the total number of pixels are green (G), while a quarter of the total number is assigned to both red (R) and blue (B). <BR><BR>&nbsp;&nbsp;<BR><BR>G <BR> R <BR> G <BR> R <BR> <BR>B <BR> G <BR> B <BR> G <BR> <BR>G <BR> R <BR> G <BR> R <BR> <BR>B <BR> G <BR> B <BR> G <BR> <BR><BR>In order to obtain this color information, the&nbsp;&nbsp;color image sensor is covered with either a red, a green, or a blue filter, in a repeating pattern. This pattern, or sequence, of filters can vary, but the widely adopted “Bayer”&nbsp;&nbsp;pattern, which was invented at Kodak, is a repeating 2x2 arrangement. <BR><BR><BR>Photographs &amp; Text adapted from Photobit <BR><BR>When the image sensor is read out, line by line, the pixel sequence comes out GRGRGR, etc., and then the alternate line sequence is BGBGBG, etc. This output is called sequential RGB (or sRGB). <BR><BR>Since each pixel has been made sensitive only to one color (one spectral band), the overall sensitivity of a color image sensor is lower than a monochrome (panchromatic) sensor, and in fact is typically 3x less sensitive. As a result, monochrome sensors are better for low-light applications, such as security cameras. (It is also why human eyes switch to black and white mode in the dark).<BR><BR>&nbsp;&nbsp;<BR><BR>MicroLenses <BR><BR>Microlenses and a metal opaque layer above the silicon funnel light to the photo-sensitive portion of each pixel. On their way, the photons of light pass through a color filter array (CFA) where the process begins of obtaining color from the inherently “monochrome” chip. (Actually, “panchromatic” is an apter term, since sensors respond across the spectrum; the word monochrome comes from television use and refers to black and white). <BR><BR> <BR><BR> <BR>Bayer color conversion and processing <BR>This note describes conversions from Bayer format to RGB and between RGB and YUV (YCrCb) color spaces. We also discuss two color processing operations (white balance and color correction) in the RGB domain, and derive the corresponding operations in the YUV domain. Using derived operations in the YUV domain, one can perform white balance and color correction directly in the YUV domain, without switching back to the RGB domain. <BR><BR>&nbsp;&nbsp;<BR><BR>1. Conversion from Bayer format to RGB <BR><BR>Bayer color filter array is a popular format for digital acquisition of color images [1]. The pattern of the color filters is shown below. Half of the total number of pixels are green (G), while a quarter of the total number is assigned to both red (R) and blue (B). <BR><BR>&nbsp;&nbsp;<BR><BR>G <BR> R <BR> G <BR> R <BR> <BR>B <BR> G <BR> B <BR> G <BR> <BR>G <BR> R <BR> G <BR> R <BR> <BR>B <BR> G <BR> B <BR> G <BR> <BR><BR>&nbsp;&nbsp;<BR><BR>To convert an image from this format to an RGB format, we need to interpolate the two missing color values in each pixel. Several standard interpolation methods (nearest neighbor, linear, cubic, cubic spline, etc.) were evaluated on this problem in [2]. The authors have measured interpolation accuracy as well as the speed of the method and concluded that the best performance is achieved by a correlation-adjusted version of the linear interpolation. The suggested method is presented here. <BR><BR>&nbsp;&nbsp;<BR><BR>1.1 Interpolating red and blue components <BR><BR>&nbsp;&nbsp;<BR><BR>G <BR> B <BR> G <BR> <BR>R <BR> G <BR> R <BR> <BR>G <BR> B <BR> G <BR> <BR><BR>(a) <BR><BR>&nbsp;&nbsp;<BR> G <BR> R <BR> G <BR> <BR>B <BR> G <BR> B <BR> <BR>G <BR> R <BR> G <BR> <BR><BR>(b) <BR> <BR>B <BR> G <BR> B <BR> <BR>G <BR> R <BR> G <BR> <BR>B <BR> G <BR> B <BR> <BR><BR>(c) <BR> R <BR> G <BR> R <BR> <BR>G <BR> B <BR> G <BR> <BR>R <BR> G <BR> R <BR> <BR><BR>(d) <BR> <BR><BR>&nbsp;&nbsp;<BR><BR>Figure 1: Four possible cases for interpolating R and B components <BR><BR>As suggested in [2], R and B values are interpolated linearly from the nearest neighbors of the same color. There are four are possible cases, as shown in Figure 1. When interpolating the missing values of R and B on a green pixel, as in Figure 1 (a) and (b), we take the average values of the two nearest neighbors of the same color. For example, in Figure 1 (a), the value for the blue component on a shaded G pixel will be the average of the blue pixels above and below the G pixel, while the value for the red component will be the average of the two red pixels to the left and right of the G pixel. <BR><BR>Figure 1 (c) shows the case when the value of the blue component is to be interpolated for an R pixel. In such case, we take the average of the four nearest blue pixels cornering the R pixel. Similarly, to determine the value of the red component on a B pixel in Figure 2 (d) we take the average of the four nearest red pixels cornering the B pixel. <BR><BR>&nbsp;&nbsp;<BR><BR>1.2 Interpolating the green component <BR><BR>By [2], green component is adaptively interpolated from a pair of nearest neighbors. To illustrate the procedure, consider two possible cases in Figure 2. <BR><BR>&nbsp;&nbsp;<BR><BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp; <BR> R1 <BR>&nbsp;&nbsp; <BR>&nbsp;&nbsp; <BR> <BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp; <BR> G1 <BR>&nbsp;&nbsp; <BR>&nbsp;&nbsp; <BR> <BR>R4 <BR> G4 <BR> R <BR> G2 <BR> R2 <BR> <BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp; <BR> G3 <BR>&nbsp;&nbsp; <BR>&nbsp;&nbsp; <BR> <BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp; <BR> R3 <BR>&nbsp;&nbsp; <BR>&nbsp;&nbsp; <BR> <BR><BR>(a) <BR>&nbsp;&nbsp; <BR>&nbsp;&nbsp; <BR> B1 <BR>&nbsp;&nbsp; <BR>&nbsp;&nbsp; <BR> <BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp; <BR> G1 <BR>&nbsp;&nbsp; <BR>&nbsp;&nbsp; <BR> <BR>B4 <BR> G4 <BR> B <BR> G2 <BR> B2 <BR> <BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp; <BR> G3 <BR>&nbsp;&nbsp; <BR>&nbsp;&nbsp; <BR> <BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp; <BR> B3 <BR>&nbsp;&nbsp; <BR>&nbsp;&nbsp; <BR> <BR><BR>(b) <BR> <BR><BR>&nbsp;&nbsp;<BR><BR>Figure 2: Two possible cases for interpolating G component <BR><BR>&nbsp;&nbsp;<BR><BR>In Figure 2 (a), the value of the green component is to be interpolated on an R pixel. The value used for the G component here is <BR><BR> <BR><BR>&nbsp;&nbsp;<BR><BR>In other words, we take into account the correlation in the red component to adapt the interpolation method. If the difference between R1 and R3 is smaller than the difference between R2 and R4, indicating that the correlation is stronger in the vertical direction, we use the average of the vertical neighbors G1 and G3 to interpolate the required value. If the horizontal correlation is larger, we use horizontal neighbors. If neither direction dominates the correlation, we use all four neighbors. <BR><BR>&nbsp;&nbsp;<BR><BR>Similarly, for Figure 2 (b) we will have <BR><BR>&nbsp;&nbsp;<BR><BR> <BR><BR>&nbsp;&nbsp;<BR><BR>To conclude, note that if the speed of execution is the issue, one can safely use simple linear interpolation of the green component from the four nearest neighbors, without any adaptation <BR><BR> <BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -