[go: up one dir, main page]

CN103268596B - A kind of method for reducing picture noise and making color be near the mark - Google Patents

A kind of method for reducing picture noise and making color be near the mark Download PDF

Info

Publication number
CN103268596B
CN103268596B CN201310211102.3A CN201310211102A CN103268596B CN 103268596 B CN103268596 B CN 103268596B CN 201310211102 A CN201310211102 A CN 201310211102A CN 103268596 B CN103268596 B CN 103268596B
Authority
CN
China
Prior art keywords
coordinates
image
color
matrix
images
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN201310211102.3A
Other languages
Chinese (zh)
Other versions
CN103268596A (en
Inventor
杜娟
梁睿
胡池
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
South China University of Technology SCUT
Original Assignee
South China University of Technology SCUT
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by South China University of Technology SCUT filed Critical South China University of Technology SCUT
Priority to CN201310211102.3A priority Critical patent/CN103268596B/en
Publication of CN103268596A publication Critical patent/CN103268596A/en
Application granted granted Critical
Publication of CN103268596B publication Critical patent/CN103268596B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Image Processing (AREA)

Abstract

本发明提供了一种降低图像噪声和使颜色接近标准的方法,在精密电子组装设备工作场景下,利用多镜头获取图像,并降低图像噪声和使颜色接近标准。该方法通过对拍摄的两幅图利用单应性矩阵进行对应点匹配,然后以一幅图像为底稿将公共区域的图像进行融合,降低图像的噪声;同时运用色彩校正矩阵的方法对整幅融合图像进行全局颜色校正,使图像的颜色更接近标准颜色。

The invention provides a method for reducing image noise and making the color close to the standard. In the working scene of precision electronic assembly equipment, multiple lenses are used to acquire images, and the image noise is reduced and the color is close to the standard. This method uses the homography matrix to match the corresponding points of the two photographed images, and then fuses the images in the common area with one image as a draft to reduce the noise of the image; The image undergoes global color correction to make the color of the image closer to the standard color.

Description

一种降低图像噪声和使颜色接近标准的方法A Method of Reducing Image Noise and Bringing Color Close to Standard

技术领域technical field

本发明涉及精密电子组装设备的图像处理领域,具体涉及一种在精密电子组装设备工作场景下,降低图像噪声和使颜色接近标准的方法。The invention relates to the field of image processing of precision electronic assembly equipment, in particular to a method for reducing image noise and making the color close to the standard in the working scene of the precision electronic assembly equipment.

背景技术Background technique

经典的针对单一图像的降噪方法是空间域滤波和频率域滤波。空间域滤波是在原图上利用模板直接对像素值进行卷积运算,包括均值滤波、中值滤波、低通滤波。频率域滤波是利用傅里叶变换将原图从空间域转换到频率域,然后调整不同频率的图像系数来去除噪声,最后将图像从频率域变回空间域。此外,还有利用小波变换滤波、偏微分方程、变分法、形态学滤波等方法进行图像去噪。The classic noise reduction methods for a single image are spatial domain filtering and frequency domain filtering. Spatial domain filtering is to use templates on the original image to directly perform convolution operations on pixel values, including mean filtering, median filtering, and low-pass filtering. Frequency domain filtering is to use Fourier transform to convert the original image from the spatial domain to the frequency domain, then adjust the image coefficients of different frequencies to remove noise, and finally change the image from the frequency domain back to the spatial domain. In addition, there are methods such as wavelet transform filtering, partial differential equations, variational methods, and morphological filtering for image denoising.

实际上,针对单一图像的降噪方法会造成图像细节的丢失。In fact, the noise reduction method for a single image will cause the loss of image details.

发明内容Contents of the invention

本发明的目的在于克服现有技术的不足,提供了一种在精密电子组装设备工作场景下,用多镜头降低图像噪声和使颜色接近标准的方法。The purpose of the present invention is to overcome the deficiencies of the prior art and provide a method for reducing image noise and making the color close to the standard by using multiple lenses in the working scene of precision electronic assembly equipment.

为了实现发明目的,本发明采用的技术方案为:采用多镜头拍摄获得公共区域较大的两幅印刷电路板图像,然后以一张图像作为底稿把两图的公共区域加权合成,利用噪声的随机性来降低图像的噪声,最后通过颜色校正矩阵来使颜色接近标准。利用两图合成降低噪声的方案可以较好地保留图像的细节。In order to achieve the purpose of the invention, the technical solution adopted in the present invention is: adopt multi-camera shooting to obtain two printed circuit board images with larger common areas, and then use one image as a draft to weight and synthesize the common areas of the two images, using the randomness of noise to reduce the noise of the image, and finally make the color close to the standard through the color correction matrix. The scheme of reducing noise by combining two images can better preserve the details of the image.

一种降低图像噪声和使颜色接近标准的方法,在精密电子组装设备工作场景下,采用多镜头拍摄获得公共区域较大的两幅印刷电路板图像,然后以其中一张图像作为底稿把两幅印刷电路板图像的公共区域加权合成,利用噪声的随机性来降低图像的噪声,最后通过颜色校正矩阵来使颜色接近标准。A method to reduce image noise and make the color close to the standard. In the working scene of precision electronic assembly equipment, two images of printed circuit boards with large public areas are obtained by multi-lens shooting, and then one of the images is used as a draft to combine the two images. The common area weighted synthesis of the printed circuit board image uses the randomness of the noise to reduce the noise of the image, and finally uses the color correction matrix to make the color close to the standard.

上述的降低图像噪声和使颜色接近标准的方法,其特征是具体包括如下步骤:The above-mentioned method for reducing image noise and making color close to the standard is characterized in that it specifically includes the following steps:

(1)两幅图像公共区域加权融合:选择两幅印刷电路板图像中的一张图像作为底稿,利用单应性矩阵将另一张图像变换成与底稿在公共区域有对应元素的图像,然后对两幅图像的公共区域进行加权,得到新的图像,从而降低图像噪声;(1) Weighted fusion of two images in the common area: select one of the two printed circuit board images as a draft, use the homography matrix to transform the other image into an image that has corresponding elements in the common area of the draft, and then Weight the common area of the two images to get a new image, thereby reducing image noise;

(2)色彩校正:通过一个3乘3的矩阵变换,将新的图像里原有的RGB颜色空间映射到标准的RGB颜色空间,使得图像的RGB像素值更接近标准的RGB像素值。(2) Color correction: through a 3 by 3 matrix transformation, the original RGB color space in the new image is mapped to the standard RGB color space, so that the RGB pixel value of the image is closer to the standard RGB pixel value.

上述步骤(1)中所拍摄的两幅印刷电路板图像为在精密电子组装设备工作场景的同一个平面上的图像;人工或自动选取同一平面上n组(不少于4组)对应点,得到对应点的坐标,利用直接线性变换算法求解出两图像对应的单应性矩阵。The two printed circuit board images taken in the above step (1) are images on the same plane of the precision electronic assembly equipment working scene; manually or automatically select n groups (not less than 4 groups) of corresponding points on the same plane, The coordinates of the corresponding points are obtained, and the homography matrix corresponding to the two images is obtained by using the direct linear transformation algorithm.

上述步骤(1)中,将另一张图像变换成与所述底稿在公共区域有对应元素的图像过程中,为了提高运算速度,每16像素*16像素的方框使用单应性矩阵得到4组顶点对应点坐标(该4组对应点坐标为方框的顶点),其余对应点坐标用双线性插值的方法和已求的4组对应点坐标得到。In the above step (1), in the process of transforming another image into an image that has corresponding elements in the common area of the draft, in order to improve the calculation speed, each 16-pixel*16-pixel box uses a homography matrix to obtain 4 The coordinates of the corresponding points of the vertices of the group (the coordinates of the four corresponding points are the vertices of the box), and the coordinates of the remaining corresponding points are obtained by the method of bilinear interpolation and the coordinates of the four corresponding points that have been calculated.

上述步骤(1)中,将另一张图像变换成与所述底稿在公共区域有对应元素的图像过程中,新图像的像素值要通过对应点坐标在原图获取,需利用双线性插值方法在目标点最邻近的4个坐标的像素值得到所需要的整数坐标下的像素值。In the above step (1), in the process of transforming another image into an image that has corresponding elements in the common area of the draft, the pixel values of the new image must be obtained from the original image through the coordinates of the corresponding points, and bilinear interpolation method is required The pixel values at the 4 nearest coordinates of the target point are used to obtain the pixel values at the required integer coordinates.

所述直接线性变换算法包括:将两组对应点坐标Xl和Xr经过归一化得到Xlg和Xrg,(下标l和r分别表示左图和右图,Xl和Xr分别代表左图和右图的原始对应点坐标,Xlg和Xrg分别代表左图和右图的归一化后对应点坐标。xl和xr分别代表左图和右图的x坐标,yl和yr分别代表左图和右图的x坐标,E(xl)和E(xr)分别是左图和右图归一化前x坐标的期望,E(yl)和E(yr)是左图和右图归一化前y坐标的期望,D(xl)和D(xr)分别是左图和右图归一化前x坐标的方差,D(yl)和D(yr)分别是左图和右图归一化前y坐标的方差);利用Xi'×HXi=0整理成Ah=0得其中hi代表3乘3单应性矩阵的第i行的转置, 将3n乘9的A矩阵(n是指对应点组数)进行奇异值分解A=UDVT,归一化后单应性矩阵Hg即为V的最后一列,反归一化的单应性矩阵 The direct linear transformation algorithm comprises: two groups of corresponding point coordinates X l and X r pass through with Normalized to get X lg and X rg , (the subscripts l and r represent the left and right images respectively, X l and X r represent the original corresponding point coordinates of the left and right images respectively, X lg and X rg represent the left The normalized corresponding point coordinates of the graph and the right graph. x l and x r represent the x coordinates of the left graph and the right graph respectively, y l and y r represent the x coordinates of the left graph and the right graph respectively, E(x l ) and E(x r ) are the expectations of the x coordinates of the left and right images before normalization, respectively, E(y l ) and E(y r ) are the expectations of the y coordinates of the left and right images before normalization, D( x l ) and D(x r ) are the variances of the x-coordinates of the left and right images before normalization, respectively, D(y l ) and D(y r ) are the y-coordinates of the left and right images before normalization, respectively variance); use X i '×HX i =0 to organize into Ah=0 to get where h i represents the transpose of row i of the 3 by 3 homography matrix, Singular value decomposition A=UDV T is performed on the 3n by 9 A matrix (n refers to the number of corresponding point groups). After normalization, the homography matrix H g is the last column of V. The denormalized homography matrix

所述的双线性插值方法包括:插值按照16像素*16像素的方框逐个进行,f(1),f(2),f(3),f(4)分别指的是方框四个顶点位置的映射坐标,在每一个方框内部,利用公式f12(k,1)=(f(1)*(16-k)+f(2)*k)>>2,f23(16,k)=(f(2)*(16-k)+f(3)*k)>>2,f34(k,16)=(f(3)*(16-k)+f(4)*k)>>3,f41(1,k)=(f(4)*(16-k)+f(1)*k)>>3先插值四条边,然后利用公式f(x,y)=(f(1)*(64-x)*(64-y)+f(2)*(x)*(64-y)+f(3)*(64-x)*(y)+f(4)*x*y)>>12插值方框的内部区域;其中,下标代表待插值边的第一顶点和第二顶点的标记,k代表位于待插值边上且与该待插值边上第一个顶点距离为k-1个像素的坐标,k取值为2~15;x、y代表方框内的坐标,取值为2~15。The bilinear interpolation method includes: interpolation is carried out one by one according to the frame of 16 pixels*16 pixels, and f(1), f(2), f(3), and f(4) refer to four square frames respectively. The mapping coordinates of the vertex position, inside each box, use the formula f 12 (k,1)=(f(1)*(16-k)+f(2)*k)>>2, f 23 (16 ,k)=(f(2)*(16-k)+f(3)*k)>>2, f 34 (k,16)=(f(3)*(16-k)+f(4 )*k)>>3, f 41 (1,k)=(f(4)*(16-k)+f(1)*k)>>3 first interpolate four sides, and then use the formula f(x, y)=(f(1)*(64-x)*(64-y)+f(2)*(x)*(64-y)+f(3)*(64-x)*(y) +f(4)*x*y)>>12 The internal area of the interpolation box; wherein, the subscript represents the mark of the first vertex and the second vertex of the edge to be interpolated, and k represents the edge located on the edge to be interpolated and connected to the edge to be interpolated The distance from the first vertex on the interpolation edge is the coordinate of k-1 pixels, and the value of k is 2 to 15; x and y represent the coordinates in the box, and the value is 2 to 15.

所述的双线性插值方法利用双线性插值方法在目标点最邻近的4个对应点坐标的像素值得到所需要的整数坐标下的像素值;利用公式f(x,y)=(f(1)*(64-x)*(64-y)+f(2)*(x)*(64-y)+f(3)*(64-x)*(y)+f(4)*x*y)>>12,f(1),f(2),f(3),f(4)分别指的是最邻近的4个坐标的像素值。The described bilinear interpolation method utilizes the bilinear interpolation method to obtain the pixel value under the required integer coordinates at the pixel values of the 4 corresponding point coordinates closest to the target point; using the formula f(x, y)=(f (1)*(64-x)*(64-y)+f(2)*(x)*(64-y)+f(3)*(64-x)*(y)+f(4) *x*y)>>12, f(1), f(2), f(3), f(4) respectively refer to the pixel values of the nearest 4 coordinates.

所述步骤(2)包括:只需要在该场景做一次颜色校正矩阵的求取,以后就一直使用该矩阵作为颜色校正;两个摄像机先在工作场景下拍摄24色标准调色板,调色板要在两幅图的公共区域里,然后利用步骤(1)所述的降噪方法得到合成图像。The step (2) includes: it is only necessary to obtain the color correction matrix once in the scene, and the matrix will be used as the color correction in the future; the two cameras first shoot the 24-color standard palette in the working scene, and then use the color correction matrix. The board should be in the common area of the two images, and then use the noise reduction method described in step (1) to obtain a composite image.

步骤(2)中使颜色接近标准的方法包括:将合成图像上读取24个色块的5点像素平均值作为输入,调色板对应色块的标准像素值作为输出,把公式整理成Ax=b的形式(Rin、Gin、Bin分别为输入的红色、绿色、蓝色通道矩阵的颜色值,Rin、Gin、Bin分别为标准色块的红色、绿色、蓝色通道矩阵的颜色值),得公式(即),其中,ci是代表3乘3颜色校正矩阵第i行的转置,矩阵A大小为72*9,向量b的大小为72*1;利用最小二乘法x=(AT*A)-1*ATb或奇异值分解可得到所需要的变换矩阵。The method of making the color close to the standard in step (2) includes: taking the 5-point pixel average value of 24 color blocks read on the composite image as input, and the standard pixel value of the color block corresponding to the palette as output, using the formula Organized into the form of Ax=b (R in , G in , B in are the color values of the input red, green, blue channel matrix respectively, R in , G in , B in are the red, green, The color value of the blue channel matrix), the formula (which is ), where c i represents the transposition of row i of the 3×3 color correction matrix, the size of matrix A is 72*9, and the size of vector b is 72*1; using the least squares method x=( AT *A) -1 * AT b or singular value decomposition can get the required transformation matrix.

与现有技术相比,本发明具有如下优点和效果:Compared with prior art, the present invention has following advantage and effect:

本发明采用的多摄像头图像融合降低图像噪声可以减少经典的单一图像滤波去噪丢失细节,利用色彩校正矩阵可使颜色接近标准,有着实际的生产意义。The multi-camera image fusion adopted by the present invention reduces image noise and can reduce the loss of details in classic single image filtering and denoising, and the color correction matrix can be used to make the color close to the standard, which has practical production significance.

附图说明Description of drawings

图1是本发明降低噪声和使颜色接近标准总流程图Fig. 1 is that the present invention reduces noise and makes color close to standard general flowchart

图2是求取单应性矩阵流程Figure 2 is the process of obtaining the homography matrix

图3是将一张图像变换并与另一张图像加全合成流程图Figure 3 is a flow chart of transforming an image and adding it to another image

图4是求取颜色校正矩阵流程图Figure 4 is a flow chart for obtaining the color correction matrix

具体实施方式detailed description

以下结合附图对本发明的实施作进一步说明,但本发明的实施和保护范围不限于此。The implementation of the present invention will be further described below in conjunction with the accompanying drawings, but the implementation and protection scope of the present invention are not limited thereto.

一种降低图像噪声和使颜色接近标准的方法,具体包括如下五个主要步骤:A method for reducing image noise and bringing colors close to standard, including the following five main steps:

(1)人工或自动选取同一平面上不少于4组对应点,得到对应点的坐标,利用直接线性变换算法求解出两图像对应的单应性矩阵。(1) Manually or automatically select no less than 4 groups of corresponding points on the same plane, obtain the coordinates of the corresponding points, and use the direct linear transformation algorithm to solve the corresponding homography matrix of the two images.

直接线性变换算法:将两组对应点坐标Xl和Xr经过归一化得到Xlg和Xrg,E(x)是归一化前坐标的期望,D(x)是归一化前坐标的方差。利用Xi'×HXi=0整理成Ah=0得其中hi代表3乘3单应性矩阵的第i行的转置, 将3n乘9的A矩阵进行奇异值分解A=UDVT,归一化后单应性矩阵Hg即为V的最后一列,反归一化的单应性矩阵 Direct linear transformation algorithm: the coordinates X l and X r of two sets of corresponding points are passed through with Normalization results in X lg and X rg , E(x) is the expectation of the coordinates before normalization, and D(x) is the variance of the coordinates before normalization. Use X i '×HX i =0 to organize into Ah=0 where h i represents the transpose of row i of the 3 by 3 homography matrix, Singular value decomposition of the 3n by 9 A matrix A=UDV T , the normalized homography matrix H g is the last column of V, and the denormalized homography matrix

(2)计算公共区域内图像的对应点,为了提高运算速度,每16像素*16像素的方框才使用单应性矩阵得到4组对应点坐标,其余对应点坐标用双线性插值的方法和4组对应点坐标得到。(2) Calculate the corresponding points of the image in the public area. In order to improve the calculation speed, the homography matrix is used for each 16-pixel*16-pixel box to obtain 4 sets of corresponding point coordinates, and the other corresponding point coordinates use bilinear interpolation. And 4 sets of corresponding point coordinates are obtained.

双线性插值方法按照16像素*16像素的方框逐个进行,f(1),f(2),f(3),f(4)分别指的是方框四个顶点位置的映射坐标。在每一个方框内部,利用公式f12(k,1)=(f(1)*(16-k)+f(2)*k)>>2,f23(16,k)=(f(2)*(16-k)+f(3)*k)>>2,f34(k,16)=(f(3)*(16-k)+f(4)*k)>>3,f41(1,k)=(f(4)*(16-k)+f(1)*k)>>3先插值四条边,然后利用公式f(x,y)=(f(1)*(64-x)*(64-y)+f(2)*(x)*(64-y)+f(3)*(64-x)*(y)+f(4)*x*y)>>12插值方框的内部区域。下标代表方框的其中两个顶点,如下标12代表以该两个顶点为端点的待插值边的第一顶点1和第二顶点2(又如,下标41代表待插值边的第一顶点4和第二顶点1),f12(k,1)代表在以第一顶点1和第二顶点2为端点构成的待插值边上与第一顶点1的距离为k-1个像素的点的映射坐标;fab(k,1)代表在以第一顶点a和第二顶点b为端点构成的待插值边上与第一顶点a的距离为k-1个像素的点的映射坐标,k代表位于待插值边上且与该待插值边上第一个顶点a的距离为k-1个像素的坐标(k为坐标,fab(k,1)为映射坐标,坐标是在方框里建立的坐标系,映射坐标是在完整大图里建立的坐标系),取值为2~15;x、y代表方框内的坐标,取值为2~15。The bilinear interpolation method is performed one by one according to a 16-pixel*16-pixel box, and f(1), f(2), f(3), and f(4) respectively refer to the mapping coordinates of the four vertices of the box. Inside each box, using the formula f 12 (k,1)=(f(1)*(16-k)+f(2)*k)>>2, f 23 (16,k)=(f (2)*(16-k)+f(3)*k)>>2, f 34 (k,16)=(f(3)*(16-k)+f(4)*k)>> 3, f 41 (1,k)=(f(4)*(16-k)+f(1)*k)>>3 First interpolate the four sides, and then use the formula f(x,y)=(f( 1)*(64-x)*(64-y)+f(2)*(x)*(64-y)+f(3)*(64-x)*(y)+f(4)* x*y)>>12 Interpolate the inner area of the box. The subscript represents two of the vertices of the box, and the subscript 12 represents the first vertex 1 and the second vertex 2 of the edge to be interpolated with these two vertices as endpoints (for another example, subscript 41 represents the first vertex of the edge to be interpolated). vertex 4 and the second vertex 1), f 12 (k,1) represents the distance between the first vertex 1 and the first vertex 1 is k-1 pixels The mapping coordinates of the point; f ab (k,1) represents the mapping coordinates of a point whose distance from the first vertex a is k-1 pixels on the edge to be interpolated with the first vertex a and the second vertex b as endpoints , k represents the coordinates located on the side to be interpolated and the distance from the first vertex a on the side to be interpolated is k-1 pixels (k is the coordinate, f ab (k, 1) is the mapping coordinate, and the coordinate is in the square The coordinate system established in the box, the mapping coordinates are the coordinate system established in the complete large image), the value is 2~15; x, y represent the coordinates in the box, the value is 2~15.

