图形学笔记《Fundamentals of Computer Graphics 4th Edition》——【3】Raster Images 光栅图像
- raster display: show images as rectangular arrays of pixels
- pixel: a short for “picture element”
- raster image: a 2D array that stores the pixel value for each pixel——R G B
- 因为显示设备与图片大小不能保证一致,可能会有拉伸、变形、变色等变换发生,因此it’s best to think of a raster image as a device-independent description of the image to be displayed
-
vector image: 另一种显示方式,storing descriptions of shapes——areas of color bounded by lines or curves——with no reference to any particular pixel grid
- advantage: resolution independent, can be displayed well on very high resolution devices
- disadvantage: must be rasterized(光栅化) before displayed
- often used for: text, diagrams, mechanical drawings——crispness and precision are important, photographic images and complex shading aren’t needed
Raster Devices
Displays
一般说来,显示设备有两种:
-
emissive displays: 发射型显示器,use pixels that directly emit controllable amounts of light
- 如,light-emitting diode (LED), 每个像素上都有半导体设备(可能多个颜色如R G B,在远方看起来就会形成一种颜色),根据当前电流决定其光强
-
transmissive displays: 透射式显示器,the pixels themselves don’t emit light but instead vary the amount of the light that they allow to pass through them, require a light source to illuminate them
- 如,liquid crystal displays (LCDs),如图所示,偏振光会根据电压大小偏转不同的角度,偏转度为0时没有光线通过filter,当电压使其偏转90度时,所有光线都会通过filter,此时光强最大
- 如,liquid crystal displays (LCDs),如图所示,偏振光会根据电压大小偏转不同的角度,偏转度为0时没有光线通过filter,当电压使其偏转90度时,所有光线都会通过filter,此时光强最大
- 分辨率的含义:一张图片上有多少个像素点(长×宽)
Hardcopy Devices
- int-jet printer: 喷墨式打印机,一般只能打印binary images,可使用多颜色喷头打印彩色图片
- thermal dye transfer: 热敏式,在print head和dye receiver中间加入一层donor ribbon,可以根据热度产生不同强度的颜色
- 分辨率的含义——pixel desity
- ppi: 如热敏式的300 pixels per inch——has elements spaced 300 per inch across its head
- dpi: 如喷墨式的1200 dots per inch——places dots on a grid with 1200 grid points per inch
- 同等质量的图片,喷墨式通常需要比热敏式更高的分辨率(吧?)
Input Devices
- 相机中也有像素级别的感光元件,去获取该像素的颜色和光强
- 多数相机中会使用像上图一样的color-filter array or mosaic to allow each pixel to see only red, green or blue light, leaving the image processing software to fill in the missing values in a process known as demosaicking(去马赛克)
- 还有一些相机使用多层感光元件,每一层去感不同颜色的光(R G B),不需要多余的处理了
- 分辨率的含义:
- the fixed number of pixels in the array
- is usually quoted using the total count of pixels:如3000×2000 = 6 million pixels——6 megapixel (MP) camera
Images, Pixels, and Geometry
- 首先,我们将图片的表示抽象为,其中 is a rectangular area, V is the set of possible pixel values
- 像素点的值含义:the value of the image in the vicinity(邻近) of this grid point
- 下图是本书中像素含义约定:
Pixel Values
- HDR: high dynamic range, images stored with floating-point numbers
- LDR: low dynamic range, images that are stored with integers
- 常见格式:每像素RGB(3个)/灰度(1个)32位浮点数——占内存太大,所以要优化
- 但优化后,每像素所用位数变少,可能会造成两种后果:
- clipping: 如,阳光下,过亮的地方无法显示
- quantization, or banding: 尤其在动态图像中,会产生突变
Monitor Intensities and Gamma
- 显示值和输入值不是一一对称的,也不是线性关系(显示器关掉的时候可能也会有一点光强)
- 通常可用公式表示:, where is the input pixel value between zero and one, is the degree of freedom
-
的求法:找到灰度=0.5时的a值,
- 这个图还蛮好玩的就放上来啦!离远了看或者摘掉近视眼镜看,觉得左右颜色一样,就找到灰度=0.5的颜色了~
- gamma correct原理看懂了,那个公式看不明白。。总觉得不对
- 原理是,令,可以使输入输出变成线性~
为什么要有个值?
- 人眼对光强的感受是非线性的
- between 1.5 and 3会使光强与人的主观感受相匹配
RGB Color
Alpha Compositing 透明度混合
- 混合结果可以用公式表示:, where is the pixel coverage, which tells the fraction of the pixel covered by the foreground layer, is the foreground color, is the background color
-
值可以存储在一个单独的灰度图像中,又可称为alpha mask或transparency mask;或存储在RGB图像的第四个通道中,即alpha channel
Image Storage
- jpeg: lossy formant, compresses image blocks based on thresholds in the human visual system, works well for natural images
- tiff: is most commonly used to hold binary images or losslessly compressed 8- or 16-bit RGB
- ppm: loseless, uncompressed format, most often used for 8-bit RGB images
- png: lossless, with a good set of open source management tools