WO2016058359A1 - Method and device for generating three-dimensional image - Google Patents

Method and device for generating three-dimensional image Download PDF

Info

Publication number
WO2016058359A1
WO2016058359A1 PCT/CN2015/077900 CN2015077900W WO2016058359A1 WO 2016058359 A1 WO2016058359 A1 WO 2016058359A1 CN 2015077900 W CN2015077900 W CN 2015077900W WO 2016058359 A1 WO2016058359 A1 WO 2016058359A1
Authority
WO
WIPO (PCT)
Prior art keywords
feature
region
determining
plane
value
Prior art date
Application number
PCT/CN2015/077900
Other languages
French (fr)
Chinese (zh)
Inventor
张启平
孙李娜
Original Assignee
华为技术有限公司
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2016058359A1 publication Critical patent/WO2016058359A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T17/00Three dimensional [3D] modelling, e.g. data description of 3D objects

Definitions

  • the present invention relates to the field of image processing, and more particularly to a method and apparatus for generating a three-dimensional image.
  • Three-dimensional reconstruction is getting more and more attention because of the ability to reconstruct the three-dimensional model information of objects.
  • a method for determining the depth of the anti-aliasing iteration of the viewpoint image is proposed, which mainly solves the problem of deep error. Since the method puts the target of depth determination on the viewpoint image, this inevitably leads to a low depth resolution and cannot obtain an overly complex scene, which results in a limited application range of the method.
  • an improved high-resolution reconstruction method for computing integrated images is proposed, which mainly solves the problem that the existing computational integrated imaging reconstruction method has low resolution and high reconstruction complexity.
  • the method determines the non-zero pixel points in the reconstructed image point by point, and superimposes the color value on the zero pixel points among the adjacent 8 pixel points, and integrates and restores the three-dimensional image of the target.
  • the reconstruction method described by the method still results in a two-dimensional image, and cannot restore the depth information of the three-dimensional object, thereby reducing the advantages of light field imaging.
  • the present invention provides a method and apparatus for generating a three-dimensional image, which can extract depth values more accurately and more accurately generate a three-dimensional image.
  • a method for generating a three-dimensional image comprising: acquiring a plurality of micro-cell images; dividing a plurality of feature regions on each of the micro-cell images, each of the plurality of feature regions The difference between the color values of any two pixel points is less than or equal to the first threshold; and the plurality of area planes are determined according to the plurality of feature areas, wherein the feature areas included in each of the area planes belong to the same object or belong to the same
  • the source area each of the plurality of feature areas belongs to only one of the plurality of area planes; the area plane depth value of each area plane is determined; and the three-dimensional image is obtained according to the area plane depth value.
  • the determining, by the plurality of feature regions, the plurality of region planes includes: determining a first feature region of the plurality of feature regions and the first a contiguous region of a feature region; determining a first joint probability density that the first feature region and the adjacent feature region of the first feature region do not belong to the same object; determining a contiguous feature region of the first feature region and the first feature region a second joint probability density belonging to the same object; determining a neighboring feature region of the first feature region and the first feature region when a ratio of the first joint probability density to the second joint probability density is less than or equal to a second threshold It belongs to the same area plane in the plurality of area planes, and the same area plane includes feature areas belonging to the same object.
  • determining the plurality of area planes according to the plurality of feature areas including: determining a second feature area of the plurality of feature areas, and the a contiguous region of the second feature region; a first likelihood ratio of the merge region and the second feature region, a second likelihood ratio of the merge region and the adjacent feature region of the second feature region, the merge region including the second a feature area and an adjacent area of the second feature area; determining the adjacency of the second feature area and the second feature area when the first likelihood ratio and/or the second likelihood ratio is less than or equal to a third threshold
  • the feature area belongs to the same area plane in the plurality of area planes, and the feature area included in the same area plane belongs to the same object.
  • the determining, by the plurality of feature regions, the plurality of region planes includes: determining, in the image of the first microcell in the plurality of feature regions a third feature area; determining a fourth feature area in the second microcell image of the plurality of feature areas that has the smallest color error value of the third feature area, the second microcell image and the first microcell image And the color error value of the fourth feature area and the third feature area is less than or equal to a fourth threshold; determining that the third feature area and the fourth feature area belong to the same area plane of the plurality of area planes, the same The feature area included in the area plane belongs to the homologous area.
  • the Determining a plurality of area planes includes: determining a fifth feature area of the third micro unit image and a center pixel point of the fifth feature area of the plurality of feature areas; and in the fourth micro unit image, Centering on a pixel point on the same pole line of the central pixel, determining a plurality of regions having the same size and shape as the fifth feature region, the fourth microcell image being adjacent to the third microcell image; Determining, in the plurality of regions, a sixth feature region having a smallest color error value with the fifth feature region, wherein a color error value of the sixth feature region and the fifth feature region is less than or equal to a fifth threshold; determining the fifth feature region and The sixth feature area belongs to the same area plane in the plurality of area planes, and the feature area included in the same area plane belongs to the same area.
  • the acquiring the plurality of micro-units includes: acquiring a light field image by using a light field camera; mapping each pixel point in the light field image to a five-dimensional space to obtain a corresponding mapped pixel point, where the coordinates of the five-dimensional space include: horizontal X-direction coordinates , vertical Y direction coordinate, red component intensity value coordinate, green component intensity value coordinate and blue component intensity value coordinate; the average color value of the highest density region in the neighborhood of the mapped pixel point is determined as the color value of the mapped pixel point; The mapped pixel points that determine the color value determine the plurality of microcell images.
  • the determining each of the regions Determining a plane depth value of the plane includes: determining at least one feature point in the plane of each area; determining a depth value of the at least one feature point; determining a depth value of the area plane of the area of each area, where the plane depth value is An average of depth values of the at least one feature point.
  • the acquiring the plurality of micro unit images includes: acquiring the plurality of micro unit images by using a light field camera; Determining the depth value of the at least one feature point includes: determining a center interval of the adjacent lens of the light field camera; determining a distance from a plane where the plurality of microcell images are located to a plane of the light field camera lens array; determining the mth The disparity value of the feature point; the depth value w m ' of the mth feature point is calculated according to the following formula:
  • determining the disparity value of the mth feature point includes: using the mth feature point as The center establishes an original matching block; determines a to-be-matched block in the micro-cell image adjacent to the micro-cell image in which the original matching block is located; and determines an original view of the m-th feature point according to the original matching block and the to-be-matched block a difference; determining, according to the original disparity value, a microcell image to be matched that is farthest from the microcell image where the mth feature point is located, and determining the microcell image of the to-be-matched microcell image and the original matching block The difference in the number of images between the two; according to the original matching block and the matching block in the image of the to-be-matched micro-unit with the smallest color error value of the original matching block, determining the matching disparity value of the m-th feature point; according to the following formula Calculating the exact dispar
  • D is the matching disparity value
  • n is the difference in the number of images.
  • the acquiring the multiple micro cells includes: acquiring, by using a light field camera, the plurality of microcell images; obtaining the three-dimensional image according to the planar depth value of the region, comprising: establishing a three-dimensional coordinate system, where the three-dimensional coordinate system includes an x-axis, a y-axis, and a z-axis; The following formula generates a three-dimensional image in the three-dimensional coordinate system:
  • P j represents coordinate values of the j-th pixel point in the plurality of micro-cell images corresponding to the three-dimensional coordinate system
  • C j represents coordinates of the j-th pixel point corresponding to the center of the microlens in the plurality of micro-cell images a value
  • X j represents a coordinate value of the j-th pixel in the plurality of micro-cell images
  • w j represents a plane depth value of the region of the region plane where the j-th pixel is located
  • i represents the plurality of micro- The distance from the plane of the unit image to the plane of the light field camera lens array, the j being less than or equal to the number of all the pixels in the plurality of microcell images.
  • an apparatus for generating a three-dimensional image comprising: an obtaining module, configured to acquire a plurality of micro-cell images; and a dividing module, configured to divide a plurality of feature regions on each of the micro-cell images, The difference between the color values of any two of the plurality of feature regions is less than or equal to the first threshold; the first determining module is configured to determine the plurality of region planes according to the plurality of feature regions, The feature area included in each area plane belongs to the same object or belongs to the same area, and each of the plurality of feature areas belongs to only the multiple area planes. And a second determining module, configured to determine an area plane depth value of each area plane; and a third determining module, configured to obtain a three-dimensional image according to the area plane depth value.
  • the first determining module is specifically configured to: determine a first feature region of the plurality of feature regions and an adjacent region of the first feature region; Determining a first joint probability density that the first feature region and the adjacent feature region of the first feature region do not belong to the same object; determining that the first feature region and the adjacent feature region of the first feature region belong to a second association of the same object a probability density; when the ratio of the first joint probability density to the second joint probability density is less than or equal to the second threshold, determining that the first feature region and the adjacent feature region of the first feature region belong to the plurality of region planes The same area plane, the feature area included in the same area plane belongs to the same object.
  • the first determining module is specifically configured to: determine a second feature region of the plurality of feature regions and an adjacent region of the second feature region; Determining a first likelihood ratio of the merged region and the second feature region, a second likelihood ratio of the merged region and the adjacent feature region of the second feature region, the merged region including the second feature region and the second feature a contiguous region of the region; when the first likelihood ratio and/or the second likelihood ratio is less than or equal to the third threshold, determining that the second feature region and the adjacent feature region of the second feature region belong to the plurality of regions The same area plane in the plane, the feature area included in the same area plane belongs to the same object.
  • the first determining module is specifically configured to: determine a third feature region in the first microcell image of the plurality of feature regions; a fourth feature region of the second microcell image of the plurality of feature regions having the smallest color error value of the third feature region, the second microcell image being adjacent to the first microcell image, the fourth feature region And determining, by the third feature region, a color error value that is less than or equal to a fourth threshold; determining that the third feature region and the fourth feature region belong to the same region plane in the plurality of region planes, and the feature region included in the same region plane belongs to Homologous region.
  • the first determining module is specifically configured to: determine a fifth feature region in the third microcell image of the plurality of feature regions, and the first a central pixel point of the five feature regions; in the fourth microcell image, a plurality of regions having the same size and shape as the fifth feature region are determined centering on a pixel point on the same pole line as the central pixel point a fourth microcell image is adjacent to the third microcell image; and a sixth feature region having a smallest color error value with the fifth feature region is determined in the plurality of regions, the sixth feature region and the sixth feature region The color error value of the five feature regions is less than or equal to the fifth threshold; determining that the fifth feature region and the sixth feature region belong to the same region plane in the plurality of region planes, and the feature region included in the same region plane belongs to the same region .
  • the acquiring module is specifically used to : acquiring a light field image by using a light field camera; mapping each pixel point in the light field image to a five-dimensional space to obtain a corresponding mapped pixel point, wherein the coordinates of the five-dimensional space include: horizontal X direction coordinate, vertical Y Direction coordinate, red component intensity value coordinate, green component intensity value coordinate and blue component intensity value coordinate; determining an average color value of the highest density region in the neighborhood of the mapped pixel point as a color value of the mapped pixel point; The mapped pixel of the value determines the plurality of microcell images.
  • the second determining module is specific And determining, by the at least one feature point in the plane of each area, determining a depth value of the at least one feature point, and determining an area plane depth value of the area plane, where the area plane depth value is the at least one feature point The average of the depth values.
  • the acquiring module is specifically configured to: acquire the multiple micro unit images by using a light field camera;
  • the determining module is specifically configured to: determine a center interval of the adjacent lens of the light field camera; determine a distance from a plane where the plurality of micro unit images are located to a plane of the light field camera lens array; and determine a disparity value of the mth feature point;
  • the depth value w m ' of the mth feature point is calculated according to the following formula:
  • t for the light field camera lens center spacing of adjacent; for i from the plane where the image of the micro cell to the light-field camera lens plane of the array; disparity value D m for the m-th feature point .
  • the second determining module is specifically configured to: establish an original matching block by using the mth feature point; Determining a block to be matched in the microcell image adjacent to the microcell image in which the original matching block is located; determining an original disparity value of the mth feature point according to the original matching block and the to-be-matched block; Determining the image of the microcell to be matched that is farthest from the microcell image where the mth feature point is located, and determining the difference in the number of images between the image of the microcell to be matched and the microcell image where the original matching block is located a value; determining a matching disparity value of the mth feature point according to the original matching block and the matching block with the smallest color error value of the original matching block in the to-be-matched microcell image; and calculating the mth matching according to the following formula The exact disparity value of the block d m :
  • D is the matching disparity value
  • n is the difference in the number of images.
  • the acquiring module is specifically used to Obtaining the plurality of microcell images by using a light field camera;
  • the third determining module is specifically configured to: establish a three-dimensional coordinate system, where the three-dimensional coordinate system includes an x-axis, a y-axis, and a z-axis; and the three-dimensional coordinates are according to the following formula Generate a 3D image within the system:
  • P j represents coordinate values of the j-th pixel point in the plurality of micro-cell images corresponding to the three-dimensional coordinate system
  • C j represents coordinates of the j-th pixel point corresponding to the center of the microlens in the plurality of micro-cell images a value
  • X j represents a coordinate value of the j-th pixel in the plurality of micro-cell images
  • w j represents a plane depth value of the region of the region plane where the j-th pixel is located
  • i represents the plurality of micro- The distance from the plane of the unit image to the plane of the light field camera lens array, the j being less than or equal to the number of all the pixels in the plurality of microcell images.
  • the method and apparatus for generating a three-dimensional image by acquiring a plurality of micro-cell images, dividing the feature regions on the plurality of micro-cell images, combining the feature regions into the region planes, and calculating the depth values of the region planes
  • the three-dimensional image is generated according to the depth value, which avoids the mismatch in the depth value extraction process, thereby more accurately extracting the depth value, thereby making the generated three-dimensional image more accurate and realistic, and the application scene range is wider.
  • FIG. 1 is a schematic flow chart of a method of generating a three-dimensional image according to an embodiment of the present invention.
  • FIG. 2 is a schematic diagram of a method of generating a three-dimensional image in accordance with an embodiment of the present invention.
  • FIG. 3 is a schematic block diagram of an apparatus for generating a three-dimensional image in accordance with an embodiment of the present invention.
  • FIG. 4 is another schematic block diagram of an apparatus for generating a three-dimensional image in accordance with an embodiment of the present invention.
  • FIG. 1 shows a schematic flow diagram of a method 100 of generating a three-dimensional image, which may be performed by a terminal, in accordance with an embodiment of the present invention. As shown in FIG. 1, the method 100 includes:
  • S130 Determine, according to the multiple feature regions, a plurality of region planes, where the feature regions included in each region plane belong to the same object or belong to the same region, and each of the plurality of feature regions belongs to the plurality of feature regions only One of the area planes;
  • the two-dimensional micro-cell image may be acquired by using the light field camera, and the feature region is divided on the micro-cell image, and the pixel point in the feature region satisfies the difference between the color values of any two pixel points is less than or equal to the first A threshold, and each pixel on the microcell image belongs to one of the plurality of feature regions.
  • the region plane is obtained by combining the feature regions, and the depth value in each region plane is calculated.
  • the depth value is used as the depth value of all the pixels in the region plane, and a three-dimensional coordinate system is established, and each depth value is determined according to the depth value of each pixel point.
  • the three-dimensional coordinate values of the pixels thereby generating a three-dimensional image.
  • the method for generating a three-dimensional image is performed by dividing a feature region on the acquired plurality of microcell images, combining the feature region into a region plane, calculating a depth value of the region plane, and generating a three-dimensional stereoscopic image according to the depth value,
  • the mismatching in the depth value extraction process is avoided, so that the depth value can be extracted more accurately, thereby making the three-dimensional stereo image more accurate and realistic, and the application scene range is wider.
  • a plurality of microcell images can be obtained by a light field camera. Specifically, it can pass The light field camera directly captures a light field image, which is a micro cell image array composed of a plurality of micro cell images.
  • the light field image may be mapped by the mean shift method. Specifically, each pixel in the light field image is mapped to a five-dimensional space to obtain a corresponding mapped pixel, and the coordinates of the five-dimensional space include: horizontal X-direction coordinates, vertical Y-direction coordinates, and red component intensity values.
  • Coordinate, green component intensity value coordinate and blue component intensity value coordinate for each mapped pixel obtained by mapping, obtaining an average color value of a maximum density region within a neighborhood of each mapped pixel; using the color value as the mapped pixel.
  • the new color value of the point, and then the color value of the original pixel point is re-determined from the five-dimensional space to obtain a new micro-cell image array.
  • the size of the mapped pixel point neighborhood may be determined based on empirical values.
  • a plurality of feature regions may be divided on each microcell image in the microcell image array composed of the acquired plurality of microcell images, such that the pixel points included in each feature region satisfy the color of any two pixel points.
  • the difference in values is less than or equal to the first threshold.
  • the different feature regions do not overlap, and each pixel point belongs to only one of the plurality of feature regions.
  • the color value of the pixel may include an RGB (Red Red, Green Green, Blue Blue) value or an HSV (Hue Tone, Saturation Saturation, Value Brightness) value of the pixel, but the present invention is not limited thereto. .
  • the feature area can be divided by the flooding method.
  • a pixel point that is not divided into a feature area or is not marked as a area plane is arbitrarily selected as a seed point on any one of the micro unit images, and the seed point is used as a new feature area.
  • Gradually finding a pixel point that is smaller than or equal to a first threshold value in a contiguous set of the feature area for example, the color value may be an RGB value, and the first threshold is a corresponding RGB threshold, in turn Calculating whether the difference between the seed point and the color value of the pixel point in the adjacent set meets less than or equal to the set threshold.
  • the contiguous set of the feature regions may include 4 neighborhood pixels, and may also include 8 neighborhood pixels.
  • the first threshold may be set according to experience, or may be set according to image processing requirements, and the present invention is not limited thereto.
  • the feature area divided by the flooding method is a continuous area, and the difference of the color values of any two pixel points belonging to the same feature area satisfies less than or equal to the first threshold.
  • the feature region is further divided by the Kmeans algorithm, and the obtained feature region includes a discontinuous region, and each of the feature regions meets a difference between the color values of any two pixels in the same feature region is less than or equal to the first A threshold, the first threshold may be set according to an empirical value.
  • all the micro unit images may be divided into feature regions at the same time, and may be sequentially divided according to a certain direction, for example, in order from left to right and from top to bottom.
  • the plurality of micro cell images are divided, and the present invention is not limited thereto.
  • a plurality of area planes are determined according to the plurality of divided feature regions.
  • the plurality of feature regions belonging to the same object may be combined to obtain a region plane by determining whether the plurality of feature regions belong to the same object; and the plurality of feature regions may belong to the same region, and may belong to the same region.
  • Multiple feature regions are combined to obtain a region plane; it is also possible to determine whether multiple feature regions belong to the same object, combine feature regions belonging to the same object, and determine whether multiple feature regions belong to the same region, and belong to the same region.
  • Multiple feature areas of the area are also merged to finally obtain the area plane.
  • the feature area may be merged, the area plane may be obtained by combining the feature areas on the position, and the feature area may be merged by marking the feature areas of different positions as the same area plane.
  • whether the plurality of feature regions belong to the same object can be determined by the following method.
  • the gray values follow a normal distribution.
  • the calculated feature region R 1 and the adjacent feature region R 2 respectively include m 1 and m 2 pixel points, and have the following two assumptions:
  • H 1 : R 1 and R 2 do not belong to the same object, in which case the gray values of both regions obey different Gaussian distributions ( ⁇ 1 , ⁇ 1 2 ) and ( ⁇ 2 , ⁇ 2 2 ).
  • the above parameters are unknown, but can be estimated using samples.
  • the correlation parameters ⁇ 0 , ⁇ 1 , ⁇ 2 in the embodiment of the present invention can be obtained by the formulas (2) and (3).
  • the ratio of the combined densities of H 1 and H 0 is calculated by the following formula (6), which is a likelihood ratio L:
  • the second threshold When the L value is less than or equal to the second threshold, it is determined that the feature region R 1 and the adjacent feature region R 2 belong to the same object, and when the L value is greater than the second threshold, determining that the feature region R 1 and the adjacent feature region R 2 are not Belong to the same object.
  • Each feature region in each microcell image and the adjacent region of the feature region are judged and combined by the above method to obtain a plurality of region planes.
  • the second threshold may be set according to an empirical value, or may be set according to an image processing requirement, and the present invention is not limited thereto.
  • the feature region and the adjacent region of the feature region are combined into a merged region, and the feature is determined by calculating a likelihood ratio of the merged region and the adjacent region of the feature region and the feature region. Whether the area and the adjacent area of the feature area belong to the same object.
  • selecting any two adjacent feature regions in any one of the plurality of micro cell images is the second feature region R 1 and the adjacent region R 2 of the second feature region, and R 1 and R 2 merged into a merged region R 3, according to the above equations (1) - (6) calculating the likelihood ratio L 31 R 3 and R 1 are, respectively, R 3 and R 2 log likelihood ratio L 32, if L 31 and / or If L 32 is less than or equal to the third threshold, it can be determined that R 1 and R 2 belong to the same object, otherwise, it can be determined that R 1 and R 2 do not belong to the same object.
  • the third threshold may be set according to an empirical value, or may be set according to an image processing requirement, and the present invention is not limited thereto.
  • the area plane may be determined by determining that multiple feature areas belong to the same area. Specifically, in any two adjacent micro cell image first micro cell image and second micro cell image, any one of the first micro cell images is selected as a third feature region, and the second micro cell image is selected. Each feature region on the top is regarded as a suspected homologous region. Calculate the color error value E of the third feature region and each suspected homologous region according to the following formula (7):
  • the color value of the corresponding pixel; E represents the sum of the differences of the color values of all the pixels in the third feature region and the suspected homologous region. Selecting a suspected homologous region in which all the suspected homologous regions satisfying the color error value E is less than or equal to the fourth threshold is the fourth feature region, and the fourth feature region and the third feature region are homologous region. If there is no fourth feature area, the same area determined as the third feature area is the third feature area itself.
  • the fourth threshold may be set according to an empirical value, or may be set according to an image processing requirement, and the present invention is not limited thereto.
  • Each feature region in each microcell image and the adjacent microcell image is sequentially determined by the above method, and the feature regions belonging to the homologous region are combined to obtain a region plane.
  • the color value of the pixel may include an RGB value or an HSV value of the pixel, but the invention is not limited thereto.
  • whether the multiple feature regions belong to the homologous region may also be determined by the following method. Any one of the plurality of micro cell images is used as the fifth feature region, and the central pixel of the fifth feature region is determined. In the fifth feature area In the micro cell image adjacent to the micro cell image, each pixel point on the same pole line as the central pixel point is sequentially selected, and the same size and shape as the fifth feature region are established with these pixel points as a center. The region is a suspected homologous region. According to the formula (7), the color error value E between the fifth feature region and each of the plurality of suspected homologous regions is sequentially calculated.
  • the region where the color error value E is less than or equal to the fifth threshold the region where the color error value E is the smallest is the sixth feature region, and the sixth feature region is the homologous region of the fifth feature region. If the sixth feature area does not exist, the same area determined as the fifth feature area is the fifth feature area itself.
  • the fifth threshold may be set according to an empirical value, or may be set according to an image processing requirement, and the present invention is not limited thereto.
  • the color value of the pixel may include an RGB value or an HSV value of the pixel, but the invention is not limited thereto.
  • the feature regions when the feature regions are merged by the foregoing method, the feature regions may be divided according to a certain direction, and the feature regions are merged in a certain order to obtain a region plane.
  • the microcell image may be sequentially divided into a plurality of feature regions in order from left to right and from top to bottom, and the fifth feature region is determined in the microcell image in which the feature region is divided, and the adjacent regions are not divided.
  • a sixth feature area is determined in the microcell image of the feature area.
  • the area plane depth values of the respective area planes are calculated.
  • the depth value of the area plane may be determined by determining feature points in each area plane and calculating a depth value of each feature point.
  • the feature points in the plane of the area may be determined by the SIFT feature point search method, and the feature points may also be determined by the FAST feature point search method, and the present invention is not limited thereto.
  • the depth values of the respective feature points are calculated.
  • a plurality of microcell images can be obtained by a light field camera, the microcell images constitute a two-dimensional microcell image array, and the depth value w m ' of the mth feature point is determined according to the following formula (8):
  • t is the adjacent lens center interval of the light field camera
  • i is the distance from the microcell image array plane to the light field camera lens array plane
  • d m is the parallax value of the mth feature point
  • m Representing any one of all feature points, the depth value of each feature point on each area plane is calculated by the formula (8).
  • the disparity value d m in the formula can be calculated by a block matching algorithm.
  • the disparity value d m can also be calculated more accurately by the method of color error value matching.
  • the original matching block is established centering on the mth feature point, and the size of the matching block can be set according to an empirical value, and the mth feature is determined according to the block matching algorithm.
  • the pixel to be matched on the adjacent microcell image of the microcell image where the point is located, and the original disparity value of the mth feature point is calculated.
  • d m represents the disparity value of the mth feature point
  • the mth feature point is any feature point in any area plane.
  • the disparity value of each feature point can be calculated according to the above method.
  • the depth values of all the feature points in the area plane may be averaged, and the average depth value is used as the plane in the area.
  • the depth value of all the pixels but the present invention is not limited thereto.
  • the area plane may be ignored, and the depth value is not calculated, but the present invention is not limited thereto.
  • a three-dimensional image is generated according to the depth value.
  • a three-dimensional coordinate system is established.
  • the three-dimensional coordinate system includes an x-axis, a y-axis, and a z-axis.
  • the backward direction of the generated three-dimensional scene can be set to the positive direction of the z-axis, and the generated three-dimensional scene is oriented.
  • the right direction is set to the positive x-axis direction
  • the direction of the generated three-dimensional scene is set to the positive direction of the y-axis.
  • the x and y directions may correspond to the horizontal and vertical directions of the two-dimensional microcell image array of the original plurality of microcell images.
  • the coordinate value P j of any pixel in any micro cell image in the three-dimensional coordinate system is calculated by using the following formula (10):
  • P j represents a coordinate value of a j-th pixel point in the micro-cell image array corresponding to the three-dimensional coordinate system
  • C j represents a coordinate value of the j-th pixel point in the micro-mirror image array corresponding to the center of the micro-lens
  • X j represents the coordinate value of the j-th pixel point in the micro-cell image array
  • w j represents the depth value of the area of the region where the j-th pixel point is located
  • i represents the micro-cell image array plane to the light The distance of the field camera lens array plane, where j is less than or equal to the number of all pixel points in the microcell image array.
  • an adjacent microcell image or an adjacent feature region of a feature region of the microcell image may be the microcell image or a micro neighborhood within the 4 neighborhood or 8 neighborhoods of the feature region.
  • the unit image or the feature area, the present invention is not limited thereto.
  • the size of the sequence numbers of the above processes does not mean the order of execution, and the order of execution of each process should be determined by its function and internal logic, and should not be taken to the embodiments of the present invention.
  • the implementation process constitutes any limitation.
  • a plurality of micro-cell images are acquired by a light field camera, and a feature region is divided for each micro-cell image, by determining whether each feature region belongs to the same object, and/or each feature region. Whether it belongs to a homologous region, and the feature regions belonging to the same object and/or belonging to the homologous region are region planes, and the average depth value of the feature points in each region plane is calculated, and the average depth value is used as all the pixels in the region plane.
  • the depth value is used to generate a three-dimensional stereo image, which avoids mismatching in the depth value extraction process, thereby more accurately and quickly extracting the depth value, thereby making the generated three-dimensional image more accurate and realistic, and the application scene range is wider.
  • FIG. 1 A method of generating a three-dimensional image according to an embodiment of the present invention is described in detail above with reference to FIGS. 1 through 2, and an apparatus for generating a three-dimensional image according to an embodiment of the present invention will be described below with reference to FIG.
  • FIG. 3 shows a schematic block diagram of an apparatus for generating a three-dimensional image in accordance with an embodiment of the present invention. As shown in Figure 3, the device comprises:
  • the obtaining module 210 is configured to acquire a plurality of micro unit images
  • the dividing module 220 is configured to divide a plurality of feature regions on each of the micro cell images, and a difference of color values of any two pixel points in each of the plurality of feature regions is less than or equal to a first threshold ;
  • the first determining module 230 is configured to determine, according to the plurality of feature regions, a plurality of region planes, wherein the feature regions included in each of the region planes belong to the same object or belong to the same region, and each of the plurality of feature regions The feature area belongs to only one of the plurality of area planes;
  • a second determining module 240 configured to determine an area plane depth value of each area plane
  • the third determining module 250 is configured to obtain a three-dimensional image according to the regional plane depth value.
  • the method for generating a three-dimensional image according to an embodiment of the present invention passes through a plurality of acquired micro cells
  • the feature region is divided on the image, the merged feature region is the region plane, the depth value of the region plane is calculated, and the three-dimensional stereo image is generated according to the depth value, thereby avoiding the mismatch in the depth value extraction process, thereby more accurately extracting the depth value, and further Make the 3D stereo image more accurate and realistic, and the application scene range is wider.
  • a plurality of micro cell images may be acquired by a light field camera to form a micro cell image array
  • the acquiring module 210 acquires the micro cell image array
  • the micro cell image array includes a plurality of micro cell images.
  • the acquisition module 210 may perform mapping processing on the light field image by the mean shift method. Specifically, each pixel in the light field image is mapped to a five-dimensional space to obtain a corresponding mapped pixel, and the coordinates of the five-dimensional space include: horizontal X-direction coordinates, vertical Y-direction coordinates, and red component intensity values.
  • Coordinate, green component intensity value coordinate and blue component intensity value coordinate for each mapped pixel obtained by mapping, obtaining an average color value of a maximum density region within a neighborhood of each mapped pixel; using the color value as the mapped pixel.
  • the new color value of the point, and then the color value of the original pixel point is re-determined from the five-dimensional space to obtain a new micro-cell image array.
  • the size of the mapped pixel point neighborhood may be determined based on empirical values.
  • each micro cell image of the plurality of micro cell images may be divided into a plurality of feature regions by the dividing module 220, so that the pixel points included in each feature region satisfy the color values of any two pixel points. The difference is less than or equal to the first threshold.
  • the different feature regions do not overlap, and each pixel point belongs to only one of the plurality of feature regions.
  • the color value of the pixel may include an RGB value or an HSV value of the pixel, but the invention is not limited thereto.
  • the feature area can be divided by the flooding method.
  • the feature area divided by the flooding method is a continuous area, and the difference of the color values of any two pixel points belonging to the same feature area satisfies less than or equal to the first threshold.
  • the feature region is further divided by the Kmeans algorithm, and the obtained feature region includes a discontinuous region, and each of the feature regions meets a difference between the color values of any two pixels in the same feature region is less than or equal to the first A threshold, the first threshold may be set according to an empirical value.
  • all the micro unit images may be divided into feature regions at the same time, and may be sequentially divided according to a certain direction, for example, in order from left to right and from top to bottom.
  • the plurality of micro cell images are divided, and the present invention is not limited thereto.
  • the first The determination module 230 determines a plurality of area planes.
  • the plurality of feature regions belonging to the same object may be combined to obtain a region plane by determining whether the plurality of feature regions belong to the same object; and the plurality of feature regions may belong to the same region, and may belong to the same region.
  • Multiple feature regions are combined to obtain a region plane; it is also possible to determine whether multiple feature regions belong to the same object, combine feature regions belonging to the same object, and determine whether multiple feature regions belong to the same region, and belong to the same region.
  • Multiple feature areas of the area are also merged to finally obtain the area plane.
  • the feature area may be merged, the area plane may be obtained by combining the feature areas on the position, and the feature area may be merged by marking the feature areas of different positions as the same area plane.
  • the first determining module 430 may determine whether the plurality of feature regions belong to the same object by using the following method.
  • the calculated feature region R 1 and the adjacent feature region R 2 respectively include m 1 and m 2 pixel points, and have the following two assumptions:
  • H 1 : R 1 and R 2 do not belong to the same object, in which case the gray values of both regions obey different Gaussian distributions ( ⁇ 1 , ⁇ 1 2 ) and ( ⁇ 2 , ⁇ 2 2 ).
  • the above parameters are unknown, but can be estimated using samples.
  • the correlation parameters ⁇ 0 , ⁇ 1 , ⁇ 2 in the embodiment of the present invention can be obtained. Therefore, in the case of H 0 , the joint density As shown in formula (4); in the case of H 1 , joint density As shown in formula (5).
  • the ratio of the combined densities of H 1 and H 0 is calculated by the formula (6), and the ratio is the likelihood ratio L.
  • the second threshold When the L value is less than or equal to the second threshold, it is determined that the feature region R 1 and the adjacent feature region R 2 belong to the same object, and when the L value is greater than the second threshold, determining that the feature region R 1 and the adjacent feature region R 2 are not Belong to the same object.
  • Each feature region in each microcell image and the adjacent region of the feature region are judged and combined by the above method to obtain a plurality of region planes.
  • the second threshold may be set according to an empirical value, or may be set according to an image processing requirement, and the present invention is not limited thereto.
  • the first determining module 430 may also be a merged area by combining the feature area and the adjacent area of the feature area, by calculating a similarity between the merged area and the adjacent area of the feature area and the feature area. However, it is determined whether the feature area and the adjacent area of the feature area belong to the same object.
  • any two adjacent feature regions in any one of the plurality of micro cell images is the second feature region R 1 and the adjacent region R 2 of the second feature region, and R 1 and R 2 merged into a merged region R 3, according to the above equations (1) - (6) calculating the likelihood ratio L 31 R 3 and R 1 are, respectively, R 3 and R 2 log likelihood ratio L 32, if L 31 and / or If L 32 is less than or equal to the third threshold, it may be determined that R 1 and R 2 belong to the same object. Otherwise, it may be determined that R 1 and R 2 do not belong to the same object.
  • the third threshold may be set according to an empirical value. It can also be set according to image processing requirements, and the present invention is not limited thereto.
  • the first determining module 430 may determine the area plane by determining that multiple feature areas belong to the same area. Specifically, in any two adjacent micro cell image first micro cell image and second micro cell image, any one of the first micro cell images is selected as a third feature region, and the second micro cell image is selected. Each feature region on the top is regarded as a suspected homologous region.
  • the same area determined as the third feature area is the third feature area itself.
  • the fourth threshold may be set according to an empirical value, or may be set according to an image processing requirement, and the present invention is not limited thereto.
  • Each feature region in each microcell image and the adjacent microcell image is sequentially determined by the above method, and the feature regions belonging to the homologous region are combined to obtain a region plane.
  • the color value of the pixel may include an RGB value or an HSV value of the pixel, but the invention is not limited thereto.
  • the first determining module 430 may further determine whether the multiple feature regions belong to the same region by using the following method. Any one of the plurality of micro cell images is used as the fifth feature region, and the central pixel of the fifth feature region is determined. In the microcell image adjacent to the microcell image in which the fifth feature region is located, each pixel point on the same pole line as the central pixel point is sequentially selected, and the pixel points are established as the center and the fifth pixel. A plurality of regions having the same size and shape as the feature region are suspected homologous regions. According to the formula (7), the color error value E between the fifth feature region and each of the plurality of suspected homologous regions is sequentially calculated.
  • the region where the color error value E is less than or equal to the fifth threshold the region where the color error value E is the smallest is the sixth feature region, and the sixth feature region is the homologous region of the fifth feature region. If the sixth feature area does not exist, the same area determined as the fifth feature area is the fifth feature area itself.
  • the fifth threshold may be set according to an empirical value, or may be set according to an image processing requirement, and the present invention is not limited thereto.
  • the color value of the pixel may include an RGB value or an HSV value of the pixel, but the invention is not limited thereto.
  • the feature regions when the feature regions are merged by the foregoing method, the feature regions may be divided according to a certain direction, and the feature regions are merged in a certain order to obtain a region plane.
  • the microcell image may be sequentially divided into a plurality of feature regions in order from left to right and from top to bottom, and the fifth feature region is determined in the microcell image in which the feature region is divided, and the adjacent regions are not divided.
  • a sixth feature area is determined in the microcell image of the feature area.
  • the second determining module 240 determines the area plane depth values of the respective area planes.
  • the determining module 240 may determine the depth value of the area plane by determining feature points in each area plane and calculating a depth value of each feature point.
  • the feature points in the plane of the area may be determined by the SIFT feature point search method, and the feature points may also be determined by the FAST feature point search method, and the present invention is not limited thereto.
  • the depth value of each feature point is calculated.
  • a plurality of microcell images can be obtained by a light field camera, and the microcell images form a two-dimensional microcell image array, and the depth value w m ' of the mth feature point is determined according to formula (8), as shown in FIG. 2, where t is the adjacent lens center interval of the light field camera; i is the distance from the microcell image array plane to the light field camera lens array plane; d m is the disparity value of each feature point, and m represents all feature points Any one of the feature points, the depth value of each feature point on each area plane is calculated by the formula (8).
  • the disparity value d m in the formula can be calculated by a block matching algorithm.
  • the disparity value d m can also be calculated more accurately by the method of color error value matching. Specifically, taking the mth feature point as an example, the original matching block is established centering on the mth feature point, and the size of the matching block can be set according to an empirical value, and the mth feature is determined according to the block matching algorithm. The pixel to be matched on the adjacent microcell image of the microcell image where the point is located, and the original disparity value of the mth feature point is calculated.
  • determining, according to the calculated original disparity value, a matching microcell image of the matching block that is farthest from the microcell image where the mth feature point is located, and matching the original matching block, and determining the matching microcell image The difference n between the number of microcell images between the microcell image in which the original matching block is located.
  • the depth values of all the feature points in the area plane may be averaged, and the average depth value is obtained.
  • the depth value is taken as the pixel value of all the pixels in the plane of the area, but the present invention is not limited thereto.
  • the area plane may be ignored, and the depth value is not calculated, but the present invention is not limited thereto.
  • the third determining module 250 generates a three-dimensional image according to the depth values.
  • a three-dimensional coordinate system is established.
  • the three-dimensional coordinate system includes an x-axis, a y-axis, and a z-axis.
  • the backward direction of the generated three-dimensional scene can be set to the positive direction of the z-axis, and the generated three-dimensional scene is oriented.
  • the right direction is set to the positive x-axis direction, and the direction of the generated three-dimensional scene is set to the positive direction of the y-axis.
  • the x and y directions may correspond to the horizontal and vertical directions of the two-dimensional microcell image array of the original plurality of microcell images.
  • C j represents the j-th pixel point in the a coordinate value corresponding to the center of the microlens in the microcell image array
  • X j represents a coordinate value of the jth pixel point in the microcell image array
  • w j represents the depth of the plane of the region where the jth pixel point is located
  • the value i represents the distance from the microcell image array plane to the plane of the light field camera lens array, where j is less than or equal to the number of all pixel points in the microcell image array.
  • an adjacent microcell image or an adjacent feature region of a feature region of the microcell image may be the microcell image or a micro neighborhood within the 4 neighborhood or 8 neighborhoods of the feature region.
  • the unit image or the feature area, the present invention is not limited thereto.
  • the apparatus 200 for generating a three-dimensional image may correspond to the execution of the present invention.
  • the method 100 for generating a three-dimensional image in an embodiment of the invention, and the above-described and other operations and/or functions of the respective modules in the apparatus 200 for generating a three-dimensional image are respectively implemented in order to implement the respective processes of the respective methods in FIGS. 1 to 2. , will not repeat them here.
  • the apparatus for generating a three-dimensional image acquires a plurality of microcell images by a light field camera, and divides a feature region for each microcell image, by determining whether each feature region belongs to the same object, and/or each feature region. Whether it belongs to a homologous region, and the feature regions belonging to the same object and/or belonging to the homologous region are region planes, and the average depth value of the feature points in each region plane is calculated, and the average depth value is used as all the pixels in the region plane.
  • the depth value is used to generate a three-dimensional stereo image, which avoids mismatching in the depth value extraction process, thereby more accurately and quickly extracting the depth value, thereby making the generated three-dimensional image more accurate and realistic, and the application scene range is wider.
  • an embodiment of the present invention further provides an apparatus 300 for generating a three-dimensional image, including a processor 310, a memory 320, and a bus system 330.
  • the processor 310 and the memory 320 are connected by a bus system 330 for storing instructions for executing instructions stored by the memory 320.
  • the memory 320 stores program code, and the processor 310 can call the program code stored in the memory 320 to perform the following operations:
  • a three-dimensional image is obtained based on the planar depth value of the region.
  • the apparatus for generating a three-dimensional image divides the feature area on the acquired plurality of micro unit images, merges the feature area into the area plane, calculates the depth value of the area plane, and generates a three-dimensional stereoscopic image according to the depth value.
  • the mismatching in the depth value extraction process is avoided, so that the depth value can be extracted more accurately, thereby making the three-dimensional stereo image more accurate and realistic, and the application scene range is wider.
  • the processor 310 may be a central processing unit (“CPU"), and the processor 310 may also be other general-purpose processors, digital signal processors (DSPs). , application specific integrated circuit (ASIC), off-the-shelf programmable gate array (FPGA) Or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, and the like.
  • the general purpose processor may be a microprocessor or the processor or any conventional processor or the like.
  • the memory 320 can include read only memory and random access memory and provides instructions and data to the processor 310. A portion of the memory 320 may also include a non-volatile random access memory. For example, the memory 320 can also store information of the device type.
  • the bus system 330 may include a power bus, a control bus, a status signal bus, and the like in addition to the data bus. However, for clarity of description, various buses are labeled as bus system 330 in the figure.
  • each step of the foregoing method may be completed by an integrated logic circuit of hardware in the processor 310 or an instruction in a form of software.
  • the steps of the method disclosed in the embodiments of the present invention may be directly implemented as a hardware processor, or may be performed by a combination of hardware and software modules in the processor.
  • the software module can be located in a conventional storage medium such as random access memory, flash memory, read only memory, programmable read only memory or electrically erasable programmable memory, registers, and the like.
  • the storage medium is located in the memory 320, and the processor 310 reads the information in the memory 320 and combines the hardware to perform the steps of the above method. To avoid repetition, it will not be described in detail here.
  • the processor 310 may invoke the program code stored in the memory 320 to: determine a first feature region of the plurality of feature regions and a contiguous region of the first feature region; determine the first Determining, by the feature area, the first joint probability density of the adjacent feature area of the first feature area not belonging to the same object; determining a second joint probability density of the first feature area and the adjacent feature area of the first feature area belonging to the same object; When the ratio of the first joint probability density to the second joint probability density is less than or equal to the second threshold, determining that the first feature region and the adjacent feature region of the first feature region belong to the same region of the plurality of region planes In the plane, the feature area included in the same area plane belongs to the same object.
  • the processor 310 may invoke the program code stored in the memory 320 to: determine a second feature region of the plurality of feature regions and a contiguous region of the second feature region; determine a merge region a first likelihood ratio of the second feature region, a second likelihood ratio of the merged region and the adjacent feature region of the second feature region, the merge region including adjacency of the second feature region and the second feature region a region; when the first likelihood ratio and/or the second likelihood ratio is less than or equal to a third threshold, determining that the second feature region and the adjacent feature region of the second feature region belong to the plurality of region planes The same area plane, the feature area included in the same area plane belongs to the same object.
  • the processor 310 may invoke the program code stored in the memory 320 to: determine a third feature region in the first microcell image of the plurality of feature regions; determine the plurality of features a fourth feature region of the second microcell image in the region having the smallest color error value of the third feature region, the second microcell image being adjacent to the first microcell image, the fourth feature region and the first The color error value of the three feature regions is less than or equal to the fourth threshold; determining that the third feature region and the fourth feature region belong to the same region plane in the plurality of region planes, and the feature region included in the same region plane belongs to the same region .
  • the processor 310 may invoke the program code stored in the memory 320 to: determine a fifth feature region and the fifth feature region in the third microcell image of the plurality of feature regions. a central pixel; in the fourth microcell image, a plurality of regions having the same size and shape as the fifth feature region are determined centering on a pixel point on the same pole line as the central pixel point, the fourth micro a unit image adjacent to the third microcell image; determining, in the plurality of regions, a sixth feature region having a smallest color error value with the fifth feature region, and a color error value of the sixth feature region and the fifth feature region And less than or equal to the fifth threshold; determining that the fifth feature region and the sixth feature region belong to the same region plane in the plurality of region planes, and the feature region included in the same region plane belongs to the same region.
  • the processor 310 may call the program code stored in the memory 320 to perform the following operations: acquiring a light field image by using a light field camera; mapping each pixel point in the light field image to one by one The dimension space obtains corresponding mapped pixel points, and the coordinates of the five-dimensional space include: horizontal X direction coordinates, vertical Y direction coordinates, red component intensity value coordinates, green component intensity value coordinates, and blue component intensity value coordinates; The average color value of the highest density region in the dot neighborhood is determined as the color value of the mapped pixel; the plurality of microcell images are determined according to the mapped pixel determined by the color value.
  • the processor 310 may call the program code stored in the memory 320 to: determine at least one feature point in each area plane; determine a depth value of the at least one feature point; determine the An area plane depth value of each area plane, the area plane depth value being an average of depth values of the at least one feature point.
  • the processor 310 may call the program code stored in the memory 320 to: acquire the plurality of micro unit images by using a light field camera; and determine a center interval of adjacent lenses of the light field camera; Determining a distance from a plane of the plurality of microcell images to a plane of the light field camera lens array; determining a disparity value of the mth feature point; and calculating a depth value w m ' of the mth feature point according to the following formula:
  • the processor 310 may call the program code stored in the memory 320 to perform an operation of: establishing an original matching block centering on the mth feature point; determining a micro cell image where the original matching block is located a block to be matched in an adjacent microcell image; determining an original disparity value of the mth feature point according to the original matching block and the to-be-matched block; determining the mth feature point according to the original disparity value
  • the microcell image is located at the farthest distance to match the microcell image, and determines the difference in the number of images between the image of the microcell to be matched and the microcell image where the original matching block is located; according to the original matching block and the to-be-matched a matching block having the smallest color error value of the original matching block in the micro unit image, determining a matching disparity value of the mth feature point; and calculating an accurate disparity value d m of the mth feature point according to the following formula:
  • D is the matching disparity value
  • n is the difference in the number of images.
  • the processor 310 may call the program code stored in the memory 320 to: acquire the plurality of micro unit images by using a light field camera; and establish a three-dimensional coordinate system, where the three-dimensional coordinate system includes an x-axis , y-axis and z-axis; generate a three-dimensional image in the three-dimensional coordinate system according to the following formula:
  • P j represents coordinate values of the j-th pixel point in the plurality of micro-cell images corresponding to the three-dimensional coordinate system
  • C j represents coordinates of the j-th pixel point corresponding to the center of the microlens in the plurality of micro-cell images a value
  • X j represents a coordinate value of the j-th pixel in the plurality of micro-cell images
  • w j represents a plane depth value of the region of the region plane where the j-th pixel is located
  • i represents the plurality of micro- The distance from the plane of the unit image to the plane of the light field camera lens array, the j being less than or equal to the number of all the pixels in the plurality of microcell images.
  • the apparatus 300 for generating a three-dimensional image according to an embodiment of the present invention may correspond to the apparatus 200 for generating a three-dimensional image in the embodiment of the present invention, and may correspond to performing an embodiment according to the present invention.
  • the apparatus for generating a three-dimensional image divides the feature area on the acquired plurality of micro unit images, merges the feature area into the area plane, calculates the depth value of the area plane, and generates a three-dimensional stereoscopic image according to the depth value.
  • the mismatching in the depth value extraction process is avoided, so that the depth value can be extracted more accurately, thereby making the three-dimensional stereo image more accurate and realistic, and the application scene range is wider.
  • the disclosed systems, devices, and methods may be implemented in other manners.
  • the device embodiments described above are merely illustrative.
  • the division of cells is only a logical function division.
  • multiple units or components may be combined or integrated. Go to another system, or some features can be ignored or not executed.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, or an electrical, mechanical or other form of connection.
  • the units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the embodiments of the present invention.
  • each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated in In a unit.
  • the above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
  • An integrated unit if implemented in the form of a software functional unit and sold or used as a standalone product, can be stored in a computer readable storage medium.
  • the technical solution of the present invention contributes in essence or to the prior art, or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium.
  • a number of instructions are included to cause a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the various embodiments of the present invention.
  • the foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like, which can store program codes. .

Landscapes

  • Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Computer Graphics (AREA)
  • Geometry (AREA)
  • Software Systems (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Image Analysis (AREA)
  • Image Processing (AREA)

Abstract

The embodiments of the present invention relate to a method and device for generating a three-dimensional image. The method comprises: acquiring a plurality of micro unit images; dividing a plurality of feature regions on each of the micro unit images, a difference value between colour values of any two pixel points in each feature region of the plurality of feature regions being less than or equal to a first threshold value; according to the plurality of feature regions, determining a plurality of region planes, wherein the feature regions included in each region plane belong to the same object or belong to the same source region, and each feature region of the plurality of feature regions only belongs to one region plane of the plurality of region planes; determining a region plane depth value of each region plane; and obtaining a three-dimensional image according to the region plane depth value. By means of the method and device for generating a three-dimensional image in the embodiments of the present invention, a depth value can be more accurately extracted, thereby enabling the generated three-dimensional image to be more accurate and realistic, and an application scenario range to be wider.

Description

生成三维图像的方法和装置Method and apparatus for generating three-dimensional images
本申请要求于2014年10月17日提交中国专利局、申请号为201410551038.8、发明名称为“生成三维图像的方法和装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。The present application claims priority to Chinese Patent Application No. 201410551038.8, entitled "Method and Apparatus for Generating Three-Dimensional Images", filed on October 17, 2014, the entire contents of which is incorporated herein by reference. .
技术领域Technical field
本发明涉及图像处理领域,尤其涉及生成三维图像的方法和装置。The present invention relates to the field of image processing, and more particularly to a method and apparatus for generating a three-dimensional image.
背景技术Background technique
三维立体重建由于能够重建出物体的三维模型信息,越来越受到大家的重视。现有的三维重建技术中提出了一种对视点图抗混叠迭代的求取深度的方法,主要解决了深度求取错误的问题。由于该方法将深度求取的目标放到了视点图上,这必然导致深度分辨率不高并且不能求取过于复杂的场景,从而导致该方法的应用范围极大的受限。Three-dimensional reconstruction is getting more and more attention because of the ability to reconstruct the three-dimensional model information of objects. In the existing 3D reconstruction technology, a method for determining the depth of the anti-aliasing iteration of the viewpoint image is proposed, which mainly solves the problem of deep error. Since the method puts the target of depth determination on the viewpoint image, this inevitably leads to a low depth resolution and cannot obtain an overly complex scene, which results in a limited application range of the method.
另外,在机器视觉研究领域中,如何从两幅具有位差的二维图像中,提取目标的深度信息,以重建目标的三维轮廓一直以来都是一个重要问题,而光场成像的计算重建过程,也是从一系列方向和视角信息不同的二维微单元图像还原物体的三维信息的过程,两者有众多相似之处,因此,将深度提取应用于光场成像领域的计算重建方法层出不穷。然而目前现有的光场成像三维重建算法,重建的效果较差,较难应用于实践。In addition, in the field of machine vision research, how to extract the depth information of the target from two two-dimensional images with disparity to reconstruct the three-dimensional contour of the target has always been an important issue, and the computational reconstruction process of the light field imaging It is also a process of restoring three-dimensional information of objects from two-dimensional micro-cell images with different directions and perspective information. There are many similarities between them. Therefore, the computational reconstruction methods for applying depth extraction to the field of light field imaging are endless. However, the existing three-dimensional reconstruction algorithm for light field imaging has a poor reconstruction effect and is difficult to apply in practice.
现有技术中提出了一种改进的计算集成图像的高分辨率重建方法,主要解决现有计算集成成像重建方法重建图像分辨率低及重建复杂度高的问题。该方法通过逐点判断重建图像中的非零像素点,将其颜色值叠加到相邻8个像素点中的零像素点上,整合还原出目标的三维图像。但是,该方法所描述的重建方法,重建的结果仍然是二维图像,而不能还原出三维物体的深度信息,降低了光场成像的优势。In the prior art, an improved high-resolution reconstruction method for computing integrated images is proposed, which mainly solves the problem that the existing computational integrated imaging reconstruction method has low resolution and high reconstruction complexity. The method determines the non-zero pixel points in the reconstructed image point by point, and superimposes the color value on the zero pixel points among the adjacent 8 pixel points, and integrates and restores the three-dimensional image of the target. However, the reconstruction method described by the method still results in a two-dimensional image, and cannot restore the depth information of the three-dimensional object, thereby reducing the advantages of light field imaging.
发明内容Summary of the invention
本发明提供了一种生成三维图像的方法和装置,能够更准确地提取深度值,并更加准确地进行生成三维图像。 The present invention provides a method and apparatus for generating a three-dimensional image, which can extract depth values more accurately and more accurately generate a three-dimensional image.
第一方面,提供了一种生成三维图像的方法,该方法包括:获取多个微单元图像;在每个该微单元图像上划分多个特征区域,该多个特征区域中的每个特征区域内的任意两个像素点的颜色值的差值小于或等于第一阈值;根据该多个特征区域,确定多个区域平面,其中,该每个区域平面包括的特征区域属于同一物体或属于同源区域,该多个特征区域中的每个特征区域只属于该多个区域平面中的一个区域平面;确定该每个区域平面的区域平面深度值;根据该区域平面深度值得到三维图像。In a first aspect, a method for generating a three-dimensional image is provided, the method comprising: acquiring a plurality of micro-cell images; dividing a plurality of feature regions on each of the micro-cell images, each of the plurality of feature regions The difference between the color values of any two pixel points is less than or equal to the first threshold; and the plurality of area planes are determined according to the plurality of feature areas, wherein the feature areas included in each of the area planes belong to the same object or belong to the same The source area, each of the plurality of feature areas belongs to only one of the plurality of area planes; the area plane depth value of each area plane is determined; and the three-dimensional image is obtained according to the area plane depth value.
结合第一方面,在第一方面的第一种可能的实现方式中,该根据该多个特征区域,确定多个区域平面,包括:确定该多个特征区域中的第一特征区域和该第一特征区域的邻接区域;确定该第一特征区域与该第一特征区域的邻接特征区域不属于同一物体的第一联合概率密度;确定该第一特征区域与该第一特征区域的邻接特征区域属于同一物体的第二联合概率密度;当该第一联合概率密度与该第二联合概率密度之比小于或等于第二阈值时,确定该第一特征区域与该第一特征区域的邻接特征区域属于该多个区域平面中的同一区域平面,该同一区域平面包括的特征区域属于同一物体。With reference to the first aspect, in a first possible implementation manner of the first aspect, the determining, by the plurality of feature regions, the plurality of region planes includes: determining a first feature region of the plurality of feature regions and the first a contiguous region of a feature region; determining a first joint probability density that the first feature region and the adjacent feature region of the first feature region do not belong to the same object; determining a contiguous feature region of the first feature region and the first feature region a second joint probability density belonging to the same object; determining a neighboring feature region of the first feature region and the first feature region when a ratio of the first joint probability density to the second joint probability density is less than or equal to a second threshold It belongs to the same area plane in the plurality of area planes, and the same area plane includes feature areas belonging to the same object.
结合第一方面,在第一方面的第二种可能的实现方式中,该根据该多个特征区域,确定多个区域平面,包括:确定该多个特征区域中的第二特征区域和该第二特征区域的邻接区域;确定合并区域与该第二特征区域的第一似然比、该合并区域与该第二特征区域的邻接特征区域的第二似然比,该合并区域包括该第二特征区域和该第二特征区域的邻接区域;当该第一似然比和/或该第二似然比小于或等于第三阈值时,确定该第二特征区域和该第二特征区域的邻接特征区域属于该多个区域平面中的同一区域平面,该同一区域平面包括的特征区域属于同一物体。With reference to the first aspect, in a second possible implementation manner of the first aspect, determining the plurality of area planes according to the plurality of feature areas, including: determining a second feature area of the plurality of feature areas, and the a contiguous region of the second feature region; a first likelihood ratio of the merge region and the second feature region, a second likelihood ratio of the merge region and the adjacent feature region of the second feature region, the merge region including the second a feature area and an adjacent area of the second feature area; determining the adjacency of the second feature area and the second feature area when the first likelihood ratio and/or the second likelihood ratio is less than or equal to a third threshold The feature area belongs to the same area plane in the plurality of area planes, and the feature area included in the same area plane belongs to the same object.
结合第一方面,在第一方面的第三种可能的实现方式中,该根据该多个特征区域,确定多个区域平面,包括:确定该多个特征区域中的第一微单元图像中的第三特征区域;确定该多个特征区域中的第二微单元图像中与该第三特征区域的颜色误差值最小的第四特征区域,该第二微单元图像与该第一微单元图像相邻,该第四特征区域与该第三特征区域的颜色误差值小于或等于第四阈值;确定该第三特征区域和该第四特征区域属于该多个区域平面中的同一区域平面,该同一区域平面包括的特征区域属于同源区域。With reference to the first aspect, in a third possible implementation manner of the first aspect, the determining, by the plurality of feature regions, the plurality of region planes includes: determining, in the image of the first microcell in the plurality of feature regions a third feature area; determining a fourth feature area in the second microcell image of the plurality of feature areas that has the smallest color error value of the third feature area, the second microcell image and the first microcell image And the color error value of the fourth feature area and the third feature area is less than or equal to a fourth threshold; determining that the third feature area and the fourth feature area belong to the same area plane of the plurality of area planes, the same The feature area included in the area plane belongs to the homologous area.
结合第一方面,在第一方面的第四种可能的实现方式中,该根据该多个 特征区域,确定多个区域平面,包括:确定该多个特征区域中的第三微单元图像中的第五特征区域和该第五特征区域的中心像素点;在第四微单元图像中,以与该中心像素点位于同一极线上的像素点为中心,确定与该第五特征区域大小和形状相同的多个区域,该第四微单元图像与该第三微单元图像相邻;在该多个区域中确定与该第五特征区域颜色误差值最小的第六特征区域,该第六特征区域与该第五特征区域的颜色误差值小于或等于第五阈值;确定该第五特征区域和该第六特征区域属于该多个区域平面中的同一区域平面,该同一区域平面包括的特征区域属于同源区域。In conjunction with the first aspect, in a fourth possible implementation of the first aspect, the Determining a plurality of area planes includes: determining a fifth feature area of the third micro unit image and a center pixel point of the fifth feature area of the plurality of feature areas; and in the fourth micro unit image, Centering on a pixel point on the same pole line of the central pixel, determining a plurality of regions having the same size and shape as the fifth feature region, the fourth microcell image being adjacent to the third microcell image; Determining, in the plurality of regions, a sixth feature region having a smallest color error value with the fifth feature region, wherein a color error value of the sixth feature region and the fifth feature region is less than or equal to a fifth threshold; determining the fifth feature region and The sixth feature area belongs to the same area plane in the plurality of area planes, and the feature area included in the same area plane belongs to the same area.
结合第一方面或第一方面的第一种至第四种可能的实现方式中的任一种可能的实现方式,在第一方面的第五种可能的实现方式中,该获取多个微单元图像,包括:通过光场相机获取光场图像;将该光场图像中的每个像素点一一映射到五维空间得到对应的映射像素点,该五维空间的坐标包括:水平X方向坐标,垂直Y方向坐标,红色分量强度值坐标,绿色分量强度值坐标和蓝色分量强度值坐标;将该映射像素点邻域内密度最大区域的平均颜色值确定为该映射像素点的颜色值;根据确定了颜色值的该映射像素点确定该多个微单元图像。In conjunction with the first aspect or any one of the possible implementations of the first to fourth possible implementations of the first aspect, in a fifth possible implementation of the first aspect, the acquiring the plurality of micro-units The image includes: acquiring a light field image by using a light field camera; mapping each pixel point in the light field image to a five-dimensional space to obtain a corresponding mapped pixel point, where the coordinates of the five-dimensional space include: horizontal X-direction coordinates , vertical Y direction coordinate, red component intensity value coordinate, green component intensity value coordinate and blue component intensity value coordinate; the average color value of the highest density region in the neighborhood of the mapped pixel point is determined as the color value of the mapped pixel point; The mapped pixel points that determine the color value determine the plurality of microcell images.
结合第一方面或第一方面的第一种至第四种可能的实现方式中的任一种可能的实现方式,在第一方面的第六种可能的实现方式中,该确定该每个区域平面的区域平面深度值,包括:确定该每个区域平面内的至少一个特征点;确定该至少一个特征点的深度值;确定该每个区域平面的区域平面深度值,该区域平面深度值为该至少一个特征点的深度值的平均值。In conjunction with the first aspect or any one of the first to fourth possible implementations of the first aspect, in a sixth possible implementation of the first aspect, the determining each of the regions Determining a plane depth value of the plane includes: determining at least one feature point in the plane of each area; determining a depth value of the at least one feature point; determining a depth value of the area plane of the area of each area, where the plane depth value is An average of depth values of the at least one feature point.
结合第一方面的第六种可能的实现方式,在第一方面的第七种可能的实现方式中,该获取多个微单元图像,包括:利用光场相机,获取该多个微单元图像;该确定该至少一个特征点的深度值,包括:确定该光场相机相邻透镜的中心间隔;确定该多个微单元图像所在的平面到该光场相机透镜阵列平面的距离;确定第m个特征点的视差值;根据下列公式计算该第m个特征点的深度值wm':With reference to the sixth possible implementation manner of the first aspect, in a seventh possible implementation manner of the first aspect, the acquiring the plurality of micro unit images includes: acquiring the plurality of micro unit images by using a light field camera; Determining the depth value of the at least one feature point includes: determining a center interval of the adjacent lens of the light field camera; determining a distance from a plane where the plurality of microcell images are located to a plane of the light field camera lens array; determining the mth The disparity value of the feature point; the depth value w m ' of the mth feature point is calculated according to the following formula:
Figure PCTCN2015077900-appb-000001
Figure PCTCN2015077900-appb-000001
其中,t为该光场相机相邻透镜的中心间隔;i为该多个微单元图像所在的平面到该光场相机透镜阵列平面的该距离;dm为该第m个特征点的视差 值。Where t is the center spacing of adjacent lenses of the light field camera; i is the distance from the plane of the plurality of microcell images to the plane of the lens array of the light field camera; d m is the parallax of the mth feature point value.
结合第一方面的第七种可能的实现方式,在第一方面的第八种可能的实现方式中,该确定该第m个特征点的视差值,包括:以该第m个特征点为中心建立原始匹配块;确定与该原始匹配块所在的微单元图像相邻的微单元图像中的待匹配块;根据该原始匹配块和该待匹配块,确定该第m个特征点的原始视差值;根据该原始视差值确定与该第m个特征点所在的微单元图像距离最远的待匹配微单元图像,并确定该待匹配微单元图像与该原始匹配块所在的微单元图像之间的图像数量差值;根据该原始匹配块和该待匹配微单元图像中与该原始匹配块颜色误差值最小的匹配块,确定该第m个特征点的匹配视差值;根据下列公式计算该第m个特征点的精确视差值dmIn conjunction with the seventh possible implementation of the first aspect, in an eighth possible implementation manner of the first aspect, determining the disparity value of the mth feature point includes: using the mth feature point as The center establishes an original matching block; determines a to-be-matched block in the micro-cell image adjacent to the micro-cell image in which the original matching block is located; and determines an original view of the m-th feature point according to the original matching block and the to-be-matched block a difference; determining, according to the original disparity value, a microcell image to be matched that is farthest from the microcell image where the mth feature point is located, and determining the microcell image of the to-be-matched microcell image and the original matching block The difference in the number of images between the two; according to the original matching block and the matching block in the image of the to-be-matched micro-unit with the smallest color error value of the original matching block, determining the matching disparity value of the m-th feature point; according to the following formula Calculating the exact disparity value d m of the mth feature point:
Figure PCTCN2015077900-appb-000002
Figure PCTCN2015077900-appb-000002
其中,D为该匹配视差值;n为该图像数量差值。Where D is the matching disparity value; n is the difference in the number of images.
结合第一方面或第一方面的第一种至第八种可能的实现方式中的任一种可能的实现方式,在第一方面的第九种可能的实现方式中,该获取多个微单元图像,包括:利用光场相机,获取该多个微单元图像;该根据该区域平面深度值得到三维图像,包括:建立三维坐标系,该三维坐标系包括x轴、y轴和z轴;根据下列公式,在该三维坐标系内生成三维图像:With reference to the first aspect, or any one of the first to the eighth possible implementation manners of the first aspect, in the ninth possible implementation manner of the first aspect, the acquiring the multiple micro cells The image includes: acquiring, by using a light field camera, the plurality of microcell images; obtaining the three-dimensional image according to the planar depth value of the region, comprising: establishing a three-dimensional coordinate system, where the three-dimensional coordinate system includes an x-axis, a y-axis, and a z-axis; The following formula generates a three-dimensional image in the three-dimensional coordinate system:
Figure PCTCN2015077900-appb-000003
Figure PCTCN2015077900-appb-000003
其中,Pj表示该多个微单元图像中的第j个像素点对应该三维坐标系的坐标值,Cj表示该第j个像素点在该多个微单元图像中对应微透镜中心的坐标值,Xj表示该第j个像素点在该多个微单元图像中对应的坐标值,wj表示该第j个像素点所在的区域平面的该区域平面深度值,i表示该多个微单元图像所在的平面到该光场相机透镜阵列平面的距离,该j小于或等于该多个微单元图像中所有像素点的个数。Wherein P j represents coordinate values of the j-th pixel point in the plurality of micro-cell images corresponding to the three-dimensional coordinate system, and C j represents coordinates of the j-th pixel point corresponding to the center of the microlens in the plurality of micro-cell images a value, X j represents a coordinate value of the j-th pixel in the plurality of micro-cell images, w j represents a plane depth value of the region of the region plane where the j-th pixel is located, and i represents the plurality of micro- The distance from the plane of the unit image to the plane of the light field camera lens array, the j being less than or equal to the number of all the pixels in the plurality of microcell images.
第二方面,提供了一种生成三维图像的装置,该装置包括:获取模块,用于获取多个微单元图像;划分模块,用于在每个该微单元图像上划分多个特征区域,该多个特征区域中的每个特征区域内的任意两个像素点的颜色值的差值小于或等于第一阈值;第一确定模块,用于根据该多个特征区域,确定多个区域平面,其中,该每个区域平面包括的特征区域属于同一物体或属于同源区域,该多个特征区域中的每个特征区域只属于该多个区域平面中 的一个区域平面;第二确定模块,用于确定该每个区域平面的区域平面深度值;第三确定模块,用于根据该区域平面深度值得到三维图像。In a second aspect, an apparatus for generating a three-dimensional image is provided, the apparatus comprising: an obtaining module, configured to acquire a plurality of micro-cell images; and a dividing module, configured to divide a plurality of feature regions on each of the micro-cell images, The difference between the color values of any two of the plurality of feature regions is less than or equal to the first threshold; the first determining module is configured to determine the plurality of region planes according to the plurality of feature regions, The feature area included in each area plane belongs to the same object or belongs to the same area, and each of the plurality of feature areas belongs to only the multiple area planes. And a second determining module, configured to determine an area plane depth value of each area plane; and a third determining module, configured to obtain a three-dimensional image according to the area plane depth value.
结合第二方面,在第二方面的第一种可能的实现方式中,该第一确定模块具体用于:确定该多个特征区域中的第一特征区域和该第一特征区域的邻接区域;确定该第一特征区域与该第一特征区域的邻接特征区域不属于同一物体的第一联合概率密度;确定该第一特征区域与该第一特征区域的邻接特征区域属于同一物体的第二联合概率密度;当该第一联合概率密度与该第二联合概率密度之比小于或等于第二阈值时,确定该第一特征区域与该第一特征区域的邻接特征区域属于该多个区域平面中的同一区域平面,该同一区域平面包括的特征区域属于同一物体。With reference to the second aspect, in a first possible implementation manner of the second aspect, the first determining module is specifically configured to: determine a first feature region of the plurality of feature regions and an adjacent region of the first feature region; Determining a first joint probability density that the first feature region and the adjacent feature region of the first feature region do not belong to the same object; determining that the first feature region and the adjacent feature region of the first feature region belong to a second association of the same object a probability density; when the ratio of the first joint probability density to the second joint probability density is less than or equal to the second threshold, determining that the first feature region and the adjacent feature region of the first feature region belong to the plurality of region planes The same area plane, the feature area included in the same area plane belongs to the same object.
结合第二方面,在第二方面的第二种可能的实现方式中,该第一确定模块具体用于:确定该多个特征区域中的第二特征区域和该第二特征区域的邻接区域;确定合并区域与该第二特征区域的第一似然比、该合并区域与该第二特征区域的邻接特征区域的第二似然比,该合并区域包括该第二特征区域和该第二特征区域的邻接区域;当该第一似然比和/或该第二似然比小于或等于第三阈值时,确定该第二特征区域和该第二特征区域的邻接特征区域属于该多个区域平面中的同一区域平面,该同一区域平面包括的特征区域属于同一物体。With reference to the second aspect, in a second possible implementation manner of the second aspect, the first determining module is specifically configured to: determine a second feature region of the plurality of feature regions and an adjacent region of the second feature region; Determining a first likelihood ratio of the merged region and the second feature region, a second likelihood ratio of the merged region and the adjacent feature region of the second feature region, the merged region including the second feature region and the second feature a contiguous region of the region; when the first likelihood ratio and/or the second likelihood ratio is less than or equal to the third threshold, determining that the second feature region and the adjacent feature region of the second feature region belong to the plurality of regions The same area plane in the plane, the feature area included in the same area plane belongs to the same object.
结合第二方面,在第二方面的第三种可能的实现方式中,该第一确定模块具体用于:确定该多个特征区域中的第一微单元图像中的第三特征区域;确定该多个特征区域中的第二微单元图像中与该第三特征区域的颜色误差值最小的第四特征区域,该第二微单元图像与该第一微单元图像相邻,该第四特征区域与该第三特征区域的颜色误差值小于或等于第四阈值;确定该第三特征区域和该第四特征区域属于该多个区域平面中的同一区域平面,该同一区域平面包括的特征区域属于同源区域。With reference to the second aspect, in a third possible implementation manner of the second aspect, the first determining module is specifically configured to: determine a third feature region in the first microcell image of the plurality of feature regions; a fourth feature region of the second microcell image of the plurality of feature regions having the smallest color error value of the third feature region, the second microcell image being adjacent to the first microcell image, the fourth feature region And determining, by the third feature region, a color error value that is less than or equal to a fourth threshold; determining that the third feature region and the fourth feature region belong to the same region plane in the plurality of region planes, and the feature region included in the same region plane belongs to Homologous region.
结合第二方面,在第二方面的第四种可能的实现方式中,该第一确定模块具体用于:确定该多个特征区域中的第三微单元图像中的第五特征区域和该第五特征区域的中心像素点;在第四微单元图像中,以与该中心像素点位于同一极线上的像素点为中心,确定与该第五特征区域大小和形状相同的多个区域,该第四微单元图像与该第三微单元图像相邻;在该多个区域中确定与该第五特征区域颜色误差值最小的第六特征区域,该第六特征区域与该第 五特征区域的颜色误差值小于或等于第五阈值;确定该第五特征区域和该第六特征区域属于该多个区域平面中的同一区域平面,该同一区域平面包括的特征区域属于同源区域。With reference to the second aspect, in a fourth possible implementation manner of the second aspect, the first determining module is specifically configured to: determine a fifth feature region in the third microcell image of the plurality of feature regions, and the first a central pixel point of the five feature regions; in the fourth microcell image, a plurality of regions having the same size and shape as the fifth feature region are determined centering on a pixel point on the same pole line as the central pixel point a fourth microcell image is adjacent to the third microcell image; and a sixth feature region having a smallest color error value with the fifth feature region is determined in the plurality of regions, the sixth feature region and the sixth feature region The color error value of the five feature regions is less than or equal to the fifth threshold; determining that the fifth feature region and the sixth feature region belong to the same region plane in the plurality of region planes, and the feature region included in the same region plane belongs to the same region .
结合第二方面或第二方面的第一种至第四种可能的实现方式中的任一种可能的实现方式,在第二方面的第五种可能的实现方式中,该获取模块具体用于:通过光场相机获取光场图像;将该光场图像中的每个像素点一一映射到五维空间得到对应的映射像素点,该五维空间的坐标包括:水平X方向坐标,垂直Y方向坐标,红色分量强度值坐标,绿色分量强度值坐标和蓝色分量强度值坐标;将该映射像素点邻域内密度最大区域的平均颜色值确定为该映射像素点的颜色值;根据确定了颜色值的该映射像素点确定该多个微单元图像。With reference to the second aspect, or any one of the first to the fourth possible implementation manners of the second aspect, in a fifth possible implementation manner of the second aspect, the acquiring module is specifically used to : acquiring a light field image by using a light field camera; mapping each pixel point in the light field image to a five-dimensional space to obtain a corresponding mapped pixel point, wherein the coordinates of the five-dimensional space include: horizontal X direction coordinate, vertical Y Direction coordinate, red component intensity value coordinate, green component intensity value coordinate and blue component intensity value coordinate; determining an average color value of the highest density region in the neighborhood of the mapped pixel point as a color value of the mapped pixel point; The mapped pixel of the value determines the plurality of microcell images.
结合第二方面或第二方面的第一种至第四种可能的实现方式中的任一种可能的实现方式,在第二方面的第六种可能的实现方式中,该第二确定模块具体用于:确定该每个区域平面内的至少一个特征点;确定该至少一个特征点的深度值;确定该每个区域平面的区域平面深度值,该区域平面深度值为该至少一个特征点的深度值的平均值。With reference to the second aspect, or any one of the first to the fourth possible implementation manners of the second aspect, in a sixth possible implementation manner of the second aspect, the second determining module is specific And determining, by the at least one feature point in the plane of each area, determining a depth value of the at least one feature point, and determining an area plane depth value of the area plane, where the area plane depth value is the at least one feature point The average of the depth values.
结合第二方面的第六种可能的实现方式,在第二方面的第七种可能的实现方式中,该获取模块具体用于:利用光场相机,获取该多个微单元图像;该第二确定模块具体用于:确定该光场相机相邻透镜的中心间隔;确定该多个微单元图像所在的平面到该光场相机透镜阵列平面的距离;确定第m个特征点的视差值;根据下列公式计算该第m个特征点的深度值wm':With reference to the sixth possible implementation of the second aspect, in a seventh possible implementation manner of the second aspect, the acquiring module is specifically configured to: acquire the multiple micro unit images by using a light field camera; The determining module is specifically configured to: determine a center interval of the adjacent lens of the light field camera; determine a distance from a plane where the plurality of micro unit images are located to a plane of the light field camera lens array; and determine a disparity value of the mth feature point; The depth value w m ' of the mth feature point is calculated according to the following formula:
Figure PCTCN2015077900-appb-000004
Figure PCTCN2015077900-appb-000004
其中,t为该光场相机相邻透镜的中心间隔;i为该该微单元图像所在的平面到该光场相机透镜阵列平面的该距离;dm为该第m个特征点的视差值。Wherein, t for the light field camera lens center spacing of adjacent; for i from the plane where the image of the micro cell to the light-field camera lens plane of the array; disparity value D m for the m-th feature point .
结合第二方面的第七种可能的实现方式,在第二方面的第八种可能的实现方式中,该第二确定模块具体用于:以该第m个特征点为中心建立原始匹配块;确定与该原始匹配块所在的微单元图像相邻的微单元图像中的待匹配块;根据该原始匹配块和该待匹配块,确定该第m个特征点的原始视差值;根据该原始视差值确定与该第m个特征点所在的微单元图像距离最远的待匹配微单元图像,并确定该待匹配微单元图像与该原始匹配块所在的微单元 图像之间的图像数量差值;根据该原始匹配块和该待匹配微单元图像中与该原始匹配块颜色误差值最小的匹配块,确定该第m个特征点的匹配视差值;根据下列公式计算该第m个匹配块的精确视差值dmWith reference to the seventh possible implementation of the second aspect, in the eighth possible implementation manner of the second aspect, the second determining module is specifically configured to: establish an original matching block by using the mth feature point; Determining a block to be matched in the microcell image adjacent to the microcell image in which the original matching block is located; determining an original disparity value of the mth feature point according to the original matching block and the to-be-matched block; Determining the image of the microcell to be matched that is farthest from the microcell image where the mth feature point is located, and determining the difference in the number of images between the image of the microcell to be matched and the microcell image where the original matching block is located a value; determining a matching disparity value of the mth feature point according to the original matching block and the matching block with the smallest color error value of the original matching block in the to-be-matched microcell image; and calculating the mth matching according to the following formula The exact disparity value of the block d m :
Figure PCTCN2015077900-appb-000005
Figure PCTCN2015077900-appb-000005
其中,D为该匹配视差值;n为该图像数量差值。Where D is the matching disparity value; n is the difference in the number of images.
结合第二方面或第二方面的第一种至第八种可能的实现方式中的任一种可能的实现方式,在第二方面的第九种可能的实现方式中,该获取模块具体用于:利用光场相机,获取该多个微单元图像;该第三确定模块具体用于:建立三维坐标系,该三维坐标系包括x轴、y轴和z轴;根据下列公式,在该三维坐标系内生成三维图像:With reference to the second aspect, or any one of the first to the eighth possible implementation manners of the second aspect, in the ninth possible implementation manner of the second aspect, the acquiring module is specifically used to Obtaining the plurality of microcell images by using a light field camera; the third determining module is specifically configured to: establish a three-dimensional coordinate system, where the three-dimensional coordinate system includes an x-axis, a y-axis, and a z-axis; and the three-dimensional coordinates are according to the following formula Generate a 3D image within the system:
Figure PCTCN2015077900-appb-000006
Figure PCTCN2015077900-appb-000006
其中,Pj表示该多个微单元图像中的第j个像素点对应该三维坐标系的坐标值,Cj表示该第j个像素点在该多个微单元图像中对应微透镜中心的坐标值,Xj表示该第j个像素点在该多个微单元图像中对应的坐标值,wj表示该第j个像素点所在的区域平面的该区域平面深度值,i表示该多个微单元图像所在的平面到该光场相机透镜阵列平面的距离,该j小于或等于该多个微单元图像中所有像素点的个数。Wherein P j represents coordinate values of the j-th pixel point in the plurality of micro-cell images corresponding to the three-dimensional coordinate system, and C j represents coordinates of the j-th pixel point corresponding to the center of the microlens in the plurality of micro-cell images a value, X j represents a coordinate value of the j-th pixel in the plurality of micro-cell images, w j represents a plane depth value of the region of the region plane where the j-th pixel is located, and i represents the plurality of micro- The distance from the plane of the unit image to the plane of the light field camera lens array, the j being less than or equal to the number of all the pixels in the plurality of microcell images.
基于上述技术方案,本发明实施例的生成三维图像的方法和装置,通过获取多个微单元图像,在多个微单元图像上划分特征区域,合并特征区域为区域平面,计算区域平面的深度值,根据该深度值生成三维图像,避免了深度值提取过程中的误匹配,从而能够更加准确地提取深度值,进而使得生成的三维图像更加准确逼真,应用场景范围更广泛。Based on the foregoing technical solution, the method and apparatus for generating a three-dimensional image according to an embodiment of the present invention, by acquiring a plurality of micro-cell images, dividing the feature regions on the plurality of micro-cell images, combining the feature regions into the region planes, and calculating the depth values of the region planes The three-dimensional image is generated according to the depth value, which avoids the mismatch in the depth value extraction process, thereby more accurately extracting the depth value, thereby making the generated three-dimensional image more accurate and realistic, and the application scene range is wider.
附图说明DRAWINGS
为了更清楚地说明本发明实施例的技术方案,下面将对本发明实施例中所需要使用的附图作简单地介绍,显而易见地,下面所描述的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings to be used in the embodiments of the present invention will be briefly described below. It is obvious that the drawings described below are only some embodiments of the present invention, Those skilled in the art can also obtain other drawings based on these drawings without paying any creative work.
图1是根据本发明实施例的生成三维图像的方法的示意性流程图。FIG. 1 is a schematic flow chart of a method of generating a three-dimensional image according to an embodiment of the present invention.
图2是根据本发明实施例的生成三维图像的方法的示意图。 2 is a schematic diagram of a method of generating a three-dimensional image in accordance with an embodiment of the present invention.
图3是根据本发明实施例的生成三维图像的装置的示意框图。3 is a schematic block diagram of an apparatus for generating a three-dimensional image in accordance with an embodiment of the present invention.
图4是根据本发明实施例的生成三维图像的装置的另一示意框图。4 is another schematic block diagram of an apparatus for generating a three-dimensional image in accordance with an embodiment of the present invention.
具体实施方式detailed description
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明的一部分实施例,而不是全部实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动的前提下所获得的所有其他实施例,都应属于本发明保护的范围。The technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is obvious that the described embodiments are a part of the embodiments of the present invention, but not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts shall fall within the scope of the present invention.
图1示出了根据本发明实施例的生成三维图像的方法100的示意性流程图,该方法100可以由终端执行。如图1所示,该方法100包括:FIG. 1 shows a schematic flow diagram of a method 100 of generating a three-dimensional image, which may be performed by a terminal, in accordance with an embodiment of the present invention. As shown in FIG. 1, the method 100 includes:
S110,获取多个微单元图像;S110. Acquire multiple micro cell images.
S120,在每个该微单元图像上划分多个特征区域,该多个特征区域中的每个特征区域内的任意两个像素点的颜色值的差值小于或等于第一阈值;S120, dividing a plurality of feature regions on each of the microcell images, wherein a difference in color values of any two pixel points in each of the plurality of feature regions is less than or equal to a first threshold;
S130,根据该多个特征区域,确定多个区域平面,其中,该每个区域平面包括的特征区域属于同一物体或属于同源区域,该多个特征区域中的每个特征区域只属于该多个区域平面中的一个区域平面;S130. Determine, according to the multiple feature regions, a plurality of region planes, where the feature regions included in each region plane belong to the same object or belong to the same region, and each of the plurality of feature regions belongs to the plurality of feature regions only One of the area planes;
S140,确定该每个区域平面的区域平面深度值;S140. Determine an area plane depth value of each area plane.
S150,根据该区域平面深度值得到三维图像。S150. Obtain a three-dimensional image according to the planar depth value of the region.
具体地,可以利用光场相机获取二维的多个微单元图像,在微单元图像上划分特征区域,该特征区域内的像素点满足任意两个像素点的颜色值的差值小于或等于第一阈值,而且微单元图像上的每个像素点属于多个特征区域中的一个特征区域。通过合并特征区域得到区域平面,计算每个区域平面内的深度值,将该深度值作为该区域平面内所有像素点的深度值,建立三维坐标系,并根据各个像素点的深度值确定每个像素点的三维坐标值,从而生成三维图像。Specifically, the two-dimensional micro-cell image may be acquired by using the light field camera, and the feature region is divided on the micro-cell image, and the pixel point in the feature region satisfies the difference between the color values of any two pixel points is less than or equal to the first A threshold, and each pixel on the microcell image belongs to one of the plurality of feature regions. The region plane is obtained by combining the feature regions, and the depth value in each region plane is calculated. The depth value is used as the depth value of all the pixels in the region plane, and a three-dimensional coordinate system is established, and each depth value is determined according to the depth value of each pixel point. The three-dimensional coordinate values of the pixels, thereby generating a three-dimensional image.
因此,本发明实施例的生成三维图像的方法,通过在获取的多个微单元图像上划分特征区域,合并特征区域为区域平面,计算区域平面的深度值,根据该深度值生成三维立体图像,避免了深度值提取过程中的误匹配,从而能够更加准确地提取深度值,进而使得三维立体图像更加准确逼真,应用场景范围更广泛。Therefore, the method for generating a three-dimensional image is performed by dividing a feature region on the acquired plurality of microcell images, combining the feature region into a region plane, calculating a depth value of the region plane, and generating a three-dimensional stereoscopic image according to the depth value, The mismatching in the depth value extraction process is avoided, so that the depth value can be extracted more accurately, thereby making the three-dimensional stereo image more accurate and realistic, and the application scene range is wider.
在S110中,可以通过光场相机获得多个微单元图像。具体地,可以通 过光场相机直接拍摄得到光场图像,该光场图像即为多个微单元图像而组成的微单元图像阵列。为了使该微单元图像阵列在划分特征区域时更加准确,可选地,可以对该光场图像通过均值偏移法进行映射处理。具体地,将该光场图像中的每个像素点一一映射到五维空间得到对应的映射像素点,该五维空间的坐标包括:水平X方向坐标,垂直Y方向坐标,红色分量强度值坐标,绿色分量强度值坐标和蓝色分量强度值坐标;对于映射得到的每个映射像素点,获取每个映射像素点一个邻域内密度最大区域的平均颜色值;将该颜色值作为该映射像素点的新颜色值,进而从该五维空间重新确定原像素点的颜色值而得到新的微单元图像阵列。可选地,映射像素点邻域的大小可以根据经验值确定。In S110, a plurality of microcell images can be obtained by a light field camera. Specifically, it can pass The light field camera directly captures a light field image, which is a micro cell image array composed of a plurality of micro cell images. In order to make the microcell image array more accurate when dividing the feature region, optionally, the light field image may be mapped by the mean shift method. Specifically, each pixel in the light field image is mapped to a five-dimensional space to obtain a corresponding mapped pixel, and the coordinates of the five-dimensional space include: horizontal X-direction coordinates, vertical Y-direction coordinates, and red component intensity values. Coordinate, green component intensity value coordinate and blue component intensity value coordinate; for each mapped pixel obtained by mapping, obtaining an average color value of a maximum density region within a neighborhood of each mapped pixel; using the color value as the mapped pixel The new color value of the point, and then the color value of the original pixel point is re-determined from the five-dimensional space to obtain a new micro-cell image array. Alternatively, the size of the mapped pixel point neighborhood may be determined based on empirical values.
在S120中,可以在获取的多个微单元图像组成的微单元图像阵列中的每个微单元图像上划分多个特征区域,使每个特征区域包括的像素点满足任意两个像素点的颜色值的差值小于或等于第一阈值。该每个微单元图像划分多个特征区域后,不同特征区域之间不重合,每个像素点只属于多个特征区域中的一个特征区域。可选地,该像素点的颜色值可以包括该像素点的RGB(Red红,Green绿,Blue蓝)值或HSV(Hue色调,Saturation饱和度,Value亮度)值,但本发明并不限于此。In S120, a plurality of feature regions may be divided on each microcell image in the microcell image array composed of the acquired plurality of microcell images, such that the pixel points included in each feature region satisfy the color of any two pixel points. The difference in values is less than or equal to the first threshold. After each of the micro cell images divides the plurality of feature regions, the different feature regions do not overlap, and each pixel point belongs to only one of the plurality of feature regions. Optionally, the color value of the pixel may include an RGB (Red Red, Green Green, Blue Blue) value or an HSV (Hue Tone, Saturation Saturation, Value Brightness) value of the pixel, but the present invention is not limited thereto. .
可选地,可以通过漫水法划分特征区域。在任意一个微单元图像上任意选择一个未被划分为特征区域或未被标记为区域平面的像素点作为种子点,并将该种子点作为一个新的特征区域。逐渐在该特征区域的邻接集合内寻找与种子点的颜色值的差值小于或等于第一阈值的像素点,例如,该颜色值可以为RGB值,第一阈值即为对应的RGB阈值,依次计算种子点与其邻接集合内的像素点的颜色值的差值,是否满足小于或等于该设定阈值。将满足与种子点的颜色值的差值小于或等于第一阈值的像素点划分为该特征区域内,直到该特征区域的邻接集合内不存在小于或等于该第一阈值的像素点时,重新设定种子点,并划分另一个新的特征区域,循环该过程,将该微单元图像划分出多个特征区域。可选地,该特征区域的邻接集合可以包括4邻域像素点,还可以包括8邻域像素点。可选地,该第一阈值可以根据经验设定,也可以根据图像处理要求设定,本发明并不限于此。通过漫水法划分的特征区域为连续区域,且属于同一特征区域的任意两个像素点的颜色值的差值满足小于或等于第一阈值。 Alternatively, the feature area can be divided by the flooding method. A pixel point that is not divided into a feature area or is not marked as a area plane is arbitrarily selected as a seed point on any one of the micro unit images, and the seed point is used as a new feature area. Gradually finding a pixel point that is smaller than or equal to a first threshold value in a contiguous set of the feature area, for example, the color value may be an RGB value, and the first threshold is a corresponding RGB threshold, in turn Calculating whether the difference between the seed point and the color value of the pixel point in the adjacent set meets less than or equal to the set threshold. Dividing a pixel point that satisfies a difference with a color value of the seed point less than or equal to the first threshold into the feature area, until there is no pixel point less than or equal to the first threshold in the adjacent set of the feature area, A seed point is set and another new feature area is divided, and the process is cycled to divide the microcell image into a plurality of feature areas. Optionally, the contiguous set of the feature regions may include 4 neighborhood pixels, and may also include 8 neighborhood pixels. Optionally, the first threshold may be set according to experience, or may be set according to image processing requirements, and the present invention is not limited thereto. The feature area divided by the flooding method is a continuous area, and the difference of the color values of any two pixel points belonging to the same feature area satisfies less than or equal to the first threshold.
可选地,还可以通过Kmeans算法划分特征区域,得到的特征区域包括非连续区域,且每个特征区域都满足同一个特征区域内任意两个像素点的颜色值的差值小于或等于第一阈值,该第一阈值可以根据经验值设定。Optionally, the feature region is further divided by the Kmeans algorithm, and the obtained feature region includes a discontinuous region, and each of the feature regions meets a difference between the color values of any two pixels in the same feature region is less than or equal to the first A threshold, the first threshold may be set according to an empirical value.
在本发明实施例中,可选地,可以同时将所有微单元图像都进行特征区域划分,还可以按照一定方向的顺序依次进行划分,例如,按照从左至右,从上至下的顺序依次划分多个微单元图像,本发明并不限于此。In the embodiment of the present invention, all the micro unit images may be divided into feature regions at the same time, and may be sequentially divided according to a certain direction, for example, in order from left to right and from top to bottom. The plurality of micro cell images are divided, and the present invention is not limited thereto.
在S130中,根据划分的多个特征区域,确定多个区域平面。可选地,可以通过判断多个特征区域是否属于同一物体,将属于同一物体的多个特征区域进行合并得到区域平面;还可以通过判断多个特征区域是否属于同源区域,将属于同源区域的多个特征区域进行合并得到区域平面;还可以通过判断多个特征区域是否属于同一物体,将属于同一物体的特征区域进行合并,并判断多个特征区域是否属于同源区域,将属于同源区域的多个特征区域也进行合并,最终得到区域平面。可选地,合并特征区域,可以通过位置上的合并特征区域得到区域平面,还可以通过标记不同位置的特征区域为同一区域平面来合并特征区域。In S130, a plurality of area planes are determined according to the plurality of divided feature regions. Optionally, the plurality of feature regions belonging to the same object may be combined to obtain a region plane by determining whether the plurality of feature regions belong to the same object; and the plurality of feature regions may belong to the same region, and may belong to the same region. Multiple feature regions are combined to obtain a region plane; it is also possible to determine whether multiple feature regions belong to the same object, combine feature regions belonging to the same object, and determine whether multiple feature regions belong to the same region, and belong to the same region. Multiple feature areas of the area are also merged to finally obtain the area plane. Optionally, the feature area may be merged, the area plane may be obtained by combining the feature areas on the position, and the feature area may be merged by marking the feature areas of different positions as the same area plane.
在本发明实施例中,可以通过以下方法确定多个特征区域是否属于同一物体。具体地,在任一幅微单元图像上,确定相邻的两个特征区域分别为第一特征区域R1和第一特征区域的邻接区域R2。假设图像中的区域具有恒定灰度值,并且被独立、加性和零均值高斯噪声污染,所以灰度值服从正态分布。计算特征区域R1和邻接特征区域R2分别包括m1和m2个像素点,并有如下两种假设:In the embodiment of the present invention, whether the plurality of feature regions belong to the same object can be determined by the following method. In particular, in a micro unit on either image, determines two adjacent feature region respectively adjacent region R of the first region R 1 and a first characteristic feature region 2. Assuming that the regions in the image have constant gray values and are contaminated by independent, additive, and zero-mean Gaussian noise, the gray values follow a normal distribution. The calculated feature region R 1 and the adjacent feature region R 2 respectively include m 1 and m 2 pixel points, and have the following two assumptions:
H0:R1和R2两个区域属于同一物体,在这种情况下,两个区域的灰度值都服从单一高斯分布(μ00 2);H 0 : two regions of R 1 and R 2 belong to the same object, in which case the gray values of both regions obey a single Gaussian distribution (μ 0 , σ 0 2 );
H1:R1和R2两个区域不属于同一物体,在这种情况下,两个区域的灰度值都服从不同的高斯分布(μ11 2)和(μ22 2)。H 1 : R 1 and R 2 do not belong to the same object, in which case the gray values of both regions obey different Gaussian distributions (μ 1 , σ 1 2 ) and (μ 2 , σ 2 2 ).
一般情况下,上面的参数是未知的,但可以使用样本来估计。例如,当区域包含有n个像素点,每个像素点的灰度值为gi,i=1,2…n,服从正态分布:In general, the above parameters are unknown, but can be estimated using samples. For example, when the region contains n pixels, the gray value of each pixel is g i , i=1, 2...n, subject to a normal distribution:
Figure PCTCN2015077900-appb-000007
Figure PCTCN2015077900-appb-000007
因此,可以通过下面的公式(2)和(3)求得以下参数: Therefore, the following parameters can be obtained by the following formulas (2) and (3):
Figure PCTCN2015077900-appb-000008
Figure PCTCN2015077900-appb-000008
Figure PCTCN2015077900-appb-000009
Figure PCTCN2015077900-appb-000009
即通过公式(2)和(3)可以求得本发明实施例中的相关参数σ012That is, the correlation parameters σ 0 , σ 1 , σ 2 in the embodiment of the present invention can be obtained by the formulas (2) and (3).
因此,在H0的情况下,联合密度
Figure PCTCN2015077900-appb-000010
为:
Therefore, in the case of H 0 , the joint density
Figure PCTCN2015077900-appb-000010
for:
Figure PCTCN2015077900-appb-000011
Figure PCTCN2015077900-appb-000011
在H1的情况下,联合密度
Figure PCTCN2015077900-appb-000012
为:
In the case of H 1 , the joint density
Figure PCTCN2015077900-appb-000012
for:
Figure PCTCN2015077900-appb-000013
Figure PCTCN2015077900-appb-000013
通过下面的公式(6),计算H1与H0二者联合密度的比,该比值为似然比L:The ratio of the combined densities of H 1 and H 0 is calculated by the following formula (6), which is a likelihood ratio L:
Figure PCTCN2015077900-appb-000014
Figure PCTCN2015077900-appb-000014
当该L值小于或等于第二阈值时,确定该特征区域R1和邻接特征区域R2属于同一物体,当L值大于第二阈值时,确定该特征区域R1和邻接特征区域R2不属于同一物体。通过上述方法将每个微单元图像中的每个特征区域和该特征区域的邻接区域都进行判断并进行合并得到多个区域平面。可选地,该第二阈值可以根据经验值设定,也可以根据图像处理要求设定,本发明并不限于此。When the L value is less than or equal to the second threshold, it is determined that the feature region R 1 and the adjacent feature region R 2 belong to the same object, and when the L value is greater than the second threshold, determining that the feature region R 1 and the adjacent feature region R 2 are not Belong to the same object. Each feature region in each microcell image and the adjacent region of the feature region are judged and combined by the above method to obtain a plurality of region planes. Optionally, the second threshold may be set according to an empirical value, or may be set according to an image processing requirement, and the present invention is not limited thereto.
可选地,在本发明实施例中,还可以通过合并特征区域和该特征区域的邻接区域为合并区域,通过计算合并区域与该特征区域和该特征区域的邻接区域的似然比来确定特征区域与该特征区域的邻接区域是否属于同一物体。 具体地,选取多个微单元图像中任一微单元图像中的任一相邻的两个特征区域为第二特征区域R1和第二特征区域的邻接区域R2,将R1和R2合并为一个合并区域R3,按照上述公式(1)-(6)分别计算R3和R1的似然比L31、R3和R2的似然比L32,若L31和/或L32小于或等于第三阈值,则可以确定R1和R2属于同一物体,否则,则可以确定R1和R2不属于同一物体。例如,当要求图像处理比较精确时,可以设置为当L31和L32均小于或等于第三阈值时,可以确定R1和R2属于同一物体,否则,则可以确定R1和R2不属于同一物体;当要求图像处理不是比较精确时,可以设置为当L31或L32小于或等于第三阈值时,则可以确定R1和R2属于同一物体,否则,则可以确定R1和R2不属于同一物体。可选地,该第三阈值可以根据经验值设定,也可以根据图像处理要求设定,本发明并不限于此。Optionally, in the embodiment of the present invention, the feature region and the adjacent region of the feature region are combined into a merged region, and the feature is determined by calculating a likelihood ratio of the merged region and the adjacent region of the feature region and the feature region. Whether the area and the adjacent area of the feature area belong to the same object. Specifically, selecting any two adjacent feature regions in any one of the plurality of micro cell images is the second feature region R 1 and the adjacent region R 2 of the second feature region, and R 1 and R 2 merged into a merged region R 3, according to the above equations (1) - (6) calculating the likelihood ratio L 31 R 3 and R 1 are, respectively, R 3 and R 2 log likelihood ratio L 32, if L 31 and / or If L 32 is less than or equal to the third threshold, it can be determined that R 1 and R 2 belong to the same object, otherwise, it can be determined that R 1 and R 2 do not belong to the same object. For example, when image processing is required to be relatively accurate, it may be set that when both L 31 and L 32 are less than or equal to the third threshold, it may be determined that R 1 and R 2 belong to the same object; otherwise, it may be determined that R 1 and R 2 are not Belong to the same object; when image processing is required to be less precise, it can be set to be that when L 31 or L 32 is less than or equal to the third threshold, then it can be determined that R 1 and R 2 belong to the same object; otherwise, R 1 and R 2 does not belong to the same object. Optionally, the third threshold may be set according to an empirical value, or may be set according to an image processing requirement, and the present invention is not limited thereto.
在本发明实施例中,可以通过判断多个特征区域属于同源区域来确定区域平面。具体地,在任意相邻的两幅微单元图像第一微单元图像和第二微单元图像中,选取第一微单元图像中的任意一个特征区域为第三特征区域,将第二微单元图像上的每个特征区域分别作为疑似同源区域。按照下面的公式(7)分别计算第三特征区域与每一个疑似同源区域的颜色误差值E:In the embodiment of the present invention, the area plane may be determined by determining that multiple feature areas belong to the same area. Specifically, in any two adjacent micro cell image first micro cell image and second micro cell image, any one of the first micro cell images is selected as a third feature region, and the second micro cell image is selected. Each feature region on the top is regarded as a suspected homologous region. Calculate the color error value E of the third feature region and each suspected homologous region according to the following formula (7):
Figure PCTCN2015077900-appb-000015
Figure PCTCN2015077900-appb-000015
其中,p为第三特征区域内像素点的个数;Ip表示第三特征区域内的像素点的颜色值,Ip+d表示疑似同源区域内与第三特征区域内的像素点相对应的像素点的颜色值;E表示第三特征区域和疑似同源区域内所有像素点的颜色值的差值之和。选取满足颜色误差值E小于或等于第四阈值的所有疑似同源区域中,颜色误差值E最小的疑似同源区域为第四特征区域,则该第四特征区域与第三特征区域属于同源区域。若不存在第四特征区域,则确定为该第三特征区域的同源区域为该第三特征区域本身。可选地,该第四阈值可以根据经验值设定,也可以根据图像处理要求设定,本发明并不限于此。通过上述方法依次判断每个微单元图像和相邻的微单元图像中的每个特征区域,将属于同源区域的特征区域进行合并得到区域平面。可选地,该像素点的颜色值可以包括该像素点的RGB值或HSV值,但本发明并不限于此。Where p is the number of pixels in the third feature region; I p represents the color value of the pixel in the third feature region, and I p+d represents the pixel point in the suspected homologous region and the third feature region The color value of the corresponding pixel; E represents the sum of the differences of the color values of all the pixels in the third feature region and the suspected homologous region. Selecting a suspected homologous region in which all the suspected homologous regions satisfying the color error value E is less than or equal to the fourth threshold is the fourth feature region, and the fourth feature region and the third feature region are homologous region. If there is no fourth feature area, the same area determined as the third feature area is the third feature area itself. Optionally, the fourth threshold may be set according to an empirical value, or may be set according to an image processing requirement, and the present invention is not limited thereto. Each feature region in each microcell image and the adjacent microcell image is sequentially determined by the above method, and the feature regions belonging to the homologous region are combined to obtain a region plane. Alternatively, the color value of the pixel may include an RGB value or an HSV value of the pixel, but the invention is not limited thereto.
可选地,在本发明实施例中,还可以通过下面的方法确定多个特征区域是否属于同源区域。将多个微单元图像中任一微单元图像中任一特征区域作为第五特征区域,并确定该第五特征区域的中心像素点。在与第五特征区域 所在的微单元图像相邻的微单元图像中,依次选取与该中心像素点位于同一极线上的每个像素点,以这些像素点作为中心建立与第五特征区域大小和形状一样的多个区域为疑似同源区域。按照公式(7),依次计算第五特征区域与多个疑似同源区域中的每个区域之间的颜色误差值E。选取满足颜色误差值E小于或等于第五阈值的所有区域中,颜色误差值E最小的区域为第六特征区域,则该第六特征区域是第五特征区域的同源区域。若不存在第六特征区域,则确定为该第五特征区域的同源区域为该第五特征区域本身。可选地,该第五阈值可以根据经验值设定,也可以根据图像处理要求设定,本发明并不限于此。可选地,该像素点的颜色值可以包括该像素点的RGB值或HSV值,但本发明并不限于此。Optionally, in the embodiment of the present invention, whether the multiple feature regions belong to the homologous region may also be determined by the following method. Any one of the plurality of micro cell images is used as the fifth feature region, and the central pixel of the fifth feature region is determined. In the fifth feature area In the micro cell image adjacent to the micro cell image, each pixel point on the same pole line as the central pixel point is sequentially selected, and the same size and shape as the fifth feature region are established with these pixel points as a center. The region is a suspected homologous region. According to the formula (7), the color error value E between the fifth feature region and each of the plurality of suspected homologous regions is sequentially calculated. In the region where the color error value E is less than or equal to the fifth threshold, the region where the color error value E is the smallest is the sixth feature region, and the sixth feature region is the homologous region of the fifth feature region. If the sixth feature area does not exist, the same area determined as the fifth feature area is the fifth feature area itself. Optionally, the fifth threshold may be set according to an empirical value, or may be set according to an image processing requirement, and the present invention is not limited thereto. Alternatively, the color value of the pixel may include an RGB value or an HSV value of the pixel, but the invention is not limited thereto.
在本发明实施例中,通过上述方法合并特征区域时,可以按照一定方向的顺序进行划分特征区域,并按照一定的顺序合并特征区域得到区域平面。例如,可以按照从左至右,从上至下的顺序依次将微单元图像划分为多个特征区域,在划分了特征区域的微单元图像中确定第五特征区域,在相邻的未被划分特征区域的微单元图像中确定第六特征区域。In the embodiment of the present invention, when the feature regions are merged by the foregoing method, the feature regions may be divided according to a certain direction, and the feature regions are merged in a certain order to obtain a region plane. For example, the microcell image may be sequentially divided into a plurality of feature regions in order from left to right and from top to bottom, and the fifth feature region is determined in the microcell image in which the feature region is divided, and the adjacent regions are not divided. A sixth feature area is determined in the microcell image of the feature area.
在S140中,确定多个区域平面后,计算各个区域平面的区域平面深度值。可选的,可以通过确定每个区域平面内的特征点,并计算各个特征点深度值的方法确定区域平面的深度值。具体地,可以通过SIFT特征点查找法来确定该区域平面内的特征点,还可以通过FAST特征点查找法来确定特征点,本发明并不限于此。In S140, after determining a plurality of area planes, the area plane depth values of the respective area planes are calculated. Optionally, the depth value of the area plane may be determined by determining feature points in each area plane and calculating a depth value of each feature point. Specifically, the feature points in the plane of the area may be determined by the SIFT feature point search method, and the feature points may also be determined by the FAST feature point search method, and the present invention is not limited thereto.
在本发明实施例中,确定区域平面内的所有特征点后,计算各个特征点的深度值。具体地,可以通过光场相机得到多个微单元图像,这些微单元图像构成二维的微单元图像阵列,并根据下面的公式(8)来确定第m个特征点的深度值wm':In the embodiment of the present invention, after all the feature points in the area plane are determined, the depth values of the respective feature points are calculated. Specifically, a plurality of microcell images can be obtained by a light field camera, the microcell images constitute a two-dimensional microcell image array, and the depth value w m ' of the mth feature point is determined according to the following formula (8):
Figure PCTCN2015077900-appb-000016
Figure PCTCN2015077900-appb-000016
如图2所示,其中,t为光场相机相邻透镜中心间隔;i为微单元图像阵列平面到光场相机透镜阵列平面的距离;dm为第m个特征点的视差值,m表示所有特征点中任意一个特征点,通过该公式(8)计算每个区域平面上的每个特征点的深度值。As shown in FIG. 2, where t is the adjacent lens center interval of the light field camera; i is the distance from the microcell image array plane to the light field camera lens array plane; d m is the parallax value of the mth feature point, m Representing any one of all feature points, the depth value of each feature point on each area plane is calculated by the formula (8).
在本发明实施例中,公式中的视差值dm可以通过块匹配算法进行计算。 In the embodiment of the present invention, the disparity value d m in the formula can be calculated by a block matching algorithm.
可选地,还可以通过颜色误差值匹配的方法更加精确地计算视差值dm。具体地,以计算第m个特征点为例,以第m个特征点为中心建立原始匹配块,该匹配块的大小可以根据经验值设定,根据块匹配算法,确定与该第m个特征点所在的微单元图像相邻的微单元图像上的待匹配块,并计算该第m个特征点的原始视差值。根据计算得到的原始视差值,估算与该第m个特征点所在的微单元图像距离最远的,且包括与原始匹配块相匹配的匹配块的匹配微单元图像,确定该匹配微单元图像与原始匹配块所在微单元图像之间微单元图像个数的差值n。根据块匹配算法,确定该匹配微单元图像中与原始匹配块最匹配的匹配块,并通过块匹配算法根据原始匹配块与该匹配块计算该第m个特征点的匹配视差值D。根据下列公式(9)计算出第m个特征点的精确度视差值dmAlternatively, the disparity value d m can also be calculated more accurately by the method of color error value matching. Specifically, taking the mth feature point as an example, the original matching block is established centering on the mth feature point, and the size of the matching block can be set according to an empirical value, and the mth feature is determined according to the block matching algorithm. The pixel to be matched on the adjacent microcell image of the microcell image where the point is located, and the original disparity value of the mth feature point is calculated. And determining, according to the calculated original disparity value, a matching microcell image of the matching block that is farthest from the microcell image where the mth feature point is located, and matching the original matching block, and determining the matching microcell image The difference n between the number of microcell images between the microcell image in which the original matching block is located. And determining, according to the block matching algorithm, a matching block that matches the original matching block in the matched microcell image, and calculating a matching disparity value D of the mth feature point according to the original matching block and the matching block by using a block matching algorithm. Calculate the accuracy disparity value d m of the mth feature point according to the following formula (9):
Figure PCTCN2015077900-appb-000017
Figure PCTCN2015077900-appb-000017
其中,dm表示第m个特征点的视差值,第m个特征点为任一区域平面中任一特征点,类似地,可以根据上述方法计算出每个特征点的视差值。Where d m represents the disparity value of the mth feature point, and the mth feature point is any feature point in any area plane. Similarly, the disparity value of each feature point can be calculated according to the above method.
在本发明实施例中,通过上述方法得到区域平面内的各个特征点的深度值后,可以将该区域平面内所有特征点的深度值求取平均值,将该平均深度值作为该区域平面内所有像素点的深度值,但本发明并不限于此。In the embodiment of the present invention, after obtaining the depth values of the feature points in the area plane by using the foregoing method, the depth values of all the feature points in the area plane may be averaged, and the average depth value is used as the plane in the area. The depth value of all the pixels, but the present invention is not limited thereto.
在本发明实施例中,可选地,当某一个区域平面内不存在特征点时,可以将该区域平面忽略,不再进行计算深度值,但本发明并不限于此。In the embodiment of the present invention, optionally, when there is no feature point in a certain area plane, the area plane may be ignored, and the depth value is not calculated, but the present invention is not limited thereto.
在S150中,确定各个区域平面的深度值后,根据该深度值生成三维图像。首先,建立三维坐标系,该三维坐标系包括x轴、y轴和z轴,可选地,可以将生成的三维立体场景的向后的方向设为z轴正方向,生成的三维立体场景向右的方向设为x轴正方向,生成的三维立体场景向上的方向设为y轴正方向。可选地,x和y方向可以与原始的多个微单元图像构成的二维微单元图像阵列的水平方向和垂直方向相对应。根据建立的三维坐标系,利用下面的公式(10),计算任一微单元图像中任一像素点在三维坐标系中的坐标值PjIn S150, after determining the depth value of each area plane, a three-dimensional image is generated according to the depth value. First, a three-dimensional coordinate system is established. The three-dimensional coordinate system includes an x-axis, a y-axis, and a z-axis. Alternatively, the backward direction of the generated three-dimensional scene can be set to the positive direction of the z-axis, and the generated three-dimensional scene is oriented. The right direction is set to the positive x-axis direction, and the direction of the generated three-dimensional scene is set to the positive direction of the y-axis. Alternatively, the x and y directions may correspond to the horizontal and vertical directions of the two-dimensional microcell image array of the original plurality of microcell images. According to the established three-dimensional coordinate system, the coordinate value P j of any pixel in any micro cell image in the three-dimensional coordinate system is calculated by using the following formula (10):
Figure PCTCN2015077900-appb-000018
Figure PCTCN2015077900-appb-000018
其中,Pj表示该微单元图像阵列中的第j个像素点对应该三维坐标系的坐标值,Cj表示该第j个像素点在该微单元图像阵列中对应微透镜中心的坐 标值,Xj表示该第j个像素点在该微单元图像阵列中对应的坐标值,wj表示该第j个像素点所在该区域平面的该深度值,i表示该微单元图像阵列平面到该光场相机透镜阵列平面的距离,其中,j小于或等于微单元图像阵列中所有像素点的个数。Wherein, P j represents a coordinate value of a j-th pixel point in the micro-cell image array corresponding to the three-dimensional coordinate system, and C j represents a coordinate value of the j-th pixel point in the micro-mirror image array corresponding to the center of the micro-lens, X j represents the coordinate value of the j-th pixel point in the micro-cell image array, w j represents the depth value of the area of the region where the j-th pixel point is located, and i represents the micro-cell image array plane to the light The distance of the field camera lens array plane, where j is less than or equal to the number of all pixel points in the microcell image array.
应理解,在本发明的实施例中,微单元图像的相邻微单元图像或特征区域的相邻特征区域,可以为该微单元图像或该特征区域的4邻域内的或8邻域内的微单元图像或特征区域,本发明并不限于此。It should be understood that, in an embodiment of the present invention, an adjacent microcell image or an adjacent feature region of a feature region of the microcell image may be the microcell image or a micro neighborhood within the 4 neighborhood or 8 neighborhoods of the feature region. The unit image or the feature area, the present invention is not limited thereto.
应理解,在本发明的各种实施例中,上述各过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本发明实施例的实施过程构成任何限定。It should be understood that, in various embodiments of the present invention, the size of the sequence numbers of the above processes does not mean the order of execution, and the order of execution of each process should be determined by its function and internal logic, and should not be taken to the embodiments of the present invention. The implementation process constitutes any limitation.
因此,本发明实施例的生成三维图像的方法,通过光场相机获取多个微单元图像,对每个微单元图像划分特征区域,通过判断各个特征区域是否属于同一物体,和/或各个特征区域是否属于同源区域,合并属于同一物体和/或属于同源区域的特征区域为区域平面,计算各个区域平面内的特征点的平均深度值,将该平均深度值作为该区域平面内所有像素点的深度值来生成三维立体图像,避免了深度值提取过程中的误匹配,从而能够更加准确快速地提取深度值,进而使得生成的三维图像更加准确逼真,应用场景范围更广泛。Therefore, in the method for generating a three-dimensional image according to an embodiment of the present invention, a plurality of micro-cell images are acquired by a light field camera, and a feature region is divided for each micro-cell image, by determining whether each feature region belongs to the same object, and/or each feature region. Whether it belongs to a homologous region, and the feature regions belonging to the same object and/or belonging to the homologous region are region planes, and the average depth value of the feature points in each region plane is calculated, and the average depth value is used as all the pixels in the region plane. The depth value is used to generate a three-dimensional stereo image, which avoids mismatching in the depth value extraction process, thereby more accurately and quickly extracting the depth value, thereby making the generated three-dimensional image more accurate and realistic, and the application scene range is wider.
上文中结合图1至图2,详细描述了根据本发明实施例的生成三维图像的方法,下面将结合图3,描述根据本发明实施例的生成三维图像的装置。A method of generating a three-dimensional image according to an embodiment of the present invention is described in detail above with reference to FIGS. 1 through 2, and an apparatus for generating a three-dimensional image according to an embodiment of the present invention will be described below with reference to FIG.
图3示出了根据本发明实施例的生成三维图像的装置的示意性框图。如图3所示,该装置包括:FIG. 3 shows a schematic block diagram of an apparatus for generating a three-dimensional image in accordance with an embodiment of the present invention. As shown in Figure 3, the device comprises:
获取模块210,用于获取多个微单元图像;The obtaining module 210 is configured to acquire a plurality of micro unit images;
划分模块220,用于在每个该微单元图像上划分多个特征区域,该多个特征区域中的每个特征区域内的任意两个像素点的颜色值的差值小于或等于第一阈值;The dividing module 220 is configured to divide a plurality of feature regions on each of the micro cell images, and a difference of color values of any two pixel points in each of the plurality of feature regions is less than or equal to a first threshold ;
第一确定模块230,用于根据该多个特征区域,确定多个区域平面,其中,该每个区域平面包括的特征区域属于同一物体或属于同源区域,该多个特征区域中的每个特征区域只属于该多个区域平面中的一个区域平面;The first determining module 230 is configured to determine, according to the plurality of feature regions, a plurality of region planes, wherein the feature regions included in each of the region planes belong to the same object or belong to the same region, and each of the plurality of feature regions The feature area belongs to only one of the plurality of area planes;
第二确定模块240,用于确定该每个区域平面的区域平面深度值;a second determining module 240, configured to determine an area plane depth value of each area plane;
第三确定模块250,用于根据该区域平面深度值得到三维图像。The third determining module 250 is configured to obtain a three-dimensional image according to the regional plane depth value.
因此,本发明实施例的生成三维图像的方法,通过在获取的多个微单元 图像上划分特征区域,合并特征区域为区域平面,计算区域平面的深度值,根据该深度值生成三维立体图像,避免了深度值提取过程中的误匹配,从而能够更加准确地提取深度值,进而使得三维立体图像更加准确逼真,应用场景范围更广泛。Therefore, the method for generating a three-dimensional image according to an embodiment of the present invention passes through a plurality of acquired micro cells The feature region is divided on the image, the merged feature region is the region plane, the depth value of the region plane is calculated, and the three-dimensional stereo image is generated according to the depth value, thereby avoiding the mismatch in the depth value extraction process, thereby more accurately extracting the depth value, and further Make the 3D stereo image more accurate and realistic, and the application scene range is wider.
在本发明实施例中,可以通过光场相机获取多个微单元图像构成微单元图像阵列,获取模块210获取该微单元图像阵列,该微单元图像阵列包括多个微单元图像。具体地,为了使该微单元图像阵列在划分特征区域时更加准确,可选地,获取模块210可以对该光场图像通过均值偏移法进行映射处理。具体地,将该光场图像中的每个像素点一一映射到五维空间得到对应的映射像素点,该五维空间的坐标包括:水平X方向坐标,垂直Y方向坐标,红色分量强度值坐标,绿色分量强度值坐标和蓝色分量强度值坐标;对于映射得到的每个映射像素点,获取每个映射像素点一个邻域内密度最大区域的平均颜色值;将该颜色值作为该映射像素点的新颜色值,进而从该五维空间重新确定原像素点的颜色值而得到新的微单元图像阵列。可选地,映射像素点邻域的大小可以根据经验值确定。In the embodiment of the present invention, a plurality of micro cell images may be acquired by a light field camera to form a micro cell image array, and the acquiring module 210 acquires the micro cell image array, and the micro cell image array includes a plurality of micro cell images. Specifically, in order to make the micro-cell image array more accurate when dividing the feature region, the acquisition module 210 may perform mapping processing on the light field image by the mean shift method. Specifically, each pixel in the light field image is mapped to a five-dimensional space to obtain a corresponding mapped pixel, and the coordinates of the five-dimensional space include: horizontal X-direction coordinates, vertical Y-direction coordinates, and red component intensity values. Coordinate, green component intensity value coordinate and blue component intensity value coordinate; for each mapped pixel obtained by mapping, obtaining an average color value of a maximum density region within a neighborhood of each mapped pixel; using the color value as the mapped pixel The new color value of the point, and then the color value of the original pixel point is re-determined from the five-dimensional space to obtain a new micro-cell image array. Alternatively, the size of the mapped pixel point neighborhood may be determined based on empirical values.
在本发明实施例中,可以将多个微单元图像中的每个微单元图像通过划分模块220划分成多个特征区域,使每个特征区域包括的像素点满足任意两个像素点的颜色值的差值小于或等于第一阈值。该每个微单元图像划分多个特征区域后,不同特征区域之间不重合,每个像素点只属于多个特征区域中的一个特征区域。可选地,该像素点的颜色值可以包括该像素点的RGB值或HSV值,但本发明并不限于此。In the embodiment of the present invention, each micro cell image of the plurality of micro cell images may be divided into a plurality of feature regions by the dividing module 220, so that the pixel points included in each feature region satisfy the color values of any two pixel points. The difference is less than or equal to the first threshold. After each of the micro cell images divides the plurality of feature regions, the different feature regions do not overlap, and each pixel point belongs to only one of the plurality of feature regions. Alternatively, the color value of the pixel may include an RGB value or an HSV value of the pixel, but the invention is not limited thereto.
可选地,可以通过漫水法划分特征区域。通过漫水法划分的特征区域为连续区域,且属于同一特征区域的任意两个像素点的颜色值的差值满足小于或等于第一阈值。可选地,还可以通过Kmeans算法划分特征区域,得到的特征区域包括非连续区域,且每个特征区域都满足同一个特征区域内任意两个像素点的颜色值的差值小于或等于第一阈值,该第一阈值可以根据经验值设定。Alternatively, the feature area can be divided by the flooding method. The feature area divided by the flooding method is a continuous area, and the difference of the color values of any two pixel points belonging to the same feature area satisfies less than or equal to the first threshold. Optionally, the feature region is further divided by the Kmeans algorithm, and the obtained feature region includes a discontinuous region, and each of the feature regions meets a difference between the color values of any two pixels in the same feature region is less than or equal to the first A threshold, the first threshold may be set according to an empirical value.
在本发明实施例中,可选地,可以同时将所有微单元图像都进行特征区域划分,还可以按照一定方向的顺序依次进行划分,例如,按照从左至右,从上至下的顺序依次划分多个微单元图像,本发明并不限于此。In the embodiment of the present invention, all the micro unit images may be divided into feature regions at the same time, and may be sequentially divided according to a certain direction, for example, in order from left to right and from top to bottom. The plurality of micro cell images are divided, and the present invention is not limited thereto.
在本发明实施例中,根据划分模块220划分的多个特征区域,通过第一 确定模块230确定多个区域平面。可选地,可以通过判断多个特征区域是否属于同一物体,将属于同一物体的多个特征区域进行合并得到区域平面;还可以通过判断多个特征区域是否属于同源区域,将属于同源区域的多个特征区域进行合并得到区域平面;还可以通过判断多个特征区域是否属于同一物体,将属于同一物体的特征区域进行合并,并判断多个特征区域是否属于同源区域,将属于同源区域的多个特征区域也进行合并,最终得到区域平面。可选地,合并特征区域,可以通过位置上的合并特征区域得到区域平面,还可以通过标记不同位置的特征区域为同一区域平面来合并特征区域。In the embodiment of the present invention, according to the plurality of feature regions divided by the dividing module 220, the first The determination module 230 determines a plurality of area planes. Optionally, the plurality of feature regions belonging to the same object may be combined to obtain a region plane by determining whether the plurality of feature regions belong to the same object; and the plurality of feature regions may belong to the same region, and may belong to the same region. Multiple feature regions are combined to obtain a region plane; it is also possible to determine whether multiple feature regions belong to the same object, combine feature regions belonging to the same object, and determine whether multiple feature regions belong to the same region, and belong to the same region. Multiple feature areas of the area are also merged to finally obtain the area plane. Optionally, the feature area may be merged, the area plane may be obtained by combining the feature areas on the position, and the feature area may be merged by marking the feature areas of different positions as the same area plane.
在本发明实施例中,第一确定模块430可以通过以下方法确定多个特征区域是否属于同一物体。具体地,在任一幅微单元图像上,确定相邻的两个特征区域分别为第一特征区域R1和第一特征区域的邻接区域R2。假设图像中的区域具有恒定灰度值,并且被独立、加性和零均值高斯噪声污染,所以灰度值服从正态分布。计算特征区域R1和邻接特征区域R2分别包括m1和m2个像素点,并有如下两种假设:In the embodiment of the present invention, the first determining module 430 may determine whether the plurality of feature regions belong to the same object by using the following method. In particular, in a micro unit on either image, determines two adjacent feature region respectively adjacent region R of the first region R 1 and a first characteristic feature region 2. Assuming that the regions in the image have constant gray values and are contaminated by independent, additive, and zero-mean Gaussian noise, the gray values follow a normal distribution. The calculated feature region R 1 and the adjacent feature region R 2 respectively include m 1 and m 2 pixel points, and have the following two assumptions:
H0:R1和R2两个区域属于同一物体,在这种情况下,两个区域的灰度值都服从单一高斯分布(μ00 2);H 0 : two regions of R 1 and R 2 belong to the same object, in which case the gray values of both regions obey a single Gaussian distribution (μ 0 , σ 0 2 );
H1:R1和R2两个区域不属于同一物体,在这种情况下,两个区域的灰度值都服从不同的高斯分布(μ11 2)和(μ22 2)。H 1 : R 1 and R 2 do not belong to the same object, in which case the gray values of both regions obey different Gaussian distributions (μ 1 , σ 1 2 ) and (μ 2 , σ 2 2 ).
一般情况下,上面的参数是未知的,但可以使用样本来估计。例如,当区域包含有n个像素点,每个像素点的灰度值为gi,i=1,2…n,服从正态分布如公式(1)所示,即可以通过公式(2)和(3)可以求得本发明实施例中的相关参数σ012。因此,在H0的情况下,联合密度
Figure PCTCN2015077900-appb-000019
如公式(4)所示;在H1的情况下,联合密度
Figure PCTCN2015077900-appb-000020
如公式(5)所示。通过公式(6),计算H1与H0二者联合密度的比,该比值为似然比L。
In general, the above parameters are unknown, but can be estimated using samples. For example, when the region contains n pixels, the gray value of each pixel is g i , i=1, 2...n, obeying the normal distribution as shown in formula (1), that is, by formula (2) And (3) the correlation parameters σ 0 , σ 1 , σ 2 in the embodiment of the present invention can be obtained. Therefore, in the case of H 0 , the joint density
Figure PCTCN2015077900-appb-000019
As shown in formula (4); in the case of H 1 , joint density
Figure PCTCN2015077900-appb-000020
As shown in formula (5). The ratio of the combined densities of H 1 and H 0 is calculated by the formula (6), and the ratio is the likelihood ratio L.
当该L值小于或等于第二阈值时,确定该特征区域R1和邻接特征区域R2属于同一物体,当L值大于第二阈值时,确定该特征区域R1和邻接特征区域R2不属于同一物体。通过上述方法将每个微单元图像中的每个特征区域和该特征区域的邻接区域都进行判断并进行合并得到多个区域平面。可选地,该第二阈值可以根据经验值设定,也可以根据图像处理要求设定,本发明并不限于此。 When the L value is less than or equal to the second threshold, it is determined that the feature region R 1 and the adjacent feature region R 2 belong to the same object, and when the L value is greater than the second threshold, determining that the feature region R 1 and the adjacent feature region R 2 are not Belong to the same object. Each feature region in each microcell image and the adjacent region of the feature region are judged and combined by the above method to obtain a plurality of region planes. Optionally, the second threshold may be set according to an empirical value, or may be set according to an image processing requirement, and the present invention is not limited thereto.
可选地,在本发明实施例中,第一确定模块430还可以通过合并特征区域和该特征区域的邻接区域为合并区域,通过计算合并区域与该特征区域和该特征区域的邻接区域的似然比来确定特征区域与该特征区域的邻接区域是否属于同一物体。具体地,选取多个微单元图像中任一微单元图像中的任一相邻的两个特征区域为第二特征区域R1和第二特征区域的邻接区域R2,将R1和R2合并为一个合并区域R3,按照上述公式(1)-(6)分别计算R3和R1的似然比L31、R3和R2的似然比L32,若L31和/或L32小于或等于第三阈值,则可以确定R1和R2属于同一物体,否则,则可以确定R1和R2不属于同一物体,可选地,该第三阈值可以根据经验值设定,也可以根据图像处理要求设定,本发明并不限于此。Optionally, in the embodiment of the present invention, the first determining module 430 may also be a merged area by combining the feature area and the adjacent area of the feature area, by calculating a similarity between the merged area and the adjacent area of the feature area and the feature area. However, it is determined whether the feature area and the adjacent area of the feature area belong to the same object. Specifically, selecting any two adjacent feature regions in any one of the plurality of micro cell images is the second feature region R 1 and the adjacent region R 2 of the second feature region, and R 1 and R 2 merged into a merged region R 3, according to the above equations (1) - (6) calculating the likelihood ratio L 31 R 3 and R 1 are, respectively, R 3 and R 2 log likelihood ratio L 32, if L 31 and / or If L 32 is less than or equal to the third threshold, it may be determined that R 1 and R 2 belong to the same object. Otherwise, it may be determined that R 1 and R 2 do not belong to the same object. Optionally, the third threshold may be set according to an empirical value. It can also be set according to image processing requirements, and the present invention is not limited thereto.
在本发明实施例中,第一确定模块430可以通过判断多个特征区域属于同源区域来确定区域平面。具体地,在任意相邻的两幅微单元图像第一微单元图像和第二微单元图像中,选取第一微单元图像中的任意一个特征区域为第三特征区域,将第二微单元图像上的每个特征区域分别作为疑似同源区域。按照公式(7)分别计算第三特征区域与每一个疑似同源区域的颜色误差值E,其中,p为第三特征区域内像素点的个数;Ip表示第三特征区域内的像素点的颜色值,Ip+d表示疑似同源区域内与第三特征区域内的像素点相对应的像素点的颜色值;E表示第三特征区域和疑似同源区域内所有像素点的颜色值的差值之和。选取满足颜色误差值E小于或等于第四阈值的所有疑似同源区域中,颜色误差值E最小的疑似同源区域为第四特征区域,则该第四特征区域与第三特征区域属于同源区域。若不存在第四特征区域,则确定为该第三特征区域的同源区域为该第三特征区域本身。可选地,该第四阈值可以根据经验值设定,也可以根据图像处理要求设定,本发明并不限于此。通过上述方法依次判断每个微单元图像和相邻的微单元图像中的每个特征区域,将属于同源区域的特征区域进行合并得到区域平面。可选地,该像素点的颜色值可以包括该像素点的RGB值或HSV值,但本发明并不限于此。In the embodiment of the present invention, the first determining module 430 may determine the area plane by determining that multiple feature areas belong to the same area. Specifically, in any two adjacent micro cell image first micro cell image and second micro cell image, any one of the first micro cell images is selected as a third feature region, and the second micro cell image is selected. Each feature region on the top is regarded as a suspected homologous region. Calculating the color error value E of the third feature region and each of the suspected homology regions according to formula (7), where p is the number of pixel points in the third feature region; Ip represents the pixel point in the third feature region Color value, I p+d represents the color value of the pixel corresponding to the pixel in the third feature region in the suspected homologous region; E represents the color value of all the pixels in the third feature region and the suspected homologous region The sum of the differences. Selecting a suspected homologous region in which all the suspected homologous regions satisfying the color error value E is less than or equal to the fourth threshold is the fourth feature region, and the fourth feature region and the third feature region are homologous region. If there is no fourth feature area, the same area determined as the third feature area is the third feature area itself. Optionally, the fourth threshold may be set according to an empirical value, or may be set according to an image processing requirement, and the present invention is not limited thereto. Each feature region in each microcell image and the adjacent microcell image is sequentially determined by the above method, and the feature regions belonging to the homologous region are combined to obtain a region plane. Alternatively, the color value of the pixel may include an RGB value or an HSV value of the pixel, but the invention is not limited thereto.
可选地,在本发明实施例中,第一确定模块430还可以通过下面的方法确定多个特征区域是否属于同源区域。将多个微单元图像中任一微单元图像中任一特征区域作为第五特征区域,并确定该第五特征区域的中心像素点。在与第五特征区域所在的微单元图像相邻的微单元图像中,依次选取与该中心像素点位于同一极线上的每个像素点,以这些像素点作为中心建立与第五 特征区域大小和形状一样的多个区域为疑似同源区域。按照公式(7),依次计算第五特征区域与多个疑似同源区域中的每个区域之间的颜色误差值E。选取满足颜色误差值E小于或等于第五阈值的所有区域中,颜色误差值E最小的区域为第六特征区域,则该第六特征区域是第五特征区域的同源区域。若不存在第六特征区域,则确定为该第五特征区域的同源区域为该第五特征区域本身。可选地,该第五阈值可以根据经验值设定,也可以根据图像处理要求设定,本发明并不限于此。可选地,该像素点的颜色值可以包括该像素点的RGB值或HSV值,但本发明并不限于此。Optionally, in the embodiment of the present invention, the first determining module 430 may further determine whether the multiple feature regions belong to the same region by using the following method. Any one of the plurality of micro cell images is used as the fifth feature region, and the central pixel of the fifth feature region is determined. In the microcell image adjacent to the microcell image in which the fifth feature region is located, each pixel point on the same pole line as the central pixel point is sequentially selected, and the pixel points are established as the center and the fifth pixel. A plurality of regions having the same size and shape as the feature region are suspected homologous regions. According to the formula (7), the color error value E between the fifth feature region and each of the plurality of suspected homologous regions is sequentially calculated. In the region where the color error value E is less than or equal to the fifth threshold, the region where the color error value E is the smallest is the sixth feature region, and the sixth feature region is the homologous region of the fifth feature region. If the sixth feature area does not exist, the same area determined as the fifth feature area is the fifth feature area itself. Optionally, the fifth threshold may be set according to an empirical value, or may be set according to an image processing requirement, and the present invention is not limited thereto. Alternatively, the color value of the pixel may include an RGB value or an HSV value of the pixel, but the invention is not limited thereto.
在本发明实施例中,通过上述方法合并特征区域时,可以按照一定方向的顺序进行划分特征区域,并按照一定的顺序合并特征区域得到区域平面。例如,可以按照从左至右,从上至下的顺序依次将微单元图像划分为多个特征区域,在划分了特征区域的微单元图像中确定第五特征区域,在相邻的未被划分特征区域的微单元图像中确定第六特征区域。In the embodiment of the present invention, when the feature regions are merged by the foregoing method, the feature regions may be divided according to a certain direction, and the feature regions are merged in a certain order to obtain a region plane. For example, the microcell image may be sequentially divided into a plurality of feature regions in order from left to right and from top to bottom, and the fifth feature region is determined in the microcell image in which the feature region is divided, and the adjacent regions are not divided. A sixth feature area is determined in the microcell image of the feature area.
在本发明实施例中,第一确定模块230确定多个区域平面后,通过第二确定模块240确定各个区域平面的区域平面深度值。可选的,该确定模块240可以通过确定每个区域平面内的特征点,并计算各个特征点深度值的方法确定区域平面的深度值。具体地,可以通过SIFT特征点查找法来确定该区域平面内的特征点,还可以通过FAST特征点查找法来确定特征点,本发明并不限于此。In the embodiment of the present invention, after the first determining module 230 determines the plurality of area planes, the second determining module 240 determines the area plane depth values of the respective area planes. Optionally, the determining module 240 may determine the depth value of the area plane by determining feature points in each area plane and calculating a depth value of each feature point. Specifically, the feature points in the plane of the area may be determined by the SIFT feature point search method, and the feature points may also be determined by the FAST feature point search method, and the present invention is not limited thereto.
在本发明实施例中,第二确定模块240确定区域平面内的所有特征点后,计算各个特征点的深度值。具体地,可以通过光场相机得到多个微单元图像,这些微单元图像构成二维的微单元图像阵列,并根据公式(8)来确定第m个特征点的深度值wm',如图2所示,其中,t为光场相机相邻透镜中心间隔;i为微单元图像阵列平面到光场相机透镜阵列平面的距离;dm为各个特征点的视差值,m表示所有特征点中任意一个特征点,通过该公式(8)计算每个区域平面上的每个特征点的深度值。In the embodiment of the present invention, after the second determining module 240 determines all the feature points in the area plane, the depth value of each feature point is calculated. Specifically, a plurality of microcell images can be obtained by a light field camera, and the microcell images form a two-dimensional microcell image array, and the depth value w m ' of the mth feature point is determined according to formula (8), as shown in FIG. 2, where t is the adjacent lens center interval of the light field camera; i is the distance from the microcell image array plane to the light field camera lens array plane; d m is the disparity value of each feature point, and m represents all feature points Any one of the feature points, the depth value of each feature point on each area plane is calculated by the formula (8).
在本发明实施例中,公式中的视差值dm可以通过块匹配算法进行计算。可选地,还可以通过颜色误差值匹配的方法更加精确地计算视差值dm。具体地,以计算第m个特征点为例,以第m个特征点为中心建立原始匹配块,该匹配块的大小可以根据经验值设定,根据块匹配算法,确定与该第m个特征点所在的微单元图像相邻的微单元图像上的待匹配块,并计算该第m个特 征点的原始视差值。根据计算得到的原始视差值,估算与该第m个特征点所在的微单元图像距离最远的,且包括与原始匹配块相匹配的匹配块的匹配微单元图像,确定该匹配微单元图像与原始匹配块所在微单元图像之间微单元图像个数的差值n。根据块匹配算法,确定该匹配微单元图像中与原始匹配块最匹配的匹配块,并通过块匹配算法根据原始匹配块与该匹配块计算该第m个特征点的匹配视差值D。根据下列公式(9)计算出第m个特征点的精确度视差值dm,其中,dm表示第m个特征点的视差值,第m个特征点为任一区域平面中任一特征点,类似地,可以根据上述方法计算出每个特征点的视差值。。In the embodiment of the present invention, the disparity value d m in the formula can be calculated by a block matching algorithm. Alternatively, the disparity value d m can also be calculated more accurately by the method of color error value matching. Specifically, taking the mth feature point as an example, the original matching block is established centering on the mth feature point, and the size of the matching block can be set according to an empirical value, and the mth feature is determined according to the block matching algorithm. The pixel to be matched on the adjacent microcell image of the microcell image where the point is located, and the original disparity value of the mth feature point is calculated. And determining, according to the calculated original disparity value, a matching microcell image of the matching block that is farthest from the microcell image where the mth feature point is located, and matching the original matching block, and determining the matching microcell image The difference n between the number of microcell images between the microcell image in which the original matching block is located. And determining, according to the block matching algorithm, a matching block that matches the original matching block in the matched microcell image, and calculating a matching disparity value D of the mth feature point according to the original matching block and the matching block by using a block matching algorithm. Calculating the accuracy disparity value d m of the mth feature point according to the following formula (9), where d m represents the disparity value of the mth feature point, and the mth feature point is any one of any area plane Feature points, similarly, the disparity value of each feature point can be calculated according to the above method. .
在本发明实施例中,第二确定模块240通过上述方法得到区域平面内的各个特征点的深度值后,可以将该区域平面内所有特征点的深度值求取平均值,将该平均深度值作为该区域平面内所有像素点的深度值,但本发明并不限于此。In the embodiment of the present invention, after the second determining module 240 obtains the depth values of the feature points in the area plane by using the foregoing method, the depth values of all the feature points in the area plane may be averaged, and the average depth value is obtained. The depth value is taken as the pixel value of all the pixels in the plane of the area, but the present invention is not limited thereto.
在本发明实施例中,可选地,当某一个区域平面内不存在特征点时,可以将该区域平面忽略,不再进行计算深度值,但本发明并不限于此。In the embodiment of the present invention, optionally, when there is no feature point in a certain area plane, the area plane may be ignored, and the depth value is not calculated, but the present invention is not limited thereto.
在本发明实施例中,第二确定模块240确定各个区域平面的深度值后,第三确定模块250根据该深度值生成三维图像。首先,建立三维坐标系,该三维坐标系包括x轴、y轴和z轴,可选地,可以将生成的三维立体场景的向后的方向设为z轴正方向,生成的三维立体场景向右的方向设为x轴正方向,生成的三维立体场景向上的方向设为y轴正方向。可选地,x和y方向可以与原始的多个微单元图像构成的二维微单元图像阵列的水平方向和垂直方向相对应。根据建立的三维坐标系,利用下面的公式(10),计算任一微单元图像中任一像素点在三维坐标系中的坐标值Pj,其中,Cj表示该第j个像素点在该微单元图像阵列中对应微透镜中心的坐标值,Xj表示该第j个像素点在该微单元图像阵列中对应的坐标值,wj表示该第j个像素点所在该区域平面的该深度值,i表示该微单元图像阵列平面到该光场相机透镜阵列平面的距离,其中,j小于或等于微单元图像阵列中所有像素点的个数。In the embodiment of the present invention, after the second determining module 240 determines the depth values of the respective area planes, the third determining module 250 generates a three-dimensional image according to the depth values. First, a three-dimensional coordinate system is established. The three-dimensional coordinate system includes an x-axis, a y-axis, and a z-axis. Alternatively, the backward direction of the generated three-dimensional scene can be set to the positive direction of the z-axis, and the generated three-dimensional scene is oriented. The right direction is set to the positive x-axis direction, and the direction of the generated three-dimensional scene is set to the positive direction of the y-axis. Alternatively, the x and y directions may correspond to the horizontal and vertical directions of the two-dimensional microcell image array of the original plurality of microcell images. Calculating the coordinate value P j of any pixel in any micro cell image in a three-dimensional coordinate system according to the established three-dimensional coordinate system, wherein C j represents the j-th pixel point in the a coordinate value corresponding to the center of the microlens in the microcell image array, X j represents a coordinate value of the jth pixel point in the microcell image array, and w j represents the depth of the plane of the region where the jth pixel point is located The value i represents the distance from the microcell image array plane to the plane of the light field camera lens array, where j is less than or equal to the number of all pixel points in the microcell image array.
应理解,在本发明的实施例中,微单元图像的相邻微单元图像或特征区域的相邻特征区域,可以为该微单元图像或该特征区域的4邻域内的或8邻域内的微单元图像或特征区域,本发明并不限于此。It should be understood that, in an embodiment of the present invention, an adjacent microcell image or an adjacent feature region of a feature region of the microcell image may be the microcell image or a micro neighborhood within the 4 neighborhood or 8 neighborhoods of the feature region. The unit image or the feature area, the present invention is not limited thereto.
应理解,根据本发明实施例的生成三维图像的装置200可对应于执行本 发明实施例中的生成三维图像的方法100,并且生成三维图像的装置200中的各个模块的上述和其它操作和/或功能分别为了实现图1至图2中的各个方法的相应流程,为了简洁,在此不再赘述。It should be understood that the apparatus 200 for generating a three-dimensional image according to an embodiment of the present invention may correspond to the execution of the present invention. The method 100 for generating a three-dimensional image in an embodiment of the invention, and the above-described and other operations and/or functions of the respective modules in the apparatus 200 for generating a three-dimensional image are respectively implemented in order to implement the respective processes of the respective methods in FIGS. 1 to 2. , will not repeat them here.
因此,本发明实施例的生成三维图像的装置,通过光场相机获取多个微单元图像,对每个微单元图像划分特征区域,通过判断各个特征区域是否属于同一物体,和/或各个特征区域是否属于同源区域,合并属于同一物体和/或属于同源区域的特征区域为区域平面,计算各个区域平面内的特征点的平均深度值,将该平均深度值作为该区域平面内所有像素点的深度值来生成三维立体图像,避免了深度值提取过程中的误匹配,从而能够更加准确快速地提取深度值,进而使得生成的三维图像更加准确逼真,应用场景范围更广泛。Therefore, the apparatus for generating a three-dimensional image according to an embodiment of the present invention acquires a plurality of microcell images by a light field camera, and divides a feature region for each microcell image, by determining whether each feature region belongs to the same object, and/or each feature region. Whether it belongs to a homologous region, and the feature regions belonging to the same object and/or belonging to the homologous region are region planes, and the average depth value of the feature points in each region plane is calculated, and the average depth value is used as all the pixels in the region plane. The depth value is used to generate a three-dimensional stereo image, which avoids mismatching in the depth value extraction process, thereby more accurately and quickly extracting the depth value, thereby making the generated three-dimensional image more accurate and realistic, and the application scene range is wider.
如图4所示,本发明实施例还提供了一种生成三维图像的装置300,包括处理器310、存储器320和总线系统330。其中,处理器310和存储器320通过总线系统330相连,该存储器320用于存储指令,该处理器310用于执行该存储器320存储的指令。该存储器320存储程序代码,且处理器310可以调用存储器320中存储的程序代码执行以下操作:As shown in FIG. 4, an embodiment of the present invention further provides an apparatus 300 for generating a three-dimensional image, including a processor 310, a memory 320, and a bus system 330. The processor 310 and the memory 320 are connected by a bus system 330 for storing instructions for executing instructions stored by the memory 320. The memory 320 stores program code, and the processor 310 can call the program code stored in the memory 320 to perform the following operations:
获取多个微单元图像;Obtaining multiple microcell images;
在每个该微单元图像上划分多个特征区域,该多个特征区域中的每个特征区域内的任意两个像素点的颜色值的差值小于或等于第一阈值;Dividing, on each of the micro cell images, a plurality of feature regions, wherein a difference in color values of any two pixel points in each of the plurality of feature regions is less than or equal to a first threshold;
根据该多个特征区域,确定多个区域平面,其中,该每个区域平面包括的特征区域属于同一物体或属于同源区域,该多个特征区域中的每个特征区域只属于该多个区域平面中的一个区域平面;Determining, according to the plurality of feature regions, a plurality of region planes, wherein the feature regions included in each of the region planes belong to the same object or belong to the same region, and each of the plurality of feature regions belongs to only the plurality of regions An area plane in the plane;
确定该每个区域平面的区域平面深度值;Determining an area plane depth value of each of the area planes;
根据该区域平面深度值得到三维图像。A three-dimensional image is obtained based on the planar depth value of the region.
因此,本发明实施例的生成三维图像的装置,通过在获取的多个微单元图像上划分特征区域,合并特征区域为区域平面,计算区域平面的深度值,根据该深度值生成三维立体图像,避免了深度值提取过程中的误匹配,从而能够更加准确地提取深度值,进而使得三维立体图像更加准确逼真,应用场景范围更广泛。Therefore, the apparatus for generating a three-dimensional image according to the embodiment of the present invention divides the feature area on the acquired plurality of micro unit images, merges the feature area into the area plane, calculates the depth value of the area plane, and generates a three-dimensional stereoscopic image according to the depth value. The mismatching in the depth value extraction process is avoided, so that the depth value can be extracted more accurately, thereby making the three-dimensional stereo image more accurate and realistic, and the application scene range is wider.
应理解,在本发明实施例中,该处理器310可以是中央处理单元(Central Processing Unit,简称为“CPU”),该处理器310还可以是其他通用处理器、数字信号处理器(DSP)、专用集成电路(ASIC)、现成可编程门阵列(FPGA) 或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。It should be understood that, in the embodiment of the present invention, the processor 310 may be a central processing unit ("CPU"), and the processor 310 may also be other general-purpose processors, digital signal processors (DSPs). , application specific integrated circuit (ASIC), off-the-shelf programmable gate array (FPGA) Or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, and the like. The general purpose processor may be a microprocessor or the processor or any conventional processor or the like.
该存储器320可以包括只读存储器和随机存取存储器,并向处理器310提供指令和数据。存储器320的一部分还可以包括非易失性随机存取存储器。例如,存储器320还可以存储设备类型的信息。The memory 320 can include read only memory and random access memory and provides instructions and data to the processor 310. A portion of the memory 320 may also include a non-volatile random access memory. For example, the memory 320 can also store information of the device type.
该总线系统330除包括数据总线之外,还可以包括电源总线、控制总线和状态信号总线等。但是为了清楚说明起见,在图中将各种总线都标为总线系统330。The bus system 330 may include a power bus, a control bus, a status signal bus, and the like in addition to the data bus. However, for clarity of description, various buses are labeled as bus system 330 in the figure.
在实现过程中,上述方法的各步骤可以通过处理器310中的硬件的集成逻辑电路或者软件形式的指令完成。结合本发明实施例所公开的方法的步骤可以直接体现为硬件处理器执行完成,或者用处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器320,处理器310读取存储器320中的信息,结合其硬件完成上述方法的步骤。为避免重复,这里不再详细描述。In the implementation process, each step of the foregoing method may be completed by an integrated logic circuit of hardware in the processor 310 or an instruction in a form of software. The steps of the method disclosed in the embodiments of the present invention may be directly implemented as a hardware processor, or may be performed by a combination of hardware and software modules in the processor. The software module can be located in a conventional storage medium such as random access memory, flash memory, read only memory, programmable read only memory or electrically erasable programmable memory, registers, and the like. The storage medium is located in the memory 320, and the processor 310 reads the information in the memory 320 and combines the hardware to perform the steps of the above method. To avoid repetition, it will not be described in detail here.
可选地,作为一个实施例,处理器310可以调用存储器320中存储的程序代码执行以下操作:确定该多个特征区域中的第一特征区域和该第一特征区域的邻接区域;确定该第一特征区域与该第一特征区域的邻接特征区域不属于同一物体的第一联合概率密度;确定该第一特征区域与该第一特征区域的邻接特征区域属于同一物体的第二联合概率密度;当该第一联合概率密度与该第二联合概率密度之比小于或等于第二阈值时,确定该第一特征区域与该第一特征区域的邻接特征区域属于该多个区域平面中的同一区域平面,该同一区域平面包括的特征区域属于同一物体。Optionally, as an embodiment, the processor 310 may invoke the program code stored in the memory 320 to: determine a first feature region of the plurality of feature regions and a contiguous region of the first feature region; determine the first Determining, by the feature area, the first joint probability density of the adjacent feature area of the first feature area not belonging to the same object; determining a second joint probability density of the first feature area and the adjacent feature area of the first feature area belonging to the same object; When the ratio of the first joint probability density to the second joint probability density is less than or equal to the second threshold, determining that the first feature region and the adjacent feature region of the first feature region belong to the same region of the plurality of region planes In the plane, the feature area included in the same area plane belongs to the same object.
可选地,作为一个实施例,处理器310可以调用存储器320中存储的程序代码执行以下操作:确定该多个特征区域中的第二特征区域和该第二特征区域的邻接区域;确定合并区域与该第二特征区域的第一似然比、该合并区域与该第二特征区域的邻接特征区域的第二似然比,该合并区域包括该第二特征区域和该第二特征区域的邻接区域;当该第一似然比和/或该第二似然比小于或等于第三阈值时,确定该第二特征区域和该第二特征区域的邻接特征区域属于该多个区域平面中的同一区域平面,该同一区域平面包括的特征区域属于同一物体。 Optionally, as an embodiment, the processor 310 may invoke the program code stored in the memory 320 to: determine a second feature region of the plurality of feature regions and a contiguous region of the second feature region; determine a merge region a first likelihood ratio of the second feature region, a second likelihood ratio of the merged region and the adjacent feature region of the second feature region, the merge region including adjacency of the second feature region and the second feature region a region; when the first likelihood ratio and/or the second likelihood ratio is less than or equal to a third threshold, determining that the second feature region and the adjacent feature region of the second feature region belong to the plurality of region planes The same area plane, the feature area included in the same area plane belongs to the same object.
可选地,作为一个实施例,处理器310可以调用存储器320中存储的程序代码执行以下操作:确定该多个特征区域中的第一微单元图像中的第三特征区域;确定该多个特征区域中的第二微单元图像中与该第三特征区域的颜色误差值最小的第四特征区域,该第二微单元图像与该第一微单元图像相邻,该第四特征区域与该第三特征区域的颜色误差值小于或等于第四阈值;确定该第三特征区域和该第四特征区域属于该多个区域平面中的同一区域平面,该同一区域平面包括的特征区域属于同源区域。Optionally, as an embodiment, the processor 310 may invoke the program code stored in the memory 320 to: determine a third feature region in the first microcell image of the plurality of feature regions; determine the plurality of features a fourth feature region of the second microcell image in the region having the smallest color error value of the third feature region, the second microcell image being adjacent to the first microcell image, the fourth feature region and the first The color error value of the three feature regions is less than or equal to the fourth threshold; determining that the third feature region and the fourth feature region belong to the same region plane in the plurality of region planes, and the feature region included in the same region plane belongs to the same region .
可选地,作为一个实施例,处理器310可以调用存储器320中存储的程序代码执行以下操作:确定该多个特征区域中的第三微单元图像中的第五特征区域和该第五特征区域的中心像素点;在第四微单元图像中,以与该中心像素点位于同一极线上的像素点为中心,确定与该第五特征区域大小和形状相同的多个区域,该第四微单元图像与该第三微单元图像相邻;在该多个区域中确定与该第五特征区域颜色误差值最小的第六特征区域,该第六特征区域与该第五特征区域的颜色误差值小于或等于第五阈值;确定该第五特征区域和该第六特征区域属于该多个区域平面中的同一区域平面,该同一区域平面包括的特征区域属于同源区域。Optionally, as an embodiment, the processor 310 may invoke the program code stored in the memory 320 to: determine a fifth feature region and the fifth feature region in the third microcell image of the plurality of feature regions. a central pixel; in the fourth microcell image, a plurality of regions having the same size and shape as the fifth feature region are determined centering on a pixel point on the same pole line as the central pixel point, the fourth micro a unit image adjacent to the third microcell image; determining, in the plurality of regions, a sixth feature region having a smallest color error value with the fifth feature region, and a color error value of the sixth feature region and the fifth feature region And less than or equal to the fifth threshold; determining that the fifth feature region and the sixth feature region belong to the same region plane in the plurality of region planes, and the feature region included in the same region plane belongs to the same region.
可选地,作为一个实施例,处理器310可以调用存储器320中存储的程序代码执行以下操作:通过光场相机获取光场图像;将该光场图像中的每个像素点一一映射到五维空间得到对应的映射像素点,该五维空间的坐标包括:水平X方向坐标,垂直Y方向坐标,红色分量强度值坐标,绿色分量强度值坐标和蓝色分量强度值坐标;将该映射像素点邻域内密度最大区域的平均颜色值确定为该映射像素点的颜色值;根据确定了颜色值的该映射像素点确定该多个微单元图像。Optionally, as an embodiment, the processor 310 may call the program code stored in the memory 320 to perform the following operations: acquiring a light field image by using a light field camera; mapping each pixel point in the light field image to one by one The dimension space obtains corresponding mapped pixel points, and the coordinates of the five-dimensional space include: horizontal X direction coordinates, vertical Y direction coordinates, red component intensity value coordinates, green component intensity value coordinates, and blue component intensity value coordinates; The average color value of the highest density region in the dot neighborhood is determined as the color value of the mapped pixel; the plurality of microcell images are determined according to the mapped pixel determined by the color value.
可选地,作为一个实施例,处理器310可以调用存储器320中存储的程序代码执行以下操作:确定该每个区域平面内的至少一个特征点;确定该至少一个特征点的深度值;确定该每个区域平面的区域平面深度值,该区域平面深度值为该至少一个特征点的深度值的平均值。Optionally, as an embodiment, the processor 310 may call the program code stored in the memory 320 to: determine at least one feature point in each area plane; determine a depth value of the at least one feature point; determine the An area plane depth value of each area plane, the area plane depth value being an average of depth values of the at least one feature point.
可选地,作为一个实施例,处理器310可以调用存储器320中存储的程序代码执行以下操作:利用光场相机,获取该多个微单元图像;确定该光场相机相邻透镜的中心间隔;确定该多个微单元图像所在的平面到该光场相机透镜阵列平面的距离;确定第m个特征点的视差值;根据下列公式计算该第 m个特征点的深度值wm':Optionally, as an embodiment, the processor 310 may call the program code stored in the memory 320 to: acquire the plurality of micro unit images by using a light field camera; and determine a center interval of adjacent lenses of the light field camera; Determining a distance from a plane of the plurality of microcell images to a plane of the light field camera lens array; determining a disparity value of the mth feature point; and calculating a depth value w m ' of the mth feature point according to the following formula:
Figure PCTCN2015077900-appb-000021
Figure PCTCN2015077900-appb-000021
其中,t为该光场相机相邻透镜的中心间隔;i为该多个微单元图像所在的平面到该光场相机透镜阵列平面的该距离;dm为该第m个特征点的视差值。Where t is the center spacing of adjacent lenses of the light field camera; i is the distance from the plane of the plurality of microcell images to the plane of the lens array of the light field camera; d m is the parallax of the mth feature point value.
可选地,作为一个实施例,处理器310可以调用存储器320中存储的程序代码执行以下操作:以该第m个特征点为中心建立原始匹配块;确定与该原始匹配块所在的微单元图像相邻的微单元图像中的待匹配块;根据该原始匹配块和该待匹配块,确定该第m个特征点的原始视差值;根据该原始视差值确定与该第m个特征点所在的微单元图像距离最远的待匹配微单元图像,并确定该待匹配微单元图像与该原始匹配块所在的微单元图像之间的图像数量差值;根据该原始匹配块和该待匹配微单元图像中与该原始匹配块颜色误差值最小的匹配块,确定该第m个特征点的匹配视差值;根据下列公式计算该第m个特征点的精确视差值dmOptionally, as an embodiment, the processor 310 may call the program code stored in the memory 320 to perform an operation of: establishing an original matching block centering on the mth feature point; determining a micro cell image where the original matching block is located a block to be matched in an adjacent microcell image; determining an original disparity value of the mth feature point according to the original matching block and the to-be-matched block; determining the mth feature point according to the original disparity value The microcell image is located at the farthest distance to match the microcell image, and determines the difference in the number of images between the image of the microcell to be matched and the microcell image where the original matching block is located; according to the original matching block and the to-be-matched a matching block having the smallest color error value of the original matching block in the micro unit image, determining a matching disparity value of the mth feature point; and calculating an accurate disparity value d m of the mth feature point according to the following formula:
Figure PCTCN2015077900-appb-000022
Figure PCTCN2015077900-appb-000022
其中,D为该匹配视差值;n为该图像数量差值。Where D is the matching disparity value; n is the difference in the number of images.
可选地,作为一个实施例,处理器310可以调用存储器320中存储的程序代码执行以下操作:利用光场相机,获取该多个微单元图像;建立三维坐标系,该三维坐标系包括x轴、y轴和z轴;根据下列公式,在该三维坐标系内生成三维图像:Optionally, as an embodiment, the processor 310 may call the program code stored in the memory 320 to: acquire the plurality of micro unit images by using a light field camera; and establish a three-dimensional coordinate system, where the three-dimensional coordinate system includes an x-axis , y-axis and z-axis; generate a three-dimensional image in the three-dimensional coordinate system according to the following formula:
Figure PCTCN2015077900-appb-000023
Figure PCTCN2015077900-appb-000023
其中,Pj表示该多个微单元图像中的第j个像素点对应该三维坐标系的坐标值,Cj表示该第j个像素点在该多个微单元图像中对应微透镜中心的坐标值,Xj表示该第j个像素点在该多个微单元图像中对应的坐标值,wj表示该第j个像素点所在的区域平面的该区域平面深度值,i表示该多个微单元图像所在的平面到该光场相机透镜阵列平面的距离,该j小于或等于该多个微单元图像中所有像素点的个数。Wherein P j represents coordinate values of the j-th pixel point in the plurality of micro-cell images corresponding to the three-dimensional coordinate system, and C j represents coordinates of the j-th pixel point corresponding to the center of the microlens in the plurality of micro-cell images a value, X j represents a coordinate value of the j-th pixel in the plurality of micro-cell images, w j represents a plane depth value of the region of the region plane where the j-th pixel is located, and i represents the plurality of micro- The distance from the plane of the unit image to the plane of the light field camera lens array, the j being less than or equal to the number of all the pixels in the plurality of microcell images.
应理解,根据本发明实施例的生成三维图像的装置300可对应于本发明实施例中的生成三维图像的装置200,并可以对应于执行根据本发明实施例 的方法100中的相应主体,并且生成三维图像的装置300中的各个模块的上述和其它操作和/或功能分别为了实现图1至图2中的各个方法的相应流程,为了简洁,在此不再赘述。It should be understood that the apparatus 300 for generating a three-dimensional image according to an embodiment of the present invention may correspond to the apparatus 200 for generating a three-dimensional image in the embodiment of the present invention, and may correspond to performing an embodiment according to the present invention. The above-described and other operations and/or functions of the respective modules in the method 300 for generating the three-dimensional image, respectively, in order to implement the respective processes of the respective methods in FIGS. 1 to 2, for the sake of brevity, Let me repeat.
因此,本发明实施例的生成三维图像的装置,通过在获取的多个微单元图像上划分特征区域,合并特征区域为区域平面,计算区域平面的深度值,根据该深度值生成三维立体图像,避免了深度值提取过程中的误匹配,从而能够更加准确地提取深度值,进而使得三维立体图像更加准确逼真,应用场景范围更广泛。Therefore, the apparatus for generating a three-dimensional image according to the embodiment of the present invention divides the feature area on the acquired plurality of micro unit images, merges the feature area into the area plane, calculates the depth value of the area plane, and generates a three-dimensional stereoscopic image according to the depth value. The mismatching in the depth value extraction process is avoided, so that the depth value can be extracted more accurately, thereby making the three-dimensional stereo image more accurate and realistic, and the application scene range is wider.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the various examples described in connection with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both, for clarity of hardware and software. Interchangeability, the composition and steps of the various examples have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the solution. A person skilled in the art can use different methods for implementing the described functions for each particular application, but such implementation should not be considered to be beyond the scope of the present invention.
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。A person skilled in the art can clearly understand that, for the convenience and brevity of the description, the specific working process of the system, the device and the unit described above can refer to the corresponding process in the foregoing method embodiment, and details are not described herein again.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另外,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口、装置或单元的间接耦合或通信连接,也可以是电的,机械的或其它的形式连接。In the several embodiments provided by the present application, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. For example, the device embodiments described above are merely illustrative. For example, the division of cells is only a logical function division. In actual implementation, there may be another division manner. For example, multiple units or components may be combined or integrated. Go to another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, or an electrical, mechanical or other form of connection.
作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本发明实施例方案的目的。The units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the embodiments of the present invention.
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以是两个或两个以上单元集成在 一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated in In a unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分,或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。An integrated unit, if implemented in the form of a software functional unit and sold or used as a standalone product, can be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention contributes in essence or to the prior art, or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium. A number of instructions are included to cause a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the various embodiments of the present invention. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like, which can store program codes. .
以上,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到各种等效的修改或替换,这些修改或替换都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以权利要求的保护范围为准。 The above is only the specific embodiment of the present invention, but the scope of the present invention is not limited thereto, and any equivalent modification or can be easily conceived by those skilled in the art within the technical scope of the present disclosure. Such modifications or substitutions are intended to be included within the scope of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims (20)

  1. 一种生成三维图像的方法,其特征在于,包括:A method for generating a three-dimensional image, comprising:
    获取多个微单元图像;Obtaining multiple microcell images;
    在每个所述微单元图像上划分多个特征区域,所述多个特征区域中的每个特征区域内的任意两个像素点的颜色值的差值小于或等于第一阈值;Dividing a plurality of feature regions on each of the microcell images, wherein a difference in color values of any two pixel points in each of the plurality of feature regions is less than or equal to a first threshold;
    根据所述多个特征区域,确定多个区域平面,其中,所述每个区域平面包括的特征区域属于同一物体或属于同源区域,所述多个特征区域中的每个特征区域只属于所述多个区域平面中的一个区域平面;Determining, according to the plurality of feature regions, a plurality of region planes, wherein the feature regions included in each of the region planes belong to the same object or belong to a homologous region, and each of the plurality of feature regions belongs to only Describe one of a plurality of area planes;
    确定所述每个区域平面的区域平面深度值;Determining an area plane depth value of each of the area planes;
    根据所述区域平面深度值得到三维图像。A three-dimensional image is obtained based on the area plane depth value.
  2. 根据权利要求1所述的方法,其特征在于,所述根据所述多个特征区域,确定多个区域平面,包括:The method according to claim 1, wherein the determining the plurality of area planes according to the plurality of feature areas comprises:
    确定所述多个特征区域中的第一特征区域和所述第一特征区域的邻接区域;Determining a first feature region of the plurality of feature regions and an adjacent region of the first feature region;
    确定所述第一特征区域与所述第一特征区域的邻接特征区域不属于同一物体的第一联合概率密度;Determining a first joint probability density that the first feature region and the adjacent feature region of the first feature region do not belong to the same object;
    确定所述第一特征区域与所述第一特征区域的邻接特征区域属于同一物体的第二联合概率密度;Determining, by the second feature probability density, that the first feature region and the adjacent feature region of the first feature region belong to the same object;
    当所述第一联合概率密度与所述第二联合概率密度之比小于或等于第二阈值时,确定所述第一特征区域与所述第一特征区域的邻接特征区域属于所述多个区域平面中的同一区域平面,所述同一区域平面包括的特征区域属于同一物体。Determining that the first feature region and the adjacent feature region of the first feature region belong to the plurality of regions when a ratio of the first joint probability density to the second joint probability density is less than or equal to a second threshold The same area plane in the plane, the feature area included in the same area plane belongs to the same object.
  3. 根据权利要求1所述的方法,其特征在于,所述根据所述多个特征区域,确定多个区域平面,包括:The method according to claim 1, wherein the determining the plurality of area planes according to the plurality of feature areas comprises:
    确定所述多个特征区域中的第二特征区域和所述第二特征区域的邻接区域;Determining a second feature region of the plurality of feature regions and an adjacent region of the second feature region;
    确定合并区域与所述第二特征区域的第一似然比、所述合并区域与所述第二特征区域的邻接特征区域的第二似然比,所述合并区域包括所述第二特征区域和所述第二特征区域的邻接区域;Determining a first likelihood ratio of the merged region and the second feature region, a second likelihood ratio of the merged region and the adjacent feature region of the second feature region, the merged region including the second feature region And an adjacent area of the second feature area;
    当所述第一似然比和/或所述第二似然比小于或等于第三阈值时,确定所述第二特征区域和所述第二特征区域的邻接特征区域属于所述多个区域平 面中的同一区域平面,所述同一区域平面包括的特征区域属于同一物体。Determining that the adjacent feature regions of the second feature region and the second feature region belong to the plurality of regions when the first likelihood ratio and/or the second likelihood ratio is less than or equal to a third threshold Flat The same area plane in the face, the feature area included in the same area plane belongs to the same object.
  4. 根据权利要求1所述的方法,其特征在于,所述根据所述多个特征区域,确定多个区域平面,包括:The method according to claim 1, wherein the determining the plurality of area planes according to the plurality of feature areas comprises:
    确定所述多个特征区域中的第一微单元图像中的第三特征区域;Determining a third feature region of the first of the plurality of feature regions;
    确定所述多个特征区域中的第二微单元图像中与所述第三特征区域的颜色误差值最小的第四特征区域,所述第二微单元图像与所述第一微单元图像相邻,所述第四特征区域与所述第三特征区域的颜色误差值小于或等于第四阈值;Determining, in a second microcell image of the plurality of feature regions, a fourth feature region having a smallest color error value with the third feature region, the second microcell image being adjacent to the first microcell image The color error value of the fourth feature area and the third feature area is less than or equal to a fourth threshold;
    确定所述第三特征区域和所述第四特征区域属于所述多个区域平面中的同一区域平面,所述同一区域平面包括的特征区域属于同源区域。Determining that the third feature region and the fourth feature region belong to the same region plane of the plurality of region planes, and the feature region included in the same region plane belongs to a homologous region.
  5. 根据权利要求1所述的方法,其特征在于,所述根据所述多个特征区域,确定多个区域平面,包括:The method according to claim 1, wherein the determining the plurality of area planes according to the plurality of feature areas comprises:
    确定所述多个特征区域中的第三微单元图像中的第五特征区域和所述第五特征区域的中心像素点;Determining a fifth feature region of the third plurality of feature regions and a central pixel point of the fifth feature region;
    在第四微单元图像中,以与所述中心像素点位于同一极线上的像素点为中心,确定与所述第五特征区域大小和形状相同的多个区域,所述第四微单元图像与所述第三微单元图像相邻;In the fourth microcell image, a plurality of regions having the same size and shape as the fifth feature region are determined centering on a pixel point on the same pole line as the central pixel point, the fourth microcell image Adjacent to the third microcell image;
    在所述多个区域中确定与所述第五特征区域颜色误差值最小的第六特征区域,所述第六特征区域与所述第五特征区域的颜色误差值小于或等于第五阈值;Determining, in the plurality of regions, a sixth feature region having a smallest color error value with the fifth feature region, wherein a color error value of the sixth feature region and the fifth feature region is less than or equal to a fifth threshold;
    确定所述第五特征区域和所述第六特征区域属于所述多个区域平面中的同一区域平面,所述同一区域平面包括的特征区域属于同源区域。Determining that the fifth feature region and the sixth feature region belong to the same region plane of the plurality of region planes, and the feature region included in the same region plane belongs to a homologous region.
  6. 根据权利要求1至5中任一项所述的方法,其特征在于,所述获取多个微单元图像,包括:The method according to any one of claims 1 to 5, wherein the acquiring a plurality of microcell images comprises:
    通过光场相机获取光场图像;Acquiring a light field image through a light field camera;
    将所述光场图像中的每个像素点一一映射到五维空间得到对应的映射像素点,所述五维空间的坐标包括:水平X方向坐标,垂直Y方向坐标,红色分量强度值坐标,绿色分量强度值坐标和蓝色分量强度值坐标;Mapping each pixel point in the light field image to a five-dimensional space to obtain corresponding mapping pixel points, wherein the coordinates of the five-dimensional space include: horizontal X direction coordinates, vertical Y direction coordinates, and red component intensity value coordinates , green component intensity value coordinates and blue component intensity value coordinates;
    将所述映射像素点邻域内密度最大区域的平均颜色值确定为所述映射像素点的颜色值;Determining an average color value of the highest density region in the neighborhood of the mapped pixel point as a color value of the mapped pixel point;
    根据确定了颜色值的所述映射像素点确定所述多个微单元图像。 The plurality of microcell images are determined based on the mapped pixel points that determine the color value.
  7. 根据权利要求1至5中任一项所述的方法,其特征在于,所述确定所述每个区域平面的区域平面深度值,包括:The method according to any one of claims 1 to 5, wherein the determining the regional plane depth value of each of the area planes comprises:
    确定所述每个区域平面内的至少一个特征点;Determining at least one feature point in each of the area planes;
    确定所述至少一个特征点的深度值;Determining a depth value of the at least one feature point;
    确定所述每个区域平面的区域平面深度值,所述区域平面深度值为所述至少一个特征点的深度值的平均值。Determining an area plane depth value of each of the area planes, the area plane depth value being an average of depth values of the at least one feature point.
  8. 根据权利要求7所述的方法,其特征在于,所述获取多个微单元图像,包括:The method according to claim 7, wherein the acquiring a plurality of microcell images comprises:
    利用光场相机,获取所述多个微单元图像;Acquiring the plurality of microcell images using a light field camera;
    所述确定所述至少一个特征点的深度值,包括:Determining the depth value of the at least one feature point includes:
    确定所述光场相机相邻透镜的中心间隔;Determining a center interval of adjacent lenses of the light field camera;
    确定所述多个微单元图像所在的平面到所述光场相机透镜阵列平面的距离;Determining a distance from a plane in which the plurality of microcell images are located to a plane of the light field camera lens array;
    确定第m个特征点的视差值;Determining a disparity value of the mth feature point;
    根据下列公式计算所述第m个特征点的深度值wm':The depth value w m ' of the mth feature point is calculated according to the following formula:
    Figure PCTCN2015077900-appb-100001
    Figure PCTCN2015077900-appb-100001
    其中,t为所述光场相机相邻透镜的中心间隔;i为所述多个微单元图像所在的平面到所述光场相机透镜阵列平面的所述距离;dm为所述第m个特征点的视差值。Where t is the center spacing of adjacent lenses of the light field camera; i is the distance from the plane of the plurality of microcell images to the plane of the light field camera lens array; d m is the mth The disparity value of the feature point.
  9. 根据权利要求8所述的方法,其特征在于,所述确定所述第m个特征点的视差值,包括:The method according to claim 8, wherein the determining the disparity value of the mth feature point comprises:
    以所述第m个特征点为中心建立原始匹配块;Establishing an original matching block centering on the mth feature point;
    确定与所述原始匹配块所在的微单元图像相邻的微单元图像中的待匹配块;Determining a block to be matched in a microcell image adjacent to the microcell image in which the original matching block is located;
    根据所述原始匹配块和所述待匹配块,确定所述第m个特征点的原始视差值;Determining an original disparity value of the mth feature point according to the original matching block and the to-be-matched block;
    根据所述原始视差值确定与所述第m个特征点所在的微单元图像距离最远的待匹配微单元图像,并确定所述待匹配微单元图像与所述原始匹配块所在的微单元图像之间的图像数量差值;Determining, according to the original disparity value, a to-be-matched microcell image that is farthest from the microcell image in which the mth feature point is located, and determining the microcell to be matched with the original matching block The difference in the number of images between images;
    根据所述原始匹配块和所述待匹配微单元图像中与所述原始匹配块颜色误差值最小的匹配块,确定所述第m个特征点的匹配视差值; Determining a matching disparity value of the mth feature point according to the original matching block and the matching block in the to-be-matched microcell image that has the smallest color error value of the original matching block;
    根据下列公式计算所述第m个特征点的精确视差值dmCalculating the exact disparity value d m of the mth feature point according to the following formula:
    Figure PCTCN2015077900-appb-100002
    Figure PCTCN2015077900-appb-100002
    其中,D为所述匹配视差值;n为所述图像数量差值。Where D is the matching disparity value; n is the difference in the number of images.
  10. 根据权利要求1至9中任一项所述的方法,其特征在于,所述获取多个微单元图像,包括:The method according to any one of claims 1 to 9, wherein the acquiring a plurality of microcell images comprises:
    利用光场相机,获取所述多个微单元图像;Acquiring the plurality of microcell images using a light field camera;
    所述根据所述区域平面深度值生成三维图像,包括:The generating a three-dimensional image according to the regional plane depth value includes:
    建立三维坐标系,所述三维坐标系包括x轴、y轴和z轴;Establishing a three-dimensional coordinate system including an x-axis, a y-axis, and a z-axis;
    根据下列公式,在所述三维坐标系内生成三维图像:A three-dimensional image is generated within the three-dimensional coordinate system according to the following formula:
    Figure PCTCN2015077900-appb-100003
    Figure PCTCN2015077900-appb-100003
    其中,Pj表示所述多个微单元图像中的第j个像素点对应所述三维坐标系的坐标值,Cj表示所述第j个像素点在所述多个微单元图像中对应微透镜中心的坐标值,Xj表示所述第j个像素点在所述多个微单元图像中对应的坐标值,wj表示所述第j个像素点所在的区域平面的所述区域平面深度值,i表示所述多个微单元图像所在的平面到所述光场相机透镜阵列平面的距离,所述j小于或等于所述多个微单元图像中所有像素点的个数。Wherein, P j represents a coordinate value of the j-th pixel point of the plurality of micro-cell images corresponding to the three-dimensional coordinate system, and C j represents that the j-th pixel point corresponds to the micro-cell image a coordinate value of a lens center, X j represents a coordinate value corresponding to the j-th pixel point in the plurality of micro-cell images, and w j represents a depth of the region plane of a region plane where the j-th pixel point is located a value, i represents a distance from a plane in which the plurality of microcell images are located to a plane of the light field camera lens array, the j being less than or equal to the number of all pixel points in the plurality of microcell images.
  11. 一种生成三维图像的装置,其特征在于,包括:An apparatus for generating a three-dimensional image, comprising:
    获取模块,用于获取多个微单元图像;An acquiring module, configured to acquire a plurality of micro unit images;
    划分模块,用于在每个所述微单元图像上划分多个特征区域,所述多个特征区域中的每个特征区域内的任意两个像素点的颜色值的差值小于或等于第一阈值;a dividing module, configured to divide a plurality of feature regions on each of the microcell images, wherein a difference in color values of any two pixel points in each of the plurality of feature regions is less than or equal to the first Threshold value
    第一确定模块,用于根据所述多个特征区域,确定多个区域平面,其中,所述每个区域平面包括的特征区域属于同一物体或属于同源区域,所述多个特征区域中的每个特征区域只属于所述多个区域平面中的一个区域平面;a first determining module, configured to determine, according to the plurality of feature regions, a plurality of region planes, wherein the feature regions included in each of the region planes belong to the same object or belong to a homologous region, and the plurality of feature regions Each feature area belongs to only one of the plurality of area planes;
    第二确定模块,用于确定所述每个区域平面的区域平面深度值;a second determining module, configured to determine an area plane depth value of each area plane;
    第三确定模块,用于根据所述区域平面深度值得到三维图像。And a third determining module, configured to obtain a three-dimensional image according to the regional plane depth value.
  12. 根据权利要求11所述的装置,其特征在于,所述第一确定模块具体用于:The device according to claim 11, wherein the first determining module is specifically configured to:
    确定所述多个特征区域中的第一特征区域和所述第一特征区域的邻接区域; Determining a first feature region of the plurality of feature regions and an adjacent region of the first feature region;
    确定所述第一特征区域与所述第一特征区域的邻接特征区域不属于同一物体的第一联合概率密度;Determining a first joint probability density that the first feature region and the adjacent feature region of the first feature region do not belong to the same object;
    确定所述第一特征区域与所述第一特征区域的邻接特征区域属于同一物体的第二联合概率密度;Determining, by the second feature probability density, that the first feature region and the adjacent feature region of the first feature region belong to the same object;
    当所述第一联合概率密度与所述第二联合概率密度之比小于或等于第二阈值时,确定所述第一特征区域与所述第一特征区域的邻接特征区域属于所述多个区域平面中的同一区域平面,所述同一区域平面包括的特征区域属于同一物体。Determining that the first feature region and the adjacent feature region of the first feature region belong to the plurality of regions when a ratio of the first joint probability density to the second joint probability density is less than or equal to a second threshold The same area plane in the plane, the feature area included in the same area plane belongs to the same object.
  13. 根据权利要求11所述的装置,其特征在于,所述第一确定模块具体用于:The device according to claim 11, wherein the first determining module is specifically configured to:
    确定所述多个特征区域中的第二特征区域和所述第二特征区域的邻接区域;Determining a second feature region of the plurality of feature regions and an adjacent region of the second feature region;
    确定合并区域与所述第二特征区域的第一似然比、所述合并区域与所述第二特征区域的邻接特征区域的第二似然比,所述合并区域包括所述第二特征区域和所述第二特征区域的邻接区域;Determining a first likelihood ratio of the merged region and the second feature region, a second likelihood ratio of the merged region and the adjacent feature region of the second feature region, the merged region including the second feature region And an adjacent area of the second feature area;
    当所述第一似然比和/或所述第二似然比小于或等于第三阈值时,确定所述第二特征区域和所述第二特征区域的邻接特征区域属于所述多个区域平面中的同一区域平面,所述同一区域平面包括的特征区域属于同一物体。Determining that the adjacent feature regions of the second feature region and the second feature region belong to the plurality of regions when the first likelihood ratio and/or the second likelihood ratio is less than or equal to a third threshold The same area plane in the plane, the feature area included in the same area plane belongs to the same object.
  14. 根据权利要求11所述的装置,其特征在于,所述第一确定模块具体用于:The device according to claim 11, wherein the first determining module is specifically configured to:
    确定所述多个特征区域中的第一微单元图像中的第三特征区域;Determining a third feature region of the first of the plurality of feature regions;
    确定所述多个特征区域中的第二微单元图像中与所述第三特征区域的颜色误差值最小的第四特征区域,所述第二微单元图像与所述第一微单元图像相邻,所述第四特征区域与所述第三特征区域的颜色误差值小于或等于第四阈值;Determining, in a second microcell image of the plurality of feature regions, a fourth feature region having a smallest color error value with the third feature region, the second microcell image being adjacent to the first microcell image The color error value of the fourth feature area and the third feature area is less than or equal to a fourth threshold;
    确定所述第三特征区域和所述第四特征区域属于所述多个区域平面中的同一区域平面,所述同一区域平面包括的特征区域属于同源区域。Determining that the third feature region and the fourth feature region belong to the same region plane of the plurality of region planes, and the feature region included in the same region plane belongs to a homologous region.
  15. 根据权利要求11所述的装置,其特征在于,所述第一确定模块具体用于:The device according to claim 11, wherein the first determining module is specifically configured to:
    确定所述多个特征区域中的第三微单元图像中的第五特征区域和所述第五特征区域的中心像素点; Determining a fifth feature region of the third plurality of feature regions and a central pixel point of the fifth feature region;
    在第四微单元图像中,以与所述中心像素点位于同一极线上的像素点为中心,确定与所述第五特征区域大小和形状相同的多个区域,所述第四微单元图像与所述第三微单元图像相邻;In the fourth microcell image, a plurality of regions having the same size and shape as the fifth feature region are determined centering on a pixel point on the same pole line as the central pixel point, the fourth microcell image Adjacent to the third microcell image;
    在所述多个区域中确定与所述第五特征区域颜色误差值最小的第六特征区域,所述第六特征区域与所述第五特征区域的颜色误差值小于或等于第五阈值;Determining, in the plurality of regions, a sixth feature region having a smallest color error value with the fifth feature region, wherein a color error value of the sixth feature region and the fifth feature region is less than or equal to a fifth threshold;
    确定所述第五特征区域和所述第六特征区域属于所述多个区域平面中的同一区域平面,所述同一区域平面包括的特征区域属于同源区域。Determining that the fifth feature region and the sixth feature region belong to the same region plane of the plurality of region planes, and the feature region included in the same region plane belongs to a homologous region.
  16. 根据权利要求11至15中任一项所述的装置,其特征在于,所述获取模块具体用于:The device according to any one of claims 11 to 15, wherein the acquisition module is specifically configured to:
    通过光场相机获取光场图像;Acquiring a light field image through a light field camera;
    将所述光场图像中的每个像素点一一映射到五维空间得到对应的映射像素点,所述五维空间的坐标包括:水平X方向坐标,垂直Y方向坐标,红色分量强度值坐标,绿色分量强度值坐标和蓝色分量强度值坐标;Mapping each pixel point in the light field image to a five-dimensional space to obtain corresponding mapping pixel points, wherein the coordinates of the five-dimensional space include: horizontal X direction coordinates, vertical Y direction coordinates, and red component intensity value coordinates , green component intensity value coordinates and blue component intensity value coordinates;
    将所述映射像素点邻域内密度最大区域的平均颜色值确定为所述映射像素点的颜色值;Determining an average color value of the highest density region in the neighborhood of the mapped pixel point as a color value of the mapped pixel point;
    根据确定了颜色值的所述映射像素点确定所述多个微单元图像。The plurality of microcell images are determined based on the mapped pixel points that determine the color value.
  17. 根据权利要求11至15中任一项所述的装置,其特征在于,所述第二确定模块具体用于:The device according to any one of claims 11 to 15, wherein the second determining module is specifically configured to:
    确定所述每个区域平面内的至少一个特征点;Determining at least one feature point in each of the area planes;
    确定所述至少一个特征点的深度值;Determining a depth value of the at least one feature point;
    确定所述每个区域平面的区域平面深度值,所述区域平面深度值为所述至少一个特征点的深度值的平均值。Determining an area plane depth value of each of the area planes, the area plane depth value being an average of depth values of the at least one feature point.
  18. 根据权利要求17所述的装置,其特征在于,所述获取模块具体用于:The device according to claim 17, wherein the obtaining module is specifically configured to:
    利用光场相机,获取所述多个微单元图像;Acquiring the plurality of microcell images using a light field camera;
    所述第二确定模块具体用于:The second determining module is specifically configured to:
    确定所述光场相机相邻透镜的中心间隔;Determining a center interval of adjacent lenses of the light field camera;
    确定所述多个微单元图像所在的平面到所述光场相机透镜阵列平面的距离;Determining a distance from a plane in which the plurality of microcell images are located to a plane of the light field camera lens array;
    确定第m个特征点的视差值; Determining a disparity value of the mth feature point;
    根据下列公式计算所述第m个特征点的深度值wm':The depth value w m ' of the mth feature point is calculated according to the following formula:
    Figure PCTCN2015077900-appb-100004
    Figure PCTCN2015077900-appb-100004
    其中,t为所述光场相机相邻透镜的中心间隔;i为所述所述微单元图像所在的平面到所述光场相机透镜阵列平面的所述距离;dm为所述第m个特征点的视差值。Where t is the center spacing of adjacent lenses of the light field camera; i is the distance from the plane of the microcell image to the plane of the light field camera lens array; d m is the mth The disparity value of the feature point.
  19. 根据权利要求18所述的装置,其特征在于,所述第二确定模块具体用于:The device according to claim 18, wherein the second determining module is specifically configured to:
    以所述第m个特征点为中心建立原始匹配块;Establishing an original matching block centering on the mth feature point;
    确定与所述原始匹配块所在的微单元图像相邻的微单元图像中的待匹配块;Determining a block to be matched in a microcell image adjacent to the microcell image in which the original matching block is located;
    根据所述原始匹配块和所述待匹配块,确定所述第m个特征点的原始视差值;Determining an original disparity value of the mth feature point according to the original matching block and the to-be-matched block;
    根据所述原始视差值确定与所述第m个特征点所在的微单元图像距离最远的待匹配微单元图像,并确定所述待匹配微单元图像与所述原始匹配块所在的微单元图像之间的图像数量差值;Determining, according to the original disparity value, a to-be-matched microcell image that is farthest from the microcell image in which the mth feature point is located, and determining the microcell to be matched with the original matching block The difference in the number of images between images;
    根据所述原始匹配块和所述待匹配微单元图像中与所述原始匹配块颜色误差值最小的匹配块,确定所述第m个特征点的匹配视差值;Determining a matching disparity value of the mth feature point according to the original matching block and the matching block in the to-be-matched microcell image that has the smallest color error value of the original matching block;
    根据下列公式计算所述第m个匹配块的精确视差值dmCalculating the exact disparity value d m of the mth matching block according to the following formula:
    Figure PCTCN2015077900-appb-100005
    Figure PCTCN2015077900-appb-100005
    其中,D为所述匹配视差值;n为所述图像数量差值。Where D is the matching disparity value; n is the difference in the number of images.
  20. 根据权利要求11至19中任一项所述的装置,其特征在于,所述获取模块具体用于:The device according to any one of claims 11 to 19, wherein the acquisition module is specifically configured to:
    利用光场相机,获取所述多个微单元图像;Acquiring the plurality of microcell images using a light field camera;
    所述第三确定模块具体用于:The third determining module is specifically configured to:
    建立三维坐标系,所述三维坐标系包括x轴、y轴和z轴;Establishing a three-dimensional coordinate system including an x-axis, a y-axis, and a z-axis;
    根据下列公式,在所述三维坐标系内生成三维图像:A three-dimensional image is generated within the three-dimensional coordinate system according to the following formula:
    Figure PCTCN2015077900-appb-100006
    Figure PCTCN2015077900-appb-100006
    其中,Pj表示所述多个微单元图像中的第j个像素点对应所述三维坐标系的坐标值,Cj表示所述第j个像素点在所述多个微单元图像中对应微透镜中心的坐标值,Xj表示所述第j个像素点在所述多个微单元图像中对应的坐 标值,wj表示所述第j个像素点所在的区域平面的所述区域平面深度值,i表示所述多个微单元图像所在的平面到所述光场相机透镜阵列平面的距离,所述j小于或等于所述多个微单元图像中所有像素点的个数。 Wherein, P j represents a coordinate value of the j-th pixel point of the plurality of micro-cell images corresponding to the three-dimensional coordinate system, and C j represents that the j-th pixel point corresponds to the micro-cell image a coordinate value of a lens center, X j represents a corresponding coordinate value of the j-th pixel point in the plurality of micro-cell images, and w j represents a depth of the region plane of a region plane where the j-th pixel point is located a value, i represents a distance from a plane in which the plurality of microcell images are located to a plane of the light field camera lens array, the j being less than or equal to the number of all pixel points in the plurality of microcell images.
PCT/CN2015/077900 2014-10-17 2015-04-30 Method and device for generating three-dimensional image WO2016058359A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201410551038.8A CN105574926B (en) 2014-10-17 2014-10-17 The method and apparatus for generating 3-D view
CN201410551038.8 2014-10-17

Publications (1)

Publication Number Publication Date
WO2016058359A1 true WO2016058359A1 (en) 2016-04-21

Family

ID=55746062

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/077900 WO2016058359A1 (en) 2014-10-17 2015-04-30 Method and device for generating three-dimensional image

Country Status (2)

Country Link
CN (1) CN105574926B (en)
WO (1) WO2016058359A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10165257B2 (en) * 2016-09-28 2018-12-25 Intel Corporation Robust disparity estimation in the presence of significant intensity variations for camera arrays
CN107702660A (en) * 2017-04-22 2018-02-16 广州首感光电科技有限公司 Minute yardstick 3 D Industrial detecting system based on light field micro-imaging
CN107330930B (en) * 2017-06-27 2020-11-03 晋江市潮波光电科技有限公司 Three-dimensional image depth information extraction method

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101848397A (en) * 2010-05-14 2010-09-29 西安电子科技大学 Improved high-resolution reconstruction method for calculating integrated image
CN102804231A (en) * 2009-06-15 2012-11-28 微软公司 Piecewise planar reconstruction of three-dimensional scenes
US20140085433A1 (en) * 2012-09-24 2014-03-27 Samsung Electronics Co., Ltd. Multiview image generating method and multiview image display apparatus

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CA2553473A1 (en) * 2005-07-26 2007-01-26 Wa James Tam Generating a depth map from a tw0-dimensional source image for stereoscopic and multiview imaging
US9240048B2 (en) * 2012-11-30 2016-01-19 Adobe Systems Incorporated Depth estimation using three-dimensional epipolar data structures

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102804231A (en) * 2009-06-15 2012-11-28 微软公司 Piecewise planar reconstruction of three-dimensional scenes
CN101848397A (en) * 2010-05-14 2010-09-29 西安电子科技大学 Improved high-resolution reconstruction method for calculating integrated image
US20140085433A1 (en) * 2012-09-24 2014-03-27 Samsung Electronics Co., Ltd. Multiview image generating method and multiview image display apparatus

Also Published As

Publication number Publication date
CN105574926A (en) 2016-05-11
CN105574926B (en) 2018-05-11

Similar Documents

Publication Publication Date Title
US11830141B2 (en) Systems and methods for 3D facial modeling
US10679361B2 (en) Multi-view rotoscope contour propagation
CN106228507B (en) A kind of depth image processing method based on light field
TWI729995B (en) Generating a merged, fused three-dimensional point cloud based on captured images of a scene
US8447099B2 (en) Forming 3D models using two images
US8452081B2 (en) Forming 3D models using multiple images
Concha et al. Using superpixels in monocular SLAM
KR100762670B1 (en) Method and device for generating disparity map from stereo image and stereo matching method and device therefor
CN111107337B (en) Depth information complementing method and device, monitoring system and storage medium
CN106600686A (en) Three-dimensional point cloud reconstruction method based on multiple uncalibrated images
JP2018028899A (en) Image registration method and system
US9406140B2 (en) Method and apparatus for generating depth information
US10692235B2 (en) Image processing apparatus and method for determining a depth of a pixel of a reference image
EP3026631A1 (en) Method and apparatus for estimating depth of focused plenoptic data
WO2021035627A1 (en) Depth map acquisition method and device, and computer storage medium
CN114332125A (en) Point cloud reconstruction method and device, electronic equipment and storage medium
KR100943635B1 (en) Method and apparatus for generating disparity map using digital camera image
WO2016058359A1 (en) Method and device for generating three-dimensional image
CN110443228B (en) Pedestrian matching method and device, electronic equipment and storage medium
Benveniste et al. Nary coded structured light-based range scanners using color invariants
CN116051736A (en) Three-dimensional reconstruction method, device, edge equipment and storage medium
CN116704111B (en) Image processing method and apparatus
TWI393070B (en) Human face model construction method
TWI595446B (en) Method for improving occluded edge quality in augmented reality based on depth camera
Ferreira et al. Accurate and fast micro lenses depth maps from a 3D point cloud in light field cameras

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 15850298

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 15850298

Country of ref document: EP

Kind code of ref document: A1