(3)将另一张图像变换成与底稿在公共区域有对应元素的图像,然后将两图加权合成。新图的像素值要通过对应点坐标在原图获取,因为对应点坐标可能有小数,所以需要利用双线性插值方法在目标点最邻近的4个坐标的像素值得到所需要的整数坐标下的像素值。(3) Transform another image into an image that has corresponding elements in the common area of the draft, and then combine the two images with weights. The pixel values of the new image should be obtained from the original image through the corresponding point coordinates, because the corresponding point coordinates may have decimals, so it is necessary to use the bilinear interpolation method to obtain the required integer coordinates from the pixel values of the 4 nearest coordinates of the target point Pixel values.

利用双线性插值方法在目标点最邻近的4个对应点坐标的像素值得到所需要的整数坐标下的像素值。利用公式f(x,y)=(f(1)*(64-x)*(64-y)+f(2)*(x)*(64-y)+f(3)*(64-x)*(y)+f(4)*x*y)>>12,f(1),f(2),f(3),f(4)分别指的是最邻近的4个坐标的像素值。Use the bilinear interpolation method to obtain the pixel values at the required integer coordinates from the pixel values of the four corresponding point coordinates closest to the target point. Using the formula f(x,y)=(f(1)*(64-x)*(64-y)+f(2)*(x)*(64-y)+f(3)*(64- x)*(y)+f(4)*x*y)>>12, f(1), f(2), f(3), f(4) respectively refer to the nearest 4 coordinates Pixel values.

