Summary of the invention
Task of the present invention is to solve a prior art difficult problem, provides a kind of based on rim detection, the method that the multispectral image of the Same Scene that can obtain different field angle matees fast, and this method has stronger robustness and fault-tolerance.
Technological means
The invention discloses a kind of multispectral image fast matching method based on rim detection, method may further comprise the steps:
A, obtain the gray-scale map of the multispectral image of Same Scene under any field angle;
B, each gray-scale map that the A step is obtained carry out filtering and noise reduction, obtain level and smooth gray level image;
C, the level and smooth gray-scale map that the B step is obtained carry out edge extracting;
D, filter out the part edge point of the image that the C step obtains, obtain the discrete gray scale dot chart in edge with preset rectangular window;
The matching parameter that E, setting will be found the solution, and utilize particle group optimizing method that matching parameter is optimized and find the solution, optimum matching parameter obtained.
In the B step, elder generation before the gray level image filtering and noise reduction is carried out image enhancement processing to gray level image.
Wherein the C step comprises:
Step C1: the level and smooth gray-scale map convolution of utilizing first order difference template and B step to obtain, the gradient magnitude and the direction of acquisition image;
Step C2: the gradient magnitude that step C1 is obtained is done non-maximum value and is suppressed, and the gray-scale value at the edge that obtains is set to an extreme value of gray-scale value, and all the other each points all are made as with the edge gray-scale value representes another gray scale extreme value that color is opposite;
Step C3: utilize the dual threshold method that step C2 is obtained the result and detect and repair, obtain complete edge image.
Used first order difference template is the Sobel operator in step C1.
Wherein the D step comprises:
Step D1: the rectangular window that utilization is preset scans identification to each pixel of the image that the C step obtains with the scan mode of going or be listed as;
Step D2: when the central point of rectangular window was positioned at any pixel of image border, the gray-scale value of central point remained unchanged, and all the other each gray values of pixel points in the window all are made as with the edge gray-scale value representes another gray scale extreme value that color is opposite; When the central point of rectangular window was positioned at any pixel at non-image edge, each gray values of pixel points in the rectangular window was constant.
Rectangular window is a square window, and size is according to the closeness setting of the pixel of image border.The length of side of square window is 3,5,7,9 or 11 pixels.
Wherein the E step comprises:
Step e 1: the piece image of choosing edge pixel point comparatively dense in the image that the D step obtains is a benchmark, and produces many group matching parameter at random;
Step e 2: one group of matching parameter wherein of selecting step e 1 to produce at random, and change the coordinate of each pixel of the more sparse image in edge according to this matching parameter, and mate with image and the benchmark image after changing;
Step e 3: any new coordinate points that obtains with step e 2 is the center, its neighborhood is scanned, and obtain the matching degree scoring of this point according to the position that the point of the benchmark image in this neighborhood occurs;
Step e 4: repeated execution of steps E3 marks until the matching degree of obtaining all new coordinate points, and obtains the matching effect evaluating according to the matching degree scoring of each point;
Step e 5: repeated execution of steps E2, step e 3 and step e 4, the matching effect evaluating of finding the solution all matching parameter that produce at random by step e 1;
Step e 6: utilize particle group optimizing method that matching parameter is optimized and find the solution, obtain the optimum matching effect.Step e 6 also comprises:
Step e 6a: set population and iterations, produce a plurality of primaries at random, the many groups matching parameter that promptly produces at random in the E1 step, and produce initial velocity at random;
Step e 6b: according to current location, calculate the fitness of particle, and current location is set is individual desired positions;
Step e 6c: to the desired positions of each particle by its position, fitness and the current particle of the iterations cycle calculations of setting;
Step e 6d: after the loop ends, export overall desired positions.
This multispectral image fast matching method is used for the quick coupling of visible images and infrared image; The quick coupling that perhaps is used for infrared image and ultraviolet image; The quick coupling that perhaps is used for visible images and ultraviolet image perhaps is used for visible images, infrared image and ultraviolet image three's quick coupling.
Beneficial effect
The present invention has following advantage: 1, not restriction of the field angle when obtaining multispectral image, and field angle can be the same or different; 2, matching result does not receive the influence of detector mirror, and the size of image resolution ratio is not had special requirement; 3, adopt the window filtering technique, the filtration fraction marginal point can be realized images match fast; 4, the matching effect evaluation function can hold matching error, makes image matching method have very strong fault freedom; 5, employing heuristic search algorithm---particle swarm optimization algorithm optimization is found the solution matching parameter, and it has good global convergence performance, can find appropriate matching parameter fast; 6, have very strong robustness, both be applicable to the multispectral image coupling, be applicable to that also the proposition of this method mainly is the coupling that is used for visible images and infrared image with spectrogram picture coupling.
Embodiment
Referring to Fig. 1 is the process flow diagram of a basic embodiment of multispectral image fast matching method disclosed by the invention, and said method comprises the following steps:
A, obtain the gray-scale map of the multispectral image of Same Scene under any field angle;
B, each gray-scale map that the A step is obtained carry out filtering and noise reduction, obtain level and smooth gray level image;
C, the level and smooth gray-scale map that the B step is obtained carry out edge extracting;
D, filter out the part edge point of the image that the C step obtains, obtain the discrete gray scale dot chart in edge with preset rectangular window;
The matching parameter that E, setting will be found the solution, and utilize particle group optimizing method that matching parameter is optimized and find the solution, the optimum matching effect obtained.
Carry out detailed description further in the face of each step down.
Steps A: the gray-scale map that obtains the multispectral image of Same Scene under any field angle.Arbitrarily field angle explanation this method to the resolution of the image that obtains, shooting angle completely without requiring, so long as the image under the Same Scene all can use this method.The method of obtaining gray-scale map has two kinds usually, and the one, through conversion formula, the 2nd, search mapping table, two kinds all is common knowledge technology, repeats no more.
Step B: each gray-scale map that the A step is obtained carries out filtering and noise reduction, obtains level and smooth gray level image.Because external environment condition is disturbed and the influence of electronic equipment; Can there be noise in the multispectral image that obtains, like Gaussian noise, salt-pepper noise, thermonoise and 1/f noise or the like, therefore; Must carry out denoising to the multispectral gray-scale map that obtains, adopt gaussian filtering to carry out denoising usually.
Before filtering, also contain a process that image is strengthened usually; Stress some interested characteristic, suppress uninterested characteristic, the difference in the expanded view picture between the different objects characteristic; Improve picture quality, abundant information amount, strengthen image interpretation and recognition effect.
Step C: the level and smooth gray-scale map that the B step is obtained carries out edge extracting.Edge of image is meant the part that the image local regional luminance changes noticeably, and this regional gray scale section generally can be regarded as a step, both changes to another gray scale and differs bigger gray-scale value from the play of having to go to the toilet in very little buffer area of a gray-scale value.Extract the edge and comprise three steps:
Step C1: the level and smooth gray-scale map convolution of utilizing first order difference template and B step to obtain, the gradient magnitude and the direction of acquisition image.The first order difference template has a lot, considers that from noise robustness the Sobel operator is the most suitable.
Step C2: the gradient magnitude that step C1 is obtained is done non-maximum value and is suppressed, and the gray-scale value at the edge that obtains is set to an extreme value of gray-scale value, and all the other each points all are made as with the edge gray-scale value representes another gray scale extreme value that color is opposite.Confirm that it is not enough that the edge only obtains overall gradient, therefore for confirming the edge, the maximum point of necessary reservation partial gradient is called and suppresses non-maximum value.Can be divided into four direction for any pixel and its eight neighbors, the pixel orientation at diagonal angle is identical each other, and the gradient direction of center pixel is one of four direction.Each center pixel P compares with two pixels along gradient line; If the gradient magnitude of center pixel P is big unlike the gradient magnitude along two adjacent image points of this gradient direction; Then this center pixel P is not the edge of image point, and its gray-scale value is made as an extreme value of gray-scale value; Otherwise then this center pixel P is the edge of image point, and its gray-scale value is made as another extreme value of gray-scale value.For example the gray-scale value with marginal point is made as 255 (whites), and the gray-scale value of all the other points is made as 0 (black).
Step C3: utilize the dual threshold method that step C2 is obtained the result and detect and repair, obtain complete edge image.
Step D: filter out the part edge point of the image that the C step obtains with preset rectangular window, obtain the discrete gray scale dot chart in edge.Obtain the edge image of multispectral image through step C, its number of edge points is more, if directly be used for images match, workload will be very big, is unfavorable for realizing quick coupling.In addition, even under the Same Scene, the edge of multispectral image neither overlap fully, if all the edge is used for coupling calculating, can make the fault freedom of matching process reduce so.Therefore, under the prerequisite that does not reduce matching performance, reduce the part edge point, help improving the efficient and the performance of method.As shown in Figure 2, obtain the discrete gray scale dot chart in edge and comprise following two steps:
Step D1: the rectangular window that utilization is preset scans identification to each pixel of the image that the C step obtains with the scan mode of going or be listed as.Shown in Fig. 2 (a), rectangular window is generally square, and its length of side is the odd number of pixels point, and square window is lined by line scan with the mode of line scanning.Square window is big more, and the marginal point that filters out is just many more, and the edge discrete point that obtains is also just few more, and follow-up matching algorithm is also just fast more.But square window can not be too big, will influence matching effect too greatly, so; The length of side of square window is generally got 3,5,7,9 or 11 pixels, for the multispectral image of edge than comparatively dense, such as visible images; Rectangular window can be got bigger; And for the more sparse multispectral image in edge, such as infrared image, rectangular window just should be obtained smaller.
Step D2: when the central point of rectangular window was positioned at image border some arbitrarily, the gray-scale value of central point remained unchanged, and the gray-scale value of all the other each points that window is interior all is made as with the edge gray-scale value representes another gray scale extreme value that color is opposite; When the central point of rectangular window was positioned at non-image edge some arbitrarily, the gray-scale value of the each point that rectangular window is interior was constant.Gray-scale value according to foregoing present embodiment is provided with rule, and the image effect that obtains after this step finishes is shown in Fig. 2 (b).
Step e: set and write down matching parameter and the matching effect evaluating that to find the solution.For multispectral image, if their field angle is different, also difference to some extent of their resolution and number of pixels so.Also just say that can there be certain scaling ratio in they on yardstick.In addition, even the field angle of multispectral image is identical because the adjustment problem of instrument, though taking Same Scene, but still there is certain skew in multispectral image, need translation wherein a width of cloth spectrum picture just can make their registrations.Specifically comprise following several steps:
Step e 1: the piece image (being called spectrum 1 image) of choosing the edge comparatively dense that the D step obtains is a benchmark, and produces at random
MThe group matching parameter.
Step e 2: one group of matching parameter wherein of selecting step e 1 to produce at random; And change the coordinate of each pixel of the more sparse image (being called spectrum 2 images) in edge, and mate with image and the benchmark image (spectrum 1 image) after changing according to this matching parameter.Matching parameter has three, i.e. the translational movement x of enlargement factor s, directions X
0With the translational movement y on the Y direction
0, spectrum 2 image edge discrete point coordinates do
(x, y), after conversion, obtain
(x ', y '), its transformation for mula is following:
Wherein, enlargement factor
sBe positive floating number,
x 0 With
y 0 Be integer.For any one group of selected matching parameter (
s,
x 0 ,
y 0 ), be new coordinate points with each edge discrete point coordinate conversion of spectrum 2 images.
Step e 3: any new coordinate points that obtains with step e 2 is the center, its neighborhood is scanned, and obtain the matching degree scoring of this point according to the position that the point of the benchmark image in this neighborhood occurs.For certain new coordinate points of 2 images of the spectrum after the conversion, if in its 3 * 3 neighborhood coordinate, have at least one to be spectrum 1 edge of image discrete point, the scoring of the matching degree of this point is 1 so; If in its 4 * 4 neighborhood coordinate, just there is one to be spectrum 1 edge of image discrete point, the scoring of the matching degree of this point is 0.8 so; If in its 5 * 5 neighborhood coordinate, just there is one to be spectrum 1 edge of image discrete point, the scoring of the matching degree of this point is 0.6 so.The size of scanning neighborhood can come to be provided with voluntarily to the requirement of fault-tolerance according to the user, and it is just passable generally to scan 5 * 5 neighborhoods.
Step e 4: repeated execution of steps E3 marks until the matching degree of obtaining all new coordinate points, and obtains the matching effect evaluating according to the matching degree scoring of each point
FitGiven matching parameter and obtained the matching degree scoring of all new coordinate points after, also need the parameter that can estimate the integral image matching effect, so that confirm the matching parameter when reaching best matching effect.This evaluation criterion is exactly the matching effect evaluating
FitAsking
FitThe time, at first want initialization
Fit=0, the matching degree scoring addition with each point gets final product then.
FitBe worth greatly more, the expression matching effect is good more, otherwise just poor more.
Step e 5: repeated execution of steps E2, step e 3 and step e 4 find the solution that all produce by step e 1 at random
MThe matching effect evaluating of group matching parameter
Fit
Step e 6: utilize particle group optimizing method that matching parameter is optimized and find the solution, obtain the optimum matching effect.The ultimate principle of particle swarm optimization algorithm is following: be located at
NIn the dimension search volume, have
MThe initial population that individual particle is formed, wherein the locus of i particle does
x i =(x I1 , x I2 , ... , x IN ), its current flight speed
v i =(v I1 , v I2 , ... , v IN ),Wherein
I=1,2, ... , MA fitness function is set, the locus of particle is estimated, as adaptive value, estimate the quality of this particle present position with the functional value that calculates.
P i =(p I1 , p I2 , ... , p IN )The desired positions that is experienced for particle i, i.e. particle
iThe position with best adaptive value that is lived through is called individual desired positions.For maximization problems, the fitness function of particle
F (x)Be the bigger the better.
Be optimized when finding the solution matching parameter with particle swarm optimization algorithm, three matching parameter form a particle (
S, x 0 , y 0 ), the dimension that is to say particle is 3; Fitness function is the matching effect evaluating
Fit, be the fitness function of the particle of maximization problems
F (x)It is as shown in Figure 3 to be optimized the flow process of finding the solution matching parameter with particle swarm optimization algorithm, and its concrete step that realizes is following:
Step e 6a: set population
MAnd iterations
G, produce at random
MIndividual primary, promptly the E1 step produces at random
MThe group matching parameter, and produce initial velocity at random
V (t)
Step e 6b: according to current location, calculate the fitness of particle, i.e. the matching effect evaluating
FitIt is individual desired positions that current location is set
P (t)
Step e 6c: by the maximum iteration time of setting
GCarry out following loop computation:
To each particle, do following computing (
Fort=1,2,
...,
G):
1, calculates inertia weight
ω (t), renewal speed
V (t), and its qualification
v Max In;
2, calculate current location
X (t)And fitness function during current location
F (x):
3, upgrade current individual desired positions
P (t):
4, upgrade current overall desired positions
P g (t):
Wherein
ω (t)Be inertia weight,
ω Max With
ω Min Represent minimum and maximum inertia weight respectively, generally distinguish value 1 and 0;
c 1 With
c 2 Be acceleration constant, value is 2 usually;
Rand1 ()With
Rand2 ()Be two separate, in [0,1] equally distributed random function.In flight course, produce the possibility that flies away from the search volume for fear of particle,
v Ij Usually be limited in certain scope,
v Ij ∈ [v Max , v Max ], wherein
v Max =k*
x Max , 0. 1≤
k≤1. 0.
Step e 6d: after the loop ends, export overall desired positions
P g (G), be matching parameter final optimization pass result.
It more than is a preferred embodiment of the present invention; Can know through this embodiment; Field angle when the multispectral image fast matching method based on rim detection disclosed by the invention does not require that multispectral image obtains is identical; Even bigger dislocation takes place multispectral image, still can obtain good matching effect.The core of this method is to adopt window filtering technique and particle group optimizing method to obtain best matching parameter fast, when estimating matching effect, adopts the matching effect evaluating
FitAs the evaluation criterion of matching effect, in the ideal case, if two images mate fully,
FitSize equal spectrum 2 edge of image discrete point numbers.But in reality, multispectral image can not mate fully, and they tend to exist the error of a plurality of pixels.Utilize the matching effect evaluating can satisfy this actual conditions just, allow to exist certain error as the evaluation criterion of matching effect.Therefore, this image matching method has good fault-tolerance and robustness, for further processing (like Multispectral Image Fusion, image mosaic etc.) provides important basis.
The present invention can be used for the quick coupling of visible images and infrared image; The quick coupling that perhaps is used for infrared image and ultraviolet image; The quick coupling that perhaps is used for visible images and ultraviolet image; The quick coupling that perhaps is used for visible images, infrared image and ultraviolet image three, and other need be to image processing process multispectral or that look like to mate with spectrogram.