Stereo-picture synthetic method and device
Technical field
The present invention relates to image display technology, more particularly, relate to a kind of stereo-picture synthetic method and device.
Background technology
Existing stereo-picture is generally take same object from different perspectives by two camera lenses, the image that acquisition two is different respectively, then, when showing to user, the eyes to user provide captured two different images respectively, thus obtain the sensation of stereo-picture.When acquisition image, must ensure that the resolution of two images is consistent, user so just can be made to obtain real third dimension when viewing image.If varying in size of resolution, obtain three-dimensional image by very difficult, require higher to lens parameters in the process of shooting like this, use flexibility lower.
Summary of the invention
The object of the invention is to, require higher in existing stereo-picture acquiring technology to camera lens, the defect that flexibility is lower, provide a kind of technology can using different resolution Images uniting stereo-picture, to overcome above-mentioned defect.
One aspect of the present invention, provides a kind of stereo-picture synthetic method, comprises the following steps:
S1, collection two-way are taken same object from different perspectives respectively and are obtained, and have the image of different resolution;
S2, interpolation conversion is carried out to the image in described two-way image with low resolution, make the resolution of the image after conversion equal with the resolution in described two-way image with the image of high-resolution;
S3, synthesis process is carried out to the image having a high-resolution in the image after conversion and described two-way image, formation stereo-picture;
Stereo-picture after S4, output synthesis.
Stereo-picture synthetic method of the present invention, wherein comprises the step that low-resolution image carries out interpolation conversion:
S21, on the described image with high-resolution, Corresponding matching point is searched to the described each pixel had in the image of low resolution; If the pixel had described in correspondence in the image of low resolution can have in the image of high-resolution described the match point finding correspondence, then described this pixel had in the image of low resolution is recorded as correct match point, otherwise this pixel is recorded as error matching points;
S22, to adjacent two correct match points, search corresponding to described two corresponding pixel points had in the image of high-resolution, when two described adjacent correct match points are positioned at same a line, by the pixel between described two corresponding pixel points by being inserted between described two adjacent correct match points or when two described adjacent correct match points are positioned at same row after column average, be inserted between described two adjacent correct match points after pixel between described two corresponding pixel points is average by row, to obtain the first interpolation image;
S23, above-mentioned steps S22 obtain the first interpolation image neighbor pixel linearly insert pixel, make insert after low-resolution image equal with the pixel of high-definition picture.
Stereo-picture synthetic method of the present invention, wherein step S21 comprises:
S211, there is pixel in the image of low resolution for mid point or summit with described, choose (2m+1) × the pixel region of (2n+1) as matching template, wherein m and n is at the natural number chosen from the scope of 1 to 5;
S212, matching template covered described in there is the region at pixel place corresponding with the described pixel had in the image of low resolution in the image of high-resolution;
S213, calculating error hiding rate, this error hiding rate is:
Wherein, absolute grayscale difference sum for described in have by the region that matching template covers in the image of high-resolution, with the absolute value sum of the difference of corresponding pixel points gray value in matching template;
S214, setting error hiding rate threshold value, if error hiding rate is less than error hiding rate threshold value, then correctly mates, otherwise is erroneous matching.
Stereo-picture synthetic method of the present invention, wherein step S23 comprises:
The first interpolation image obtained in S231, comparison step S22 and the pixel number with higher resolution image, determine that in the first interpolation image, the average insertion of neighbor pixel is counted, and round up;
S232, foundation bilinear interpolation method, insert pixel in the first interpolation image;
If there is the pixel quantity of the image of low resolution more than the described pixel quantity with the image of high-resolution described in after S233 inserts pixel, then calculate the pixel number needing to delete in described each row or column with the image of low resolution; By the pixel of this row or column sum divided by the pixel number needing to delete, and round downwards, be designated as S; From S+1 pixel, delete a pixel every S pixel, until residual pixel point is equal with the described corresponding row or column with the image of high-resolution.
Stereo-picture synthetic method of the present invention, wherein step S3 comprises:
S31, determine Images uniting form;
If S32 synthesize form for when full frame (full side-by-side) or full frame point and point (fulldot-by-dot) shoulder to shoulder by the image described in after the described image with high-resolution and process with low resolution by left and right side by side or mode side by side up and down synthesize a road image; If synthesis form be half screen shoulder to shoulder (half side-by-side) or half screen point and point (half dot-by-dot) time, every row or column, pixel is taken out to two-way image, then by left and right side by side or mode side by side up and down synthesize a road image.
Another aspect of the present invention, provides a kind of stereo-picture synthesizer, comprising:
Signal receiving module, takes same object from different perspectives respectively obtain for gathering two-way, and have the image of different resolution;
Image processing module, for carrying out interpolation conversion to the image in described two-way image with low resolution, makes the resolution of the image after conversion equal with the resolution in described two-way image with higher resolution image;
Image synthesis unit, carrying out synthesis process to having higher resolution image in the image after conversion and described two-way image, forming stereo-picture;
Image output module, for exporting the stereo-picture after synthesis;
Signal receiving module, image processing module, image synthesis unit is connected successively with image output module.
Stereo-picture synthesizer of the present invention, image processing module comprises:
Image matching unit, for searching Corresponding matching point to the described each pixel had in the image of low resolution on the described image with high-resolution; If the pixel had described in correspondence in the image of low resolution can have in the image of high-resolution described the match point finding correspondence, then described this pixel had in the image of low resolution is recorded as correct match point, otherwise this pixel is recorded as error matching points;
First interpolating unit, for to adjacent two correct match points, search corresponding to described two corresponding pixel points had in the image of high-resolution, when two described adjacent correct match points are positioned at same a line, by the pixel between described two corresponding pixel points by being inserted between described two adjacent correct match points or when two described adjacent correct match points are positioned at same row after column average, be inserted between described two adjacent correct match points after pixel between described two corresponding pixel points is average by row, to obtain the first interpolation image;
Second interpolating unit, inserts pixel for the neighbor pixel linearly at the first interpolation image, makes the low-resolution image after inserting equal with the pixel of high-definition picture.
Stereo-picture synthesizer of the present invention, the first interpolating unit
Matching template generator, this matching template generator has pixel in the image of low resolution for mid point or summit with described, choose (2m+1) × the pixel region of (2n+1) as matching template, wherein m and n is at the natural number chosen from the scope of 1 to 5;
Matching template decover, for having the region at pixel place corresponding with the described pixel had in the image of low resolution in the image of high-resolution described in being covered by matching template;
Error hiding rate calculator, for calculating error hiding rate, this error hiding rate is:
Wherein, absolute grayscale difference sum is have the region covered by matching template in the image of high-resolution, with the absolute value sum of the difference of corresponding pixel points gray value in matching template;
Error hiding threshold comparator, for setting error hiding rate threshold value, if error hiding rate is less than error hiding rate threshold value, then correctly mates, otherwise is erroneous matching.
Stereo-picture synthesizer of the present invention, wherein the second interpolating unit comprises:
Insertion is counted calculator, obtains image and the pixel number with higher resolution image for comparing the first interpolating unit, determines that the average insertion that the first interpolating unit obtains neighbor pixel in image is counted, and rounds up;
Bi-linear interpolator, for according to bilinear interpolation method, inserts pixel in the image that the first interpolating unit obtains;
Pixel adjuster, described in after insertion pixel, there is the pixel quantity of the image of low resolution more than the described pixel quantity with the image of high-resolution, then calculate the pixel number needing to delete in described each row or column with the image of low resolution; By the pixel of this row or column sum divided by the pixel number needing to delete, and round downwards, be designated as S; From S+1 pixel, delete a pixel every S pixel, until residual pixel point is equal with the described corresponding row or column with the image of high-resolution.
Stereo-picture synthesizer of the present invention, image synthesis unit comprises:
Format selector, for determining Images uniting form;
Image compressor, for synthesize form be full frame (full side-by-side) shoulder to shoulder or full frame point and point (full dot-by-dot) time, by the image described in after the described image with high-resolution and process with low resolution by left and right side by side or mode side by side up and down synthesize a road image; Synthesize form be half screen shoulder to shoulder (half side-by-side) or half screen point and point (half dot-by-dot) time, every row or column, pixel is taken out to two-way image, then by left and right side by side or mode side by side up and down synthesize a road image.
Implement stereo-picture synthetic method of the present invention and device, image processing and tracking unit different for two resolution can be become stereo-picture, overcome the requirement to two-way image resolution ratio in prior art, make the camera lens can choosing different size in the process of shooting stereo-picture flexibly, improve the convenience of shooting stereo images, also help the cost reducing stereoscopic shooting device.
Accompanying drawing explanation
Below in conjunction with accompanying drawing, the present invention will be described, wherein:
Fig. 1 is the flow chart of stereo-picture synthetic method of the present invention;
Fig. 2 is the low-resolution image schematic diagram that the present invention obtains;
Fig. 3 is the high-definition picture schematic diagram that the present invention obtains;
Fig. 4 is the schematic diagram of bilinear interpolation of the present invention;
Fig. 5 is the functional block diagram of stereo-picture synthesizer of the present invention;
Fig. 6 is the functional block diagram of image processing module;
Fig. 7 is the functional block diagram of image matching unit;
Fig. 8 is the functional block diagram of the second interpolating unit.
Embodiment
Below in conjunction with the drawings and specific embodiments, the present invention is described in detail.
Be illustrated in figure 1 the flow chart of stereo-picture synthetic method of the present invention, stereo-picture synthetic method of the present invention processes for the not identical image to be synthesized of two width resolution, make two width images after processing have identical resolution, the merging of stereo-picture can be carried out.
First in step sl, obtain the image of two-way for merging, this two-way image to be taken same object from different angles and is obtained, and tell the concrete resolution of two-way image, in order to outstanding feature of the present invention, the resolution limiting the image that the present invention obtains here is not identical; In subsequent process, with high-definition picture as a reference, low-resolution image is processed, make process after low-resolution image resolution improve and equal with high-definition picture.
Concrete processing method is S2: carry out interpolation conversion to low-resolution image, and the foundation of interpolation is full resolution pricture, first on high-definition picture, searches Corresponding matching point to the pixel in each low-resolution image; If can correctly mate, remember that the pixel in this low-resolution image is correct match point, otherwise be error matching points; To adjacent two correct match points, search corresponding two corresponding pixel points in high-definition picture, by the pixel between the pixel of two corresponding high-definition pictures by row or between the correct match point being inserted into two low-resolution images after column average.This completes primary interpolation.Such as Fig. 2 is low-resolution image 500, Fig. 3 is high-definition picture 600, and wherein two adjacent points corresponding to correct match point (501,502) are (601,604); In fig. 2, two adjacent correct match points are " row is adjacent ", and namely two points are positioned at same a line; Corresponding second corresponding points 604 of the first correct match point 501 correct match point 502 of corresponding first corresponding points 601, second; Between two corresponding points, there are two row pixels (602,603), column average is pressed to two row pixels, pixel average out to 1 point namely in 602, pixel average out to 1 point in 603; Then the points generated after average by these two, are inserted between two adjacent correct match points (501,502).More than the interpolation operations of two consecutive points in same a line, when two adjacent correct match points at same row time, then after average by row between two corresponding points in high-definition picture, between two the adjacent correct match points being inserted into same row.
Now insert the pixel of a part, compared the image after process and high-definition picture: the image after process is identical with high-resolution, then processed, can carry out the merging of image if just occur; If occur, the high-resolution image of image ratio after process is many, then carry out adaptability deletion, make the resolution of two images equal.
But in most cases, the image for the first time after interpolation, compared with high-definition picture, still needs to insert pixel further.Now carry out secondary interpolation, adopt bilinear interpolation method, specifically comprise the following steps:
Relatively obtain the pixel number of image and high-definition picture after first time interpolation, determine that the average insertion of neighbor pixel in first time interpolation acquisition image is counted, and round up; Such as, in certain a line, the first interpolation image has 400 pixels, and is 1250 at the pixel of high-definition picture corresponding row, then insert between 2 of the first interpolation image:
(1250-400)÷400=2.125
Then rounding up is 3 pixels, and the numerical value such as gray scale, RGB of concrete insertion pixel is realized by method below:
According to bilinear interpolation method, after first time interpolation, image inserts pixel, specifically as shown in Figure 4: XY plane is the plane at image place after first time interpolation, ABCD is after first time interpolation, first interpolation image can form the minimum combination of quadrangle, the quadrangle inside that namely ABCD surrounds no longer includes other pixels.Because we have calculated the number of the average pixel inserted of each row, column adjacent point-to-point transmission needs in a previous step, that is we have known concrete number and the position needing the pixel of insertion in quadrangle ABCD.Assuming that need to insert pixel at inner E point.After this set up Z-direction axle, this axle can the numerical value of gray scale, RGB etc. of represent pixel, for gray scale corresponding to gray scale ABCD on figure for A ' B ' C ' D '.Point adjacent for A ' B ' C ' D ' is coupled together, obtains the linear change between each point.After this E is projected to one group of opposite side (as AD and BC) of ABCD, then on A ' D ' and B ' C ', correspondence finds the gray value of two subpoints respectively, finally the point of these two gray values on figure is coupled together, so just can find gray value from E point to Z-direction.In like manner, also can with AB, CD both sides as projection limit, its result obtained is identical.
If the pixel of low-resolution image is more than high-definition picture after insertion pixel, then calculate the pixel number that each row or column needs to delete; By the pixel of this row or column sum divided by the pixel number needing to delete, and round downwards, be designated as S; From S+1 pixel, a pixel is deleted every S pixel, until residual pixel point row or column corresponding to high-definition picture is equal, such as: after carrying out bilinear interpolation, the pixel of low-resolution image is 1400 points, and pixel corresponding to high-definition picture is 1250, and that now will delete counts as 1400-1250=150, then do business: 1400 ÷ 150=9.33, rounding downwards is 9.Then from the 10th pixel, every 9 point deletions 1 pixel, deletion 150 altogether.It should be noted that, before this delet method is also applicable to first time interpolation after there is the operation that the pixel of low-resolution image is more than high-definition picture pixel.
Like this after twice interpolation, the resolution of low-resolution image is consistent with full resolution pricture, then the synthesis of image can be carried out: first determine Images uniting form, image can be collectively referred to as form (side-by-side) or point and point form (dot-by-dot) shoulder to shoulder in the present invention, and be further divided into full frame (full) and half screen (half), that is:
If synthesis form when being full frame (full side-by-side) or full frame point and point (fulldot-by-dot) shoulder to shoulder by the image after process by left and right side by side or mode side by side up and down synthesize a road image; If synthesis form be half screen shoulder to shoulder (half side-by-side) or half screen point and point (halfdot-by-dot) time, every row or column, pixel is taken out to two-way image, then by left and right side by side or mode side by side up and down synthesize a road image.
It should be noted that, the present invention, when carrying out merging image, can also synthesize according to other form, has more than and is limited to above-mentioned several picture formats.
As Fig. 5, be the system block diagram of stereo-picture synthesizer of the present invention, comprise 4 modules connected successively within the system: signal receiving module 100, image processing module 200, image synthesis unit 300 and image output module 400.Signal receiving module 100, obtains two-way image, and differentiates the resolution of two-way image, such as in two-way stereo camera shooting, obtain the different image of two-way resolution by two camera lenses, compared with prior art, signal receiving module 100 no longer limits the resolution of two-way image; Image processing module 200, carries out interpolation conversion to the low-resolution image in the two-way image obtained, and makes the image resolution ratio after changing equal with high-definition picture; Image synthesis unit 300 pairs of converted images and high-definition picture carry out synthesis process; Finally export the stereo-picture after synthesis by image output module 400.
Specifically as shown in Figure 6, image processing module 200 also specifically comprises: image matching unit 201, first interpolating unit 202 connected successively and the second interpolating unit 203.The function of unit is as follows:
Image matching unit 201, for searching Corresponding matching point to each pixel in low-resolution image on high-definition picture; If can correctly mate, remember that the pixel in this low-resolution image is correct match point, otherwise be error matching points;
First interpolating unit 202, for adjacent two correct match points, searches corresponding two corresponding pixel points in high-definition picture, by the pixel between two corresponding pixel points by row or be inserted into after column average between two correct match points.When two correct match points are same a line time, then between two corresponding pixel points by column average after be inserted between two correct match points; And when two correct match points are same row time, be then inserted between two correct match points after average by row between two corresponding pixel points.
As shown in Figure 7, in order to realize first time interpolation success, image matching unit 201 is configured with matching template generator 2011, this matching template generator 2011 with the pixel in low-resolution image for mid point or summit, choose (2m+1) × the pixel region of (2n+1) is as matching template, wherein 1≤m≤5,1≤n≤5; Preferentially attempt when choosing with the pixel in low-resolution image as mid point sets up matching template, when the pixel region chosen is beyond original low-resolution image time, to change into the pixel in low-resolution image as summit, make the region chosen be arranged in low-resolution image completely.
Matching template is covered high-definition picture corresponding pixel points region by matching template decover 2012;
Calculate error hiding rate by error hiding rate calculator 2013, this error hiding rate is:
Wherein, absolute grayscale difference sum is by the region that matching template covers in high-definition picture, with the absolute value sum of the difference of corresponding pixel points gray value in matching template;
Then error hiding threshold comparator 2014 sets error hiding rate threshold value, if error hiding rate is less than error hiding rate threshold value, then correctly mates, otherwise is erroneous matching.This threshold value is 1% to 5%, and numerical value is less, and the matching degree of the normal match point obtained is higher.
As shown in Figure 8, the second interpolating unit 203, the neighbor pixel linearly for image after the process of the first interpolating unit 202 inserts pixel, makes the low-resolution image after inserting equal with the pixel of high-definition picture.Concrete, the second interpolating unit 203 comprises:
Insert calculator 2031 of counting and compare the pixel number that the first interpolating unit 202 obtains image and high-definition picture, determine that the first interpolating unit 202 processes the average insertion of neighbor pixel in rear image and counts, and round up;
Bi-linear interpolator 2032, for according to bilinear interpolation method, to the image insertion pixel that the first interpolating unit 202 obtains;
Pixel adjuster 2033, for when the pixel inserting low-resolution image after pixel is more than high-definition picture, calculates the pixel number needing each row or column to delete; By the pixel of this row or column sum divided by the pixel number needing to delete, and round downwards, be designated as S; From S+1 pixel, delete a pixel every S pixel, until residual pixel point row or column corresponding to high-definition picture is equal.
After the interpolation of twice, obtain the image that two resolution is identical, image is collectively referred to as form (side-by-side) or point and point form (dot-by-dot) shoulder to shoulder by image output module 400, and is further divided into full frame (full) and half screen (half), that is:
If synthesis form when being full frame (full side-by-side) or full frame point and point (fulldot-by-dot) shoulder to shoulder by the image after process by left and right side by side or mode side by side up and down synthesize a road image; If synthesis form be half screen shoulder to shoulder (half side-by-side) or half screen point and point (halfdot-by-dot) time, every row or column, pixel is taken out to two-way image, then by left and right side by side or mode side by side up and down synthesize a road image.
These are only the specific embodiment of the invention, scope of the present invention can not be limited with this, the equalization change that those skilled in the art in the art do according to this creation, and the change that those skilled in that art know, all still should belong to the scope that the present invention is contained.