(4)只在工作场景做一次颜色校正矩阵的求取,以后就一直使用该矩阵作为颜色校正。两个摄像机先在工作场景下拍摄24色标准调色板,调色板要在两幅图的公共区域里,然后利用上述步骤合成图像。(4) Calculate the color correction matrix only once in the working scene, and use this matrix for color correction all the time. The two cameras first shoot the 24-color standard palette in the working scene, and the palette should be in the common area of the two pictures, and then use the above steps to synthesize the image.

将图上读取24个色块的5点像素平均值作为输入,调色板对应色块的标准像素值作为输出,把公式整理成Ax=b的形式,得公式其中,ci是代表3乘3颜色校正矩阵第i行的转置,矩阵A大小为72*9,向量b的大小为72*1。利用最小二乘法x=(AT*A)-1*ATb或奇异值分解可得到所需要的变换矩阵。The 5-point pixel average value of the 24 color blocks read on the picture is taken as input, and the standard pixel value of the color block corresponding to the palette is used as output, and the formula Organize it into the form of Ax=b, and get the formula Among them, c i is the transpose representing the i-th row of the 3 by 3 color correction matrix, the size of matrix A is 72*9, and the size of vector b is 72*1. The required transformation matrix can be obtained by using the least square method x=( AT *A) -1 * AT b or singular value decomposition.

