当前位置:网站首页>FLIR blackfly s industrial camera: explanation and configuration of color correction and code setting method
FLIR blackfly s industrial camera: explanation and configuration of color correction and code setting method
2022-07-07 02:01:00 【The moon shines on the silver sea like a dragon】
Flir Blackfly S Industrial camera : Explanation and configuration of color correction and code setting method
The main content of this blog is
- Introduce Blackfly S The color correction matrix used by the camera (CCM,color correction matrix)
- It also shows how to calculate the custom CCM.
- Color correction and customization through code CCM To configure
The photos we saw taken by the camera , In fact, it's not directly obtained by the camera , It needs various treatments , For example, white balance 、 Color correction, etc , Finally, it is shown by our eyes , Of course, the ultimate goal of all kinds of processing is to make the photos we see more similar to the scenes we see directly .
The photo processing process is like the following process :
Color correction concept
Color correction is to transform the source image ( Captured images ) The color displayed in is converted to the corrected color target image ( Final view ) The process of .
Each sensor has a specific response to light , And each lighting condition ( for example , The sun 、 Fluorescent lamp ) Each has its own emission spectrum , This will affect the composition of the image when capturing optical information .
The emission spectra of various light sources in the above figure
The efficiency of the sensor in converting photons into electrons is called QE(quantum efficlency), This value changes according to the compensation of light .
This is GS3-U3-51S5C(IMX250 sensor) Of QE
‘
Here is the key to explain what is QE(quantum efficlency), It's the vertical axis above .
** Quantum efficiency (Quantum Efficiency)( Spectral characteristics ):** Defined as CCD The chip is irradiated by a certain wavelength of incident light , The ratio of the average number of photons produced by photoelectric effect to the number of incident photons , Characterized CCD The sensitivity of the chip to incident light of different wavelengths . The efficiency of light quanta at different wavelengths is different ,CCD The quantum efficiency of some wavelengths can be as high as 98%.
Color correction considers how each color channel interacts with other channels , And scale each color channel independently . CCM Used to measure and compensate for these interactions .
The importance of color correction
In applications such as visual inspection or sorting products , Reproducing accurate colors is very important , Because small differences in color will affect the accuracy and reliability of the results .
Blackfly S Use CCM The conversion corrects the output image to sRGB Color space .
sRGB Color space is the most commonly used color space , Because it provides the best guess for how the monitor reproduces color .
How to correct the color
Color correction is to transform the source image ( Captured images ) The color displayed in is converted to the corrected color target image ( Final view ) The process of .
The following calculation formula shows the calculation of a single pixel :
Expansion is :
about n x m Pixel size of the image , This calculation performs n x m Time .
The difference between color correction and white balance
CCM Consider how color channels interact with each other and scale individual channels accordingly . CCM Is a non diagonal matrix , And the goal is RGB The value is the above RGB The value of the function .
white balance (WB) By scaling each R、G or B Channel to adjust the emission spectrum . The white balance matrix is a diagonal matrix , The goal is RGB Value according to its source RGB The value is scaled by a constant .
The two matrices are as follows :
Then the white balance adjusts the color through the following calculation formula :
The following image was taken under the condition of warm fluorescent lamp .
You can compare the picture effects of three situations , Namely : There is no color correction method 、 White balance only and enable white balance and CCM Result .
On the left is WB off,CCM off
The middle is WB on,CCM off
On the right is WB on,CCM on
Blackfly S How to correct the color
Blackfly S Use predefined CCM Create correct for different lighting conditions sRGB Output .
Predefined CCM Be integrated into RGB Transform the light source , because CCM Cannot be independent of white balance ( Transform the light source ).
CCM Can be Flir Upper computer SpinView Settings can also be made through API Interface to set the code
The color conversion selector displays RGB To RGB Standard options for . If you use different pixel formats , for example YUV or YCbCr Pixel format , The color conversion selector will provide RGB To YUV The option to . CCM Change to explain YUV How to encode color information .
adopt SpinView Set color correction
- 1 Computer connected to the camera
- 2 open SpinView
- 3 open Processing Menu check ISP Enable Whether to open
- 4 Check Color Transformation Enable Whether to open
- 5 stay RGB Transform Light Source Choose from proper RGB Transform the light source ( Warm fluorescence 、 Cold fluorescence 、 a sunny day 、 overcast 、 tungsten lamp 、 overcast 、 commonly )
Relevant settings are ticked out in the red box on the picture
adopt API Code for color correction settings
// Set up Color correction
// Turn on ISP
CBooleanPtr ptrIspEnable = nodeMap.GetNode("IspEnable");
ptrIspEnable->SetValue(1);
// Turn on Color Transformation Enable
CBooleanPtr ptrColorTransformEnable = nodeMap.GetNode("ColorTransformationEnable");
ptrColorTransformEnable->SetValue(1);
// Set up RGB Transform Light Source
CEnumerationPtr ptrRgbTransformLightSource = nodeMap.GetNode
( "RgbTransformLightSource");
CEnumEntryPtr ptrRgbTransformationLightSourceWarm = ptrRgbTransformLightSource->
GetEntryByName("WarmFluorescent3000K");
ptrRgbTransformLightSource->SetIntValue(ptrRgbTransformationLightSourceWarm->GetValue());
how Customize CCM And set up
There are several types of standard target image colors . The following are typical color targets used :
- sRGB: standard RGB Color space . This is for display 、 Printers and Internet The most common color space .
- Adobe RGB: Provide more than sRGB Larger color space .
- CIE XYZ: The color space that maps how the human eye responds to light of a specific wavelength . sRGB and Adobe RGB Is a subset of this space .
In some cases , The default settings may not be sufficient to meet our needs . for example , If the target color is not sRGB, You need to use custom CCM. because Blackfly S It's turned into sRGB.
The following is in the form of an example , Shows how to put a ( Source ) The image color is converted to camera ( Target camera ) Image color .
Customized through upper settings CCM
To derive custom CCM:
1 Use the following target and source representations to define the target and source cameras .
2 Take an image of the standardized color calibration map under standard lighting conditions . ( This example shows an example with 24 It's a square Macbeth Color checker .)
3 Determine the average pixel color value in each square , To establish 24 Compare two unique colors . In these calculations ,k = 24 As in each square 24 Average pixel color :
4 Use matrix multiplication to determine CCM:
5 Definition CCM after , take CCM Values map to Blackfly S Corresponding parameters in the camera .
6 Use SpinView For customization CCM Set gain value :
RGB Transform Light Source choice Custom
And then choose Color Transformation Value Selector choice Gain00 Then set the size of the value below
And then put 00-22 All of them are set up
adopt API Code setting customization CCM
Set customization CCM
// Set customization CCM
// Turn on ISP
CBooleanPtr ptrIspEnable = nodeMap.GetNode("IspEnable");
ptrIspEnable->SetValue(1);
// Turn on ColorTransformationEnable
CBooleanPtr ptrColorTransformationEnable = nodeMap.GetNode("ColorTransformationEnable");
ptrColorTransformationEnable->SetValue(1);
// take RgbTransformLightSource Set to Custom
CEnumerationPtr ptrRgbTransformLightSource = nodeMap.GetNode("RgbTransformLightSource");
CEnumEntryPtr ptrRgbTransformationLightSourceCustom = ptrRgbTransformLightSource
->GetEntryByName("Custom");
ptrRgbTransformLightSource->SetIntValue(ptrRgbTransformationLightSourceCustom
->GetValue());
// Set up Gain00
CEnumerationPtr ptrColorTransformationValueSelector =
nodeMap.GetNode("ColorTransformationValueSelector");
CEnumEntryPtr ptrGain00 = ptrColorTransformationValueSelector->GetEntryByName("Gain00");
ptrColorTransformationValueSelector->SetIntValue(ptrGain00->GetValue());
CFloatPtr Gain00Value = nodeMap.GetNode("ColorTransformationValue");
Gain00Value->SetValue([Enter CCM Value]);
// Same settings Gain00-22
边栏推荐
- How did partydao turn a tweet into a $200million product Dao in one year
- Mysqlbackup restores specific tables
- Flir Blackfly S 工业相机 介绍
- Related programming problems of string
- Today's question -2022/7/4 modify string reference type variables in lambda body
- centos8安装mysql报错:The GPG keys listed for the “MySQL 8.0 Community Server“ repository are already ins
- Appium自动化测试基础 — uiautomatorviewer定位工具
- LeetCode. Sword finger offer 62 The last remaining number in the circle
- 传感器:DS1302时钟芯片及驱动代码
- 刨析《C语言》【进阶】付费知识【二】
猜你喜欢
百度飞将BMN时序动作定位框架 | 数据准备与训练指南 (上)
FLIR blackfly s industrial camera: configure multiple cameras for synchronous shooting
Mongodb checks whether the table is imported successfully
我如何编码8个小时而不会感到疲倦。
盒子拉伸拉扯(左右模式)
ROS學習(23)action通信機制
ROS learning (26) dynamic parameter configuration
ROS learning (XX) robot slam function package -- installation and testing of rgbdslam
一文带你走进【内存泄漏】
Appium基础 — Appium Inspector定位工具(一)
随机推荐
ROS learning (23) action communication mechanism
XML to map tool class xmlmaputils (tool class V)
Vingt - trois mille feuilles? "Yang mou" derrière l'explosion de la consommation végétale
The use of video in the wiper component causes full screen dislocation
centos8安裝mysql報錯:The GPG keys listed for the “MySQL 8.0 Community Server“ repository are already ins
ROS学习(十九)机器人SLAM功能包——cartographer
ROS learning (21) robot slam function package -- installation and testing of orbslam
爬虫实战(六):爬笔趣阁小说
ROS learning (26) dynamic parameter configuration
ROS学习(25)rviz plugin插件
Command injection of cisp-pte
MySQL's most basic select statement
刨析《C语言》【进阶】付费知识【一】
Treadpoolconfig thread pool configuration in real projects
Cisp-pte practice explanation (II)
HDU 4661 message passing (wood DP & amp; Combinatorics)
C语言关于链表的代码看不懂?一篇文章让你拿捏二级指针并深入理解函数参数列表中传参的多种形式
Date processing tool class dateutils (tool class 1)
Long press the button to execute the function
Appium基础 — Appium Inspector定位工具(一)