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 to take from different perspectives same object by two camera lenses, obtain respectively two different images, then when showing to the user, provide respectively two captured different images to user's eyes, thereby obtain the sensation of stereo-picture.When obtaining image, must guarantee that the resolution of two images is consistent, so just can make the user obtain real third dimension when watching image.If varying in size of resolution with being difficult to obtain three-dimensional image, had relatively high expectations to lens parameters in the process of taking like this, use flexibility lower.
Summary of the invention
The object of the invention is to, obtain in technology for existing stereo-picture camera lens is had relatively high expectations, the defective that flexibility is lower provides the technology of the enough different resolution images of a kind of energy synthetic stereo image, to overcome defects.
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, the image that has low resolution in described two-way image is carried out interpolation conversion, the resolution that has the image of high-resolution in the resolution that makes the image after conversion and described two-way image equates;
S3, the image that has a high-resolution in the image after conversion and described two-way image synthesize processing, the formation stereo-picture;
Stereo-picture after S4, output are synthesized.
Stereo-picture synthetic method of the present invention wherein comprises the step that low-resolution image carries out interpolation conversion:
S21, each pixel in described image with low resolution is searched the Corresponding matching point on described image with high-resolution; If a pixel in corresponding described image with low resolution can find corresponding match point in described image with high-resolution, this pixel in described image with 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 two corresponding pixel points in described image with high-resolution, when two described adjacent correct match points are positioned at delegation, be inserted into described two adjacent correct match points between after by column average the pixel between described two corresponding pixel points or when two described adjacent correct match points are positioned at same row, be inserted between described two adjacent correct match points, to obtain the first interpolation image after pixel between described two corresponding pixel points is average by row;
S23, between the neighbor pixel of the first interpolation image that above-mentioned steps S22 obtains the linear pixel that inserts, make the low-resolution image after insertion equate with the pixel of high-definition picture.
Stereo-picture synthetic method of the present invention, wherein step S21 comprises:
S211, the pixel in the described image with low resolution be as mid point or summit, chooses the pixel zone of (2m+1) * (2n+1) as matching template, and wherein m and n are the natural number of choosing from 1 to 5 scope;
S212, matching template is covered in described image with high-resolution the zone at corresponding with pixel in described image with low resolution pixel place;
S213, calculating mistake matching rate, this mistake matching rate is:
Wherein, the poor sum of absolute grayscale is the zone that is covered by matching template in described image with high-resolution, with the absolute value sum of the difference of corresponding pixel points gray value in matching template;
S214 sets mistake matching rate threshold value, if the mistake matching rate correctly mates, otherwise is erroneous matching less than mistake matching rate threshold value.
Stereo-picture synthetic method of the present invention, wherein step S23 comprises:
The first interpolation image that obtains in S231, comparison step S22 and the pixel number with higher resolution image are determined that in the first interpolation image, the average insertion of neighbor pixel is counted, and are rounded up;
S232, according to bilinear interpolation method, insert pixel in the first interpolation image;
If S233 inserts the pixel quantity of described image with low resolution after pixel more than described pixel quantity with image of high-resolution, calculating need to be in the pixel number of each row or column deletion of described image with low resolution; With the pixel sum of this row or column pixel number divided by the needs deletion, and round downwards, be designated as S; Since S+1 pixel, every pixel of S pixel deletion, until residual pixel point equates with described corresponding row or column with image of high-resolution.
Stereo-picture synthetic method of the present invention, wherein step S3 comprises:
S31, determine that image synthesizes form;
The image that will describedly have high-resolution when if the synthetic form of S32 is full frame (full side-by-side) shoulder to shoulder or full frame point and point (full dot-by-dot) with process after described image with low resolution by the left and right side by side or up and down side by side mode synthesize one road image; If synthetic form is half screen shoulder to shoulder when (half side-by-side) or half screen point and point (half dot-by-dot), the two-way image is taken out pixel every row or column, then by left and right side by side synthetic one road image of mode side by side or up and down.
Another aspect of the present invention provides a kind of stereo-picture synthesizer, comprising:
Signal receiving module is taken same object from different perspectives respectively for the collection two-way and is obtained, and has the image of different resolution;
Image processing module, the image that is used for described two-way image is had low resolution carries out the interpolation conversion, and the resolution that has higher resolution image in the resolution that makes the image after conversion and described two-way image equates;
Image synthesis unit is synthesized processing to having higher resolution image in the image after conversion and described two-way image, forms stereo-picture;
Image output module is used for the stereo-picture after output is synthesized;
Signal receiving module, image processing module, image synthesis unit is connected with image output module and is connected.
Stereo-picture synthesizer of the present invention, image processing module comprises:
The images match unit is used for each pixel of described image with low resolution is searched the Corresponding matching point on described image with high-resolution; If a pixel in corresponding described image with low resolution can find corresponding match point in described image with high-resolution, this pixel in described image with low resolution is recorded as correct match point, otherwise this pixel is recorded as error matching points;
The first interpolating unit, be used for adjacent two correct match points, search corresponding two corresponding pixel points in described image with high-resolution, when two described adjacent correct match points are positioned at delegation, be inserted into described two adjacent correct match points between after by column average the pixel between described two corresponding pixel points or when two described adjacent correct match points are positioned at same row, be inserted between described two adjacent correct match points, to obtain the first interpolation image after pixel between described two corresponding pixel points is average by row;
The second interpolating unit is used for the linear pixel that inserts between the neighbor pixel of the first interpolation image, makes the low-resolution image after insertion equate with the pixel of high-definition picture.
Stereo-picture synthesizer of the present invention, the first interpolating unit
The matching template generator, the pixel of this matching template generator in the described image with low resolution is as mid point or summit, choose the pixel zone of (2m+1) * (2n+1) as matching template, wherein m and n are the natural number of choosing from 1 to 5 scope;
Matching template covers device, is used for matching template is covered the zone at described image with high-resolution pixel place corresponding with pixel in described image with low resolution;
Mistake matching rate calculator is used for calculating the mistake matching rate, and this mistake matching rate is:
Wherein, the poor sum of absolute grayscale is to have a zone that is 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;
Mistake matching threshold comparator is for setting mistake matching rate threshold value, if the mistake matching rate correctly mates, otherwise is erroneous matching less than mistake matching rate threshold value.
Stereo-picture synthesizer of the present invention, wherein the second interpolating unit comprises:
The insertion calculator of counting is used for relatively that the first interpolating unit obtains image and the pixel number with higher resolution image, determines that the average insertion that the first interpolating unit obtains neighbor pixel in image counts, and rounds up;
The bilinear interpolation device is used for according to bilinear interpolation method, inserts pixel in the image of the first interpolating unit acquisition;
The pixel adjuster, be used for the pixel quantity of described image with low resolution after inserting pixel more than described pixel quantity with image of high-resolution, calculating need to be in the pixel number of each row or column deletion of described image with low resolution; With the pixel sum of this row or column pixel number divided by the needs deletion, and round downwards, be designated as S; Since S+1 pixel, every pixel of S pixel deletion, until residual pixel point equates with described corresponding row or column with image of high-resolution.
Stereo-picture synthesizer of the present invention, image synthesis unit comprises:
The form selector is used for determining the synthetic form of image;
Image compressor, be used for when synthetic form is full frame (full side-by-side) shoulder to shoulder or full frame point and point (full dot-by-dot), with described image with high-resolution with process after described image with low resolution by the left and right side by side or up and down side by side mode synthesize one road image; Be half screen shoulder to shoulder when (half side-by-side) or half screen point and point (half dot-by-dot) at synthetic form, the two-way image is taken out pixel every row or column, then by left and right side by side synthetic one road image of mode side by side or up and down.
Implement stereo-picture synthetic method of the present invention and device, two different images of resolution can be merged into stereo-picture, overcome in the prior art requirement to the two-way image resolution ratio, make the camera lens that to choose flexibly different size in the process of taking stereo-picture, improve the convenience of shooting stereo images, also helped the cost that reduces stereoscopic shooting device.
Description of drawings
The present invention will be described below in conjunction with accompanying drawing, 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 images match unit;
Fig. 8 is the functional block diagram of the second interpolating unit.
Embodiment
The present invention is described in detail below in conjunction with the drawings and specific embodiments.
Be illustrated in figure 1 as the flow chart of stereo-picture synthetic method of the present invention, stereo-picture synthetic method of the present invention is to process for the two not identical images to be synthesized of width resolution, make two width images after processing have identical resolution, can carry out the merging of stereo-picture.
At first in step S1, obtain the image that two-way is used for merging, this two-way image is taken same object from different angles and is obtained, and tell the concrete resolution of two-way image, for outstanding characteristics of the present invention, the resolution that limits 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 the resolution of the low-resolution image after processing improve and equate with high-definition picture.
Concrete processing method is S2: low-resolution image is carried out the interpolation conversion, and the foundation of interpolation is full resolution pricture, at first the pixel in each low-resolution image is searched the Corresponding matching point on high-definition picture; If can correctly mate the pixel of remembering in this low-resolution image is correct match point, otherwise is error matching points; To adjacent two correct match points, search corresponding two corresponding pixel points in high-definition picture, be inserted between the correct match point of two low-resolution images after the pixel between the pixel of the high-definition picture of two correspondences is average by row or column.So just completed primary interpolation.For example Fig. 2 is low-resolution image 500, and Fig. 3 is high-definition picture 600, and wherein two adjacent corresponding points of 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 delegation; Corresponding the first corresponding the second corresponding points 604 of the correct match point 502 of corresponding points 601, the second of the first correct match point 501; Two row pixels (602,603) are arranged between two corresponding points, two row pixels are pressed column average, be i.e. pixel average out to 1 point in 602, pixel average out to 1 point in 603; Then with these two the average rear points that generate, be inserted between two adjacent correct match points (501,502).Be more than two consecutive points at the interpolation operation with delegation, when two adjacent correct match points at same row the time, average by row between two corresponding points in high-definition picture after, be inserted between two adjacent correct match points of same row.
A part of pixel, the image after comparison process and high-definition picture have been inserted this moment: if the image after just occurring processing is identical with high-resolution, finish dealing with, can carry out the merging of image; If the high-resolution image of image ratio after occurring processing is many, carry out the adaptability deletion, make the resolution of two images equate.
Yet in most cases, the image after interpolation is compared with high-definition picture for the first time, or needs further to insert pixel.Carry out secondary interpolation this moment, adopt bilinear interpolation method, specifically comprise the following steps:
Obtain more for the first time the pixel number of image and high-definition picture after interpolation, determine that the average insertion of neighbor pixel in the image of interpolation acquisition is for the first time counted, and round up; For example, in certain delegation, the first interpolation image has 400 pixels, and is 1250 at the pixel of high-definition picture corresponding row, inserts between 2 of the first interpolation image:
(1250-400)÷400=2.125
Then rounding up is 3 pixels, and the numerical value such as the gray scale of concrete insertion pixel, RGB are realized by following method:
According to bilinear interpolation method, image inserts pixel after the interpolation for the first time, specifically as shown in Figure 4: the XY plane is the plane at image place after interpolation for the first time, ABCD is for after interpolation for the first time, can form tetragonal minimum combination on the first interpolation image, namely the quadrangle inside that surrounds of ABCD no longer includes other pixels.Because we have calculated the number that the adjacent point-to-point transmission of each row, column needs the average pixel that inserts in previous step, that is to say that we have known number and the position of the pixel that specifically need to insert in quadrangle ABCD.Suppose at inner E point and need to insert pixel.After this set up the Z axis of orientation, the numerical value of the gray scale that this axle can represent pixel, RGB etc., the gray scale corresponding take gray scale as example ABCD is A ' B ' C ' D ' on figure.The adjacent point of A ' B ' C ' D ' is coupled together, obtain the linear change between each point.After this E is projected to one group of opposite side (as AD and BC) of ABCD, then the corresponding gray value that finds two subpoints respectively on A ' D ' and B ' C ', at last the point of these two gray values on figure coupled together, so just can find gray value to Z-direction from the E point.In like manner, also can use AB, CD both sides as the projection limit, the result of its acquisition is identical.
If after the insertion pixel, the pixel of low-resolution image is more than high-definition picture, calculate the pixel number that each row or column need to be deleted; With the pixel sum of this row or column pixel number divided by the needs deletion, and round downwards, be designated as S; Since S+1 pixel, every pixel of S pixel deletion, until residual pixel point row or column corresponding to high-definition picture equates, for example: after carrying out bilinear interpolation, the pixel of low-resolution image is 1400 points, and pixel corresponding to high-definition picture is 1250, and counting that will delete this moment is 1400-1250=150, then do the business: 1400 ÷ 150=9.33, rounding downwards is 9.Then since the 10th pixel, 1 pixel of every 9 point deletions is deleted altogether 150.Need to prove, this delet method also is applicable to the operation that pixel that low-resolution image appears after interpolation in front is for the first time Duoed than the high-definition picture pixel.
Like this after twice interpolation, the resolution of low-resolution image is consistent with full resolution pricture, then can carry out the synthetic of image: first determine the synthetic form of image, image can be collectively referred to as in the present invention form (side-by-side) or point and point form (dot-by-dot) shoulder to shoulder, and be further divided into full frame (full) and half screen (half), that is:
The image after processing when if synthetic form is full frame (full side-by-side) shoulder to shoulder or full frame point and point (full dot-by-dot) by the left and right side by side or up and down side by side mode synthesize one road image; If synthetic form is half screen shoulder to shoulder when (half side-by-side) or half screen point and point (half dot-by-dot), the two-way image is taken out pixel every row or column, then by left and right side by side synthetic one road image of mode side by side or up and down.
Need to prove, the present invention can also synthesize according to other form when carrying out the combined diagram picture, has more than to be limited to above-mentioned several picture formats.
As Fig. 5, be the system block diagram of stereo-picture synthesizer of the present invention, comprise in this system 4 modules that connect successively: signal receiving module 100, image processing module 200, image synthesis unit 300 and image output module 400.Signal receiving module 100 obtains the two-way image, and differentiates the resolution of two-way image, for example in the 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 that obtains, and makes the image resolution ratio after conversion equate with high-definition picture; After 300 pairs of conversions of image synthesis unit, image and high-definition picture synthesize processing; Stereo-picture after being synthesized by image output module 400 outputs at last.
Concrete as shown in Figure 6, image processing module 200 also specifically comprises: the images match unit 201, the first interpolating unit 202 and the second interpolating unit 203 that connect successively.The function of unit is as follows:
Images match unit 201 is used for each pixel of low-resolution image is searched the Corresponding matching point on high-definition picture; If can correctly mate the pixel of remembering in this low-resolution image is correct match point, otherwise is error matching points;
The first interpolating unit 202 is used for adjacent two correct match points, searches corresponding two corresponding pixel points in high-definition picture, is inserted between two correct match points after the pixel between two corresponding pixel points is average by row or column.When two correct match points are with delegation the time, be inserted between two correct match points after by column average between two corresponding pixel points; And when two correct match points are same row, be inserted between two correct match points after average by row between two corresponding pixel points.
As shown in Figure 7, in order to realize interpolation success for the first time, images match unit 201 disposes matching template generator 2011, the pixel of this matching template generator 2011 in the low-resolution image is as mid point or summit, choose the pixel zone of (2m+1) * (2n+1) as matching template, 1≤m≤5,1≤n≤5 wherein; When choosing, the preferential pixel of attempting in the low-resolution image is set up matching template as mid point, when the pixel zone of choosing has exceeded original low-resolution image, change pixel in the low-resolution image into as the summit, make the zone of choosing be arranged in low-resolution image fully.
It is regional that matching template covering device 2012 covers the high-definition picture corresponding pixel points with matching template;
Calculate the mistake matching rate by mistake matching rate calculator 2013, this mistake matching rate is:
Wherein, the poor sum of absolute grayscale is the zone that is covered by matching template in high-definition picture, with the absolute value sum of the difference of corresponding pixel points gray value in matching template;
Then miss matching threshold comparator 2014 and set mistake matching rate threshold values, if the mistake matching rate correctly mates, otherwise is erroneous matching less than mistake matching rate threshold value.This threshold value is 1% to 5%, and numerical value is less, and the matching degree of resulting normal match point is higher.
As shown in Figure 8, the second interpolating unit 203 is used for the linear pixel that inserts between the neighbor pixel of image after the processing of the first interpolating unit 202, makes the low-resolution image after insertion equate with the pixel of high-definition picture.Concrete, the second interpolating unit 203 comprises:
Insertion count calculator 2031 relatively the first interpolating unit 202 obtain the pixel number of images and high-definition picture, determine that the first interpolating unit 202 processes the average insertion of neighbor pixel in images afterwards and count, and round up;
Bilinear interpolation device 2032 is used for according to bilinear interpolation method, and the image that obtains to the first interpolating unit 202 inserts pixel;
Pixel adjuster 2033, the pixel that is used for low-resolution image after inserting pixel calculate the pixel number that needs each row or column deletion during more than high-definition picture; With the pixel sum of this row or column pixel number divided by the needs deletion, and round downwards, be designated as S; Since S+1 pixel, every pixel of S pixel deletion, until residual pixel point row or column corresponding to high-definition picture equates.
After the interpolation of twice, two images that resolution is identical have been obtained, image output module 400 is collectively referred to as form (side-by-side) or point and point form (dot-by-dot) shoulder to shoulder with image, and is further divided into full frame (full) and half screen (half), that is:
The image after processing when if synthetic form is full frame (full side-by-side) shoulder to shoulder or full frame point and point (full dot-by-dot) by the left and right side by side or up and down side by side mode synthesize one road image; If synthetic form is half screen shoulder to shoulder when (half side-by-side) or half screen point and point (half dot-by-dot), the two-way image is taken out pixel every row or column, then by left and right side by side synthetic one road image of mode side by side or up and down.
These are only the specific embodiment of the invention, can not limit scope of the present invention with this, the equalization that those skilled in the art in the art do according to this creation changes, and the change known of those skilled in that art, all should still belong to the scope that the present invention is contained.