(5)每一次得到的合成图像经过颜色校正得到新的图像。(5) The composite image obtained each time undergoes color correction to obtain a new image.

如图1,为本发明的降低噪声和使颜色接近标准流程图。具体为先拍摄两张公共区域较大的贴片机工作场景图像,利用直接线性变换算法求取单应性矩阵,再求出其中一图变换后的图像,以另一图为底稿将两图加权合成,最后通过颜色校正得到最终的图像。颜色校正矩阵只需要进行一次求解就能得到。As shown in Fig. 1, it is a flow chart of reducing noise and making color close to the standard of the present invention. Specifically, first take two images of the working scene of the placement machine with a large public area, use the direct linear transformation algorithm to obtain the homography matrix, and then obtain the transformed image of one of the images, and use the other image as a draft to combine the two images Weighted compositing, and finally color correction to get the final image. The color correction matrix only needs to be solved once to obtain.

如图2所示为求解单应性矩阵流程图。第一步是通过自动或人工选取不少于4组对应点,对应点最好能够均匀分布在图像各部分;第二步是将对应点进行归一化,为了提高求解单应性矩阵的精度;第三步是利用奇异值分解得到归一化后的单应性矩阵;第四步是对上一步的矩阵进行反归一化,得到原有对应坐标的单应性矩阵。Figure 2 shows the flow chart of solving the homography matrix. The first step is to automatically or manually select no less than 4 groups of corresponding points, and the corresponding points should preferably be evenly distributed in all parts of the image; the second step is to normalize the corresponding points, in order to improve the accuracy of solving the homography matrix ; The third step is to use singular value decomposition to obtain the normalized homography matrix; the fourth step is to denormalize the matrix in the previous step to obtain the original homography matrix corresponding to the coordinates.

