Lighting model
Flux
- Able to see around the world has two components: a source outside the case, the surface of the light source
- It refers to the light flux perceived by the human eye can radiated power, which is equal to the product of the radiation of a wavelength band per unit time and the view of the relative band
- In notation, LM units (lumens)
- 1lm = 0.00146 watts
Typical values of different light sources
light source | Flux | Explanation |
---|---|---|
sun | 3.566 * 10 ^ 28 lm | Energy source of our existence |
Candlelight | 12.56lm (4π) | Definition of flux |
Incandescent / tungsten halogen lamp | 12 ~ 24lm / W | More efficient than incandescent tungsten halogen lamps |
Gas discharge lamps and fluorescent lamps | 50~120lm / W | Gas discharge lamp |
LED lights | 110lm / W | no |
radioactivity
- Irradiance: means to project radiant flux density (we can feel the intensity of light) on a planar surface. Refers to a surface plane to reach the unit time, the radiant energy per unit area
- The symbol E represents, typically in units of Lux (lux)
- 1lux = 1lm / m^2
Some typical irradiance
Scenes | Illuminance (lux) | Explanation |
---|---|---|
Night | 0.001 ~ 0。02 | 0.02 to 0.3 moonlight |
Indoor cloudy | 5 ~ 50 | Outdoor cloudy |
Sunny indoor | 100 ~ 1000 | In doing visual system needs to fill light |
Sunny sunlight | 100000 | You do not need to fill light in the visual system |
Suitable for reading | 300 ~ 750 | Need 50 to 60 read books |
Home video camera standard illumination | 1400 | In doing need to fill light vision systems |
Common light source
According to different classification
- Direction: direct light, scattered light (diffusing plate)
- Spectrum: visible light into visible light
- Other: polarization, other
About backlight
- From the back light source illuminates the object
- Features: light emitting surface is a scattering surface, good uniformity. Specularly reflective material may be used, such as a flaw detection on a wafer or a glass substrate; detecting the LED, smiling electronic element size, shape, target test
Color light source
- Similar to the color filter (white or weakened)
- Strengthen the complementary color (black or strengthen)
- Features: If you want to highlight some of the more clearly the color, select the color corresponding to the complementary color of the ring light source for illumination, which can significantly improve the contrast of the image
- Examples: PCB board green background, with white light, MARK point contrast is not high enough, and the background mixed together easy, difficult to distinguish. With red light green background to improve the contrast, MARK point clearly visible.
Color Model
- RGB model
- CMYK model
- HSI model
Related to achieve corresponding color OpenCV
1) color space transducer means
-
c ++ realize
// 第一个参数:输入的图像 // 第二个参数:转换以后的图像 // 第三个参数:code: COLOR_BGR2GRAY, COLOR_BGR2HSV 表示在哪两个空间进行转换 void cvtColor(InputArray src, OutputArray dst, int code, int dstCn = 0);
-
python achieve
dst = cv.cvtColor(src, code[, dst[,dstCn]])
2) channel separation
-
c ++ realize
// 第一个参数:原始多通道的图像 // 第二个参数:通道分离后的结果,通常是个数组 void split(const Mat& src, Mat *mvBegin);
-
python achieved: the form: bgr [:,:, 0] represents the 0th channel (Blue) extract
3) sample program
Version 3.1 Cpp
#include "opencv2/opencv.hpp"
using namespace cv;
int main(void) {
char *fn = "D:\\lena.jpg";
Mat image1 = imread(fn);
Mat image, gray, hsv, hsvChannels[3];
pyrDown(image1, image);
cvtColor(image, gray, COLOR_BGR2GRAY); // 把原始图像转化成灰度图像
imshow("source image", image);
imshow("gray", gray);
waitKey(); // 不加这句话,窗口会闪退
cvtColor(image, hsv, COLOR_BGR2HSV); // 把原始图像转化成hsv图像
split(hsv, hsvChannels); // 通过split函数把hsv三个通道分离开来
imshow("Hue", hsvChannels[0]); // 色度通道
imshow("Saturation", hsvChannels[1]); // 饱和度通道
imshow("Value", hsvChannels[2]); // 亮度通道
waitKey();
return 0;
}
3.2 Python version
import cv2 as cv
filename = r'/Users/johnny/Downloads/1.jpg'
img = cv.imread(filename)
gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
cv.imshow("source image", img)
cv.imshow("gray", gray)
cv.waitKey()
hsv = cv.cvtColor(img, cv.COLOR_BGR2HSV) # 将bgr转化为hsv
# 显示hsv的各个通道
cv.imshow("Hue", hsv[:, :, 0]) # 在最后一维指定通道
cv.imshow("Saturation", hsv[:, :, 1])
cv.imshow("Value", hsv[:, :, 2])
cv.waitKey();
# 显示bgr的各个通道
cv.imshow("Blue", img[:, :, 0])
cv.imshow("Green", img[:, :, 1])
cv.imshow("Red", img[:, :, 2])
cv.waitKey()
cv.destroyAllWindows()