CN104766319B - Lifting night takes pictures the method for image registration accuracy - Google Patents
Lifting night takes pictures the method for image registration accuracy Download PDFInfo
- Publication number
- CN104766319B CN104766319B CN201510155826.XA CN201510155826A CN104766319B CN 104766319 B CN104766319 B CN 104766319B CN 201510155826 A CN201510155826 A CN 201510155826A CN 104766319 B CN104766319 B CN 104766319B
- Authority
- CN
- China
- Prior art keywords
- condition
- image
- pixel
- flash
- feature points
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 35
- 239000011159 matrix material Substances 0.000 claims abstract description 109
- 230000009466 transformation Effects 0.000 claims abstract description 45
- PXFBZOLANLWPMH-UHFFFAOYSA-N 16-Epiaffinine Natural products C1C(C2=CC=CC=C2N2)=C2C(=O)CC2C(=CC)CN(C)C1C2CO PXFBZOLANLWPMH-UHFFFAOYSA-N 0.000 claims abstract description 43
- 230000001186 cumulative effect Effects 0.000 claims description 6
- 238000001914 filtration Methods 0.000 claims description 6
- 238000013507 mapping Methods 0.000 claims description 6
- 238000005070 sampling Methods 0.000 claims description 6
- 238000001514 detection method Methods 0.000 claims description 3
- 230000001737 promoting effect Effects 0.000 claims 3
- 238000004364 calculation method Methods 0.000 claims 1
- 238000005259 measurement Methods 0.000 claims 1
- 230000004927 fusion Effects 0.000 description 6
- 238000004088 simulation Methods 0.000 description 6
- 230000008901 benefit Effects 0.000 description 5
- 230000000694 effects Effects 0.000 description 5
- 238000005286 illumination Methods 0.000 description 4
- 238000010586 diagram Methods 0.000 description 3
- 238000007781 pre-processing Methods 0.000 description 3
- 239000000284 extract Substances 0.000 description 2
- 238000000605 extraction Methods 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 230000003044 adaptive effect Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 230000007812 deficiency Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000008569 process Effects 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
Landscapes
- Image Analysis (AREA)
Abstract
一种提升夜间拍照图像配准精度的方法,具体包括:输入待配准图像;图像灰度化;直方图均衡化;检测特征点;匹配特征点;利用随机抽样一致RANSAC算法,剔除误特征点匹配对;判断闪光灯条件下拍摄的图像的特征点是否过于集中,若是,进行特征点匹配对均衡化,否则,直接利用已检测出来的特征点匹配对求解仿射变换矩阵;特征点匹配对均衡化;利用特征点匹配对列出方程,求解方程组,得到仿射变换矩阵;配准图像。本发明能够根据已检测出的特征点匹配对的位置信息,自适应的添加匹配对,使得特征点的分布更加均匀,避免由于特征点过于集中而导致的过拟合问题,提高夜间拍照图像的配准精度。
A method for improving the registration accuracy of photographed images at night, specifically comprising: inputting images to be registered; image grayscale; histogram equalization; detecting feature points; matching feature points; Matching pair; determine whether the feature points of the image taken under flashlight conditions are too concentrated, if so, perform feature point matching pair equalization, otherwise, directly use the detected feature point matching pair to solve the affine transformation matrix; feature point matching pair equalization use feature point matching to list equations, solve equations, and obtain affine transformation matrix; register images. The present invention can adaptively add matching pairs according to the position information of the detected feature point matching pairs, so that the distribution of feature points is more uniform, avoiding the over-fitting problem caused by too concentrated feature points, and improving the accuracy of nighttime photographed images. Registration accuracy.
Description
技术领域technical field
本发明属于图像处理技术领域,更进一步涉及图像配准技术领域中的一种提升夜间拍照图像配准精度的方法。本发明用于单帧闪光灯图像和多帧无闪光灯图像融合提升夜间拍照质量的配准预处理中,可以有效的避免重影和模糊的出现,大大提高图像融合的质量。The invention belongs to the technical field of image processing, and further relates to a method for improving the registration accuracy of images taken at night in the technical field of image registration. The present invention is used in registration preprocessing for fusion of a single-frame flashlight image and multi-frame non-flashlight images to improve the quality of photographing at night, can effectively avoid ghosting and blurring, and greatly improve the quality of image fusion.
背景技术Background technique
目前,夜间拍照图像配准方法主要有基于频域的方法和基于时域的方法。基于时域的方法中最具代表性的有基于特征的方法,这种方法是根据特征点提取算法对待配准的图像提取特征点,利用所求的特征点进行图像配准的。基于特征的方法优点在于尺度不变性,鲁棒性强,对于微弱的均匀的光照变化不敏感。但是该方法仍然存在缺点,在夜间拍照时,开闪光灯拍照时照片会出现前景十分亮而背景很暗的情况,而在无闪光灯拍照时图像的整体偏暗,这样在配准时,特征点检测时检测到的特征点非常少,不足以求出仿射变换矩阵,或者特别集中在一个比较小的区域,求仿射变换矩阵时会造成过拟合的情况。At present, there are mainly frequency-domain-based methods and time-domain-based methods for image registration at night. The most representative method based on the time domain is the feature-based method. This method extracts feature points from the image to be registered according to the feature point extraction algorithm, and uses the feature points to perform image registration. The advantages of the feature-based method are scale invariance, strong robustness, and insensitivity to weak uniform illumination changes. However, this method still has shortcomings. When taking pictures at night, the foreground will be very bright and the background will be very dark when the flash is on, and the overall image will be dark when there is no flash. There are very few detected feature points, which are not enough to calculate the affine transformation matrix, or they are concentrated in a relatively small area, which will cause over-fitting when calculating the affine transformation matrix.
Yingxuan Zhu,Samuel Cheng,Vladimir Stankovic和Lina Stankovic发表的论文“Image registration using BP-SIFT”(Journal of Visual Communication andImage Representation,Volume 24,Issue 4,May 2013,Pages 448–457)中提出一种基于特征点的图像配准方法。该方法首先根据BP-SIFT(Belief Propagation Scale InvariantFeature Transform)算法提取待配准图像的特征点,然后对所求的特征点进行匹配得到匹配对,根据匹配对得到变换矩阵,最后根据变换矩阵进行重采样得到最后配准的图像。该方法对光照变化不大的待配准图像配准效果较好,但是仍然存在的不足之处是,对于光照强度变化很大的待配准图像会出现提取的特征点很少,或者提取的特征点过于集中,从而造成过拟合,降低配准精度。A feature-based Point image registration method. This method first extracts the feature points of the image to be registered according to the BP-SIFT (Belief Propagation Scale InvariantFeature Transform) algorithm, then matches the feature points to obtain the matching pair, obtains the transformation matrix according to the matching pair, and finally performs re-registration according to the transformation matrix. Sampling to get the final registered image. This method has a good registration effect on images to be registered with little change in illumination, but there is still a disadvantage that for images to be registered with large changes in illumination intensity, there will be few feature points extracted, or the extracted The feature points are too concentrated, resulting in over-fitting and reducing the registration accuracy.
上海交通大学申请的专利“基于改进Harris角点的图像配准方法”(申请日:2009年9月4日,申请号:200910195131.9,公开号:101655982)中公开了一种图像配准的方法。该方法计算待配准图像的尺度空间并在尺度空间求取Harris角点,用仿射形态修改技术对尺度空间的Harris角点进行迭代处理,对特征点使用描述子和匹配方法进行匹配,通过匹配实现配准。该方法存在的不足之处是,该方法在应用于夜间拍摄的开闪光灯和不开闪光灯的图像配准时,由于没有考虑光照的分布不均匀的情形,从而造成所检测到的特征点分布不均匀,由此引起过拟合,导致图像只在某一个区域内是配准的。An image registration method is disclosed in the patent "Image registration method based on improved Harris corner points" (application date: September 4, 2009, application number: 200910195131.9, publication number: 101655982) filed by Shanghai Jiaotong University. This method calculates the scale space of the image to be registered and obtains the Harris corner points in the scale space, uses the affine shape modification technology to iteratively process the Harris corner points in the scale space, and uses the descriptor and matching method to match the feature points. Matching achieves registration. The disadvantage of this method is that when this method is applied to the image registration of night shooting with and without flash, it does not consider the uneven distribution of illumination, resulting in uneven distribution of detected feature points , which causes overfitting, resulting in the image being registered only in a certain area.
发明内容Contents of the invention
本发明的目的是针对上述现有技术的不足,提出一种提升闪光灯和无闪光灯图像配准精确度的方法。The object of the present invention is to propose a method for improving the registration accuracy of images with and without a flash to address the above-mentioned deficiencies in the prior art.
本发明根据针对夜间拍照时开闪光灯的条件下拍照会出现前景过亮而背景过暗以及在无闪光灯的条件下拍照整体偏暗的问题,首先对待配准的两张图像进行直方图均衡,改善灰度分布集中,增强图像的对比度,然后进行尺度不变特征变换SIFT特征点检测和匹配,利用随机抽样一致Ransac算法去除误匹配点,为了避免由于特征点过于集中而导致的过拟合问题,利用已求得的匹配对,自适应的添加匹配对,使得特征点的分布更加均匀,最后利用这些匹配对求得仿射变换矩阵并配准图像。According to the problem that the foreground is too bright and the background is too dark when taking pictures at night when the flashlight is turned on, and the overall darkness of the picture is taken under the condition of no flashlight, the present invention first performs histogram equalization on the two images to be registered to improve The gray distribution is concentrated, the contrast of the image is enhanced, and then the scale-invariant feature transformation SIFT feature point detection and matching is performed, and the random sampling consistent Ransac algorithm is used to remove the mismatching points. In order to avoid the over-fitting problem caused by the over-concentration of feature points, Using the obtained matching pairs, adaptively add matching pairs to make the distribution of feature points more uniform, and finally use these matching pairs to obtain an affine transformation matrix and register images.
为实现上述目的,本发明包括如下主要步骤:To achieve the above object, the present invention comprises the following main steps:
(1)输入待配准图像:(1) Input the image to be registered:
分别输入待配准的一幅在有闪光灯和一幅在无闪光灯条件下拍摄的图像;Input one image taken with flash and one without flash to be registered respectively;
(2)图像灰度化:(2) Image grayscale:
按照下式,分别对待配准的闪光灯条件下和无闪光灯条件下拍摄的图像进行灰度化:According to the following formula, the images taken under the conditions of the flash light and without the flash light to be registered are respectively grayscaled:
其中,Yi表示待配准的闪光灯条件下和无闪光灯条件下拍摄的图像中第i个像素的灰度值,i表示待配准的闪光灯条件下和无闪光灯条件下拍摄的图像的像素点的序号,B、G、R分别表示待配准的闪光灯条件下和无闪光灯条件下拍摄的图像的蓝、绿、红通道,Bi表示待配准的闪光灯条件下和无闪光灯条件下拍摄的图像的第i个像素的蓝通道,Gi表示待配准的闪光灯条件下和无闪光灯条件下拍摄的图像的第i个像素的绿通道,Ri表示待配准的闪光灯条件下和无闪光灯条件下拍摄的图像的第i个像素的红通道;Among them, Y i represents the gray value of the i-th pixel in the image taken under the condition of the flash light and without the flash light to be registered, and i represents the pixel point of the image shot under the condition of the flash light and without the flash light to be registered B, G, and R represent the blue, green, and red channels of the images taken under the condition of the flash light and without the flash light to be registered respectively, and B i represent the channels of the images shot under the condition of the flash light to be registered and without the flash light The blue channel of the i-th pixel of the image, G i represents the green channel of the i-th pixel of the image to be registered under the flash condition and no flash condition, and R i represents the flash condition and no flash condition to be registered The red channel of the i-th pixel of the image captured under the condition;
(3)直方图均衡化:(3) Histogram equalization:
按照下式,分别对待配准的闪光灯条件下和无闪光灯条件下拍摄的图像进行直方图均衡化:According to the following formula, the histogram equalization is performed on the images taken under the condition of the flash light and without the flash light to be registered respectively:
sx=int[(L-1)*px+0.5];s x = int[(L-1)*p x +0.5];
其中,px表示亮度通道矩阵的最终灰度级出现的概率值的累加和,x表示亮度通道矩阵的灰度值,x的取值范围为0~255,∑表示求和操作,f表示亮度通道矩阵的灰度级,f=0,1,2,...,x,g(f)表示亮度通道矩阵的最终灰度级出现的概率值,sx表示直方图均衡化后亮度通道矩阵中灰度值x的映射值,int表示取整操作,L表示亮度通道矩阵灰度级的最大值;Among them, p x represents the cumulative sum of the probability values of the final gray level of the brightness channel matrix, x represents the gray value of the brightness channel matrix, and the value range of x is 0 to 255, ∑ represents the summation operation, and f represents the brightness The gray level of the channel matrix, f=0,1,2,...,x, g(f) represents the probability value of the final gray level of the brightness channel matrix, and s x represents the brightness channel matrix after histogram equalization The mapping value of the middle gray value x, int means the rounding operation, L means the maximum value of the gray level of the brightness channel matrix;
(4)检测特征点:(4) Detection of feature points:
(4a)对待配准的闪光灯条件下和无闪光灯条件下拍摄的图像,用不同尺度的高斯滤波器进行滤波得到的图像形成一个子八度octave;以此类推,对待配准的闪光灯条件下和无闪光灯条件下拍摄的图像分别进行一次,两次,三次下采样,并进行类似的滤波操作,得到高斯金字塔图层,将相邻的图层相减,得到差分高斯金字塔;(4a) For the images taken under the conditions of the flash light to be registered and without the flash light, the images obtained by filtering with Gaussian filters of different scales form a sub-octave; by analogy, the images taken under the flash light conditions to be registered and The images taken under the condition of no flash are down-sampled once, twice, and three times respectively, and similar filtering operations are performed to obtain a Gaussian pyramid layer, and the adjacent layers are subtracted to obtain a differential Gaussian pyramid;
(4b)在差分高斯金字塔中,比较中间图层上像素点与其相同尺度图层的8个相邻像素点大小,以及该像素点与其上下相邻尺度图层的18个相邻像素点的大小,如果中间图层上像素点的值是最大值或者是最小值,则将该像素点作为候选的特征点;(4b) In the differential Gaussian pyramid, compare the pixel point on the middle layer with the size of 8 adjacent pixel points of the same scale layer, and the size of the pixel point and the size of 18 adjacent pixel points of the adjacent scale layer above and below , if the value of the pixel point on the intermediate layer is the maximum value or the minimum value, the pixel point is used as a candidate feature point;
(4c)去除对噪声敏感的低对比度的候选特征点和具有不稳定的边缘响应的候选特征点,剩余的是最终的特征点;(4c) remove noise-sensitive low-contrast candidate feature points and candidate feature points with unstable edge responses, and the rest are final feature points;
(4d)计算以最终特征点为中心邻域像素的梯度方向,并用直方图表示,直方图的峰值表示最终特征点的邻域像素梯度的主方向,将该邻域像素梯度的主方向作为该最终特征点的方向;(4d) Calculate the gradient direction of the neighborhood pixel with the final feature point as the center, and express it with a histogram. The peak value of the histogram represents the main direction of the gradient of the neighborhood pixel of the final feature point, and take the main direction of the neighborhood pixel gradient as the The direction of the final feature point;
(4e)以最终特征点为中心,选择16×16的邻域,并将该邻域划分为16个4×4的子区域,在每个子区域上计算0°,45°,135°,180°,225°,270°,315°,360°共8个方向的梯度累加值,生成128维的特征向量;(4e) Take the final feature point as the center, select a 16×16 neighborhood, and divide the neighborhood into 16 4×4 sub-regions, and calculate 0°, 45°, 135°, 180° on each sub-region °, 225°, 270°, 315°, 360° total gradient cumulative value in 8 directions to generate a 128-dimensional feature vector;
(5)匹配特征点:(5) Match feature points:
对于闪光灯条件下拍摄的图像中的每一个最终特征点,利用欧氏距离找到无闪光灯条件下拍摄的图像中与闪光灯条件下拍摄的图像的最终特征点最近的两个特征点,在这两个特征点中,如果最近的距离与次最近的距离的比值小于0.4,则闪光灯条件下拍摄的图像的最终特征点与无闪光灯条件下拍摄的图像中的距离最近的点匹配,否则不匹配;For each final feature point in the image taken under the flash condition, use the Euclidean distance to find the two feature points closest to the final feature point of the image taken under the flash condition in the image taken without the flash condition. Among the feature points, if the ratio of the shortest distance to the next shortest distance is less than 0.4, the final feature point of the image taken under the flash condition matches the nearest point in the image taken under the flash condition, otherwise it does not match;
(6)利用随机抽样一致RANSAC算法,剔除误特征点匹配对;(6) Use random sampling consistent RANSAC algorithm to eliminate wrong feature point matching pairs;
(7)判断闪光灯条件下拍摄的图像的特征点是否满足判断条件,若是,执行步骤(8),否则,执行步骤(9);(7) Judging whether the feature points of the image taken under the condition of the flashlight meet the judgment condition, if so, perform step (8), otherwise, perform step (9);
(8)特征点匹配对均衡化:(8) Feature point matching pair equalization:
(8a)按照下式,计算待配准的闪光灯条件下和无闪光灯条件下拍摄的图像的特征点匹配对在列方向和行方向的平均偏移量:(8a) According to the following formula, calculate the average offset of the feature point matching pairs in the column direction and the row direction of the image taken under the condition of the flashlight and without the flashlight to be registered:
其中,Δx表示待配准的闪光灯条件下和无闪光灯条件下拍摄的图像的特征点匹配对在列方向上的平均偏移量,x表示待配准的闪光灯条件下和无闪光灯条件下拍摄的图像的特征点的列方向,n表示待配准的闪光灯条件下和无闪光灯条件下拍摄的图像的特征点匹配对的总数,i表示待配准的闪光灯条件下和无闪光灯条件下拍摄的图像的特征点匹配对的序号,表示第i个待配准的闪光灯条件下和无闪光灯条件下拍摄的图像的特征点匹配对中闪光灯条件下拍摄图像的特征点列坐标,表示第i个待配准的闪光灯条件下和无闪光灯条件下拍摄的图像的特征点匹配对中无闪光灯条件下拍摄图像的特征点列坐标,Δy表示待配准的闪光灯条件下和无闪光灯条件下拍摄的图像的特征点匹配对在行方向上的平均偏移量,y表示待配准的闪光灯条件下和无闪光灯条件下拍摄的图像的特征点的行方向,表示第i个待配准的闪光灯条件下和无闪光灯条件下拍摄的图像的特征点匹配对中闪光灯条件下拍摄图像的特征点的行坐标,表示第i个待配准的闪光灯条件下和无闪光灯条件下拍摄的图像的特征点匹配对中无闪光灯条件下拍摄图像的特征点的行坐标;Among them, Δx represents the average offset of the matching pairs of feature points in the column direction of the image to be registered under the flash condition and without the flash condition, and x represents the image taken under the flash condition and without the flash condition to be registered The column direction of the feature points of the image, n represents the total number of matching pairs of feature points of the image to be registered under the condition of the flash and without the flash, i represents the number of matching pairs of the feature points of the image to be registered under the condition of the flash and without the flash The serial number of the feature point matching pair of the image, Indicates that the feature points of the i-th image to be registered under the condition of the flashlight and the image taken without the flashlight match the column coordinates of the feature points of the image taken under the condition of the flashlight, Indicates the feature point column coordinates of the i -th image to be registered under the condition of the flashlight and without the flashlight in the matching pair of feature points of the image taken under the condition of the flashlight without the flashlight, Δy represents the condition of the flashlight to be registered and without the flashlight The average offset of the feature point matching pairs in the row direction of the image taken under the condition of Represents the row coordinates of the feature points of the i-th image to be registered under the condition of the flashlight and the image taken under the condition of no flashlight matching the feature points of the image taken under the condition of the flashlight, Represent the row coordinates of the feature points of the i-th image to be registered under the condition of the flashlight and the feature point of the image taken under the condition of the flashlight without the flashlight;
(8b)按照下式,将待配准的闪光灯条件下拍摄的图像分成M×M的相同大小的子块:(8b) According to the following formula, the image taken under the condition of the flashlight to be registered is divided into M×M sub-blocks of the same size:
其中,HW表示子块的宽度,表示向下取整操作,W表示闪光灯条件下拍摄的图像的宽度,M表示闪光灯下拍摄的图像每一行的子块个数,HH表示子块的高度,H表示闪光灯条件下拍摄的图像的高度;Among them, HW represents the width of the sub-block, Represents the rounding down operation, W represents the width of the image captured under the flash condition, M represents the number of sub-blocks in each row of the image captured under the flash light, HH represents the height of the sub-block, and H represents the height of the image captured under the flash condition ;
(8c)按照下式,计算闪光灯下拍摄的图像拟添加的特征点的行坐标和列坐标:(8c) According to the following formula, calculate the row coordinates and column coordinates of the feature points to be added to the image taken under the flashlight:
其中,表示拟添加的特征点的列坐标,x表示拟添加特征点的列方向,k表示闪光灯条件下拍摄的图像内拟添加的特征点的序号,k=(i×M+j)×N×N+i1×N+j1,i表示相同大小的子块对应的行的编号,i=0,1,2,...,M-1,i1表示子块内拟添加的特征点对应的行的编号,i1=0,1,2,...,N-1,j表示相同大小的子块的对应的列的编号,j=0,1,2,...,M-1,j1表示子块内拟添加的特征点的对应的列的编号,j1=0,1,2,...,N-1,HW表示子块的宽度,Dx表示拟添加的特征点之间的列方向的距离,W表示闪光灯条件下拍摄的图像的宽度,M表示闪光灯下拍摄的图像每一行的子块个数,N表示闪光灯下拍摄的图像的每个子块每一行添加的特征点个数,表示拟添加的特征点的行坐标,y表示拟添加的特征点的行方向,HH表示子块的高度,Dy表示拟添加的特征点之间的行方向的距离,H表示闪光灯条件下拍摄的图像的高度,H表示闪光灯条件下拍摄的图像的高度,M表示闪光灯下拍摄的图像每一行的子块个数,N表示闪光灯下拍摄的图像的每个子块每一行添加的特征点个数;in, Represents the column coordinates of the feature points to be added, x represents the column direction of the feature points to be added, k represents the sequence number of the feature points to be added in the image taken under flash conditions, k=(i×M+j)×N×N +i1×N+j1, i represents the number of the row corresponding to the sub-block of the same size, i=0,1,2,...,M-1, i1 represents the row corresponding to the feature point to be added in the sub-block Number, i1=0,1,2,...,N-1, j represents the number of the corresponding column of the sub-block of the same size, j=0,1,2,...,M-1, j1 represents The number of the corresponding column of the feature point to be added in the sub-block, j1=0,1,2,...,N-1, HW indicates the width of the sub-block, D x indicates the column between the feature points to be added direction distance, W represents the width of the image captured under the flashlight condition, M represents the number of subblocks in each row of the image captured under the flashlight, and N represents the number of feature points added to each row of each subblock of the image captured under the flashlight, Represents the row coordinates of the feature points to be added, y represents the row direction of the feature points to be added, HH represents the height of the sub-block, D y represents the distance in the row direction between the feature points to be added, and H represents the shooting under flash conditions the height of the image, H represents the height of the image taken under the flashlight condition, M represents the subblock number of each row of the image taken under the flashlight, and N represents the number of feature points added to each row of each subblock of the image taken under the flashlight;
(8d)按照下式,计算无闪光灯条件下拍摄的图像拟添加的特征点的列坐标和行坐标:(8d) According to the following formula, calculate the column coordinates and row coordinates of the feature points to be added to the image taken under the condition of no flashlight:
其中,表示无闪光灯条件下拍摄的图像拟添加的特征点的列坐标,x表示拟添加特征点的列方向,k表示拟添加的特征点的序号,表示闪光灯条件下拍摄的图像拟添加的特征点的列坐标,Δx表示待配准的闪光灯条件下和无闪光灯条件下拍摄的图像的特征点匹配对在列方向上的平均偏移量,表示无闪光灯条件下拍摄的图像拟添加的特征点的行坐标,表示闪光灯条件下拍摄的图像拟添加的特征点的行坐标,Δy表示待配准的闪光灯条件下和无闪光灯条件下拍摄的图像的特征点匹配对在行方向上的平均偏移量;in, Represents the column coordinates of the feature points to be added to the image taken under the condition of no flash, x represents the column direction of the feature points to be added, k represents the serial number of the feature points to be added, Indicates the column coordinates of the feature points to be added to the images captured under flash conditions, Δx represents the average offset in the column direction of the matching pairs of feature points of images captured under flash conditions and without flash conditions, Indicates the row coordinates of the feature points to be added to the image taken under the condition of no flashlight, Represents the row coordinates of the feature points to be added to the image taken under the flashlight condition, and Δy represents the average offset in the row direction of the feature point matching pair of the image taken under the flashlight condition and without the flashlight condition to be registered;
(9)利用步骤(6)和步骤(8)得到的特征点匹配对列出方程,求解方程组,得到仿射变换矩阵H;(9) utilize step (6) and the feature point matching that step (8) obtains to list equation, solve equation group, obtain affine transformation matrix H;
(10)配准图像:(10) Registration image:
(10a)按照下式,计算配准后的闪光灯条件下拍摄的图像的位置(i,j)的像素,经过映射之后对应的闪光灯条件下拍摄的图像的位置:(10a) According to the following formula, calculate the pixel of the position (i, j) of the image captured under the flashlight condition after registration, and the position of the image captured under the corresponding flashlight condition after mapping:
其中,i'表示闪光灯条件下拍摄的图像像素的列坐标,H-1 1,1表示仿射变换矩阵的逆矩阵的第一行第一列元素,H-1 1,2表示仿射变换矩阵的逆矩阵的第一行第二列元素,H-1 1,3表示仿射变换矩阵的逆矩阵的第一行第三列元素,H-1 2,1表示仿射变换矩阵的逆矩阵的第二行第一列元素,H-1 2,2表示仿射变换矩阵的逆矩阵的第二行第二列元素,H-1 2,3表示仿射变换矩阵的逆矩阵的第二行第三列元素,H-1 3,1表示仿射变换矩阵的逆矩阵的第三行第一列元素,H-1 3,2表示仿射变换矩阵的逆矩阵的第三行第二列元素,H-1 3,3表示仿射变换矩阵的逆矩阵的第三行第三列元素,i表示配准后的闪光灯条件下拍摄的图像像素的列坐标,j表示配准后的闪光灯条件下拍摄的图像像素的行坐标,j'表示闪光灯条件下拍摄的图像像素的行坐标;Among them, i' represents the column coordinates of the image pixels taken under the condition of flashlight, H -1 1,1 represents the first row and first column element of the inverse matrix of the affine transformation matrix, H -1 1,2 represents the affine transformation matrix The element in the first row and the second column of the inverse matrix, H -1 1,3 means the element in the first row and the third column of the inverse matrix of the affine transformation matrix, H -1 2,1 means the inverse matrix of the affine transformation matrix The element in the first column of the second row, H -1 2,2 means the element in the second row and the second column of the inverse matrix of the affine transformation matrix, H -1 2,3 means the second row and the second column of the inverse matrix of the affine transformation matrix Three columns of elements, H -1 3,1 represents the third row and first column element of the inverse matrix of the affine transformation matrix, H -1 3,2 represents the third row and second column element of the inverse matrix of the affine transformation matrix, H -1 3,3 represents the third row and third column element of the inverse matrix of the affine transformation matrix, i represents the column coordinates of the image pixels captured under the flashlight condition after registration, and j represents the shooting under the flashlight condition after registration The row coordinates of the image pixels of j' represent the row coordinates of the image pixels captured under the flashlight condition;
(10b)按照下式,计算配准后的闪光灯条件下拍摄的图像的位置(i,j)像素的像素值:(10b) According to the following formula, calculate the pixel value of the pixel at position (i, j) of the image captured under the condition of the flashlight after registration:
Ri,j=α1×FIi,Ij+α2×FIi,Ij+1+α3×FIi+1,Ij+α4×FIi+1,Ij+1;R i,j =α 1 ×F Ii,Ij +α 2 ×F Ii,Ij+1 +α 3 ×F Ii+1,Ij +α 4 ×F Ii+1,Ij+1 ;
其中,Ri,j表示配准后的闪光灯条件下拍摄的图像的像素值,i表示配准后的闪光灯条件下拍摄的图像像素的列坐标,j表示配准后的闪光灯条件下拍摄的图像像素的行坐标,α1表示距离闪光灯条件下拍摄的图像像素最近的左上角的像素的权重,FIi,Ij表示距离闪光灯条件下拍摄的图像像素最近的左上角的像素的像素值,Ii表示闪光灯条件下拍摄的图像像素的列坐标的整数部分,Ij表示闪光灯条件下拍摄的图像像素的行坐标的整数部分,α2表示距离闪光灯条件下拍摄的图像像素最近的左下角的像素的权重,FIi,Ij+1表示距离闪光灯条件下拍摄的图像像素最近的左下角的像素的像素值,α3表示距离闪光灯条件下拍摄的图像像素最近的右上角的像素的权重,FIi+1,Ij表示距离闪光灯条件下拍摄的图像像素最近的右上角的像素的像素值,α4表示距离闪光灯条件下拍摄的图像像素最近的右下角的像素的权重,FIi+1,Ij+1表示距离闪光灯条件下拍摄的图像像素最近的右下角的像素的像素值。where R i,j represents the pixel value of the image captured under the registered flash condition, i represents the column coordinate of the image pixel captured under the registered flash condition, and j represents the image captured under the registered flash condition The row coordinates of the pixel, α 1 represents the weight of the pixel in the upper left corner closest to the image pixel captured under the flash condition, F Ii, Ij represents the pixel value of the pixel in the upper left corner closest to the image pixel captured under the flash condition, and Ii represents The integer part of the column coordinates of the image pixel captured under the flash light condition, Ij represents the integer part of the row coordinates of the image pixel captured under the flash light condition, α2 represents the weight of the pixel in the lower left corner closest to the image pixel captured under the flash light condition, F Ii,Ij+1 represents the pixel value of the pixel in the lower left corner closest to the image pixel captured under the flash condition, α 3 represents the weight of the pixel in the upper right corner closest to the image pixel captured under the flash condition, F Ii+1, Ij represents the pixel value of the pixel in the upper right corner closest to the image pixel captured under the flash condition, α 4 represents the weight of the pixel in the lower right corner closest to the image pixel captured under the flash condition, F Ii+1, Ij+1 represents the distance The pixel value of the nearest bottom right pixel to the image pixel taken under flash conditions.
与现有的技术相比,本发明具有以下优点:Compared with the prior art, the present invention has the following advantages:
第一,由于本发明在夜间拍摄的待配准图像配准前采用直方图均衡化预处理方法,克服了现有技术存在的对光照强度变化很大的待配准图像提取的特征点过少的不足,使得本发明具有能够检测出更多的特征点,提高配准精度的优点。First, because the present invention adopts the histogram equalization preprocessing method before the registration of the image to be registered that is shot at night, it overcomes the problem of the prior art that there are too few feature points extracted for the image to be registered that varies greatly in light intensity Insufficiency of the method makes the present invention have the advantages of being able to detect more feature points and improve registration accuracy.
第二,由于本发明利用特征点匹配对的列坐标和行坐标的标准差信息,设定特征点匹配对是否集中的判断条件,克服了现有技术存在的不能有效处理特征点匹配对过于集中的情形的不足,使得本发明具有能够判断匹配对是否过于集中,然后进行特征点均衡化处理,提高配准精度的优点。Second, because the present invention uses the standard deviation information of the column coordinates and row coordinates of the feature point matching pairs to set the judging conditions for whether the feature point matching pairs are concentrated, it overcomes the inability to effectively deal with the excessive concentration of feature point matching pairs in the prior art Due to the shortcomings of the situation, the present invention has the advantage of being able to judge whether the matching pairs are too concentrated, and then perform feature point equalization processing to improve registration accuracy.
第三,由于本发明能够根据已检测出的特征点匹配对的位置信息,对特征点匹配对均衡化处理,克服了现有技术存在的对光照强度变化很大的待配准图像提取的特征点过于集中的不足,使得本发明具有避免求解仿射变换矩阵时出现过拟合的问题,提高配准精度的优点。Third, because the present invention can equalize the matching pair of feature points according to the position information of the detected matching pair of feature points, it overcomes the feature extraction of images to be registered that vary greatly in light intensity in the prior art. The problem of too concentrated points makes the present invention have the advantages of avoiding the problem of over-fitting when solving the affine transformation matrix and improving the registration accuracy.
附图说明Description of drawings
图1为本发明的流程图;Fig. 1 is a flowchart of the present invention;
图2为本发明的仿真图。Fig. 2 is a simulation diagram of the present invention.
具体实施方式detailed description
下面结合附图对本发明作进一步的详细描述。The present invention will be described in further detail below in conjunction with the accompanying drawings.
参照附图1,对本发明实现的步骤作进一步的详细描述:With reference to accompanying drawing 1, the step that the present invention realizes is described in further detail:
步骤1,输入待配准图像。Step 1, input the image to be registered.
分别输入待配准的一幅在有闪光灯和一幅在无闪光灯条件下拍摄的图像。Input one image taken with flash and one without flash to be registered.
步骤2,图像灰度化。Step 2, image grayscale.
按照下式,分别对待配准的闪光灯条件下和无闪光灯条件下拍摄的图像进行灰度化:According to the following formula, the images taken under the conditions of the flash light and without the flash light to be registered are respectively grayscaled:
其中,Yi表示待配准的闪光灯条件下和无闪光灯条件下拍摄的图像中第i个像素的灰度值,i表示待配准的闪光灯条件下和无闪光灯条件下拍摄的图像的像素点的序号,B、G、R分别表示待配准的闪光灯条件下和无闪光灯条件下拍摄的图像的蓝、绿、红通道,Bi表示待配准的闪光灯条件下和无闪光灯条件下拍摄的图像的第i个像素的蓝通道,Gi表示待配准的闪光灯条件下和无闪光灯条件下拍摄的图像的第i个像素的绿通道,Ri表示待配准的闪光灯条件下和无闪光灯条件下拍摄的图像的第i个像素的红通道。Among them, Y i represents the gray value of the i-th pixel in the image taken under the condition of the flash light and without the flash light to be registered, and i represents the pixel point of the image shot under the condition of the flash light and without the flash light to be registered B, G, and R represent the blue, green, and red channels of the images taken under the condition of the flash light and without the flash light to be registered respectively, and B i represent the channels of the images shot under the condition of the flash light to be registered and without the flash light The blue channel of the i-th pixel of the image, G i represents the green channel of the i-th pixel of the image to be registered under the flash condition and no flash condition, and R i represents the flash condition and no flash condition to be registered The red channel of the i-th pixel of the image captured under the condition.
步骤3,直方图均衡化。Step 3, histogram equalization.
按照下式,分别对待配准的闪光灯条件下和无闪光灯条件下拍摄的图像进行直方图均衡化:According to the following formula, the histogram equalization is performed on the images taken under the condition of the flash light and without the flash light to be registered respectively:
sx=int[(L-1)*px+0.5];s x = int[(L-1)*p x +0.5];
其中,px表示亮度通道矩阵的最终灰度级出现的概率值的累加和,x表示亮度通道矩阵的灰度值,x的取值范围为0~255,∑表示求和操作,f表示亮度通道矩阵的灰度级,f=0,1,2,...,x,g(f)表示亮度通道矩阵的最终灰度级出现的概率值,sx表示直方图均衡化后亮度通道矩阵中灰度值x的映射值,int表示取整操作,L表示亮度通道矩阵灰度级的最大值。Among them, p x represents the cumulative sum of the probability values of the final gray level of the brightness channel matrix, x represents the gray value of the brightness channel matrix, and the value range of x is 0 to 255, ∑ represents the summation operation, and f represents the brightness The gray level of the channel matrix, f=0,1,2,...,x, g(f) represents the probability value of the final gray level of the brightness channel matrix, and s x represents the brightness channel matrix after histogram equalization The mapping value of the middle gray value x, int means the rounding operation, L means the maximum value of the gray level of the brightness channel matrix.
步骤4,检测特征点。Step 4, detect feature points.
对待配准的闪光灯条件下和无闪光灯条件下拍摄的图像,用不同尺度的高斯滤波器进行滤波得到的图像形成一个子八度octave;以此类推,对待配准的闪光灯条件下和无闪光灯条件下拍摄的图像分别进行一次,两次,三次下采样,并进行类似的滤波操作,得到高斯金字塔图层,将相邻的图层相减,得到差分高斯金字塔。Images taken under the conditions of the flash light and no flash light to be registered, the images obtained by filtering with Gaussian filters of different scales form a sub-octave octave; The images taken below are down-sampled once, twice, and three times, and similar filtering operations are performed to obtain a Gaussian pyramid layer, and the adjacent layers are subtracted to obtain a differential Gaussian pyramid.
在差分高斯金字塔中,比较中间图层上像素点与其相同尺度图层的8个相邻像素点大小,以及该像素点与其上下相邻尺度图层的18个相邻像素点的大小,如果中间图层上像素点的值是最大值或者是最小值,则将该像素点作为候选的特征点。In the differential Gaussian pyramid, compare the size of the pixel on the middle layer with the 8 adjacent pixels of the same scale layer, and the size of the 18 adjacent pixels of the pixel and its upper and lower adjacent scale layers, if the middle If the value of the pixel point on the layer is the maximum value or the minimum value, then the pixel point is used as a candidate feature point.
按照下述方法,去除对噪声敏感的低对比度的候选特征点和具有不稳定边缘响应的候选特征点,剩余的是最终的特征点。According to the following method, the low-contrast candidate feature points that are sensitive to noise and the candidate feature points with unstable edge responses are removed, and the remaining feature points are the final feature points.
去除对噪声敏感的低对比度的候选特征点的方法如下。The method of removing low-contrast candidate feature points that are sensitive to noise is as follows.
第一步:按照下式,计算亚像素级精度的特征点位置:Step 1: Calculate the feature point position with sub-pixel precision according to the following formula:
其中,X′表示达到亚像素级精度的特征点的位置,D表示差分高斯DOG空间,X表示特征点位置。Among them, X' represents the position of the feature point with sub-pixel precision, D represents the difference Gaussian DOG space, and X represents the position of the feature point.
第二步:按照下式,计算差分高斯空间在亚像素级精度的特征点位置上的值:Step 2: According to the following formula, calculate the value of the difference Gaussian space at the position of the feature point with sub-pixel precision:
其中,D(X′)表示差分高斯空间在亚像素级精度的特征点位置上的值,D(X)表示差分高斯空间在特征点位置上的值,D表示差分高斯DOG空间,X表示特征点位置。Among them, D(X′) represents the value of the differential Gaussian space at the position of the feature point with sub-pixel precision, D(X) represents the value of the differential Gaussian space at the position of the feature point, D represents the differential Gaussian DOG space, and X represents the feature point location.
第三步:保留满足|D(X′)|≥0.03条件的特征点,剔除不满足该条件的特征点。The third step: retain the feature points that satisfy the condition of |D(X′)|≥0.03, and eliminate the feature points that do not meet the condition.
去除具有不稳定的边缘响应的候选特征点的方法如下。The method of removing candidate feature points with unstable marginal responses is as follows.
第一步:按照下式,计算海森Hessian矩阵:Step 1: Calculate the Hessian matrix according to the following formula:
其中,H表示差分高斯空间的局部曲率矩阵,Dxx表示差分高斯空间在候选的特征点的列方向上的二阶偏导,Dxy表示差分高斯空间在候选的特征点的列方向和行方向上的二阶偏导,Dyy表示差分高斯空间在候选的特征点的行方向上的二阶偏导,x表示候选的特征点的列号,y表示候选的特征点的行号。Among them, H represents the local curvature matrix of the differential Gaussian space, D xx represents the second-order partial derivative of the differential Gaussian space in the column direction of the candidate feature point, D xy represents the differential Gaussian space in the column direction and row direction of the candidate feature point The second-order partial derivative of D yy represents the second-order partial derivative of the differential Gaussian space in the row direction of the candidate feature point, x represents the column number of the candidate feature point, and y represents the row number of the candidate feature point.
第二步:按照下式,计算海森Hessian矩阵H的大特征值和小特征值的比值:Step 2: According to the following formula, calculate the ratio of the large eigenvalue to the small eigenvalue of the Hessian matrix H:
其中,r表示海森Hessian矩阵H的大特征值和小特征值的比值,α表示海森Hessian矩阵H的大特征值,β表示海森Hessian矩阵H的小特征值。Among them, r represents the ratio of the large eigenvalue to the small eigenvalue of the Hessian matrix H, α represents the large eigenvalue of the Hessian matrix H, and β represents the small eigenvalue of the Hessian matrix H.
第三步:判断海森矩阵Hessian是否满足以下条件:Step 3: Determine whether the Hessian matrix Hessian satisfies the following conditions:
其中,Tr(H)表示海森Hessian矩阵H的迹,Det(H)表示海森Hessian矩阵H的行列式,r表示海森Hessian矩阵H的大特征值和小特征值的比值。Among them, Tr(H) represents the trace of the Hessian matrix H, Det(H) represents the determinant of the Hessian matrix H, and r represents the ratio of the large and small eigenvalues of the Hessian matrix H.
第四步:保留满足上述条件的候选的特征点,剔除不满足该条件的候选特征点。Step 4: Keep the candidate feature points that meet the above conditions, and eliminate the candidate feature points that do not meet the conditions.
按照下式,计算以最终特征点为中心邻域像素的梯度方向,并用直方图表示,直方图的峰值表示最终特征点的邻域像素梯度的主方向,将该邻域像素梯度的主方向作为该最终特征点的方向:According to the following formula, calculate the gradient direction of the neighborhood pixel with the final feature point as the center, and express it in a histogram. The peak value of the histogram represents the main direction of the gradient of the neighborhood pixel of the final feature point, and take the main direction of the neighborhood pixel gradient as The orientation of this final feature point:
其中,m(x,y)表示邻域像素的梯度的模值,L(x+1,y)表示邻域像素右边像素在高斯空间的值,L(x-1,y)表示邻域像素左边像素在高斯空间的值,L(x,y+1)表示邻域像素下边像素在高斯空间的值,L(x,y-1)表示邻域像素上边像素在高斯空间的值,x表示邻域像素的列号,y表示邻域像素的行号,θ(x,y)表示邻域像素的梯度的方向,arctan表示反正切操作。Among them, m(x,y) represents the modulus value of the gradient of the neighboring pixel, L(x+1,y) represents the value of the pixel on the right side of the neighboring pixel in Gaussian space, and L(x-1,y) represents the neighboring pixel The value of the pixel on the left in Gaussian space, L(x,y+1) represents the value of the pixel below the neighboring pixel in Gaussian space, L(x,y-1) represents the value of the pixel above the neighboring pixel in Gaussian space, x represents The column number of the neighboring pixel, y represents the row number of the neighboring pixel, θ(x, y) represents the direction of the gradient of the neighboring pixel, and arctan represents the arctangent operation.
以最终特征点为中心,选择16×16的邻域,并将该邻域划分为16个4×4的子区域,在每个子区域上计算0°,45°,135°,180°,225°,270°,315°,360°共8个方向上的梯度累加值,可生成128维的特征向量。With the final feature point as the center, select a 16×16 neighborhood, and divide the neighborhood into 16 4×4 sub-regions, and calculate 0°, 45°, 135°, 180°, 225° on each sub-region °, 270°, 315°, and 360°, the cumulative gradient values in 8 directions can generate a 128-dimensional feature vector.
步骤5,匹配特征点。Step 5, matching feature points.
对于闪光灯条件下拍摄的图像中的每一个最终特征点,利用欧氏距离找到无闪光灯条件下拍摄的图像中与闪光灯条件下拍摄的图像的最终特征点最近的两个特征点,在这两个特征点中,如果最近的距离与次最近的距离的比值小于0.4,则闪光灯条件下拍摄的图像的最终特征点与无闪光灯条件下拍摄的图像中的距离最近的点匹配,否则不匹配。For each final feature point in the image taken under the flash condition, use the Euclidean distance to find the two feature points closest to the final feature point of the image taken under the flash condition in the image taken without the flash condition. Among the feature points, if the ratio of the closest distance to the next closest distance is less than 0.4, the final feature point of the image taken under the flash condition matches the nearest point in the image taken without the flash condition, otherwise it does not match.
步骤6,利用下述随机抽样一致RANSAC算法,剔除误特征点匹配对。Step 6, use the following random sampling consistent RANSAC algorithm to eliminate false feature point matching pairs.
第一步:从特征点匹配对集合中随机选取4个特征点匹配对。Step 1: Randomly select 4 feature point matching pairs from the set of feature point matching pairs.
第二步:根据所选取的4个特征点匹配对列出方程组,求解方程组,得到仿射变换矩阵。The second step: List the equations according to the selected four matching pairs of feature points, and solve the equations to obtain the affine transformation matrix.
第三步:根据仿射变换矩阵和欧式距离误差度量函数,从特征点匹配对集合中寻找满足当前仿射变换矩阵的一致集Consensus。Step 3: According to the affine transformation matrix and the Euclidean distance error metric function, search for a consensus set that satisfies the current affine transformation matrix from the feature point matching pair set.
第四步:判断当前一致集中元素的个数是否大于最优一致集中元素的个数,若是,将当前一致集更新为最优一致集,否则,保持原来的最优一致集。Step 4: Determine whether the number of elements in the current consistent set is greater than the number of elements in the optimal consistent set. If so, update the current consistent set to the optimal consistent set; otherwise, keep the original optimal consistent set.
第五步:更新当前错误概率P。Step 5: Update the current error probability P.
第六步:判断更新后的错误概率P是否大于允许的最小错误概率,若是,执行第一步,否则,将最优一致集作为最终的特征点匹配对。Step 6: Determine whether the updated error probability P is greater than the allowable minimum error probability, if so, perform the first step, otherwise, use the optimal consistent set as the final feature point matching pair.
步骤7,判断闪光灯条件下拍摄的图像的特征点是否满足下述判断条件,若是,执行步骤(8),否则,执行步骤(9)。Step 7, judging whether the feature points of the image captured under the condition of the flash lamp meet the following judging conditions, if so, go to step (8), otherwise, go to step (9).
其中,Vx表示闪光灯条件下拍摄的图像的特征点列坐标偏离平均值的程度,W表示闪光灯条件下拍摄的图像的宽,Vy表示闪光灯条件下拍摄的图像的特征点行坐标偏离平均值的程度,H表示闪光灯条件下拍摄的图像的高。Among them, V x represents the degree to which the column coordinates of the feature points of the image captured under the flash light condition deviate from the average value, W represents the width of the image captured under the flash light condition, and V y represents the deviation of the feature point row coordinates of the image captured under the flash light condition from the average value The degree, H indicates the high of the image captured under the flash condition.
步骤8,特征点匹配对均衡化。Step 8, feature point matching pair equalization.
按照下式,计算待配准的闪光灯条件下和无闪光灯条件下拍摄的图像的特征点匹配对在列方向和行方向的平均偏移量:According to the following formula, calculate the average offset of the feature point matching pairs in the column direction and the row direction of the images taken under the flashlight condition and without the flashlight condition to be registered:
其中,Δx表示待配准的闪光灯条件下和无闪光灯条件下拍摄的图像的特征点匹配对在列方向上的平均偏移量,x表示待配准的闪光灯条件下和无闪光灯条件下拍摄的图像的特征点的列方向,n表示待配准的闪光灯条件下和无闪光灯条件下拍摄的图像的特征点匹配对的总数,i表示待配准的闪光灯条件下和无闪光灯条件下拍摄的图像的特征点匹配对的序号,表示第i个待配准的闪光灯条件下和无闪光灯条件下拍摄的图像的特征点匹配对中闪光灯条件下拍摄图像的特征点列坐标,表示第i个待配准的闪光灯条件下和无闪光灯条件下拍摄的图像的特征点匹配对中无闪光灯条件下拍摄图像的特征点列坐标,Δy表示待配准的闪光灯条件下和无闪光灯条件下拍摄的图像的特征点匹配对在行方向上的平均偏移量,y表示待配准的闪光灯条件下和无闪光灯条件下拍摄的图像的特征点的行方向,表示第i个待配准的闪光灯条件下和无闪光灯条件下拍摄的图像的特征点匹配对中闪光灯条件下拍摄图像的特征点的行坐标,表示第i个待配准的闪光灯条件下和无闪光灯条件下拍摄的图像的特征点匹配对中无闪光灯条件下拍摄图像的特征点的行坐标。Among them, Δx represents the average offset of the matching pairs of feature points in the column direction of the image to be registered under the flash condition and without the flash condition, and x represents the image taken under the flash condition and without the flash condition to be registered The column direction of the feature points of the image, n represents the total number of matching pairs of feature points of the image to be registered under the condition of the flash and without the flash, i represents the number of matching pairs of the feature points of the image to be registered under the condition of the flash and without the flash The serial number of the feature point matching pair of the image, Indicates that the feature points of the i-th image to be registered under the condition of the flashlight and the image taken without the flashlight match the column coordinates of the feature points of the image taken under the condition of the flashlight, Indicates the feature point column coordinates of the i -th image to be registered under the condition of the flashlight and without the flashlight in the matching pair of feature points of the image taken under the condition of the flashlight without the flashlight, Δy represents the condition of the flashlight to be registered and without the flashlight The average offset of the feature point matching pairs in the row direction of the image taken under the condition of Represents the row coordinates of the feature points of the i-th image to be registered under the condition of the flashlight and the image taken under the condition of no flashlight matching the feature points of the image taken under the condition of the flashlight, Indicates the row coordinates of the feature points of the i-th to-be-registered image captured under the flash condition and without the flash condition in the matching pair.
按照下式,将待配准的闪光灯条件下拍摄的图像分成M×M的相同大小的子块:According to the following formula, the image taken under the flashlight condition to be registered is divided into M×M sub-blocks of the same size:
其中,HW表示子块的宽度,表示向下取整操作,W表示闪光灯条件下拍摄的图像的宽度,M表示闪光灯下拍摄的图像每一行的子块个数,HH表示子块的高度,H表示闪光灯条件下拍摄的图像的高度。Among them, HW represents the width of the sub-block, Represents the rounding down operation, W represents the width of the image captured under the flash condition, M represents the number of sub-blocks in each row of the image captured under the flash light, HH represents the height of the sub-block, and H represents the height of the image captured under the flash condition .
按照下式,计算闪光灯下拍摄的图像拟添加的特征点的行坐标和列坐标:According to the following formula, calculate the row coordinates and column coordinates of the feature points to be added to the image taken under the flashlight:
其中,表示拟添加的特征点的列坐标,x表示拟添加特征点的列方向,k表示闪光灯条件下拍摄的图像内拟添加的特征点的序号,k=(i×M+j)×N×N+i1×N+j1,i表示相同大小的子块对应的行的编号,i=0,1,2,...,M-1,i1表示子块内拟添加的特征点对应的行的编号,i1=0,1,2,...,N-1,j表示相同大小的子块的对应的列的编号,j=0,1,2,...,M-1,j1表示子块内拟添加的特征点的对应的列的编号,j1=0,1,2,...,N-1,HW表示子块的宽度,Dx表示拟添加的特征点之间的列方向的距离,W表示闪光灯条件下拍摄的图像的宽度,M表示闪光灯下拍摄的图像每一行的子块个数,N表示闪光灯下拍摄的图像的每个子块每一行添加的特征点个数,表示拟添加的特征点的行坐标,y表示拟添加的特征点的行方向,HH表示子块的高度,Dy表示拟添加的特征点之间的行方向的距离,H表示闪光灯条件下拍摄的图像的高度,H表示闪光灯条件下拍摄的图像的高度,M表示闪光灯下拍摄的图像每一行的子块个数,N表示闪光灯下拍摄的图像的每个子块每一行添加的特征点个数。in, Represents the column coordinates of the feature points to be added, x represents the column direction of the feature points to be added, k represents the sequence number of the feature points to be added in the image taken under flash conditions, k=(i×M+j)×N×N +i1×N+j1, i represents the number of the row corresponding to the sub-block of the same size, i=0,1,2,...,M-1, i1 represents the row corresponding to the feature point to be added in the sub-block Number, i1=0,1,2,...,N-1, j represents the number of the corresponding column of the sub-block of the same size, j=0,1,2,...,M-1, j1 represents The number of the corresponding column of the feature point to be added in the sub-block, j1=0,1,2,...,N-1, HW indicates the width of the sub-block, D x indicates the column between the feature points to be added direction distance, W represents the width of the image captured under the flashlight condition, M represents the number of subblocks in each row of the image captured under the flashlight, and N represents the number of feature points added to each row of each subblock of the image captured under the flashlight, Represents the row coordinates of the feature points to be added, y represents the row direction of the feature points to be added, HH represents the height of the sub-block, D y represents the distance in the row direction between the feature points to be added, and H represents the shooting under flash conditions the height of the image, H represents the height of the image captured under the flashlight condition, M represents the number of sub-blocks in each row of the image captured under the flashlight, and N represents the number of feature points added to each row of each sub-block in the image captured under the flashlight.
按照下式,计算无闪光灯条件下拍摄的图像拟添加的特征点的列坐标和行坐标:According to the following formula, calculate the column coordinates and row coordinates of the feature points to be added to the image taken under the condition of no flash:
其中,表示无闪光灯条件下拍摄的图像拟添加的特征点的列坐标,x表示拟添加特征点的列方向,k表示拟添加的特征点的序号,表示闪光灯条件下拍摄的图像拟添加的特征点的列坐标,Δx表示待配准的闪光灯条件下和无闪光灯条件下拍摄的图像的特征点匹配对在列方向上的平均偏移量,表示无闪光灯条件下拍摄的图像拟添加的特征点的行坐标,表示闪光灯条件下拍摄的图像拟添加的特征点的行坐标,Δy表示待配准的闪光灯条件下和无闪光灯条件下拍摄的图像的特征点匹配对在行方向上的平均偏移量。in, Represents the column coordinates of the feature points to be added to the image taken under the condition of no flash, x represents the column direction of the feature points to be added, k represents the serial number of the feature points to be added, Indicates the column coordinates of the feature points to be added to the images captured under flash conditions, Δx represents the average offset in the column direction of the matching pairs of feature points of images captured under flash conditions and without flash conditions, Indicates the row coordinates of the feature points to be added to the image taken under the condition of no flashlight, Indicates the row coordinates of the feature points to be added to images captured under flash conditions, and Δy represents the average offset in the row direction of the feature point matching pairs of images captured under flash conditions and without flash conditions to be registered.
步骤9,利用步骤(6)和步骤(8)得到的特征点匹配对列出方程,求解方程组,得到仿射变换矩阵H。Step 9, use the matching pairs of feature points obtained in step (6) and step (8) to list equations, solve the equation system, and obtain the affine transformation matrix H.
步骤10,配准图像。Step 10, register images.
按照下式,计算配准后的闪光灯条件下拍摄的图像的位置(i,j)的像素,经过映射之后对应的闪光灯条件下拍摄的图像的位置:According to the following formula, calculate the pixel of the position (i, j) of the image captured under the flash light condition after registration, and the corresponding position of the image captured under the flash light condition after mapping:
其中,i'表示闪光灯条件下拍摄的图像像素的列坐标,H-1 1,1表示仿射变换矩阵的逆矩阵的第一行第一列元素,H-1 1,2表示仿射变换矩阵的逆矩阵的第一行第二列元素,H-1 1,3表示仿射变换矩阵的逆矩阵的第一行第三列元素,H-1 2,1表示仿射变换矩阵的逆矩阵的第二行第一列元素,H-1 2,2表示仿射变换矩阵的逆矩阵的第二行第二列元素,H-1 2,3表示仿射变换矩阵的逆矩阵的第二行第三列元素,H-1 3,1表示仿射变换矩阵的逆矩阵的第三行第一列元素,H-1 3,2表示仿射变换矩阵的逆矩阵的第三行第二列元素,H-1 3,3表示仿射变换矩阵的逆矩阵的第三行第三列元素,i表示配准后的闪光灯条件下拍摄的图像像素的列坐标,j表示配准后的闪光灯条件下拍摄的图像像素的行坐标,j'表示闪光灯条件下拍摄的图像像素的行坐标。Among them, i' represents the column coordinates of the image pixels taken under the condition of flashlight, H -1 1,1 represents the first row and first column element of the inverse matrix of the affine transformation matrix, H -1 1,2 represents the affine transformation matrix The element in the first row and the second column of the inverse matrix, H -1 1,3 means the element in the first row and the third column of the inverse matrix of the affine transformation matrix, H -1 2,1 means the inverse matrix of the affine transformation matrix The element in the first column of the second row, H -1 2,2 means the element in the second row and the second column of the inverse matrix of the affine transformation matrix, H -1 2,3 means the second row and the second column of the inverse matrix of the affine transformation matrix Three columns of elements, H -1 3,1 represents the third row and first column element of the inverse matrix of the affine transformation matrix, H -1 3,2 represents the third row and second column element of the inverse matrix of the affine transformation matrix, H -1 3,3 represents the third row and third column element of the inverse matrix of the affine transformation matrix, i represents the column coordinates of the image pixels captured under the flashlight condition after registration, and j represents the shooting under the flashlight condition after registration The row coordinates of the image pixels, j' represents the row coordinates of the image pixels captured under flash conditions.
按照下式,计算配准后的闪光灯条件下拍摄的图像的位置(i,j)像素的像素值:According to the following formula, the pixel value of the pixel at position (i, j) of the image taken under the condition of the flash light after registration is calculated:
Ri,j=α1×FIi,Ij+α2×FIi,Ij+1+α3×FIi+1,Ij+α4×FIi+1,Ij+1;R i,j =α 1 ×F Ii,Ij +α 2 ×F Ii,Ij+1 +α 3 ×F Ii+1,Ij +α 4 ×F Ii+1,Ij+1 ;
其中,Ri,j表示配准后的闪光灯条件下拍摄的图像的像素值,i表示配准后的闪光灯条件下拍摄的图像像素的列坐标,j表示配准后的闪光灯条件下拍摄的图像像素的行坐标,α1表示距离闪光灯条件下拍摄的图像像素最近的左上角的像素的权重,FIi,Ij表示距离闪光灯条件下拍摄的图像像素最近的左上角的像素的像素值,Ii表示闪光灯条件下拍摄的图像像素的列坐标的整数部分,Ij表示闪光灯条件下拍摄的图像像素的行坐标的整数部分,α2表示距离闪光灯条件下拍摄的图像像素最近的左下角的像素的权重,FIi,Ij+1表示距离闪光灯条件下拍摄的图像像素最近的左下角的像素的像素值,α3表示距离闪光灯条件下拍摄的图像像素最近的右上角的像素的权重,FIi+1,Ij表示距离闪光灯条件下拍摄的图像像素最近的右上角的像素的像素值,α4表示距离闪光灯条件下拍摄的图像像素最近的右下角的像素的权重,FIi+1,Ij+1表示距离闪光灯条件下拍摄的图像像素最近的右下角的像素的像素值。where R i,j represents the pixel value of the image captured under the registered flash condition, i represents the column coordinate of the image pixel captured under the registered flash condition, and j represents the image captured under the registered flash condition The row coordinates of the pixel, α 1 represents the weight of the pixel in the upper left corner closest to the image pixel captured under the flash condition, F Ii, Ij represents the pixel value of the pixel in the upper left corner closest to the image pixel captured under the flash condition, and Ii represents The integer part of the column coordinates of the image pixel captured under the flash light condition, Ij represents the integer part of the row coordinates of the image pixel captured under the flash light condition, α2 represents the weight of the pixel in the lower left corner closest to the image pixel captured under the flash light condition, F Ii,Ij+1 represents the pixel value of the pixel in the lower left corner closest to the image pixel captured under the flash condition, α 3 represents the weight of the pixel in the upper right corner closest to the image pixel captured under the flash condition, F Ii+1, Ij represents the pixel value of the pixel in the upper right corner closest to the image pixel captured under the flash condition, α 4 represents the weight of the pixel in the lower right corner closest to the image pixel captured under the flash condition, F Ii+1, Ij+1 represents the distance The pixel value of the nearest bottom right pixel to the image pixel taken under flash conditions.
下面结合附图2对本发明的仿真效果做进一步说明。The simulation effect of the present invention will be further described in conjunction with accompanying drawing 2 below.
1.仿真数据:1. Simulation data:
仿真所使用待处理的测试图像是连续拍摄的一帧开闪光灯图像和一帧不开闪光灯图像,图像大小为5312×2988,图像具有R、G、B三个颜色通道,每个通道等级为256。The test images to be processed used in the simulation are one frame of images with the flash on and one frame without the flash. The size of the image is 5312×2988. The image has three color channels of R, G, and B, and the level of each channel is 256 .
2.仿真结果与分析:2. Simulation results and analysis:
附图2是本发明的仿真结果图,其中,附图2(a)为待配准的开闪光灯下拍摄的照片;附图2(b)为作为参考帧的不开闪光灯下拍摄的照片;附图2(c)为传统的SIFT算法配准后两帧融合的效果图;附图2(d)为本发明配准后两帧融合的效果图。Accompanying drawing 2 is the simulation result figure of the present invention, and wherein, accompanying drawing 2 (a) is the photo taken under the open flashlight to be registered; Accompanying drawing 2 (b) is the photo taken under the non-open flashlight as reference frame; Accompanying drawing 2 (c) is the effect diagram of fusion of two frames after traditional SIFT algorithm registration; Accompanying drawing 2 (d) is the effect diagram of fusion of two frames after registration of the present invention.
对比附图2中的四幅子图,可以看出用传统的SIFT算法配准后融合的效果图中楼层里的灯光出现了重影现象、左边二楼的窗户之间的竖条间隔出现了断开的现象以及楼下的小车有虚影。而本发明利用直方图均衡的预处理步骤能够使检测出的匹配对大大增加,采用自适应的匹配对添加的算法能解决局部过拟合的问题,从而有效地解决了上述的重影问题。Comparing the four sub-pictures in Attachment 2, it can be seen that the lights on the floors in the fusion effect picture after registration and fusion using the traditional SIFT algorithm appear ghosting, and the vertical bars between the windows on the second floor on the left appear broken. The phenomenon of driving and the car downstairs have ghosts. However, the present invention uses the preprocessing step of histogram equalization to greatly increase the number of detected matching pairs, and adopts the algorithm of adaptive matching pair addition to solve the problem of local overfitting, thereby effectively solving the above-mentioned ghosting problem.
综上所述,可以看出本发明能够提升闪光灯下拍摄的照片和不闪光灯下拍摄的照片的配准准确度,克服了一般SIFT算法应用于上述情形下会出现重影的问题。In summary, it can be seen that the present invention can improve the registration accuracy of photos taken under flashlight and photos taken without flashlight, and overcome the problem of ghosting when the general SIFT algorithm is applied to the above situation.
Claims (6)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510155826.XA CN104766319B (en) | 2015-04-02 | 2015-04-02 | Lifting night takes pictures the method for image registration accuracy |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510155826.XA CN104766319B (en) | 2015-04-02 | 2015-04-02 | Lifting night takes pictures the method for image registration accuracy |
Publications (2)
Publication Number | Publication Date |
---|---|
CN104766319A CN104766319A (en) | 2015-07-08 |
CN104766319B true CN104766319B (en) | 2017-06-13 |
Family
ID=53648128
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510155826.XA Expired - Fee Related CN104766319B (en) | 2015-04-02 | 2015-04-02 | Lifting night takes pictures the method for image registration accuracy |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104766319B (en) |
Families Citing this family (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105718852A (en) * | 2015-11-24 | 2016-06-29 | 深圳芯启航科技有限公司 | Fingerprint image processing method and apparatus |
CN105844630B (en) * | 2016-03-21 | 2018-11-16 | 西安电子科技大学 | A kind of image super-resolution fusion denoising method of binocular vision |
CN106356757B (en) * | 2016-08-11 | 2018-03-20 | 河海大学常州校区 | A kind of power circuit unmanned plane method for inspecting based on human-eye visual characteristic |
CN106898018B (en) * | 2017-01-22 | 2020-05-08 | 武汉秀宝软件有限公司 | Image continuous matching method and system |
CN108680900A (en) * | 2018-05-21 | 2018-10-19 | 武汉科技大学 | A kind of ESPRIT sound localization methods based on RANSAC |
CN109858479B (en) * | 2018-07-10 | 2022-11-18 | 上海其高电子科技有限公司 | Image Registration Based Motor Vehicle Illegal Horn Capture System |
CN112220448B (en) * | 2020-10-14 | 2022-04-22 | 北京鹰瞳科技发展股份有限公司 | Fundus camera and fundus image synthesis method |
CN112907486B (en) * | 2021-03-18 | 2022-12-09 | 国家海洋信息中心 | A remote sensing image color correction method based on deep learning and color mapping |
CN119559226B (en) * | 2024-10-28 | 2025-09-19 | 太原理工大学 | Multi-mode remote sensing image registration method based on co-occurrence filtering and directional gradient histogram |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP1736928A1 (en) * | 2005-06-20 | 2006-12-27 | Mitsubishi Electric Information Technology Centre Europe B.V. | Robust image registration |
CN103839253A (en) * | 2013-11-21 | 2014-06-04 | 苏州盛景空间信息技术有限公司 | Arbitrary point matching method based on partial affine transformation |
CN104166967A (en) * | 2014-08-15 | 2014-11-26 | 西安电子科技大学 | Method for improving definition of video image |
CN104463775A (en) * | 2014-10-31 | 2015-03-25 | 小米科技有限责任公司 | Device and method for achieving depth-of-field effect of image |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9147260B2 (en) * | 2010-12-20 | 2015-09-29 | International Business Machines Corporation | Detection and tracking of moving objects |
-
2015
- 2015-04-02 CN CN201510155826.XA patent/CN104766319B/en not_active Expired - Fee Related
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP1736928A1 (en) * | 2005-06-20 | 2006-12-27 | Mitsubishi Electric Information Technology Centre Europe B.V. | Robust image registration |
CN103839253A (en) * | 2013-11-21 | 2014-06-04 | 苏州盛景空间信息技术有限公司 | Arbitrary point matching method based on partial affine transformation |
CN104166967A (en) * | 2014-08-15 | 2014-11-26 | 西安电子科技大学 | Method for improving definition of video image |
CN104463775A (en) * | 2014-10-31 | 2015-03-25 | 小米科技有限责任公司 | Device and method for achieving depth-of-field effect of image |
Non-Patent Citations (3)
Title |
---|
Registration Algorithm of Panchromatic and Multi-Spectral Images Based on SIFT and RANSAC;Li Ailing 等;《Photonics and Optoelectronics(SOPO)》;20120523;第1-4页 * |
分辨率差异较大的遥感图像自动配准算法研究;郎博 等;《影像技术》;20140815;第48-50页 * |
基于改进SIFT算法的视频图像序列自动拼接;卢斌 等;《测绘科学》;20130131;第38卷(第1期);第23-25页 * |
Also Published As
Publication number | Publication date |
---|---|
CN104766319A (en) | 2015-07-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104766319B (en) | Lifting night takes pictures the method for image registration accuracy | |
CN107230202B (en) | Method and system for automatic identification of pavement disease images | |
CN107545239B (en) | Fake plate detection method based on license plate recognition and vehicle characteristic matching | |
CN106683119B (en) | Moving vehicle detection method based on aerial video image | |
CN106934795B (en) | A kind of automatic testing method and prediction technique of glue into concrete beam cracks | |
KR101403876B1 (en) | Method and Apparatus for Vehicle License Plate Recognition | |
WO2023273375A1 (en) | Lane line detection method combined with image enhancement and deep convolutional neural network | |
CN103927526B (en) | Vehicle detection method based on Gaussian difference multi-scale edge fusion | |
CN112488046B (en) | A lane line extraction method based on high-resolution UAV images | |
CN107169985A (en) | A kind of moving target detecting method based on symmetrical inter-frame difference and context update | |
CN108229319A (en) | The ship video detecting method merged based on frame difference with convolutional neural networks | |
CN111462022B (en) | Underwater image sharpness enhancement method | |
CN107154017A (en) | A kind of image split-joint method based on SIFT feature Point matching | |
CN111209858A (en) | A real-time license plate detection method based on deep convolutional neural network | |
CN107909085A (en) | A kind of characteristics of image Angular Point Extracting Method based on Harris operators | |
CN104408728A (en) | Method for detecting forged images based on noise estimation | |
CN116977316A (en) | Full-field detection and quantitative evaluation method for damage defects of complex-shape component | |
CN105335949A (en) | Video image rain removal method and system | |
CN100428280C (en) | A Radiation Reprocessing Method of DMC Color Synthetic Image | |
CN106952236B (en) | Fisheye lens shot image distortion correction method based on BP neural network | |
CN101216893B (en) | Video Motion Shadow Detection Method | |
TWI530913B (en) | Moving subject detecting system and method | |
CN111429437B (en) | Object Detection-Oriented Image No-Reference Sharpness Quality Detection Method | |
CN111144203B (en) | Pedestrian shielding detection method based on deep learning | |
CN103632378B (en) | A kind of multi thresholds edge detection method of game thought of drawing based on even point |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
EXSB | Decision made by sipo to initiate 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 |
Granted publication date: 20170613 |
|
CF01 | Termination of patent right due to non-payment of annual fee |