如图3所示为将一张图像变换并与另一张图像加全合成流程图。第一步是将图像划分成多个16像素*16像素的方框,利用单应性矩阵算出所有方框4个角的对应点坐标;第二步是利用双线性插值的方法求取公共区域所有对应点坐标;第三步是利用对应点坐标和双线性插值得到其中一图变换后的图像;第四步是以另一张图像为底稿,将公共区域图像加权合成,得到降噪的图像。As shown in Figure 3, it is a flow chart of transforming an image and adding it to another image. The first step is to divide the image into multiple 16-pixel*16-pixel boxes, and use the homography matrix to calculate the corresponding point coordinates of the four corners of all boxes; the second step is to use bilinear interpolation to find the common The coordinates of all corresponding points in the area; the third step is to use the coordinates of corresponding points and bilinear interpolation to obtain the transformed image of one of the images; the fourth step is to use another image as a base to weight and synthesize the images in the public area to obtain noise reduction Image.

如图4所示对求取颜色校正矩阵流程图。第一步是先拍摄在公共区域有调色板的两张图像;第二步是用上述方法将两图像加权合成;第三步是把合成图像24个色块的RGB像素值作为输入,其中每个色块取5点的平均值,把调色板的标准RGB像素值作为输出;第四步是利用最小二乘法或奇异值分解得到颜色校正矩阵。As shown in Figure 4, the flow chart of obtaining the color correction matrix is shown. The first step is to take two images with palettes in the common area; the second step is to use the above method to weight the two images; the third step is to take the RGB pixel values of the 24 color blocks of the composite image as input, where The average value of 5 points is taken for each color block, and the standard RGB pixel value of the palette is output; the fourth step is to use the least square method or singular value decomposition to obtain the color correction matrix.

本实例在明亮的环境下拍摄工作内容的图像作为标准,然后在稍暗(即噪声较多)的环境下获取相同的图像和调色板的图像,并使用本方法进行处理。In this example, the image of the work content is taken in a bright environment as a standard, and then the same image and the image of the palette are obtained in a slightly darker (that is, more noisy) environment, and processed by this method.

噪声的评价函数为:其中,s和t分别代表标准无噪图像和有噪图像,上标i=1,2,…,N,N是图像道。若MSE越小,则噪声越小。The evaluation function of noise is: Among them, s and t represent the standard noise-free image and the noisy image respectively, and the superscript i=1,2,...,N, N is the image channel. The smaller the MSE, the smaller the noise.

颜色标准程度的评价函数为:其中,R、G、B分别代表图像的三个通道,下标in和out分别代表标准值和待检测值,上标j代表第j个色块,m代表颜色块的总数,此处取24。若q越小,颜色更接近标准。The evaluation function of color standard degree is: Among them, R, G, and B respectively represent the three channels of the image, the subscripts in and out represent the standard value and the value to be detected, respectively, the superscript j represents the jth color block, and m represents the total number of color blocks, here 24 . If q is smaller, the color is closer to the standard.

