A kind of quick Overlap-scanning mode of image applied to DSP
Technical field
The present invention relates to technical field of image processing, and in particular to a kind of quick Overlap-scanning side of image applied to DSP
Formula.
Background technique
Currently, image mosaic is typically necessary carry out images match.The matching process of image generally has matching based on gray scale
Standard, registration based on feature etc..Existing frequently-used mode is all using the registration mode based on feature.It is existing to be matched based on feature
In the technical solution of quasi- mode, figure generally is realized using Harris Corner Detection, SIFT scale invariant feature conversion scheduling algorithm
As splicing.Wherein Harris Corner Detection, principle are to detect characteristic point using the feature of a second-order matrix, are extracted
Feature have rotational invariance, the disadvantage is that not having scale invariability;SIFT algorithm is to detect certain by Gauss difference space
Check that certain extreme values carry out location feature point.SIFT algorithm improves the quality and accuracy of images match, using also relatively wider
It is general.
However the existing preferable image mosaic mode of imaging effect needs to realize in high-performance PC machine, needs efficiently to locate
Manage speed and very big memory headroom, but the embedded processing systems of similar dsp processor, suffer from processing speed and
The limitation of memory headroom, it is undesirable in terms of processing speed and splicing effect using conventional image mosaic mode.
Summary of the invention
Therefore, for above-mentioned problem, the present invention is based on the above-mentioned requirement to dsp system, propose that one kind quickly scans
Panoramic mosaic mode improves existing joining method, reduces the limitation of processing speed and memory headroom.
In order to solve the above-mentioned technical problem, thinking of the present invention is as follows: when the distance moved between two pictures
It when excessive, then can cannot be neglected deformation between image, may can also be especially for user with the variation of light and shade
Center rotates to the right the case where shooting panoramic photo.At this time to obtain ideal splicing result, two pictures are not only found out
Match point will also carry out deformation correction and Lightness disposal to picture.However, it is contemplated that the moving distance between two pictures is minimum
When (for example only moving a column pixel), then the shooting interval of two pictures is extremely short, and the deformation and light and shade between image are poor
It is different all negligible, so that it may the image mosaic mode quickly scanned using one kind.
Specifically, the technical scheme adopted by the invention is that, a kind of quick Overlap-scanning mode of image applied to DSP,
Include the following steps:
Step 1: obtaining image collection to be spliced, choose first image and second image is spliced: first really
Determine reference line and matching range: choosing first image and second image in image collection, first looked in first image
One reference line, up-and-down boundary of the reference line from image respectively vacate 10 row pixels, high 460 pixel, and the right margin 320 from image arranges
Pixel;Then it keeps left second image center and determines a matching range, matching range size is wide 30 column pixel, high by 470
Pixel, up-and-down boundary of the matching range from image respectively vacate 5 row pixels;
Step 2: the difference of adjacent pixel on calculating benchmark line: in matching range by matched line one by one with reference line carry out
Match, wherein matched line and reference line have same height, and matching process is: two neighboring pixel value is first found out in reference line
Maximum preceding 50 pairs of pixels, and record the position where this 50 pairs of values:
A1=a1-a2;
A2=a2-a3;
……
A459=a459-a460;
The wherein pixel value that a [i] is every on benchmark line, A [i] is the difference of its adjacent two o'clock, 1≤i≤459.To A
[i] carries out sequence from big to small and records preceding 50 value A [0]~corresponding coordinate position of A [49];
Step 3: best match position is determined on a match line: and then found out two-by-two on corresponding position in matched line
The difference of pixel value, and 50 pairs of differences of this 50 pairs of differences and reference line are subtracted each other two-by-two and the sum of are taken absolute value, to matching model
Each matched line in enclosing repeats above operation, then the smallest matched line of the sum of absolute value is the best match position to be looked for
It sets.Ask:
Wherein AiFor the pixel value in benchmark line, BiFor the pixel value in matched line.It finds out corresponding to minimum value
I position, as best match position;
Step 4: realizing splicing: finding best match position and be later substituted into second image in matched line right part
To get splicing result image on the right side of first image benchmark line;
Step 5: the splicing result image for next obtaining step 4 then reads a new figure as first image
Multiple images can be spliced as continuing above step as second image to obtain panorama sketch;
Step 6: cut up-and-down boundary: the panoramic picture obtained at this time has good effect, however due to flat in camera
Upper lower deviation is inevitable during moving, therefore result images can be needed there are blank by upper and lower gutter on up-and-down boundary
Divide and cuts out to get final result image.
Panoramic mosaic is carried out to image using the above method of the invention, speed is fast, slowly revolves in user's handheld device
When turning, a new images can be read every a few tens of milliseconds and be spliced, therefore the difference between the image of adjacent twi-read
Very little is just as above-mentioned example, so the effect and reality degree of splicing are also high.To sum up, the present invention is using above-mentioned
Method enormously simplifies Processing Algorithm, to greatly reduce the limit of the processing speed and memory headroom to dsp processor
System, disclosure is particularly well suited to hand held devices to carry out image mosaic using above-mentioned quick scanning mode, has expanded it significantly
Application scenarios have good practicability.
Detailed description of the invention
Now in conjunction with specific embodiment, the present invention is further described.
During image mosaic, when the distance moved between two pictures is excessive, then it can not allow to neglect between image
Depending on deformation, may can also with light and shade variation, the feelings of shooting panoramic photo are rotated to the right especially for customer-centric
Condition.At this time to obtain ideal splicing result, the match point of two pictures is not only found out, also deformation is carried out to picture and rectified
Just and Lightness disposal.However, it is contemplated that when the moving distance between two pictures is minimum (for example only moving a column pixel), then
The shooting interval of two pictures is extremely short, all negligible (picture of this project of the deformation and light and shade difference between image
Size is fixed as 640*480), such as two picture moving distances only have 10 column pixels, so that it may it is quickly scanned using one kind
Image mosaic mode.Connecting method of the invention is applied to using DSP as the embedded device of hardware carrier, which can
It to carry out the Image Acquisition of 30 frame per second, therefore is actually carrying out in splicing, in pixel per second movement in 300 column left and right
In the case of the image mosaic set forth in the present invention quickly scanned can be realized.
Specifically, a kind of quick Overlap-scanning mode of image applied to DSP of the invention, the specific implementation steps are as follows:
Step 1: obtaining image collection to be spliced first, then determine reference line matching range: choosing in image collection
Two images, first a reference line is looked in first image, up-and-down boundary of the reference line from image respectively vacates 10 row pixels,
High 460 pixel, why vacating when 10 row pixels allow for the splicing of adjacent two picture has the case where displacement up and down, from image
320 column pixel of right margin, why image middle position look for reference line be because shooting when image hit exactly caused by shape
Become minimum;Then it keeps left second image center and determines a matching range, range size is wide 30 column pixel, high 470 picture
Element, matching range respectively vacate 5 row pixels from image up-and-down boundary, so just can be corrected the case where upper and lower displacement to realize
Splicing;
Step 2: the difference of adjacent pixel on calculating benchmark line: the core concept of algorithm be in matching range by matched line by
Item is matched with reference line, and wherein matched line and reference line have same height, and matching process is: first asking in reference line
The maximum preceding 50 pairs of pixels of two neighboring pixel value out, and record the position where this 50 pairs of values:
A1=a1-a2;
A2=a2-a3;
……
A459=a459-a460;
The wherein pixel value that a [i] is every on benchmark line, A [i] is the difference of its adjacent two o'clock, 1≤i≤459.To A
[i] carries out sequence from big to small and records preceding 50 value A [0]~corresponding coordinate position of A [49];
Step 3: determining best match position on a match line: finding out pixel two-by-two on corresponding position in matched line
The difference of value, and 50 pairs of differences of this 50 pairs of differences and reference line are subtracted each other two-by-two and the sum of are taken absolute value, in matching range
Each matched line repeat above operation, then the smallest matched line of the sum of absolute value be the best match position to be looked for.I.e.
It asks:
Wherein AiFor the pixel value in benchmark line, BiFor the pixel value in matched line.It finds out corresponding to minimum value
I position, as best match position;
Step 4: realizing splicing: finding best match position and be later substituted into second image in matched line right part
To get splicing result image on the right side of first image benchmark line;
Step 5: next using result images as first image, then reading a new images as second image
Multiple images can be spliced to obtain panorama sketch by continuing above step;
Step 6: cut up-and-down boundary: the panoramic picture obtained at this time has good effect, however due to flat in camera
Upper lower deviation is inevitable during moving, therefore result images can be needed there are blank by upper and lower gutter on up-and-down boundary
Divide and cuts out to get final result image.
Panoramic mosaic should be carried out to image in this way, speed is fast, can be with when user's handheld device slowly rotates
Every a few tens of milliseconds read a new images spliced, therefore the difference very little between the image of adjacent twi-read just as with
On the example mentioned it is the same, so the effect and reality degree of splicing are also high.
Although specifically showing and describing the present invention in conjunction with preferred embodiment, those skilled in the art should be bright
It is white, it is not departing from the spirit and scope of the present invention defined by the appended claims, it in the form and details can be right
The present invention makes a variety of changes, and is protection scope of the present invention.