本实例中原始拍摄调色板图像的颜色标准程度为17171.4,用PS调整得到的标准调色板图像(颜色标准程度为0),用所求颜色校正矩阵进行校正得到的调色板图像(颜色标准程度为5618.4),说明颜色更接近标准。In this example, the color standard degree of the original palette image is 17171.4, the standard palette image (color standard degree is 0) adjusted by PS, and the palette image obtained by correction with the required color correction matrix (color The standard degree is 5618.4), indicating that the color is closer to the standard.

实例中所拍摄的左图的MSE为7463.9,拍摄的右图的MSE为4433.5,合成的降噪图像的MSE为1338.5。In the example, the MSE of the left image taken is 7463.9, the MSE of the right image taken is 4433.5, and the MSE of the synthesized noise-reduced image is 1338.5.

Claims (2)

1.一种降低图像噪声和使颜色接近标准的方法,其特征是在精密电子组装设备工作场景下,采用多镜头拍摄获得公共区域较大的两幅印刷电路板图像,然后以其中一张图像作为底稿把两幅印刷电路板图像的公共区域加权合成,利用噪声的随机性来降低图像的噪声,最后通过颜色校正矩阵来使图像颜色更接近标准颜色;具体包括如下步骤:1. A method for reducing image noise and making the color close to the standard is characterized in that in the working scene of precision electronic assembly equipment, two images of printed circuit boards with larger public areas are obtained by using multi-lens shooting, and then one of the images is used As a draft, the common areas of two printed circuit board images are weighted and synthesized, the randomness of noise is used to reduce the noise of the image, and finally the color correction matrix is used to make the image color closer to the standard color; the specific steps are as follows: (1)两幅图像公共区域加权融合:两幅印刷电路板图像为在精密电子组装设备工作场景的同一个平面上的图像;人工或自动选取同一平面上n组对应点,得到对应点的坐标,利用直接线性变换算法求解出两图像对应的单应性矩阵,n≥4;选择两幅印刷电路板图像中的一张图像作为底稿,利用单应性矩阵将另一张图像变换成与底稿在公共区域有对应元素的图像,然后对两幅图像的公共区域进行加权,得到新的图像,从而降低图像噪声;具体在将另一张图像变换成与所述底稿在公共区域有对应元素的图像过程中,为了提高运算速度,将图像划分为多个16像素*16像素的方框,每16像素*16像素的方框使用单应性矩阵得到4组方框顶点对应点坐标,其余对应点坐标用双线性插值的方法和已求的4组对应点坐标得到;在将另一张图像变换成与所述底稿在公共区域有对应元素的图像过程中,新图像的像素值要通过对应点坐标在原图获取,需利用双线性插值方法根据目标点最邻近的4个坐标的像素值得到所需要的整数坐标下的像素值;(1) Weighted fusion of two images in the common area: two printed circuit board images are images on the same plane of the precision electronic assembly equipment working scene; manually or automatically select n groups of corresponding points on the same plane to obtain the coordinates of the corresponding points , use the direct linear transformation algorithm to solve the homography matrix corresponding to the two images, n≥4; select one of the two printed circuit board images as a draft, and use the homography matrix to transform the other image into the same as the draft There are images with corresponding elements in the common area, and then the common areas of the two images are weighted to obtain a new image, thereby reducing image noise; specifically, another image is transformed into an image with corresponding elements in the common area of the draft. In the image process, in order to improve the calculation speed, the image is divided into multiple 16-pixel*16-pixel boxes, and each 16-pixel*16-pixel box uses a homography matrix to obtain 4 sets of coordinates of the corresponding points of the box vertices, and the rest correspond to The point coordinates are obtained by bilinear interpolation method and the obtained 4 sets of corresponding point coordinates; in the process of transforming another image into an image with corresponding elements in the common area of the draft, the pixel values of the new image must be passed The coordinates of the corresponding points are obtained in the original image, and the pixel values under the required integer coordinates need to be obtained according to the pixel values of the four nearest coordinates of the target point using the bilinear interpolation method; (2)色彩校正:通过一个3乘3的矩阵变换,将新的图像里原有的RGB颜色空间映射到标准的RGB颜色空间,使得图像的RGB像素值更接近标准的RGB像素值;(2) Color correction: through a 3 by 3 matrix transformation, the original RGB color space in the new image is mapped to the standard RGB color space, so that the RGB pixel value of the image is closer to the standard RGB pixel value; 所述直接线性变换算法包括:将两组对应点坐标Xl和Xr经过归一化得到Xlg和Xrg,其中下标l和r分别表示所拍摄的左图和右图,Xl和Xr分别代表左图和右图的原始对应点坐标,xl和xr分别代表左图和右图的x坐标,yl和yr分别代表左图和右图的y坐标;Xlg和Xrg分别代表左图和右图的归一化后对应点坐标,xlg和xrg分别代表左图和右图的x坐标,ylg和yrg分别代表左图和右图的y坐标;E(xl)和E(xr)分别是左图和右图归一化前x坐标的期望,E(yl)和E(yr)是左图和右图归一化前y坐标的期望,D(xl)和D(xr)分别是左图和右图归一化前x坐标的方差,D(yl)和D(yr)分别是左图和右图归一化前y坐标的方差;利用Xi'×HXi=0整理成Ah=0得其中hi代表3×3单应性矩阵的第i行的转置,i=1,2,3,X′i代表Xlg或Xrg,x′i代表xlg或xrg,y'i代表ylg或yrgXi代表Xl或Xr,xi代表xl或xr,yi代表yl或yr;T代表转置矩阵;将3n乘9的A矩阵,进行矩阵分析里面的奇异值分解A=UDVT,其中,H是反归一化单应性矩阵n是指对应点组数,归一化后单应性矩阵Hg即为V的最后一列;The direct linear transformation algorithm comprises: two groups of corresponding point coordinates X l and X r pass through with Normalized to get X lg and X rg , where the subscripts l and r represent the left and right images taken respectively, X l and X r represent the original corresponding point coordinates of the left and right images respectively, x l and x r Represent the x coordinates of the left and right images respectively, y l and y r represent the y coordinates of the left and right images respectively; X lg and X rg represent the normalized corresponding point coordinates of the left and right images respectively, x lg and x rg represent the x coordinates of the left and right images respectively, y lg and y rg represent the y coordinates of the left and right images respectively; E(x l ) and E(x r ) are the normalization of the left and right images respectively The expectation of x coordinates before normalization, E(y l ) and E(y r ) are the expectations of the y coordinates of the left and right images before normalization, D(x l ) and D(x r ) are the left and right images respectively The variance of the x-coordinates before normalization of the graph, D(y l ) and D(y r ) are the variances of the y-coordinates of the left and right graphs before normalization respectively; use X i '×HX i =0 to organize into Ah= 0 get where h i represents the transpose of row i of the 3×3 homography matrix, i=1,2,3, X' i represents X lg or X rg , x' i represents x lg or x rg , y' i represents y lg or y rg ; X i stands for X l or X r , xi stands for x l or x r , y i stands for y l or y r ; T stands for transposed matrix; take the 3n by 9 A matrix and perform the singular value decomposition A in matrix analysis = UDV T , where H is the denormalized homography matrix n refers to the number of corresponding point groups, and the normalized homography matrix H g is the last column of V; 所述的双线性插值方法包括:插值按照16像素*16像素的方框逐个进行,f(1),f(2),f(3),f(4)分别顺次指的是方框四个顶点位置的映射坐标;在每一个方框内部,利用公式f12(k,1)=(f(1)*(16-k)+f(2)*k)>>2,f23(16,k)=(f(2)*(16-k)+f(3)*k)>>2,f34(k,16)=(f(3)*(16-k)+f(4)*k)>>3,f41(1,k)=(f(4)*(16-k)+f(1)*k)>>3先插值四条边,然后利用公式f(x,y)=(f(1)*(64-x)*(64-y)+f(2)*(x)*(64-y)+f(3)*(64-x)*(y)+f(4)*x*y)>>12插值方框的内部区域;其中,f12,f23,f34,f41其下标代表待插值边的第一顶点和第二顶点的标记,f是插值函数;k代表位于待插值边上且与该待插值边上第一个顶点距离为k-1个像素的坐标,k取值为2~15;x、y代表方框内的坐标,取值为2~15;The bilinear interpolation method includes: interpolation is carried out one by one according to the frame of 16 pixels*16 pixels, and f(1), f(2), f(3), and f(4) respectively refer to the frame The mapping coordinates of the four vertex positions; inside each box, use the formula f 12 (k,1)=(f(1)*(16-k)+f(2)*k)>>2, f 23 (16,k)=(f(2)*(16-k)+f(3)*k)>>2, f 34 (k,16)=(f(3)*(16-k)+f (4)*k)>>3, f 41 (1,k)=(f(4)*(16-k)+f(1)*k)>>3 First interpolate the four sides, and then use the formula f( x,y)=(f(1)*(64-x)*(64-y)+f(2)*(x)*(64-y)+f(3)*(64-x)*( y)+f(4)*x*y)>>12 The internal area of the interpolation box; where, f 12 , f 23 , f 34 , f 41 and their subscripts represent the first vertex and the second vertex of the edge to be interpolated , f is the interpolation function; k represents the coordinates located on the side to be interpolated and the distance from the first vertex on the side to be interpolated is k-1 pixels, and the value of k is 2 to 15; x and y represent the box The coordinates within are 2 to 15; 所述的双线性插值方法利用双线性插值方法在目标点最邻近的4个对应点坐标的像素值得到所需要的整数坐标下的像素值;利用公式f(x,y)=(f(1)*(64-x)*(64-y)+f(2)*(x)*(64-y)+f(3)*(64-x)*(y)+f(4)*x*y)>>12,f(1),f(2),f(3),f(4)分别指的是最邻近的4个坐标的像素值;Described bilinear interpolation method utilizes bilinear interpolation method to obtain the pixel value under the required integer coordinates at the pixel values of the 4 corresponding point coordinates closest to the target point; utilize formula f (x, y)=(f (1)*(64-x)*(64-y)+f(2)*(x)*(64-y)+f(3)*(64-x)*(y)+f(4) *x*y)>>12, f(1), f(2), f(3), f(4) respectively refer to the pixel values of the nearest 4 coordinates; 所述步骤(2)中提高颜色清晰度的方法包括:将合成图像上读取24个色块的5点像素平均值作为输入,调色板对应色块的标准像素值作为输出,把公式整理成Ax=b的形式,其中Rin、Gin、Bin分别为输入的红色、绿色、蓝色通道矩阵的颜色值,Rout、Gout、Bout分别为标准色块的红色、绿色、蓝色通道矩阵的颜色值;得公式其中,ci是代表3×3颜色校正矩阵第i行的转置,i=1,2,3,矩阵A大小为72*9,向量b的大小为72*1;利用最小二乘法x=(AT*A)-1*ATb或奇异值分解可得到所需要的变换矩阵。The method for improving color clarity in the described step (2) includes: reading 5 pixel mean values of 24 color blocks on the synthetic image as input, and the standard pixel value of the corresponding color block of the palette as output, using the formula Arranged into the form of Ax=b, where R in , G in , and B in are the color values of the input red, green, and blue channel matrices respectively, and R out , G out , and B out are the red and green colors of the standard color blocks, respectively. , the color value of the blue channel matrix; get the formula which is Among them, c i represents the transposition of row i of the 3×3 color correction matrix, i=1,2,3, the size of matrix A is 72*9, and the size of vector b is 72*1; using the least square method x= ( AT *A) -1 * AT b or singular value decomposition can get the required transformation matrix. 2.根据权利要求1所述的降低图像噪声和使颜色接近标准的方法,其特征在于所述步骤(2)中,只需要在该场景做一次颜色校正矩阵的求取,以后就一直使用该矩阵作为颜色校正;两个摄像机先在工作场景下拍摄24色标准调色板,调色板要在两幅图的公共区域里,然后利用步骤(1)所述的方法得到合成图像。2. the method for reducing image noise according to claim 1 and making color close to the standard is characterized in that in the described step (2), it is only necessary to obtain the color correction matrix once in the scene, and the color correction matrix will be used always afterwards The matrix is used as color correction; the two cameras first shoot a 24-color standard palette in the working scene, and the palette should be in the common area of the two pictures, and then use the method described in step (1) to obtain a composite image.
CN201310211102.3A 2013-05-30 2013-05-30 A kind of method for reducing picture noise and making color be near the mark Expired - Fee Related CN103268596B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310211102.3A CN103268596B (en) 2013-05-30 2013-05-30 A kind of method for reducing picture noise and making color be near the mark

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310211102.3A CN103268596B (en) 2013-05-30 2013-05-30 A kind of method for reducing picture noise and making color be near the mark

Publications (2)

Publication Number Publication Date
CN103268596A CN103268596A (en) 2013-08-28
CN103268596B true CN103268596B (en) 2017-04-05

Family

ID=49012223

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310211102.3A Expired - Fee Related CN103268596B (en) 2013-05-30 2013-05-30 A kind of method for reducing picture noise and making color be near the mark

Country Status (1)

Country Link
CN (1) CN103268596B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US12073549B2 (en) 2019-08-30 2024-08-27 Panasonic Intellectual Property Management Co., Ltd. Stress analysis device

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10257450B2 (en) 2014-05-15 2019-04-09 Huawei Technologies Co., Ltd. Multi-frame noise reduction method, and terminal
CN104394308B (en) * 2014-11-28 2017-11-07 广东欧珀移动通信有限公司 Method and terminal that dual camera is taken pictures with different visual angles
CN107240064B (en) * 2016-03-28 2021-04-06 展讯通信(天津)有限公司 Image correction method and device and terminal
CN106097249B (en) * 2016-06-21 2019-09-17 中国科学院电子学研究所 A kind of diameter radar image anastomosing and splicing method and device
WO2018006390A1 (en) * 2016-07-08 2018-01-11 SZ DJI Technology Co., Ltd. System and method for image processing
CN106131527A (en) * 2016-07-26 2016-11-16 深圳众思科技有限公司 Dual camera color synchronization method, device and terminal
CN106774386B (en) * 2016-12-06 2019-08-13 杭州灵目科技有限公司 Unmanned plane vision guided navigation landing system based on multiple dimensioned marker
CN109462748B (en) * 2018-12-21 2020-10-09 福州大学 Stereo video color correction algorithm based on homography matrix
CN118071752B (en) * 2024-04-24 2024-07-19 中铁电气化局集团有限公司 Contact net detection method

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1417745A (en) * 2001-11-07 2003-05-14 富士施乐株式会社 Image processing equipment and program
CN101102397A (en) * 2006-07-03 2008-01-09 索尼株式会社 Noise reduction method and noise reduction device
CN102682440A (en) * 2011-02-18 2012-09-19 佳能株式会社 Image processing apparatus, image capturing apparatus, and image processing method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1417745A (en) * 2001-11-07 2003-05-14 富士施乐株式会社 Image processing equipment and program
CN101102397A (en) * 2006-07-03 2008-01-09 索尼株式会社 Noise reduction method and noise reduction device
CN102682440A (en) * 2011-02-18 2012-09-19 佳能株式会社 Image processing apparatus, image capturing apparatus, and image processing method

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US12073549B2 (en) 2019-08-30 2024-08-27 Panasonic Intellectual Property Management Co., Ltd. Stress analysis device

Also Published As

Publication number Publication date
CN103268596A (en) 2013-08-28

Similar Documents

Publication Publication Date Title
CN103268596B (en) A kind of method for reducing picture noise and making color be near the mark
TWI455062B (en) Method for 3d video content generation
CN102663719B (en) Bayer-pattern CFA image demosaicking method based on non-local mean
KR101335561B1 (en) Interpolation system and method
US10902558B2 (en) Multiscale denoising of raw images with noise estimation
CN109978774B (en) Denoising fusion method and device for multi-frame continuous equal exposure images
US20180082454A1 (en) Color normalization for a multi-camera system
JP2019165506A (en) Systems and methods for multiscopic noise reduction and high-dynamic range
TWI557686B (en) Method and device for correcting image color deviation
JP5822157B2 (en) Noise reduction apparatus, noise reduction method, and program
CN110517206B (en) Method and device for eliminating color moire
CN112801925A (en) Underwater image enhancement method for maximally eliminating water ripple influence based on information entropy
EP3381012B1 (en) Method and system for generating an output image from a plurality of corresponding input image channels
WO2019104047A1 (en) Global tone mapping
CN107784631A (en) Image deblurring method and device
CN111226256A (en) System and method for image dynamic range adjustment
CN107945119B (en) Intra-image correlation noise estimation method based on Bayer pattern
CN111915500A (en) Foggy day image enhancement method based on improved Retinex algorithm
CN114018214A (en) A Binocular Subpixel Ranging Method for Markers Based on Hardware Acceleration System
WO2013134998A1 (en) 3d reconstruction method and system
JP2019080100A (en) High accuracy color correction processing method and high accuracy color correction processor
US9451222B2 (en) Color processing of digital images
Zhou et al. Raw bayer pattern image synthesis for computer vision-oriented image signal processing pipeline design
KR20140028516A (en) Method for sub-pixel based image down-sampling with learning style
CN113132562B (en) Lens shading correction method and device and electronic equipment

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20170405