WO2022000458A1 - 图像深度信息确定方法、装置、设备和存储介质 - Google Patents
图像深度信息确定方法、装置、设备和存储介质 Download PDFInfo
- Publication number
- WO2022000458A1 WO2022000458A1 PCT/CN2020/100108 CN2020100108W WO2022000458A1 WO 2022000458 A1 WO2022000458 A1 WO 2022000458A1 CN 2020100108 W CN2020100108 W CN 2020100108W WO 2022000458 A1 WO2022000458 A1 WO 2022000458A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- cost aggregation
- pixels
- matching
- matching cost
- value
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/50—Depth or shape recovery
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/11—Region-based segmentation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10028—Range image; Depth image; 3D point clouds
Definitions
- the present invention relates to the technical field of image processing, and in particular, to a method, apparatus, device and storage medium for determining image depth information.
- Calculating depth information of a shooting scene from images captured by multiple cameras, that is, the distance between each object included in the shooting scene and the multiple cameras, is of great significance in many application scenarios.
- a process of calculating depth information provided by the related art includes: matching cost calculation, cost aggregation, disparity calculation and optimization, and disparity refinement. Among them, for the step of cost aggregation, the intermediate result of the cost aggregation process needs to be stored in the memory, and when the intermediate result is used, the intermediate result is read from the external memory.
- Embodiments of the present invention provide a method, apparatus, device, and storage medium for determining image depth information, so as to reduce the read and write bandwidth occupied in the cost aggregation process.
- an embodiment of the present invention provides a method for determining image depth information, the method comprising:
- a third matching cost aggregation value of the pixels of the first block in at least one cost aggregation direction is determined, so as to be used for determining the first matching cost aggregation value.
- the cost aggregation directions of the first matching cost aggregation value and the second matching cost aggregation value are different.
- the method further includes:
- the method Before determining a second matching cost aggregate value between a pixel in the reference column of the first block and a corresponding pixel in a second image of the plurality of images, the method further includes:
- the second matching cost aggregate value is stored in the storage space.
- determining a third matching cost aggregation value of pixels corresponding to the first block in at least one cost aggregation direction according to the first matching cost aggregation value and the second matching cost aggregation value include:
- a third aggregated value of matching costs in at least one cost aggregation direction of pixels in other rows and columns in the first block is determined.
- determining a third matching cost of pixels in other rows and columns in the first block in at least one cost aggregation direction according to the first matching cost aggregation value and the second matching cost aggregation value Aggregate values including:
- the first aggregated value of matching costs and the second aggregated value of matching costs it is determined in parallel that pixels in other rows and columns in the first block are at least in rows and columns in a row-by-column manner.
- the third matching cost aggregation value in a cost aggregation direction.
- determining a third matching cost of pixels in other rows and columns in the first block in at least one cost aggregation direction according to the first matching cost aggregation value and the second matching cost aggregation value Aggregate values including:
- the first matching cost aggregation value and the second matching cost aggregation value it is determined in a point-by-point manner that pixels in other rows and columns in the first block are aggregated in at least one cost
- the third matching cost aggregate value in the direction it is determined in a point-by-point manner that pixels in other rows and columns in the first block are aggregated in at least one cost
- an embodiment of the present invention provides a method for determining image depth information, including:
- the matching cost aggregation values corresponding to the pixels in the other rows and columns in the first set of cost aggregation directions determine the matching cost aggregation values corresponding to the pixels in the other rows and columns in the first set of cost aggregation directions.
- the other rows are rows and columns other than the reference row and the reference column in the image matrix;
- the depth information of the image is determined according to the aggregated value of the total matching cost corresponding to each pixel.
- storing the corresponding matching cost aggregation values of the pixels in the reference row and the reference column in the first set of cost aggregation directions into the storage space including:
- the first set of cost aggregation directions includes the first target cost aggregation direction and the second target cost aggregation direction, and the first target cost aggregation direction and the second target cost aggregation direction are different.
- the determining the corresponding matching cost aggregation values of each pixel of the image matrix in the second set of cost aggregation directions includes:
- the corresponding matching cost aggregation values of the pixels in the reference row and the reference column in the second set of cost aggregation directions determine the corresponding matching costs of the pixels in the other rows and columns in the second set of cost aggregation directions. Aggregate value.
- the corresponding matching cost aggregation values of the pixels in the reference row and the reference column in the second set of cost aggregation directions determine that the pixels in the other rows and columns are in the second set of cost aggregation directions.
- the corresponding aggregated values of matching costs including:
- Corresponding matching cost aggregate values including:
- the image matrix is divided into a plurality of image blocks, and each image block contains a part of the pixels in the reference row and the reference column;
- the determining of the corresponding matching cost aggregation values of each pixel of the image matrix in the second set of cost aggregation directions includes:
- the determining the total matching cost aggregation value corresponding to each pixel according to the matching cost aggregation value corresponding to each pixel in the first group cost aggregation direction and the second group cost aggregation direction including:
- the total matching cost aggregation value corresponding to each pixel is determined according to the corresponding matching cost aggregation value of each pixel included in the each image block in the first set of cost aggregation direction and the second set of cost aggregation direction.
- the determining the corresponding matching cost aggregation values of pixels in other rows and columns in each image block in the first set of cost aggregation directions including:
- the determining of the corresponding matching cost aggregation values of the pixels in each image block in the second set of cost aggregation directions includes:
- the corresponding matching cost aggregation values of the pixels in each image block in the second set of cost aggregation directions are traversed and calculated according to the second set direction; the first set direction is opposite to the second set direction.
- the corresponding matching cost aggregation values of a part of the pixels in the reference rows and reference columns included in each image block in the first set of cost aggregation directions determine whether other rows and columns in the each image block are in other rows and columns.
- the corresponding matching cost aggregation values of the pixels in the first set of cost aggregation directions including:
- the corresponding matching cost aggregation values in the first group of cost aggregation directions are performed in parallel.
- the way of row and column determines the corresponding matching cost aggregation values of pixels in other rows and columns in each image block in the first set of cost aggregation directions.
- the corresponding matching cost aggregation values of a part of the pixels in the reference rows and reference columns included in each image block in the first set of cost aggregation directions determine whether other rows and columns in the each image block are in other rows and columns.
- the corresponding matching cost aggregation values of the pixels in the first set of cost aggregation directions including:
- any image block in each image block according to the corresponding matching cost aggregation values of some pixels in the reference row and reference column included in the any image block in the first set of cost aggregation directions, point by point
- the corresponding matching cost aggregation values of pixels in other rows and columns in each image block in the first set of cost aggregation directions are determined in the manner of .
- the method further includes:
- an embodiment of the present invention provides an apparatus for determining image depth information, including a memory and a processor; wherein the memory stores executable codes, and when the executable codes are executed by the processor, The processor implements:
- a third matching cost aggregation value of the pixels of the first block in at least one cost aggregation direction is determined, so as to be used for determining the first matching cost aggregation value.
- the cost aggregation directions of the first matching cost aggregation value and the second matching cost aggregation value are different.
- the processor is also used for:
- the second matching cost aggregate value is stored in the storage space.
- the processor is used to:
- a third aggregated value of matching costs in at least one cost aggregation direction of pixels in other rows and columns in the first block is determined.
- the processor is used to:
- the first aggregated value of matching costs and the second aggregated value of matching costs it is determined in parallel that pixels in other rows and columns in the first block are at least in rows and columns in a row-by-column manner.
- the third matching cost aggregation value in a cost aggregation direction.
- the processor is used to:
- the first matching cost aggregation value and the second matching cost aggregation value it is determined in a point-by-point manner that pixels in other rows and columns in the first block are aggregated in at least one cost
- the third matching cost aggregate value in the direction it is determined in a point-by-point manner that pixels in other rows and columns in the first block are aggregated in at least one cost
- an embodiment of the present invention provides an apparatus for determining image depth information, including a memory and a processor; wherein, executable code is stored on the memory, and when the executable code is executed by the processor, the The processor implements:
- the matching cost aggregation values corresponding to the pixels in the other rows and columns in the first set of cost aggregation directions determine the matching cost aggregation values corresponding to the pixels in the other rows and columns in the first set of cost aggregation directions.
- the other rows are rows and columns other than the reference row and the reference column in the image matrix;
- the depth information of the image is determined according to the aggregated value of the total matching cost corresponding to each pixel.
- the processor is used to:
- the first set of cost aggregation directions includes the first target cost aggregation direction and the second target cost aggregation direction, and the first target cost aggregation direction and the second target cost aggregation direction are different.
- the processor is used to:
- the corresponding matching cost aggregation values of the pixels in the reference row and the reference column in the second set of cost aggregation directions determine the corresponding matching costs of the pixels in the other rows and columns in the second set of cost aggregation directions. Aggregate value.
- the processor is used to:
- the processor is used to:
- the image matrix is divided into a plurality of image blocks, and each image block contains a part of the pixels in the reference row and the reference column;
- the total matching cost aggregation value corresponding to each pixel is determined according to the corresponding matching cost aggregation value of each pixel included in the each image block in the first set of cost aggregation direction and the second set of cost aggregation direction.
- the processor is used to:
- the corresponding matching cost aggregation values of the pixels in other rows and columns in each image block in the first set of cost aggregation directions are calculated;
- the corresponding matching cost aggregation values of the pixels in each image block in the second set of cost aggregation directions are traversed and calculated according to the second set direction; the first set direction is opposite to the second set direction.
- the processor is used to:
- the corresponding matching cost aggregation values of some pixels in the reference row and reference column included in the any image block in the first set of cost aggregation direction are determined in the manner of rows and columns.
- the processor is used to:
- any image block in each image block according to the corresponding matching cost aggregation values of some pixels in the reference row and reference column included in the any image block in the first set of cost aggregation directions, point by point
- the corresponding matching cost aggregation values of pixels in other rows and columns in each image block in the first set of cost aggregation directions are determined in the manner of .
- the processor is also used for:
- an embodiment of the present invention provides an electronic device, which includes a photographing apparatus and the apparatus for determining image depth information in the third and fourth aspects.
- an embodiment of the present invention provides a computer-readable storage medium, where the storage medium is a computer-readable storage medium, and program instructions are stored in the computer-readable storage medium, and the program instructions are used to implement the first Aspects and the image depth information determination method of the second aspect.
- the data read and write bandwidth can be reduced.
- FIG. 1 is a schematic flowchart of a method for determining image depth information according to an embodiment of the present invention
- FIG. 2 is a schematic diagram of 16 cost aggregation directions according to an embodiment of the present invention.
- FIG. 3 is a schematic diagram of 8 cost aggregation directions according to an embodiment of the present invention.
- FIG. 4 is a schematic diagram of the positions of reference rows and reference columns in an image matrix provided by an embodiment of the present invention.
- FIG. 5 is a schematic diagram of an image block segmentation result according to an embodiment of the present invention.
- FIG. 6 is a schematic diagram of an image block according to an embodiment of the present invention.
- FIG. 7 is a schematic diagram of a point-by-point restoration of a matching cost aggregate value of an image block according to an embodiment of the present invention.
- FIG. 8 is a schematic flowchart of another method for determining image depth information according to an embodiment of the present invention.
- FIG. 9 is a schematic structural diagram of an apparatus for determining image depth information according to an embodiment of the present invention.
- FIG. 10 is a schematic structural diagram of another apparatus for determining image depth information according to an embodiment of the present invention.
- FIG. 11 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
- the words “if”, “if” as used herein may be interpreted as “at” or “when” or “in response to determining” or “in response to detecting”.
- the phrases “if determined” or “if detected (the stated condition or event)” can be interpreted as “when determined” or “in response to determining” or “when detected (the stated condition or event),” depending on the context )” or “in response to detection (a stated condition or event)”.
- FIG. 1 is a flowchart of a method for determining image depth information provided by an embodiment of the present invention. As shown in FIG. 1 , the method includes the following steps:
- the matching cost is used to measure the similarity between corresponding pixels in the images captured by multiple cameras.
- the image matrix may also correspond to images captured by a movable camera at different positions, and the matching cost is used to measure the similarity between the images captured by the movable camera at different positions.
- the matching cost aggregation values corresponding to the pixels in the other rows and columns in the first set of cost aggregation directions wherein , and the other row columns are rows and columns other than the reference row and reference column in the image matrix.
- an image containing the object can be captured, the depth information of the captured image can be determined, and an image can be determined based on the depth information of the image.
- the distance between an object and the camera The embodiment of the present invention provides a method for determining image depth information.
- a plurality of images of an object may be photographed by a photographing device, and based on the plurality of images, the depth information of the target image in the plurality of images may be determined.
- the photographing device may include multiple cameras, or only one camera. When the photographing device includes multiple cameras, the multiple cameras can be set at different positions, so that the multiple cameras can respectively photograph an object from different angles to obtain images of an object from different angles. When the photographing device includes a camera, the same camera can be used to photograph an object from different positions at different times, so that images from different angles of an object can also be obtained.
- the following will take a binocular camera as an example for description. However, those skilled in the art will appreciate that multiple cameras may be employed to implement various embodiments of the present invention, as well as combinations of different embodiments.
- a binocular camera may be used to photograph an object to obtain a left-view image and a right-view image including the object. Taking the left image as the target image, the image depth information is calculated.
- the main process of calculating image depth information includes:
- the matching cost is also called the matching cost value.
- the matching cost represents the similarity between two pixels.
- Cost aggregation is used to use all pixels in the image corresponding to the entire scene to influence each single pixel to obtain a more accurate result than the matching cost.
- Parallax calculation and optimization and parallax refinement are used to verify the calculation results and perform sub-pixel processing, etc.
- the depth information of the target image can be calculated, and then the distance between an object and the photographing device can be further obtained according to the principle of triangulation.
- the embodiment of the present invention specifically provides a method for cost aggregation, and the mathematical principle of cost aggregation will be introduced below.
- C(p, D p ) is the matching cost of a certain pixel, and p is any pixel in the image.
- the disparity difference is 1, and the range of Np is the adjacent area of pixel p.
- ] is a penalty term when the disparity variation range in adjacent pixels is large (ie, the disparity difference value is greater than 1).
- the computational complexity involved in the cost aggregation process is relatively high, and it is a Non-deterministic Polynomial (NP) problem with polynomial complexity.
- NP Non-deterministic Polynomial
- cost aggregation can also be performed from 8 cost aggregation directions, or cost aggregation can also be performed from other number of cost aggregation directions, which is not limited in this embodiment of the present invention.
- the cost aggregation in a certain cost aggregation direction can be achieved by the following formula:
- the first term C(p, d) in the polynomial is the matching cost of pixel p.
- the second item is the minimum value among the 4 data including L r (pr,d), L r (pr,d-1)+P 1 , and L r (pr,d+1)+P 1 , L r (pr,d+1)+P 1 and min i L r (pr,i)+P 2 .
- L r (pr, d) represents the cost aggregation value of the previous pixel of pixel p in the r direction under the disparity d.
- L r (pr, d-1) represents the cost aggregation value of the previous pixel of pixel p in the r direction under disparity d-1.
- L r (pr, d+1) represents the cost aggregation value of the previous pixel of pixel p in the r direction under disparity d+1.
- min i L r (pr,i) represents the minimum cost aggregation value of the previous pixel of pixel p in the r direction under disparity i, where the value range of i is any value between 0 and the maximum disparity value .
- P 1 and P 2 are the penalty coefficients, and the farther the distance from the pixel p, the larger the penalty coefficient.
- the function of the third term min k L r (pr,k) is to prevent L r (p, d) from saturating, that is, to prevent L r (p, d) from growing too large with iteration.
- the cost aggregation value of a certain pixel p in a certain cost aggregation direction can be calculated, and by using this formula repeatedly, the cost aggregation value corresponding to a certain pixel p in all cost aggregations can be obtained, and then a certain cost aggregation value can be obtained.
- the total cost aggregation value of a pixel p can be obtained by adding the corresponding cost aggregation values of pixel p on all cost aggregations.
- the disparity d corresponding to the aggregated value of the minimum total matching cost is the final disparity value.
- the aggregated value of the total matching cost of a certain pixel p is described above. By repeating this method, the aggregated value of the total matching cost of all pixels in the image can be calculated. In practical applications, the aggregation value of the matching cost of all pixels in the image on the upper left part of the path can be calculated first, and the calculation result can be stored in the memory. Among them, the memory may be double rate synchronous dynamic random access memory (DDR) or other types of memory. Then compute the aggregated matching cost of all pixels in the image along the lower right part of the path.
- DDR synchronous dynamic random access memory
- the aggregated value of the matching cost After calculating the aggregated value of the matching cost of all pixels in the image on the lower right part of the path, read the aggregated value of the matching cost of all pixels in the image on the upper left part of the path from the memory, and put all the pixels in the image on the upper left part of the path.
- the aggregated value of the matching cost is added to the aggregated value of the matching cost of the corresponding pixel in the image on the lower right part of the path to obtain the aggregated value of the total matching cost corresponding to all pixels in the image.
- the calculation order of the upper left part path and the lower right part path can also be reversed.
- the upper left part of the path may be, for example, the path shown by L0_pd-L3_pd in FIG. 3
- the lower right part of the path may be, for example, the path shown by L4_pd-L7_pd in FIG. 3 .
- the matching cost aggregate value restores the matching cost aggregate value of all pixels in the image on a certain part of the path, which can greatly reduce the occupancy of data read and write bandwidth.
- the cost aggregation value includes the matching cost of the pixel and the cost aggregation value of the previous pixel in the current cost aggregation direction. Based on this, the process of cost aggregation can be expressed by the following formula:
- i is the current pixel in the image
- C i represents the matching cost of the current pixel i
- L0_pd i-1 represents the cost aggregation value of the previous pixel i-1 in the current cost aggregation direction
- L0_pd i represents the current aggregation direction
- the cost aggregation and summation result of the upper left part path can be expressed as:
- the matching cost aggregation values corresponding to all the pixels of the image matrix in the first set of cost aggregation directions can be calculated in the manner described above.
- the image matrix corresponds to the image captured by the binocular camera.
- the above-mentioned first group of cost aggregation directions may be partial aggregation directions among multiple cost aggregation directions.
- the multiple cost aggregation directions may be the 16 cost aggregation directions introduced above, or may be 8 cost aggregation directions, or may be other number of cost aggregation directions.
- the first set of cost aggregation directions may also be an upper left part path or a lower right part path among the multiple cost aggregation directions.
- the reference row and reference column may be the 1st row, the 17th row, the 1st column and the 17th column in the image.
- the 1st row, the middle row (ie, the 17th row), the 1st column, and the middle column (ie, the 17th column) of the image are selected as the reference row and reference column, to be used as the reference row and/ Or the aggregated cost of the reference column is stored in the DDR, and the aggregated cost of other rows and other columns is discarded (ie, not stored in the DDR).
- a certain row or column of the image can also be selected as the reference row and reference column, and stored in the DDR as the aggregate cost of the reference row and/or reference column, while the aggregation of non-reference rows or reference columns is discarded
- the cost is not limited in this embodiment of the present invention.
- the above-mentioned process of determining the positions of the pixels in the reference row and the reference column in the entire image matrix can be implemented as follows: according to the size of the image matrix, the computing power of the device for performing matching cost aggregation calculation processing, for storing matching One or more items in the size of the storage space of the cost aggregate value, and determine the reference row and reference column of the image matrix.
- the size of the image matrix is large, it may be considered to increase the number of reference rows and reference columns, which can improve the operation speed of cost aggregation processing. If the computing power of the device performing the matching cost aggregation calculation processing is relatively high, it may be considered to reduce the number of reference rows and reference columns. If the storage space for storing the matching cost aggregate value is small, you can consider increasing the number of reference rows and reference columns, which can save the storage space for storing the matching cost aggregate value.
- the corresponding matching cost aggregation values of the pixels in the reference row and reference column of the image matrix in the first set of cost aggregation directions can be obtained, for example, as shown in Figure 4
- the pixels at the marked positions in the first set of cost aggregation directions correspond to the corresponding matching cost aggregation values.
- the obtained matching cost aggregation value is stored in the memory, so that the corresponding matching cost aggregation values of the pixels in the reference row and the reference column in the first set of cost aggregation directions are retained.
- the first set of cost aggregation directions are cost aggregation directions corresponding to the paths shown in L0_pd-L3_pd shown in FIG. 3 .
- the process of storing the corresponding matching cost aggregation values of the pixels in the reference row and the reference column in the first set of cost aggregation directions into the storage space can be implemented as follows:
- the corresponding matching cost aggregation values of the pixels in the first set of cost aggregation directions are stored in the storage space, wherein the first pixel is located in the reference row and the reference column at the same time; only the second pixel in the reference row is stored in the first target cost.
- the corresponding matching cost aggregation values in the aggregation direction are stored in the storage space; wherein, the second pixel is in the reference row and not in the reference column; only the third pixel in the reference column is corresponding to each other in the second target cost aggregation direction
- the matching cost aggregated value of is stored in the memory space, where the third pixel is in the reference column and not in the reference row.
- the first group of cost aggregation directions includes a first target cost aggregation direction and a second target cost aggregation direction, and the first target cost aggregation direction and the second target cost aggregation direction are different.
- the cost aggregation values of L0_pd-L3_pd on the upper left part path of the pixels at the 1st row, 17th row, 1st column and 17th column position of the image matrix have been calculated.
- the corresponding aggregated value of the matching cost of the first pixel in the L0_pd-L3_pd direction is stored in the storage in space.
- the first pixel is, for example, the pixel located in the first column on the first row.
- the aggregated values of matching costs corresponding to the second pixels in the L0_pd, L1_pd and L2_pd directions may be stored in the storage space. It should be noted that, the aggregation value of the matching cost of the second pixel in the L3_pd direction may not be stored.
- the aggregated value of the matching cost of the third pixel in the L3_pd direction may be stored in the storage space. It should be noted that the aggregation value of the matching cost corresponding to the third pixel in the directions of L0_pd, L1_pd, and L2_pd may not be stored.
- the matching cost aggregation value corresponding to the previous pixel in a certain cost aggregation direction can be recorded as a certain cost aggregation value.
- the second set of cost aggregation directions is composed of aggregation directions that are not included in the first set of cost aggregation directions among the multiple cost aggregation directions.
- the process can be implemented as follows: according to the reference row and reference column, the image matrix is divided into multiple image blocks, each image block contains a part of the pixels in the reference row and the reference column; according to the reference row and the reference column contained in each image block.
- the corresponding matching cost aggregation values of some pixels in the column in the first set of cost aggregation directions are used to determine the corresponding matching cost aggregation values of pixels in other rows and columns in each image block in the first set of cost aggregation directions.
- the process of determining the corresponding matching cost aggregation values of each pixel of the image matrix in the second set of cost aggregation directions can be implemented as follows: determining the corresponding matching cost aggregation values of each pixel in each image block in the second set of cost aggregation directions Cost aggregate value.
- the process of determining the total matching cost aggregation value corresponding to each pixel according to the corresponding matching cost aggregation value of each pixel in the first set of cost aggregation direction and the second set of cost aggregation direction can be implemented as follows: The corresponding aggregated values of matching costs of each pixel in the first set of cost aggregation directions and the second set of cost aggregation directions are determined, and the total matching cost aggregation value corresponding to each pixel is determined.
- the entire image can be divided into two parts according to the positions of the reference row and reference column.
- 4 image blocks including image block block1-image block block4.
- Each image block block may be processed in sequence according to the sequence of image block block1-image block block2-image block block3-image block block4. That is, the processing order is a "zigzag" (ie, zigzag) processing order.
- the image block in the lower right corner of the image is used as the image block to be processed first.
- the processing process for each image block block is similar.
- the following takes the image block block1 as an example to describe the processing process for the image block block. For the processing process of other image blocks, refer to the processing process of the image block block1. Repeat.
- the image block block1 obtained after segmentation can be seen in FIG. 6 .
- the pixels in other rows and columns in the image block block1 can be determined according to the corresponding matching cost aggregation values of a part of the pixels in the reference row and the reference column included in the image block block1 in the first set of cost aggregation directions.
- a part of the pixels in the reference row and the reference column may be the pixels at the marked positions shown in FIG. 6 except the white frame, and the pixels in other rows and columns in the image block block1 may be the position of the white frame in FIG. 6 on the pixel.
- two methods are provided to determine the pixels in other rows and columns in the image block according to the corresponding matching cost aggregation values of a part of the pixels in the reference row and the reference column included in the image block in the first set of cost aggregation directions.
- the corresponding matching cost aggregation values of pixels in other rows and columns in the image block in the first set of cost aggregation directions may be determined in a row-by-row or point-by-point manner.
- each row and column can be determined in parallel in a row-by-row and column-wise manner.
- the corresponding matching cost aggregation values of pixels in other rows and columns in each image block in the first set of cost aggregation directions are not limited to the row-by-row method.
- the aggregated value of the matching cost in the directions of L0_pd, L1_pd, and L2_pd in the first row and the matching cost in the second row can be calculated separately.
- the calculation processes of the matching cost aggregate values in different directions of L0_pd-L3_pd are independent of each other, so the matching cost aggregate values in different directions can be calculated in parallel.
- the recovery of the matching cost aggregated value in the L0_pd, L1_pd, and L2_pd directions in the second row and the matching cost aggregated value in the L3_pd direction in the second column can be completed in one cycle.
- the image block shown in Figure 6 only 16 cycles can complete the calculation of the matching cost aggregation value of the pixels in other rows and columns in the image block block in the first set of cost aggregation direction.
- the calculation speed is faster.
- 4 storage spaces of the same size can be opened up in memory to store the aggregated value of the matching cost of each pixel in the L0_pd-L3_pd direction in the image block block.
- the data amount of each matching cost aggregate value is 16 bits
- 4 blocks of 16 ⁇ 16 ⁇ 16 bits of storage space can be opened to store each pixel in the image block block in L0_pd - Aggregate value of matching cost in L3_pd direction.
- each image block can be determined in a point-by-point manner according to the corresponding matching cost aggregation values of some pixels in the reference row and reference column included in any image block in the first set of cost aggregation directions.
- each image block does not contain a complete reference row or column, but can be A part of the reference row or a part of the reference column, that is, each image block includes a part of the pixels in the reference row and the reference column.
- a part of the pixels in the reference row and the reference column included in the image block may be a part of the pixels in the reference row and the reference column marked in FIG. 6 .
- the corresponding matching cost aggregation values of pixels in other rows and columns in each image block in the first set of cost aggregation directions can be calculated according to the first set direction;
- the second set direction traversal calculates the corresponding matching cost aggregation values of each pixel in each image block in the second set of cost aggregation directions; the first set direction is opposite to the second set direction.
- the first set direction may be from top to bottom and from left to right, and the second set direction may be from bottom to top and from right to left direction.
- the matching cost aggregation value in the direction of the (1,1) position can be calculated from the matching cost aggregation value in the L3_pd direction at the (1,0) position.
- the matching cost aggregation value in the L0_pd, L1_pd, and L2_pd directions of the position calculates the matching cost aggregation value in the L0_pd, L1_pd, and L2_pd directions of the (1,1) position. After computing the aggregated values of matching costs for the (1,1) position in the 4 directions, they can be added together.
- the result after calculating the addition result of the aggregated values of the matching costs in the four directions at the (1,1) position, the result can be stored in the storage space in the memory.
- the addition result of the aggregated matching cost values of all pixels in the image block block in four directions can be finally calculated, and these results are stored in the storage space in the memory.
- the image block shown in Figure 6 assuming that the data amount of the addition result of the matching cost aggregated value of each pixel in 4 directions is 16 bits, then a block of 16 ⁇ 16 ⁇ 16 bits can be opened.
- the storage space stores the summation result of the aggregated values of matching costs for each pixel in the image block block in four directions.
- the method of restoring the matching cost aggregation value of image block point by point can directly restore the matching cost aggregation value of a pixel in four directions, so it can be The aggregated values of the matching costs in these four directions are directly added, and the addition result is stored in the storage location corresponding to the storage space.
- the method of restoring the matching cost aggregated value of the image block line by line it is impossible to recover the matching cost aggregated value of a pixel in four directions at the same time, so it is necessary to restore the matching cost aggregated value of a pixel in four directions. They are respectively stored in the storage space.
- the m cost aggregation directions are divided into two groups. That is, a first set of cost aggregation directions and a second set of cost aggregation directions.
- the first group of cost aggregation directions includes m1 cost aggregation directions
- the second group of cost aggregation directions includes m2 cost aggregation directions.
- m1+m2 m
- m1, m2, and m are integers.
- the cost aggregation calculation of all the rows and columns in the image block block1 in the direction of the second set of cost aggregation can be performed, so that we can finally get The matching cost aggregation values of all rows and columns in image block block1 in multiple cost aggregation directions.
- each pixel included in the image block block1 can be divided into the first set of cost aggregation directions and the second set of cost aggregation directions.
- the corresponding aggregated values of matching costs are added together to determine the total aggregated value of matching costs corresponding to each pixel included in the image block block1.
- the disparity with the smallest aggregated value of total matching cost among all disparities can be directly selected as the final result.
- the method may be performed with reference to the manner in which any pixel performs cost aggregation in the first set of cost aggregation directions.
- the process of performing cost aggregation on any pixel in the image matrix in the second set of cost aggregation directions can be implemented as follows: acquiring pixels in the reference row and reference column of the image matrix corresponding to the second set of cost aggregation directions respectively According to the matching cost aggregation value corresponding to the pixels in the reference row and the reference column in the second set of cost aggregation direction, determine the corresponding matching costs of the pixels in other rows and columns in the second set of cost aggregation direction. Aggregate value.
- the matching cost aggregation values corresponding to the pixels in all rows and columns of the image matrix in the second set of cost aggregation directions can be calculated, the positions of the pixels in the reference rows and columns of the image matrix can be determined, and the reference of the image matrix can be retained.
- the pixels in the row and the reference column have their respective matching cost aggregation values in the second set of cost aggregation directions.
- the pixels in the reference rows and reference columns of the image matrix may correspond to each other in the second set of cost aggregation directions.
- the matching cost aggregation value of recovers the corresponding matching cost aggregation values of the pixels in the image matrix except for the reference row and the reference column in the second set of cost aggregation directions.
- the pixels in other rows and columns in the image matrix except the reference row and reference column are recovered.
- the steps of the corresponding matching cost aggregation values in the second set of cost aggregation directions include: the middle row, the last row, the middle column and the last column can be selected as the reference row and the reference column, or the first row, the middle row, the Column 1 and the middle column are selected as reference row and reference column.
- each divided image block has the corresponding matching of some pixels in the reference row and reference column in the second set of cost aggregation directions.
- Cost aggregate value In one embodiment, the corresponding pixels in the reference row are divided into image blocks adjacent to the reference row and located to the right of the reference row, and the corresponding pixels in the reference column are divided into adjacent and located in the reference column. in the image block below the reference column.
- the 1st row, 17th row, 1st column and 17th column are used as reference rows and reference columns, and an image is divided into 4 image blocks, then the 1st row and 1st column can be divided into 4 image blocks.
- the image block division method used for cost aggregation in the L0_pd-L3_pd direction may be the same as the image block division method used for cost aggregation in the L4_pd-L7_pd direction.
- the image block division method used in cost aggregation in the L0_pd-L3_pd direction may be different from the image block division method used in cost aggregation in the L4_pd-L7_pd direction.
- the first row and first column can be used as reference rows and reference columns to divide the image
- the image may be divided into reference rows and reference columns at row 17, column 17, row 32, and column 32. In this way, one image block in the upper left corner obtained contains some pixels in the 17th row and the 17th column. And so on for other image blocks.
- the image when cost aggregation is performed in the direction of L0_pd-L3_pd, the image can be divided by the first row and the first column as reference rows and columns, and when cost aggregation is performed in the direction of L4_pd-L7_pd , the image matrix can be rotated by 180°, and the image matrix can be divided by the first row, the first column, the 17th row and the 17th column as the reference row and reference column in the obtained rotated image.
- the first row, first column, 17th row and 17th column can be used to divide the image as reference row and reference column, and the image can be divided from L4_pd -
- the image matrix can be divided into reference rows and columns with the first row, the first column, the 17th row and the 17th column, and each image block does not include the reference row and reference
- the pixels in the column only contain the pixels in the white box positions as shown in Figure 4.
- the image block is rotated by 180° and then calculated.
- the process can be implemented as: rotating the image matrix by a preset angle; according to the corresponding matching cost aggregation values of the pixels in the reference row and the reference column in the rotated image matrix in the second set of cost aggregation directions, determine the corresponding matching cost aggregation values in other rows and columns.
- the corresponding matching cost aggregation values of the pixels in the second set of cost aggregation directions are implemented as: rotating the image matrix by a preset angle; according to the corresponding matching cost aggregation values of the pixels in the reference row and the reference column in the rotated image matrix in the second set of cost aggregation directions.
- the above preset angle can be 180°. After the image matrix is rotated by 180°, the lower right part of the image matrix before rotation becomes the upper left part of the image matrix after rotation, so it can refer to any pixel in the first set of cost aggregation directions.
- the cost aggregation method is similar to calculate the matching cost aggregation value corresponding to any pixel in the image matrix in the second set of cost aggregation direction.
- the first set of cost aggregation directions mentioned above may be the upper left part of the path of the image matrix, and the second set of cost aggregation directions in this case is the lower right part of the path of the image matrix.
- the first set of cost aggregation directions is the lower right part of the path of the image matrix
- the second set of cost aggregation directions is the upper left part of the path of the image matrix.
- only the matching cost aggregation values corresponding to the pixels in the reference row and the reference column in the image matrix in the first set of cost aggregation directions can be temporarily stored in the memory, without storing non-reference rows. and the matching aggregation cost values of other rows or columns of non-reference columns, so that only the matching cost aggregation values corresponding to some pixels in the image matrix in the first set of cost aggregation directions are stored.
- it can be based on the stored image matrix.
- the corresponding matching cost aggregation values in the group cost aggregation direction are recovered, and the matching cost aggregation values corresponding to the pixels in other rows and columns in the image matrix in the first group cost aggregation direction are recovered.
- the data read and write bandwidth can be greatly reduced.
- FIG. 8 is a schematic flowchart of another method for determining image depth information provided by an embodiment of the present invention. As shown in FIG. 8 , the method includes the following steps:
- the cost aggregation directions of the first matching cost aggregation value and the second matching cost aggregation value are different.
- a plurality of images of an object may be captured by a photographing device, and based on the plurality of images, the depth information of the target image in the plurality of images may be determined.
- the photographing device may include multiple cameras, or only one camera. When the photographing device includes multiple cameras, the multiple cameras can be set at different positions, so that the multiple cameras can respectively photograph an object from different angles to obtain images of an object from different angles. When the photographing device includes a camera, the same camera can be used to photograph an object from different positions at different times, so that images from different angles of an object can also be obtained.
- one of the images may be selected as the first image, and then the first image among the multiple images may be divided into multiple blocks.
- the multiple blocks may be multiple image blocks in the above-mentioned embodiment.
- a first matching cost aggregation between pixels in a corresponding reference row of the first block and corresponding pixels in a second image of the plurality of images may be calculated value.
- the cost aggregation direction corresponding to the first matching cost aggregation value may be the first group of cost aggregation directions among the multiple cost aggregation directions.
- a second aggregated match cost value between the pixel in the corresponding reference column of the first block and the corresponding pixel in the second image of the plurality of images can also be subsequently determined.
- the cost aggregation direction corresponding to the second matching cost aggregation value may be a second group of cost aggregation directions other than the first group of cost aggregation directions among the multiple cost aggregation directions.
- the third matching cost aggregation value of the pixels of the first block in at least one cost aggregation direction may be determined according to the first matching cost aggregation value and the second matching cost aggregation value, so as to be used to determine the depth information of the first block .
- the third matching cost aggregation value may be a matching cost aggregation value of pixels of other rows and columns in the first block except the reference row and the reference column in at least one cost aggregation direction.
- the matching cost aggregation values of pixels in other rows and columns in the first block in at least one cost aggregation direction can be recovered by using the first matching cost aggregation value and the second matching cost aggregation value.
- the step of determining the aggregated value of the first matching cost between the pixel in the corresponding reference row of the at least one first block in the plurality of blocks and the corresponding pixel in the second image in the plurality of images includes: Obtain the first matching cost aggregate value between the pixel in the reference row of at least one first block in the plurality of blocks and the corresponding pixel in the second image in the plurality of images; store the first matching cost aggregate value in the in the storage space.
- the step of determining the second matching cost aggregate value between the pixels in the reference column of the first block and the corresponding pixels in the second image of the plurality of images includes: obtaining the pixel in the reference column of the first block and the first block. the second matching cost aggregation value between the corresponding pixels in the two images; storing the second matching cost aggregation value in the storage space.
- the process of determining the third matching cost aggregation value of the corresponding pixel of the first block in at least one cost aggregation direction may be implemented as follows: A matching cost aggregation value and a second matching cost aggregation value determine a third matching cost aggregation value of pixels in other rows and columns in the first block in at least one cost aggregation direction.
- the cost aggregation direction corresponding to the first matching cost aggregation value may be the first group of cost aggregation directions
- the cost aggregation direction corresponding to the second matching cost aggregation value may be the second group of cost aggregation directions.
- the first set of cost aggregation directions may be a partial aggregation direction of multiple cost aggregation directions.
- the multiple cost aggregation directions may be the 16 cost aggregation directions introduced above, or may be 8 cost aggregation directions, or may be other number of cost aggregation directions.
- the first set of cost aggregation directions may also be an upper left part path or a lower right part path among the multiple cost aggregation directions.
- the second set of cost aggregation directions may be aggregation directions other than the first set of cost aggregation directions among the multiple cost aggregation directions.
- the third matching cost aggregation value may be the cost aggregation value of the pixels in other rows and columns in the first block in at least one cost aggregation direction, for example, the pixel at the position marked by the white box in FIG. 4 is in at least one cost aggregation direction
- the process of determining the third aggregated value of matching costs in at least one cost aggregation direction of pixels in other rows and columns in the first block can be implemented as follows: For the first block, according to the first aggregated value of matching costs and the second aggregated value of matching costs, the third row and column of pixels in other rows and columns in the first block in at least one cost aggregation direction are determined in parallel in a row-by-column manner. Matches the cost aggregate value.
- the process of determining the third aggregated value of matching costs in at least one cost aggregation direction of pixels in other rows and columns in the first block can be implemented as follows: For the first block, the third matching cost aggregation in at least one cost aggregation direction of pixels in other rows and columns in the first block is determined in a point-by-point manner according to the first matching cost aggregation value and the second matching cost aggregation value value.
- the at least one cost aggregation direction may be, for example, any one or more directions of L0_pd-L7_pd. Assuming that at least one cost aggregation direction is the L0_pd direction, and assuming that the matching cost aggregation value of the pixel at the (1,1) position in Figure 7 in the L0_pd direction needs to be calculated, then the matching cost in the L0_pd direction at the (0,1) position can be passed. The aggregated value calculates the aggregated value of the matching cost in the L0_pd direction at the (1,1) position. The aggregated value of the matching cost in the L0_pd direction at the position (1,1) can be used as the third aggregated value of the matching cost in at least one cost aggregation direction of the pixels in other rows and columns in the first block.
- Yet another exemplary embodiment of the present invention provides an apparatus for determining image depth information. As shown in FIG. 9 , the apparatus includes:
- the first processor 1920 is used for running the computer program stored in the memory to realize:
- a third matching cost aggregation value of the pixels of the first block in at least one cost aggregation direction is determined, so as to be used for determining the first matching cost aggregation value.
- the cost aggregation directions of the first matching cost aggregation value and the second matching cost aggregation value are different.
- the first processor 1920 is further configured to:
- the second matching cost aggregate value is stored in the storage space.
- the first processor 1920 is used for:
- a third aggregated value of matching costs in at least one cost aggregation direction of pixels in other rows and columns in the first block is determined.
- the first processor 1920 is used for:
- the first aggregated value of matching costs and the second aggregated value of matching costs it is determined in parallel that pixels in other rows and columns in the first block are at least in rows and columns in a row-by-column manner.
- the third matching cost aggregation value in a cost aggregation direction.
- the first processor 1920 is used for:
- the first matching cost aggregation value and the second matching cost aggregation value it is determined in a point-by-point manner that pixels in other rows and columns in the first block are aggregated in at least one cost
- the third matching cost aggregate value in the direction it is determined in a point-by-point manner that pixels in other rows and columns in the first block are aggregated in at least one cost
- Yet another exemplary embodiment of the present invention provides another apparatus for determining image depth information. As shown in FIG. 10 , the apparatus includes:
- the second processor 2020 is used for running the computer program stored in the memory to realize:
- the matching cost aggregation values corresponding to the pixels in the other rows and columns in the first set of cost aggregation directions determine the matching cost aggregation values corresponding to the pixels in the other rows and columns in the first set of cost aggregation directions.
- the other rows are rows and columns other than the reference row and the reference column in the image matrix;
- the second set of cost aggregation directions is not included in the first set of costs by the plurality of cost aggregation directions
- the depth information of the image is determined according to the aggregated value of the total matching cost corresponding to each pixel.
- the second processor 2020 is used for:
- the first set of cost aggregation directions includes the first target cost aggregation direction and the second target cost aggregation direction, and the first target cost aggregation direction and the second target cost aggregation direction are different.
- the second processor 2020 is used for:
- the corresponding matching cost aggregation values of the pixels in the reference row and the reference column in the second set of cost aggregation directions determine the corresponding matching costs of the pixels in the other rows and columns in the second set of cost aggregation directions. Aggregate value.
- the second processor 2020 is used for:
- the second processor 2020 is used for:
- the image matrix is divided into a plurality of image blocks, and each image block contains a part of the pixels in the reference row and the reference column;
- the total matching cost aggregation value corresponding to each pixel is determined according to the corresponding matching cost aggregation value of each pixel included in the each image block in the first set of cost aggregation direction and the second set of cost aggregation direction.
- the second processor 2020 is used for:
- the corresponding matching cost aggregation values of the pixels in each image block in the second set of cost aggregation directions are traversed and calculated according to the second set direction; the first set direction is opposite to the second set direction.
- the second processor 2020 is used for:
- the second processor 2020 is used for:
- any image block in each image block according to the corresponding matching cost aggregation values of some pixels in the reference row and reference column included in the any image block in the first set of cost aggregation directions, point by point
- the corresponding matching cost aggregation values of pixels in other rows and columns in each image block in the first set of cost aggregation directions are determined in the manner of .
- the second processor 2020 is further configured to:
- the apparatus for determining image depth information shown in FIG. 10 may execute the method of the embodiment shown in FIGS. 1-7
- the apparatus for determining image depth information shown in FIG. 9 may execute the method of the embodiment shown in FIG. 8 , which is not detailed in this embodiment.
- FIG. 11 is a schematic structural diagram of an electronic device according to an embodiment of the present invention. As shown in FIG. 11 , the electronic device includes: a photographing device 2110 and an image depth information determining device 2120 .
- the apparatus 2120 for determining image depth information may be the apparatus in the embodiments shown in FIGS. 9 and 10 .
- the apparatus 2120 for determining image depth information may be the apparatus in the embodiments shown in FIGS. 9 and 10 .
- FIGS. 9 and 10 For parts that are not described in detail in this embodiment, reference may be made to related descriptions of the embodiments shown in FIG. 1 to FIG. 8 .
- an embodiment of the present invention further provides a computer-readable storage medium, where executable codes are stored in the computer-readable storage medium, and the executable codes are used to implement the image depth information determination methods provided by the foregoing embodiments. .
- only the matching cost aggregation values corresponding to the pixels in the reference row and the reference column in the image matrix in the first set of cost aggregation directions can be temporarily stored in the memory, so that only the image matrix is stored
- the corresponding matching cost aggregation values in the group cost aggregation direction are recovered, and the matching cost aggregation values corresponding to the pixels in other rows and columns in the image matrix in the first group cost aggregation direction are recovered.
- the data read and write bandwidth can be greatly reduced.
Landscapes
- Engineering & Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Image Processing (AREA)
- Image Analysis (AREA)
Abstract
一种图像深度信息确定方法、装置、设备和存储介质,该方法包括:通过拍摄装置分别获得关于一物体的多个图像;将多个图像中的第一图像分割为多个区块;确定多个区块中至少一第一区块的对应的参考行中的像素与多个图像中的第二图像中的对应像素之间的第一匹配代价聚合值;确定第一区块的对应的参考列中的像素与多个图像中的第二图像中的对应像素之间的第二匹配代价聚合值;根据第一匹配代价聚合值和第二匹配代价聚合值,确定第一区块的像素在至少一代价聚合方向上的第三匹配代价聚合值,以用于确定第一区块的深度信息。通过该方法,可以避免存储图像矩阵中所有像素的匹配代价聚合值,能够极大降低数据读写带宽的占用。
Description
本发明涉及图像处理技术领域,尤其涉及一种图像深度信息确定方法、装置、设备和存储介质。
通过多个摄像头拍摄的图像计算拍摄场景的深度信息亦即拍摄场景中包含的各物体与多个摄像头之间的距离,在很多应用场景中具有重要意义。
相关技术提供的一种计算深度信息的过程包括:匹配代价计算、代价聚合、视差计算和优化、视差精细化。其中,对于代价聚合的步骤来说,需要将代价聚合过程的中间结果存储到存储器,在使用到中间结果时,再从外部存储器读取中间结果。
由于中间结果的数据量较大,需要读取和存储的数据量较大,通过占用较多的读写带宽才能完成代价聚合的过程。
发明内容
本发明实施例提供一种图像深度信息确定方法、装置、设备和存储介质,用以降低代价聚合过程中占用的读写带宽。
第一方面,本发明实施例提供一种图像深度信息确定方法,该方法包括:
通过拍摄装置分别获得关于一物体的多个图像;
将所述多个图像中的第一图像分割为多个区块;
确定所述多个区块中至少一第一区块的对应的参考行中的像素与所述多个图像中的第二图像中的对应像素之间的第一匹配代价聚合值;
确定所述第一区块的对应的参考列中的像素与所述多个图像中的第二图像中的对应像素之间的第二匹配代价聚合值;
根据所述第一匹配代价聚合值和所述第二匹配代价聚合值,确定所述第一区块的像素在至少一代价聚合方向上的第三匹配代价聚合值,以用于确定所述第一区块的深度信息;
其中,所述第一匹配代价聚合值和所述第二匹配代价聚合值的代价聚合方向不同。
可选地,在确定所述多个区块中至少一第一区块的对应的参考行中的像素与所述多个图像中的第二图像中的对应像素之间的第一匹配代价聚合值之前,所述方法还包括:
获取所述多个区块中至少一第一区块的参考行中的像素与所述多个图像中的第二图像中的对应像素之间的第一匹配代价聚合值;
将所述第一匹配代价聚合值存储到存储空间中;
在确定所述第一区块的参考列中的像素与所述多个图像中的第二图像中的对应像素之间的第二匹配代价聚合值之前,所述方法还包括:
获取所述第一区块的参考列中的像素与所述第二图像中的对应像素之间的第二匹配代价聚合值;
将所述第二匹配代价聚合值存储到所述存储空间中。
可选地,所述根据所述第一匹配代价聚合值和所述第二匹配代价聚合值,确定所述第一区块的对应的像素在至少一代价聚合方向上的第三匹配代价聚合值,包括:
根据所述第一匹配代价聚合值和所述第二匹配代价聚合值,确定所述第一区块中其他行列中的像素在至少一代价聚合方向上的第三匹配代价聚合值。
可选地,所述根据所述第一匹配代价聚合值和所述第二匹配代价聚合值,确定所述第一区块中其他行列中的像素在至少一代价聚合方向上的第三匹配代价聚合值,包括:
对于所述第一区块,根据所述第一匹配代价聚合值和所述第二匹配代价聚合值,并行按照逐行和列的方式确定所述第一区块中其他行列中的像素在至少一代价聚合方向上的第三匹配代价聚合值。
可选地,所述根据所述第一匹配代价聚合值和所述第二匹配代价聚合值,确定所述第一区块中其他行列中的像素在至少一代价聚合方向上的第三匹配代价聚合值,包括:
对于所述第一区块,根据所述第一匹配代价聚合值和所述第二匹配代价聚合值,按照逐点的方式确定所述第一区块中其他行列中的像素在至少一代价聚合方向上的第三匹配代价聚合值。
第二方面,本发明实施例提供一种图像深度信息确定方法,包括:
获取图像矩阵的参考行和参考列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值,所述第一组代价聚合方向是多个代价聚合方向中的部分聚合方向,所述图像矩阵与多个摄像头拍得的图像对应,匹配代价用于度量所述多个摄像头拍得的图像中相对应像素间的相似度;
将所述参考行和所述参考列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值存入到存储空间中;
根据所述参考行和所述参考列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值,确定其他行列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值,其中,所述其他行列为所述图像矩阵中除所述参考行和所述参考列之外的行列;
确定所述图像矩阵的各像素在第二组代价聚合方向上各自对应的匹配代价聚合值,所述第二组代价聚合方向由所述多个代价聚合方向中不包含在所述第一组代价聚合方向中的聚合方向组成;
根据所述各像素在第一组代价聚合方向和第二组代价聚合方向上各自对应的匹配代价聚合值,确定所述各像素各自对应的总匹配代价聚合值;
根据所述各像素各自对应的总匹配代价聚合值,确定所述图像的深度信息。
可选地,所述将所述参考行和所述参考列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值存入到存储空间中,包括:
将所述参考行和所述参考列中的第一像素在所述第一组代价聚合方向上各自对应的匹配代价聚合值存入存储空间中,其中,所述第一像素同时位于所述 参考行和所述参考列中;
仅将所述参考行中的第二像素在第一目标代价聚合方向上各自对应的匹配代价聚合值存入所述存储空间中;其中,所述第二像素在所述参考行中并且不在所述参考列中;
仅将所述参考列中的第三像素在第二目标代价聚合方向上各自对应的匹配代价聚合值存入所述存储空间中,其中,所述第三像素在所述参考列中并且不在所述参考行中;
其中,所述第一组代价聚合方向包含所述第一目标代价聚合方向和所述第二目标代价聚合方向,所述第一目标代价聚合方向和所述第二目标代价聚合方向不同。
可选地,所述确定所述图像矩阵的各像素在第二组代价聚合方向上各自对应的匹配代价聚合值,包括:
获取所述图像矩阵的参考行和参考列中的像素在第二组代价聚合方向上各自对应的匹配代价聚合值;
根据所述参考行和所述参考列中的像素在第二组代价聚合方向上各自对应的匹配代价聚合值,确定所述其他行列中的像素在第二组代价聚合方向上各自对应的匹配代价聚合值。
可选地,所述根据所述参考行和所述参考列中的像素在第二组代价聚合方向上各自对应的匹配代价聚合值,确定所述其他行列中的像素在第二组代价聚合方向上各自对应的匹配代价聚合值,包括:
将所述图像矩阵旋转预设角度;
根据旋转后的图像矩阵中所述参考行和所述参考列中的像素在第二组代价聚合方向上各自对应的匹配代价聚合值,确定所述其他行列中的像素在第二组代价聚合方向上各自对应的匹配代价聚合值。
可选地,所述根据所述参考行和所述参考列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值,确定其他行列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值,包括:
根据参考行、参考列,将图像矩阵划分为多个图像块,每个图像块中包含参考行和参考列中的一部分像素;
根据每个图像块中包含的参考行和参考列中的一部分像素在第一组代价聚合方向上各自对应的匹配代价聚合值,确定所述每个图像块中其他行列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值;
所述确定所述图像矩阵的各像素在第二组代价聚合方向上各自对应的匹配代价聚合值,包括:
确定所述每个图像块中各像素在第二组代价聚合方向上各自对应的匹配代价聚合值;
所述根据所述各像素在第一组代价聚合方向和第二组代价聚合方向上各自对应的匹配代价聚合值,确定所述各像素各自对应的总匹配代价聚合值,包括:
根据所述每个图像块中包含的各像素在第一组代价聚合方向和第二组代价聚合方向上各自对应的匹配代价聚合值,确定所述各像素各自对应的总匹配代价聚合值。
可选地,所述确定所述每个图像块中其他行列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值,包括:
按照第一设定方向遍历计算所述每个图像块中其他行列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值;
所述确定所述每个图像块中各像素在第二组代价聚合方向上各自对应的匹配代价聚合值,包括:
按照第二设定方向遍历计算所述每个图像块中各像素在第二组代价聚合方向上各自对应的匹配代价聚合值;第一设定方向与第二设定方向反向。
可选地,所述根据每个图像块中包含的参考行和参考列中的一部分像素在第一组代价聚合方向上各自对应的匹配代价聚合值,确定所述每个图像块中其他行列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值,包括:
对于每个图像块中的任一图像块,根据所述任一图像块中包含的参考行和参考列中的一部分像素在第一组代价聚合方向上各自对应的匹配代价聚合值, 并行按照逐行和列的方式确定所述每个图像块中其他行列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值。
可选地,所述根据每个图像块中包含的参考行和参考列中的一部分像素在第一组代价聚合方向上各自对应的匹配代价聚合值,确定所述每个图像块中其他行列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值,包括:
对于每个图像块中的任一图像块,根据所述任一图像块中包含的参考行和参考列中的一部分像素在第一组代价聚合方向上各自对应的匹配代价聚合值,按照逐点的方式确定所述每个图像块中其他行列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值。
可选地,所述方法还包括:
根据所述图像矩阵的大小、进行匹配代价聚合计算处理的设备的计算能力、用于存储匹配代价聚合值的存储空间的大小中的一项或者多项,确定所述图像矩阵的参考行和参考列。
第三方面,本发明实施例提供一种图像深度信息确定装置,包括存储器、处理器;其中,所述存储器上存储有可执行代码,当所述可执行代码被所述处理器执行时,使所述处理器实现:
通过拍摄装置分别获得关于一物体的多个图像;
将所述多个图像中的第一图像分割为多个区块;
确定所述多个区块中至少一第一区块的对应的参考行中的像素与所述多个图像中的第二图像中的对应像素之间的第一匹配代价聚合值;
确定所述第一区块的对应的参考列中的像素与所述多个图像中的第二图像中的对应像素之间的第二匹配代价聚合值;
根据所述第一匹配代价聚合值和所述第二匹配代价聚合值,确定所述第一区块的像素在至少一代价聚合方向上的第三匹配代价聚合值,以用于确定所述第一区块的深度信息;
其中,所述第一匹配代价聚合值和所述第二匹配代价聚合值的代价聚合方向不同。
可选地,所述处理器还用于:
获取所述多个区块中至少一第一区块的参考行中的像素与所述多个图像中的第二图像中的对应像素之间的第一匹配代价聚合值;
将所述第一匹配代价聚合值存储到存储空间中;
获取所述第一区块的参考列中的像素与所述第二图像中的对应像素之间的第二匹配代价聚合值;
将所述第二匹配代价聚合值存储到所述存储空间中。
可选地,所述处理器用于:
根据所述第一匹配代价聚合值和所述第二匹配代价聚合值,确定所述第一区块中其他行列中的像素在至少一代价聚合方向上的第三匹配代价聚合值。
可选地,所述处理器用于:
对于所述第一区块,根据所述第一匹配代价聚合值和所述第二匹配代价聚合值,并行按照逐行和列的方式确定所述第一区块中其他行列中的像素在至少一代价聚合方向上的第三匹配代价聚合值。
可选地,所述处理器用于:
对于所述第一区块,根据所述第一匹配代价聚合值和所述第二匹配代价聚合值,按照逐点的方式确定所述第一区块中其他行列中的像素在至少一代价聚合方向上的第三匹配代价聚合值。
第四方面,本发明实施例提供一种图像深度信息确定装置,包括存储器、处理器;其中,所述存储器上存储有可执行代码,当所述可执行代码被所述处理器执行时,使所述处理器实现:
获取图像矩阵的参考行和参考列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值,所述第一组代价聚合方向是多个代价聚合方向中的部分聚合方向,所述图像矩阵与多个摄像头拍得的图像对应,匹配代价用于度量所述多个摄像头拍得的图像中相对应像素间的相似度;
将所述参考行和所述参考列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值存入到存储空间中;
根据所述参考行和所述参考列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值,确定其他行列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值,其中,所述其他行列为所述图像矩阵中除所述参考行和所述参考列之外的行列;
确定所述图像矩阵的各像素在第二组代价聚合方向上各自对应的匹配代价聚合值,所述第二组代价聚合方向由所述多个代价聚合方向中不包含在所述第一组代价聚合方向中的聚合方向组成;
根据所述各像素在第一组代价聚合方向和第二组代价聚合方向上各自对应的匹配代价聚合值,确定所述各像素各自对应的总匹配代价聚合值;
根据所述各像素各自对应的总匹配代价聚合值,确定所述图像的深度信息。
可选地,所述处理器用于:
将所述参考行和所述参考列中的第一像素在所述第一组代价聚合方向上各自对应的匹配代价聚合值存入存储空间中,其中,所述第一像素同时位于所述参考行和所述参考列中;
仅将所述参考行中的第二像素在第一目标代价聚合方向上各自对应的匹配代价聚合值存入所述存储空间中;其中,所述第二像素在所述参考行中并且不在所述参考列中;
仅将所述参考列中的第三像素在第二目标代价聚合方向上各自对应的匹配代价聚合值存入所述存储空间中,其中,所述第三像素在所述参考列中并且不在所述参考行中;
其中,所述第一组代价聚合方向包含所述第一目标代价聚合方向和所述第二目标代价聚合方向,所述第一目标代价聚合方向和所述第二目标代价聚合方向不同。
可选地,所述处理器用于:
获取所述图像矩阵的参考行和参考列中的像素在第二组代价聚合方向上各自对应的匹配代价聚合值;
根据所述参考行和所述参考列中的像素在第二组代价聚合方向上各自对应 的匹配代价聚合值,确定所述其他行列中的像素在第二组代价聚合方向上各自对应的匹配代价聚合值。
可选地,所述处理器用于:
将所述图像矩阵旋转预设角度;
根据旋转后的图像矩阵中所述参考行和所述参考列中的像素在第二组代价聚合方向上各自对应的匹配代价聚合值,确定所述其他行列中的像素在第二组代价聚合方向上各自对应的匹配代价聚合值。
可选地,所述处理器用于:
根据参考行、参考列,将图像矩阵划分为多个图像块,每个图像块中包含参考行和参考列中的一部分像素;
根据每个图像块中包含的参考行和参考列中的一部分像素在第一组代价聚合方向上各自对应的匹配代价聚合值,确定所述每个图像块中其他行列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值;
确定所述每个图像块中各像素在第二组代价聚合方向上各自对应的匹配代价聚合值;
根据所述每个图像块中包含的各像素在第一组代价聚合方向和第二组代价聚合方向上各自对应的匹配代价聚合值,确定所述各像素各自对应的总匹配代价聚合值。
可选地,所述处理器用于:
按照第一设定方向遍历计算所述每个图像块中其他行列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值;
按照第二设定方向遍历计算所述每个图像块中各像素在第二组代价聚合方向上各自对应的匹配代价聚合值;第一设定方向与第二设定方向反向。
可选地,所述处理器用于:
对于每个图像块中的任一图像块,根据所述任一图像块中包含的参考行和参考列中的一部分像素在第一组代价聚合方向上各自对应的匹配代价聚合值,并行按照逐行和列的方式确定所述每个图像块中其他行列中的像素在第一组代 价聚合方向上各自对应的匹配代价聚合值。
可选地,所述处理器用于:
对于每个图像块中的任一图像块,根据所述任一图像块中包含的参考行和参考列中的一部分像素在第一组代价聚合方向上各自对应的匹配代价聚合值,按照逐点的方式确定所述每个图像块中其他行列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值。
可选地,所述处理器还用于:
根据所述图像矩阵的大小、进行匹配代价聚合计算处理的设备的计算能力、用于存储匹配代价聚合值的存储空间的大小中的一项或者多项,确定所述图像矩阵的参考行和参考列。
第五方面,本发明实施例提供一种电子设备,其中包括拍摄装置以及第三方面和第四方面中的图像深度信息确定装置。
第六方面,本发明实施例提供了一种计算机可读存储介质,所述存储介质为计算机可读存储介质,该计算机可读存储介质中存储有程序指令,所述程序指令用于实现第一方面和第二方面中的图像深度信息确定方法。
通过本发明实施例提供的图像深度信息确定方法、装置、设备和存储介质,可以降低数据读写带宽。
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本发明实施例提供的一种图像深度信息确定方法的流程图示意图;
图2为本发明实施例提供的一种16个代价聚合方向示意图;
图3为本发明实施例提供的一种8个代价聚合方向示意图;
图4为本发明实施例提供的一种图像矩阵中参考行和参考列位置示意图;
图5为本发明实施例提供的一种图像块切分结果示意图;
图6为本发明实施例提供的一种图像块示意图;
图7为本发明实施例提供的一种逐点恢复图像块的匹配代价聚合值的示意图;
图8为本发明实施例提供的另一种图像深度信息确定方法的流程图示意图;
图9为本发明实施例提供的一种图像深度信息确定装置的结构示意图;
图10为本发明实施例提供的另一种图像深度信息确定装置的结构示意图;
图11为本发明实施例提供的一种电子设备的结构示意图。
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
在本发明实施例中使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本发明。在本发明实施例和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义,“多种”一般包含至少两种。
取决于语境,如在此所使用的词语“如果”、“若”可以被解释成为“在……时”或“当……时”或“响应于确定”或“响应于检测”。类似地,取决于语境,短语“如果确定”或“如果检测(陈述的条件或事件)”可以被解释成为“当确定时”或“响应于确定”或“当检测(陈述的条件或事件)时”或“响应于检测(陈述的条件或事件)”。
另外,下述各方法实施例中的步骤时序仅为一种举例,而非严格限定。
图1为本发明实施例提供的一种图像深度信息确定方法的流程图,如图1所示,该方法包括如下步骤:
101、获取图像矩阵的参考行和参考列中的像素在第一组代价聚合方向上各 自对应的匹配代价聚合值,第一组代价聚合方向是多个代价聚合方向中的部分聚合方向,图像矩阵与多个摄像头(例如,双目摄像头,或者位于不同位置的多个摄像头)拍得的图像对应,匹配代价用于度量多个摄像头拍得的图像中相对应像素间的相似度。在另一实施方式中,图像矩阵也可以与一个能够移动的摄像头在不同位置拍得的图像对应,匹配代价用于度量所述能够移动的摄像头在不同位置拍得的图像间的相似度。
102、将参考行和参考列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值存入到存储空间中。
103、根据参考行和参考列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值,确定其他行列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值,其中,其他行列为图像矩阵中除参考行和参考列之外的行列。
104、确定图像矩阵的各像素在第二组代价聚合方向上各自对应的匹配代价聚合值,第二组代价聚合方向由多个代价聚合方向中不包含在第一组代价聚合方向中的聚合方向组成。
105、根据各像素在第一组代价聚合方向和第二组代价聚合方向上各自对应的匹配代价聚合值,确定各像素各自对应的总匹配代价聚合值。
106、根据各像素各自对应的总匹配代价聚合值,确定图像的深度信息。
实际应用中,为了确定物理世界(即,现实世界)中某一物体到拍摄装置之间的距离,可以拍摄包含该物体的图像,确定拍得的图像的深度信息,基于图像的深度信息确定某一物体到拍摄装置之间的距离。本发明实施例正是提供了一种图像深度信息确定方法。
需要说明的是,可以通过拍摄装置拍摄某一物体的多个图像,基于该多个图像,确定多个图像中目标图像的深度信息。该拍摄装置可以包括多个摄像头,也可以仅包括一个摄像头。当拍摄装置包括多个摄像头时,可以将该多个摄像头设置在不同位置上,这样该多个摄像头可以分别从不同角度对某一物体进行拍摄,得到某一物体的不同角度的图像。当拍摄装置包括一个摄像头时,可以在不同时刻通过该同一摄像头从不同位置上拍摄某一物体,这样也可以得到某 一物体的不同角度的图像。以下将以双目摄像头为例来进行说明。然而,本领域技术人员能够了解,可以采用多个摄像头来实现本发明的各个实施方式,以及不同实施方式的组合。
在一种可能的实现方式中,可以采用双目摄像头对某一物体进行拍摄,得到包含该物体的左视点图像和右视点图像。以左图作为目标图像,计算图像深度信息。计算图像深度信息的主要过程包括:
1、计算匹配代价(matching cost)。其中,匹配代价也称为匹配代价值。
2、代价聚合(cost aggregation)。
3、视差计算和优化(disparity computation/optimization)。
4、视差精细化(disparity refinement)。
其中,匹配代价表示两个像素之间的相似度。代价聚合是用于利用整个场景对应的图像中的所有像素对每一个单一像素施加影响,来获得一个较匹配代价更加精确的结果。视差计算和优化和视差精细化用于对计算结果进行校验以及进行亚像素处理等。通过上面列举的图像深度信息的计算过程,可以计算出目标图像的深度信息,然后根据三角测量原理可以进一步得到某一物体到拍摄装置之间的距离。本发明实施例具体提供了进行代价聚合的方法,下面将介绍代价聚合的数学原理。
在数学上,代价聚合的过程可以看作是求取一个全局能量最小值:
其中,C(p,D
p)为某一像素的匹配代价,p为图像中的任一像素。P
1T[|D
p-D
q|=1]为相邻像素中视差变化范围较小时的惩罚项,T[|D
p-D
q|=1]表示相邻像素D
p和D
q之间的视差差值为1,Np范围为像素p的相邻区域。P
2T[|D
p-D
q>1|]为相邻像素中视差变化范围较大(即,视差差值大于1)时的惩罚项。代价聚合过程涉及的计算复杂度较高,是一个多项式复杂程度的非确定性问题(Non-deterministic Polynomial,NP)问题。
为了降低代价聚合过程的计算复杂度,可以仅使用某些方向上的像素进行 代价聚合。如图2和图3所示,依次是16个代价聚合方向和8个代价聚合方向示意图,图中的p为图像中某一像素。除了可以从16个代价聚合方向进行代价聚合之外,还可以从8个代价聚合方向进行代价聚合,或者也可以从其他数目的代价聚合方向进行代价聚合,对此本发明实施例不做限定。
对于图像中的某一像素p,在某一代价聚合方向上的代价聚合可以通过下面的公式实现:
其中,多项式中的第一项C(p,d)为像素p的匹配代价。第二项为4个数据中的最小值,该4个数据包括L
r(p-r,d)、L
r(p-r,d-1)+P
1、L
r(p-r,d+1)+P
1、L
r(p-r,d+1)+P
1和min
iL
r(p-r,i)+P
2。L
r(p-r,d)表示像素p在r方向上的上一个像素在视差d下的代价聚合值。L
r(p-r,d-1)表示像素p在r方向上的上一个像素在视差d-1下的代价聚合值。L
r(p-r,d+1)表示像素p在r方向上的上一个像素在视差d+1下的代价聚合值。min
iL
r(p-r,i)表示像素p在r方向上的上一个像素在视差i下的最小代价聚合值,其中,i的取值范围为0到最大视差值之间的任一数值。P
1和P
2为惩罚系数,与像素p的距离越远,惩罚系数越大。第三项min
kL
r(p-r,k)的作用是防止L
r(p,d)饱和,即防止随着迭代让L
r(p,d)的增长过大。
通过上面的公式,可以计算某一像素p在某一代价聚合方向上的代价聚合值,重复使用该公式,可以得到某一像素p在所有代价聚合上分别对应的代价聚合值,进而将某一像素p在所有代价聚合上分别对应的代价聚合值进行相加,即可得到某一像素p的总匹配代价聚合值。对于某一像素p来说,最小总匹配代价聚合值对应的视差d为最终的视差取值。
上面介绍了计算某一像素p的总匹配代价聚合值,通过重复这样的方式,可以计算图像中所有像素的总匹配代价聚合值。实际应用中,可以先计算图像中所有像素在左上部分路径上的匹配代价聚合值,将计算结果存储到存储器中。其中,存储器可以是双倍速率同步动态随机存储器(DDR)或者其他类型的存储 器。然后计算图像中所有像素在右下部分路径上的匹配代价聚合值。在计算完图像中所有像素在右下部分路径上的匹配代价聚合值之后,从存储器读取图像中所有像素在左上部分路径上的匹配代价聚合值,将图像中所有像素在左上部分路径上的匹配代价聚合值与图像中对应像素在右下部分路径上的匹配代价聚合值相加,得到图像中所有像素分别对应的总匹配代价聚合值。当然,也可以将左上部分路径与右下部分路径的计算顺序进行调换。
以8个代价聚合方向为例,上述左上部分路径例如可以是图3中L0_pd-L3_pd所示的路径,右下部分路径例如可以是图3中L4_pd-L7_pd所示的路径。
在上述过程中,由于需要将图像中所有像素在某部分路径上的匹配代价聚合值暂存于存储器中,同时图像中所有像素在某部分路径上的匹配代价聚合值的数据量较大,因此需要占用较大的数据读写带宽。为了降低数据读写带宽的占用,在本发明实施例中可以只将部分匹配代价聚合值暂存于存储器中,在使用到图像中所有像素在某部分路径上的匹配代价聚合值时,基于部分匹配代价聚合值恢复出图像中所有像素在某部分路径上的匹配代价聚合值,这样可以极大地降低数据读写带宽的占用。
通过公式2可以看出,对于图像中任一像素在单一聚合方向上的代价聚合值来说,其由两部分来决定。具体来说,该代价聚合值包括该像素的匹配代价以及在当前代价聚合方向上的上一个像素的代价聚合值。基于此,可以通过下面的公式表示代价聚合的过程:
L0_pd
i=f(C
i,L0_pd
i-1) (公式3)
其中,i为图像中的当前像素,C
i表示当前像素i的匹配代价,L0_pd
i-1表示在当前代价聚合方向上的上一个像素i-1的代价聚合值,L0_pd
i表示当前聚合方向上的当前像素i的代价聚合值。以8个代价聚合方向为例,在进行右下部分路径的代价聚合加和时,需要使用左上部分路径的代价聚合加和结果,左上部分路径的代价聚合加和结果可以表示为:
下面将基于上面的分析介绍使用上面所分析的理论基础来降低数据读写带宽的占用的实现过程。
首先,可以通过上面介绍的方式来计算图像矩阵的所有像素在第一组代价聚合方向上各自对应的匹配代价聚合值。其中,图像矩阵与双目摄像头拍得的图像对应。
上述第一组代价聚合方向可以是多个代价聚合方向中的部分聚合方向。其中,多个代价聚合方向可以是前面介绍的16个代价聚合方向,也可以是8个代价聚合方向,或者可以是其他数目的代价聚合方向。第一组代价聚合方向也可以是多个代价聚合方向中的左上部分路径或者右下部分路径。
可以在整个图像矩阵中确定参考行和参考列中的像素所在的位置。如图4所示,以32×32的图像为例,参考行和参考列可以是图像中的第1行、第17行、第1列和第17列。在该示例中,选取了图像的第1行、中间一行(即,第17行)、第1列和中间一列(即,第17列)作为参考行和参考列,以将作为参考行和/或参考列的聚合代价存入DDR,而将其他行和其他列的聚合代价丢弃(即,不存入DDR中)。在其他情况下,也可以选取图像的某行或者某列作为参考行和参考列,以将其作为参考行和/或参考列的聚合代价存入DDR,而丢弃非参考行或参考列的聚合代价,对此本发明实施例不做限定。
可选地,上述在整个图像矩阵中确定参考行和参考列中的像素所在的位置的过程可以实现为:根据图像矩阵的大小、进行匹配代价聚合计算处理的设备的计算能力、用于存储匹配代价聚合值的存储空间的大小中的一项或者多项,确定图像矩阵的参考行和参考列。
在实际应用中,如果图像矩阵的尺寸较大,则可以考虑多增加参考行和参考列的数量,这样可以提高进行代价聚合处理的运算速度。如果进行匹配代价聚合计算处理的设备的计算能力较高,则可以考虑减少参考行和参考列的数量。如果用于存储匹配代价聚合值的存储空间较小,则可以考虑多增加参考行和参 考列的数量,这样可以节约用于存储匹配代价聚合值的存储空间。
在确定图像矩阵中参考行和参考列中的像素所在的位置之后,可以获取图像矩阵的参考行和参考列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值,例如图4中除了白色框之外的被标注的位置上的像素在第一组代价聚合方向上各自对应的匹配代价聚合值。将获取到的匹配代价聚合值存储到存储器中,这样参考行和参考列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值就保留了下来。在一个实施方式中,第一组代价聚合方向为图3所示的L0_pd-L3_pd所示的路径对应的代价聚合方向。
可选地,将参考行和参考列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值存入到存储空间中的过程可以实现为:将参考行和参考列中的第一像素在第一组代价聚合方向上各自对应的匹配代价聚合值存入存储空间中,其中,第一像素同时位于参考行和参考列中;仅将参考行中的第二像素在第一目标代价聚合方向上各自对应的匹配代价聚合值存入存储空间中;其中,第二像素在参考行中并且不在参考列中;仅将参考列中的第三像素在第二目标代价聚合方向上各自对应的匹配代价聚合值存入存储空间中,其中,第三像素在参考列中并且不在参考行中。
其中,第一组代价聚合方向包含第一目标代价聚合方向和第二目标代价聚合方向,第一目标代价聚合方向和第二目标代价聚合方向不同。
为了便于理解,以8个代价聚合方向为例来具体说明存储匹配代价聚合值的实现过程。假设需要从8个代价聚合方向进行代价聚合,已经计算出图像矩阵的第1行、第17行、第1列和第17列位置上的像素在左上部分路径上L0_pd-L3_pd的代价聚合值。此时,对于位于第1行、第17行、第1列和第17列中交叠位置上的第一像素,将第一像素在L0_pd-L3_pd方向上各自对应的匹配代价聚合值存入存储空间中。第一像素例如是第一行上位于第一列的像素。
对于第1行和第17行中除了第一像素之外的第二像素,可以仅将第二像素在L0_pd、L1_pd和L2_pd方向上各自对应的匹配代价聚合值存入存储空间中。需要说明的是,可以不存储第二像素在L3_pd方向上的匹配代价聚合值。
对于第1列和第17列中除了第一像素之外的第三像素,可以仅将第三像素在L3_pd方向上的匹配代价聚合值存入存储空间中。需要说明的是,可以不存储第三像素在L0_pd、L1_pd和L2_pd方向上各自对应的匹配代价聚合值。
值得注意的是,如果任一像素在某一代价聚合方向上不实际存在上一个像素,则该任一像素在某一代价聚合方向上的上一个像素对应的匹配代价聚合值可以记为某一默认数值或者记为该任一像素的匹配代价值。
在进行第二组代价聚合方向的代价聚合加和时,需要使用图像矩阵中所有像素在第一组代价聚合方向的代价聚合值,因此可以基于已保留的参考行和参考列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值,恢复出图像矩阵中图像矩阵中除参考行和参考列之外的行列中的像素在第一组代价聚合方向的代价聚合值。其中,第二组代价聚合方向由多个代价聚合方向中不包含在第一组代价聚合方向中的聚合方向组成。
可选地,根据参考行和参考列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值,确定其他行列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值的过程可以实现为:根据参考行、参考列,将图像矩阵划分为多个图像块,每个图像块中包含参考行和参考列中的一部分像素;根据每个图像块中包含的参考行和参考列中的一部分像素在第一组代价聚合方向上各自对应的匹配代价聚合值,确定每个图像块中其他行列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值。
基于此,确定图像矩阵的各像素在第二组代价聚合方向上各自对应的匹配代价聚合值的过程可以实现为:确定每个图像块中各像素在第二组代价聚合方向上各自对应的匹配代价聚合值。
根据各像素在第一组代价聚合方向和第二组代价聚合方向上各自对应的匹配代价聚合值,确定各像素各自对应的总匹配代价聚合值的过程可以实现为:根据每个图像块中包含的各像素在第一组代价聚合方向和第二组代价聚合方向上各自对应的匹配代价聚合值,确定各像素各自对应的总匹配代价聚合值。
在实际应用中,如图5所示,仍以从8个代价聚合方向上对32×32的图像 进行代价聚合的过程为例,可以按照参考行、参考列的位置,将整个图像切分为4个图像块block,包括图像块block1-图像块block4。可以按照图像块block1-图像块block2-图像块block3-图像块block4的顺序,依次对每个图像块block进行处理。也就是说,处理顺序是“之”字形(即,zigzag形)处理顺序。并且将图像的右下角的图像块作为先处理的图像块。对每个图像块block的处理过程类似,下面以图像块block1为例说明对图像块block的处理过程,其他图像块block的处理过程可以参照图像块block1的处理过程,在本发明实施例中不再赘述。
在切分之后所得的图像块block1可见图6所示。对于图像块block1来说,可以根据图像块block1中包含的参考行和参考列中的一部分像素在第一组代价聚合方向上各自对应的匹配代价聚合值,确定图像块block1中其他行列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值。其中,参考行和参考列中的一部分像素可以是图6中所示的除了白色框之外的被标注的位置上的像素,图像块block1中其他行列中的像素可以是图6中白色框位置上的像素。
在本发明实施例中,提供两种根据图像块中包含的参考行和参考列中的一部分像素在第一组代价聚合方向上各自对应的匹配代价聚合值,确定图像块中其他行列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值的方式。可以采用逐行或者逐点的方式来确定图像块中其他行列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值。
对于逐行的方式,可以根据任一图像块中包含的参考行和参考列中的一部分像素在第一组代价聚合方向上各自对应的匹配代价聚合值,并行按照逐行和列的方式确定每个图像块中其他行列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值。
在实际应用中,以图6为例,可以由第1行的L0_pd、L1_pd、L2_pd方向上的匹配代价聚合值和第2行的匹配代价值(也即前文所述的matching cost),分别计算第2行在L0_pd、L1_pd、L2_pd方向上的匹配代价聚合值。还可以通过第1列的L3_pd方向上的匹配代价聚合值和第2列的匹配代价值,计算第2 列在L3_pd方向上的匹配代价聚合值。
L0_pd-L3_pd不同方向上的匹配代价聚合值的计算过程之间是相互独立的,因此可以并行计算不同方向上的匹配代价聚合值。例如,一个周期内可以完成第2行的L0_pd、L1_pd、L2_pd方向上的匹配代价聚合值以及第2列的L3_pd方向上的匹配代价聚合值的恢复,对于图6所示的图像块block来说,仅16个周期即可完成图像块block中其他行列中的像素在第一组代价聚合方向上的匹配代价聚合值的计算。对于逐行恢复图像块的匹配代价聚合值的方式来说,计算速度较快。
值得说明的是,可以在内存中开辟4块同等大小的存储空间存储图像块block中每个像素在L0_pd-L3_pd方向上的匹配代价聚合值。以图6所示的图像块block为例,假设每个匹配代价聚合值的数据量为16比特,那么可以开辟4块16×16×16比特的存储空间存储图像块block中每个像素在L0_pd-L3_pd方向上的匹配代价聚合值。需要说明的是,由于需要用到一个图像块block中每个位置上的像素在L0_pd-L3_pd方向上的匹配代价聚合值,这其中包括图像块block中位于其他行列上的像素,同时也包括位于参考行和参考列上的像素,因此在开辟的存储空间中可以将整个图像块中每个位置上的像素在L0_pd-L3_pd方向上的匹配代价聚合值都进行存储,进而对于一个代价聚合方向来说,一个图像块需要使用16×16×16比特的存储空间。
对于逐点的方式,可以根据任一图像块中包含的参考行和参考列中的一部分像素在第一组代价聚合方向上各自对应的匹配代价聚合值,按照逐点的方式确定每个图像块中其他行列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值。
可以理解的是,由于根据参考行和参考列,对图像矩阵进行切分得到多个图像块,那么每个图像块中包含的不是完整的一整行参考行或者一整列参考列,而可以是一部分参考行或者一部分参考列,也即每个图像块中包含参考行和参考列中的一部分像素。举例来说,图像块中包含参考行和参考列中的一部分像素可以是图6中标示出的参考行和参考列中的一部分像素。
在进行逐点恢复图像块的匹配代价聚合值时,可以按照第一设定方向遍历计算每个图像块中其他行列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值;按照第二设定方向遍历计算每个图像块中各像素在第二组代价聚合方向上各自对应的匹配代价聚合值;第一设定方向与第二设定方向反向。
当第一组代价聚合方向为图像矩阵的左上部分路径时,上述第一设定方向可以是从上到下、从左到右的方向,上述第二设定方向可以是从下到上、从右到左的方向。
在实际应用中,如图7所示,可以先由(1,0)位置的L3_pd方向上的匹配代价聚合值计算出(1,1)位置的方向上的匹配代价聚合值,通过(0,1)位置的L0_pd、L1_pd、L2_pd方向上的匹配代价聚合值计算出(1,1)位置的L0_pd、L1_pd、L2_pd方向上的匹配代价聚合值。在计算出(1,1)位置在4个方向上的匹配代价聚合值之后,可以将它们相加。
可以理解的是,在计算出(1,1)位置在4个方向上的匹配代价聚合值的相加结果之后,可以将该结果存储到内存中的存储空间中。通过这样的方式,最后能够计算出图像块block中的所有像素在4个方向上的匹配代价聚合值的相加结果,并将这些结果存储到内存中的存储空间中。仍以图6所示的图像块block为例,假设每个像素在4个方向上的匹配代价聚合值的相加结果的数据量为16比特,那么可以开辟1块16×16×16比特的存储空间存储图像块block中每个像素在4个方向上的匹配代价聚合值的相加结果。相比于逐行恢复图像块的匹配代价聚合值的方式来说,采用逐点恢复图像块的匹配代价聚合值的方式可以直接恢复出一个像素在4个方向上的匹配代价聚合值,因此可以直接将这4个方向上的匹配代价聚合值相加,将相加结果存储到存储空间对应的存储位置上。而采用逐行恢复图像块的匹配代价聚合值的方式,无法同时将一个像素在4个方向上的匹配代价聚合值都恢复出,因此需要将一个像素在4个方向上的匹配代价聚合值都分别存储在存储空间中,在得到图像块所有像素在4个方向上的匹配代价聚合值之后,再从存储空间中获取出这些数据,将它们相加得到最终结果。从而,对于逐点恢复图像块的匹配代价聚合值的方式来说,需要占用的 内存的存储空间较小。
在一个实施方式中,若总共需要计算图像块block1在m个代价聚合方向上的匹配代价聚合值a1~am,则将m个代价聚合方向分为两组。即,第一组代价聚合方向和第二组代价聚合方向。其中,第一组代价聚合方向包括m1个代价聚合方向,第二组代价聚合方向包括m2个代价聚合方向。m1+m2=m,并且m1,m2,和m为整数。在恢复出图像块block1中所有行列在第一组代价聚合方向上的匹配代价聚合值之后,可以进行图像块block1中所有行列在第二组代价聚合方向上的代价聚合计算,这样最终就可以得到图像块block1中所有行列在多个代价聚合方向上的匹配代价聚合值。
在计算出图像块block1中的每一个像素在多个代价聚合方向上的匹配代价聚合值之后,可以将图像块block1中包含的各像素在第一组代价聚合方向和第二组代价聚合方向上各自对应的匹配代价聚合值相加,以确定图像块block1中包含的各像素各自对应的总的匹配代价聚合值。为了节省存储空间,可以直接选取保留所有视差中总匹配代价聚合值最小的视差作为最终结果。
可选地,在对图像矩阵中的任一像素在第二组代价聚合方向上进行代价聚合的过程中,可以参照任一像素在第一组代价聚合方向上进行代价聚合的方式进行。基于此,对图像矩阵中的任一像素在第二组代价聚合方向上进行代价聚合的过程可以实现为:获取图像矩阵的参考行和参考列中的像素在第二组代价聚合方向上各自对应的匹配代价聚合值;根据参考行和参考列中的像素在第二组代价聚合方向上各自对应的匹配代价聚合值,确定其他行列中的像素在第二组代价聚合方向上各自对应的匹配代价聚合值。
在实际应用中,可以计算图像矩阵所有行列中的像素在第二组代价聚合方向上各自对应的匹配代价聚合值,确定图像矩阵的参考行和参考列中的像素所在位置,保留图像矩阵的参考行和参考列中的像素在第二组代价聚合方向上各自对应的匹配代价聚合值。在使用图像矩阵的所有行列中的像素在第二组代价聚合方向上各自对应的匹配代价聚合值时,可以基于图像矩阵的参考行和参考列中的像素在第二组代价聚合方向上各自对应的匹配代价聚合值,恢复出图像 矩阵中除参考行和参考列的其他行列中的像素在第二组代价聚合方向上各自对应的匹配代价聚合值。
值得注意的是,基于图像矩阵的参考行和参考列中的像素在第二组代价聚合方向上各自对应的匹配代价聚合值,恢复出图像矩阵中除参考行和参考列的其他行列中的像素在第二组代价聚合方向上各自对应的匹配代价聚合值的步骤包括:可以将中间一行、最后一行、中间一列和最后一列选取为参考行和参考列,或者将第1行、中间一行、第1列和中间一列选取为参考行和参考列。在根据选定的参考行和参考列来划分图像块的过程中,要保障划分后的每个图像块中存在参考行和参考列中的一部分像素在第二组代价聚合方向上各自对应的匹配代价聚合值。在一个实施方式中,将参考行中对应的像素划入与该参考行相邻并位于该参考行右边的图像块中,以及将参考列中对应的像素划入与该参考列相邻并位于该参考列下面的图像块中。在一个实施方式中,以第1行、第17行、第1列和第17列为参考行和参考列,将一个图像划分为4个图像块,那么可以将第1行和第1列中的部分像素划分到一个图像块中,而不将第1行、第1列和第17行中的部分像素划分到一个图像块中,因为如果将第1行、第1列和第17行中的部分像素划分到一个图像块中,会使得排在该图像块下方的图像块中不包含参考行中的部分像素,进而也就难以恢复出其他行列像素的匹配代价聚合值。
在一个实施方式中,在从L0_pd-L3_pd方向上进行代价聚合时所采用的图像块的划分方式与从L4_pd-L7_pd方向上进行代价聚合时所采用的图像块的划分方式可以相同。
在另一实施方式中,在从L0_pd-L3_pd方向上进行代价聚合时所采用的图像块的划分方式与从L4_pd-L7_pd方向上进行代价聚合时所采用的图像块的划分方式可以不同。在一实施方式中,在从L0_pd-L3_pd方向上进行代价聚合时,可以以第1行和第1列为参考行和参考列,对图像进行划分,从L4_pd-L7_pd方向上进行代价聚合时,可以以第17行、第17列,第32行和第32列为参考行和参考列,对图像进行划分。这样,所得的左上角的一个图像块中包含第17 行和第17列的部分像素。其他图像块以此类推。
在另一实施方式中,在从L0_pd-L3_pd方向上进行代价聚合时,可以以第1行和第1列为参考行和参考列,对图像进行划分,从L4_pd-L7_pd方向上进行代价聚合时,可以将图像矩阵旋转180°,在得到的旋转后的图像中以第1行、第1列,第17行和第17列为参考行和参考列,对图像矩阵进行划分。
在又一实施方式中,在从L0_pd-L3_pd方向上进行代价聚合时,可以以第1行、第1列,第17行和第17列为参考行和参考列,对图像进行划分,从L4_pd-L7_pd方向上进行代价聚合时,可以同样以第1行、第1列,第17行和第17列为参考行和参考列,对图像矩阵进行划分,每个图像块不包括参考行和参考列中的像素,只包含如图4所示的白色框位置上的像素。可选地,在恢复其他行列像素的匹配代价聚合值的过程中,将图像块旋转180°之后进行计算。
可选地,根据参考行和参考列中的像素在第二组代价聚合方向上各自对应的匹配代价聚合值,确定其他行列中的像素在第二组代价聚合方向上各自对应的匹配代价聚合值的过程可以实现为:将图像矩阵旋转预设角度;根据旋转后的图像矩阵中参考行和参考列中的像素在第二组代价聚合方向上各自对应的匹配代价聚合值,确定其他行列中的像素在第二组代价聚合方向上各自对应的匹配代价聚合值。
上述预设角度可以是180°,在图像矩阵旋转180°之后,旋转前图像矩阵的右下部分变为旋转后图像矩阵的左上部分,因此可以参照任一像素在第一组代价聚合方向上进行代价聚合的方式相类似的方式,来计算图像矩阵中的任一像素在第二组代价聚合方向上各自对应的匹配代价聚合值。
可以理解的是,前面提到的第一组代价聚合方向可以是图像矩阵的左上部分路径,此时第二组代价聚合方向则为图像矩阵的右下部分路径。当第一组代价聚合方向是图像矩阵的右下部分路径时,第二组代价聚合方向则为图像矩阵的左上部分路径。
当调整参考行与参考列的数量时,会导致图像块block的大小发生变化。当图像块block越大时,数据读写带宽削减的越明显。
通过本发明实施例提供的方法,可以只将图像矩阵中参考行与参考列中的像素在第一组代价聚合方向上分别对应的匹配代价聚合值暂存于存储器中,而不存储非参考行和非参考列的其他行或列的匹配聚合代价值,这样使得仅存储图像矩阵中部分像素在第一组代价聚合方向上分别对应的匹配代价聚合值。在使用到图像矩阵中除参考行和参考列之外的其他行列中的像素在第一组代价聚合方向上分别对应的匹配代价聚合值时,可以基于已存储的图像矩阵中部分像素在第一组代价聚合方向上分别对应的匹配代价聚合值,恢复出图像矩阵中其他行列中的像素在第一组代价聚合方向上分别对应的匹配代价聚合值。通过避免存储图像矩阵中所有像素在第一组代价聚合方向上分别对应的匹配代价聚合值的方式,可以极大地降低数据读写带宽的占用。
图8为本发明实施例提供的另一种图像深度信息确定方法的流程图示意图,如图8所示,该方法包括如下步骤:
801、通过拍摄装置分别获得关于一物体的多个图像。
802、将多个图像中的第一图像分割为多个区块。
803、确定多个区块中至少一第一区块的对应的参考行中的像素与多个图像中的第二图像中的对应像素之间的第一匹配代价聚合值。
804、确定第一区块的对应的参考列中的像素与多个图像中的第二图像中的对应像素之间的第二匹配代价聚合值。
805、根据第一匹配代价聚合值和第二匹配代价聚合值,确定第一区块的像素在至少一代价聚合方向上的第三匹配代价聚合值,以用于确定第一区块的深度信息。
其中,第一匹配代价聚合值和第二匹配代价聚合值的代价聚合方向不同。
在实际应用中,可以通过拍摄装置拍摄某一物体的多个图像,基于该多个图像,确定多个图像中目标图像的深度信息。该拍摄装置可以包括多个摄像头,也可以仅包括一个摄像头。当拍摄装置包括多个摄像头时,可以将该多个摄像头设置在不同位置上,这样该多个摄像头可以分别从不同角度对某一物体进行拍摄,得到某一物体的不同角度的图像。当拍摄装置包括一个摄像头时,可以 在不同时刻通过该同一摄像头从不同位置上拍摄某一物体,这样也可以得到某一物体的不同角度的图像。
在拍得一物体的多个图像之后,可以选取其中一个图像作为第一图像,随之可以将多个图像中的第一图像分割为多个区块。该多个区块可以是上述实施例中的多个图像块。
对于多个区块中的至少一第一区块,可以计算该第一区块的对应的参考行中的像素与多个图像中的第二图像中的对应像素之间的第一匹配代价聚合值。第一匹配代价聚合值对应的代价聚合方向可以是多个代价聚合方向中的第一组代价聚合方向。
随后还可以确定第一区块的对应的参考列中的像素与多个图像中的第二图像中的对应像素之间的第二匹配代价聚合值。第二匹配代价聚合值对应的代价聚合方向可以是多个代价聚合方向中除第一组代价聚合方向之外的第二组代价聚合方向。
最后可以根据第一匹配代价聚合值和第二匹配代价聚合值,确定第一区块的像素在至少一代价聚合方向上的第三匹配代价聚合值,以用于确定第一区块的深度信息。第三匹配代价聚合值可以是第一区块中除了参考行和参考列之外的其他行列的像素在至少一代价聚合方向上的匹配代价聚合值。可以通过第一匹配代价聚合值和第二匹配代价聚合值,恢复出第一区块中其他行列的像素在至少一代价聚合方向上的匹配代价聚合值。
图8所示实施例中具体实现过程可以参考前述实施例中的相关说明,在此暂不赘述。
可选地,确定多个区块中至少一第一区块的对应的参考行中的像素与多个图像中的第二图像中的对应像素之间的第一匹配代价聚合值的步骤包括:获取多个区块中至少一第一区块的参考行中的像素与多个图像中的第二图像中的对应像素之间的第一匹配代价聚合值;将第一匹配代价聚合值存储到存储空间中。确定第一区块的参考列中的像素与多个图像中的第二图像中的对应像素之间的第二匹配代价聚合值的步骤包括:获取第一区块的参考列中的像素与第二图像 中的对应像素之间的第二匹配代价聚合值;将第二匹配代价聚合值存储到存储空间中。
可选地,根据第一匹配代价聚合值和第二匹配代价聚合值,确定第一区块的对应的像素在至少一代价聚合方向上的第三匹配代价聚合值的过程可以实现为:根据第一匹配代价聚合值和第二匹配代价聚合值,确定第一区块中其他行列中的像素在至少一代价聚合方向上的第三匹配代价聚合值。
其中,上述第一匹配代价聚合值对应的代价聚合方向可以是第一组代价聚合方向,上述第二匹配代价聚合值对应的代价聚合方向可以是第二组代价聚合方向。第一组代价聚合方向可以是多个代价聚合方向中的部分聚合方向。其中,多个代价聚合方向可以是前面介绍的16个代价聚合方向,也可以是8个代价聚合方向,或者可以是其他数目的代价聚合方向。第一组代价聚合方向也可以是多个代价聚合方向中的左上部分路径或者右下部分路径。而第二组代价聚合方向则可以是多个代价聚合方向中除第一组代价聚合方向之外的聚合方向。
第三匹配代价聚合值可以是第一区块中其他行列中的像素在至少一代价聚合方向上的代价聚合值,例如图4中白色框所标注的位置上的像素在至少一代价聚合方向上的代价聚合值。
可选地,根据第一匹配代价聚合值和第二匹配代价聚合值,确定第一区块中其他行列中的像素在至少一代价聚合方向上的第三匹配代价聚合值的过程可以实现为:对于第一区块,根据第一匹配代价聚合值和第二匹配代价聚合值,并行按照逐行和列的方式确定第一区块中其他行列中的像素在至少一代价聚合方向上的第三匹配代价聚合值。
可选地,根据第一匹配代价聚合值和第二匹配代价聚合值,确定第一区块中其他行列中的像素在至少一代价聚合方向上的第三匹配代价聚合值的过程可以实现为:对于第一区块,根据第一匹配代价聚合值和第二匹配代价聚合值,按照逐点的方式确定第一区块中其他行列中的像素在至少一代价聚合方向上的第三匹配代价聚合值。
至少一代价聚合方向例如可以是L0_pd-L7_pd中的任一或多个方向。假设 至少一代价聚合方向是L0_pd方向,假设当前需要计算图7(1,1)位置上像素在L0_pd方向上的匹配代价聚合值,那么可以通过(0,1)位置的L0_pd方向上的匹配代价聚合值计算出(1,1)位置的L0_pd方向上的匹配代价聚合值。(1,1)位置的L0_pd方向上的匹配代价聚合值,即可以作为第一区块中其他行列中的像素在至少一代价聚合方向上的第三匹配代价聚合值。
上述过程可以参考前述其他实施例中的相关说明,在此不赘述。
本发明又一示例性实施例提供了一种图像深度信息确定装置,如图9所示,该装置包括:
第一存储器1910,用于存储计算机程序;
第一处理器1920,用于运行存储器中存储的计算机程序以实现:
通过拍摄装置分别获得关于一物体的多个图像;
将所述多个图像中的第一图像分割为多个区块;
确定所述多个区块中至少一第一区块的对应的参考行中的像素与所述多个图像中的第二图像中的对应像素之间的第一匹配代价聚合值;
确定所述第一区块的对应的参考列中的像素与所述多个图像中的第二图像中的对应像素之间的第二匹配代价聚合值;
根据所述第一匹配代价聚合值和所述第二匹配代价聚合值,确定所述第一区块的像素在至少一代价聚合方向上的第三匹配代价聚合值,以用于确定所述第一区块的深度信息;
其中,所述第一匹配代价聚合值和所述第二匹配代价聚合值的代价聚合方向不同。
可选地,所述第一处理器1920还用于:
获取所述多个区块中至少一第一区块的参考行中的像素与所述多个图像中的第二图像中的对应像素之间的第一匹配代价聚合值;
将所述第一匹配代价聚合值存储到存储空间中;
获取所述第一区块的参考列中的像素与所述第二图像中的对应像素之间的第二匹配代价聚合值;
将所述第二匹配代价聚合值存储到所述存储空间中。
可选地,所述第一处理器1920用于:
根据所述第一匹配代价聚合值和所述第二匹配代价聚合值,确定所述第一区块中其他行列中的像素在至少一代价聚合方向上的第三匹配代价聚合值。
可选地,所述第一处理器1920用于:
对于所述第一区块,根据所述第一匹配代价聚合值和所述第二匹配代价聚合值,并行按照逐行和列的方式确定所述第一区块中其他行列中的像素在至少一代价聚合方向上的第三匹配代价聚合值。
可选地,所述第一处理器1920用于:
对于所述第一区块,根据所述第一匹配代价聚合值和所述第二匹配代价聚合值,按照逐点的方式确定所述第一区块中其他行列中的像素在至少一代价聚合方向上的第三匹配代价聚合值。
本发明又一示例性实施例提供了另一种图像深度信息确定装置,如图10所示,该装置包括:
第二存储器2010,用于存储计算机程序;
第二处理器2020,用于运行存储器中存储的计算机程序以实现:
获取图像矩阵的参考行和参考列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值,所述第一组代价聚合方向是多个代价聚合方向中的部分聚合方向,所述图像矩阵与多个摄像头拍得的图像对应,匹配代价用于度量所述多个摄像头拍得的图像中相对应像素间的相似度;
将所述参考行和所述参考列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值存入到存储空间中;
根据所述参考行和所述参考列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值,确定其他行列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值,其中,所述其他行列为所述图像矩阵中除所述参考行和所述参考列之外的行列;
确定所述图像矩阵的各像素在第二组代价聚合方向上各自对应的匹配代价 聚合值,所述第二组代价聚合方向由所述多个代价聚合方向中不包含在所述第一组代价聚合方向中的聚合方向组成;
根据所述各像素在第一组代价聚合方向和第二组代价聚合方向上各自对应的匹配代价聚合值,确定所述各像素各自对应的总匹配代价聚合值;
根据所述各像素各自对应的总匹配代价聚合值,确定所述图像的深度信息。
可选地,所述第二处理器2020用于:
将所述参考行和所述参考列中的第一像素在所述第一组代价聚合方向上各自对应的匹配代价聚合值存入存储空间中,其中,所述第一像素同时位于所述参考行和所述参考列中;
仅将所述参考行中的第二像素在第一目标代价聚合方向上各自对应的匹配代价聚合值存入所述存储空间中;其中,所述第二像素在所述参考行中并且不在所述参考列中;
仅将所述参考列中的第三像素在第二目标代价聚合方向上各自对应的匹配代价聚合值存入所述存储空间中,其中,所述第三像素在所述参考列中并且不在所述参考行中;
其中,所述第一组代价聚合方向包含所述第一目标代价聚合方向和所述第二目标代价聚合方向,所述第一目标代价聚合方向和所述第二目标代价聚合方向不同。
可选地,所述第二处理器2020用于:
获取所述图像矩阵的参考行和参考列中的像素在第二组代价聚合方向上各自对应的匹配代价聚合值;
根据所述参考行和所述参考列中的像素在第二组代价聚合方向上各自对应的匹配代价聚合值,确定所述其他行列中的像素在第二组代价聚合方向上各自对应的匹配代价聚合值。
可选地,所述第二处理器2020用于:
将所述图像矩阵旋转预设角度;
根据旋转后的图像矩阵中所述参考行和所述参考列中的像素在第二组代价 聚合方向上各自对应的匹配代价聚合值,确定所述其他行列中的像素在第二组代价聚合方向上各自对应的匹配代价聚合值。
可选地,所述第二处理器2020用于:
根据参考行、参考列,将图像矩阵划分为多个图像块,每个图像块中包含参考行和参考列中的一部分像素;
根据每个图像块中包含的参考行和参考列中的一部分像素在第一组代价聚合方向上各自对应的匹配代价聚合值,确定所述每个图像块中其他行列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值;
确定所述每个图像块中各像素在第二组代价聚合方向上各自对应的匹配代价聚合值;
根据所述每个图像块中包含的各像素在第一组代价聚合方向和第二组代价聚合方向上各自对应的匹配代价聚合值,确定所述各像素各自对应的总匹配代价聚合值。
可选地,所述第二处理器2020用于:
按照第一设定方向遍历计算所述每个图像块中其他行列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值;
按照第二设定方向遍历计算所述每个图像块中各像素在第二组代价聚合方向上各自对应的匹配代价聚合值;第一设定方向与第二设定方向反向。
可选地,所述第二处理器2020用于:
对于每个图像块中的任一图像块,根据所述任一图像块中包含的参考行和参考列中的一部分像素在第一组代价聚合方向上各自对应的匹配代价聚合值,并行按照逐行和列的方式确定所述每个图像块中其他行列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值。
可选地,所述第二处理器2020用于:
对于每个图像块中的任一图像块,根据所述任一图像块中包含的参考行和参考列中的一部分像素在第一组代价聚合方向上各自对应的匹配代价聚合值,按照逐点的方式确定所述每个图像块中其他行列中的像素在第一组代价聚合方 向上各自对应的匹配代价聚合值。
可选地,所述第二处理器2020还用于:
根据所述图像矩阵的大小、进行匹配代价聚合计算处理的设备的计算能力、用于存储匹配代价聚合值的存储空间的大小中的一项或者多项,确定所述图像矩阵的参考行和参考列。
图10所示的图像深度信息确定装置可以执行图1-图7所示实施例的方法,图9所示的图像深度信息确定装置可以执行图8所示实施例的方法,本实施例未详细描述的部分,可参考对图1-图8所示实施例的相关说明。该技术方案的执行过程和技术效果参见图1-图8所示实施例中的描述,在此不再赘述。
图11为本发明实施例提供的一种电子设备的结构示意图。如图11所示,该电子设备包括:拍摄装置2110和图像深度信息确定装置2120。
其中,图像深度信息确定装置2120可以是图9、10所示实施例的装置。本实施例未详细描述的部分,可参考对图1-图8所示实施例的相关说明。该技术方案的执行过程和技术效果参见图1-图8所示实施例中的描述,在此不再赘述。
另外,本发明实施例还提供一种计算机可读存储介质,所述计算机可读存储介质中存储有可执行代码,所述可执行代码用于实现如前述各实施例提供的图像深度信息确定方法。
通过本发明实施例提供的方法,可以只将图像矩阵中参考行与参考列中的像素在第一组代价聚合方向上分别对应的匹配代价聚合值暂存于存储器中,这样使得仅存储图像矩阵中部分像素在第一组代价聚合方向上分别对应的匹配代价聚合值。在使用到图像矩阵中除参考行和参考列之外的其他行列中的像素在第一组代价聚合方向上分别对应的匹配代价聚合值时,可以基于已存储的图像矩阵中部分像素在第一组代价聚合方向上分别对应的匹配代价聚合值,恢复出图像矩阵中其他行列中的像素在第一组代价聚合方向上分别对应的匹配代价聚合值。通过避免存储图像矩阵中所有像素在第一组代价聚合方向上分别对应的匹配代价聚合值的方式,可以极大地降低数据读写带宽的占用。
以上各个实施例中的技术方案、技术特征在不相冲突的情况下均可以单独, 或者进行组合,只要未超出本领域技术人员的认知范围,均属于本发明保护范围内的等同实施例。
以上所述仅为本发明的实施例,并非因此限制本发明的专利范围,凡是利用本发明说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本发明的专利保护范围内。
最后应说明的是:以上各实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。
Claims (30)
- 一种图像深度信息确定方法,其特征在于,包括:通过拍摄装置分别获得关于一物体的多个图像;将所述多个图像中的第一图像分割为多个区块;确定所述多个区块中至少一第一区块的对应的参考行中的像素与所述多个图像中的第二图像中的对应像素之间的第一匹配代价聚合值;确定所述第一区块的对应的参考列中的像素与所述多个图像中的所述第二图像中的对应像素之间的第二匹配代价聚合值;根据所述第一匹配代价聚合值和所述第二匹配代价聚合值,确定所述第一区块的像素在至少一代价聚合方向上的第三匹配代价聚合值,以用于确定所述第一区块的深度信息;其中,所述第一匹配代价聚合值和所述第二匹配代价聚合值的代价聚合方向不同。
- 根据权利要求1所述的方法,其特征在于,在确定所述多个区块中至少一第一区块的对应的参考行中的像素与所述多个图像中的第二图像中的对应像素之间的第一匹配代价聚合值之前,所述方法还包括:获取所述多个区块中至少一第一区块的参考行中的像素与所述多个图像中的第二图像中的对应像素之间的第一匹配代价聚合值;将所述第一匹配代价聚合值存储到存储空间中;在确定所述第一区块的参考列中的像素与所述多个图像中的第二图像中的对应像素之间的第二匹配代价聚合值之前,所述方法还包括:获取所述第一区块的参考列中的像素与所述第二图像中的对应像素之间的第二匹配代价聚合值;将所述第二匹配代价聚合值存储到所述存储空间中。
- 根据权利要求1所述的方法,其特征在于,所述根据所述第一匹配代价聚合值和所述第二匹配代价聚合值,确定所述第一区块的对应的像素在至少一 代价聚合方向上的第三匹配代价聚合值,包括:根据所述第一匹配代价聚合值和所述第二匹配代价聚合值,确定所述第一区块中其他行列中的像素在至少一代价聚合方向上的第三匹配代价聚合值。
- 根据权利要求3所述的方法,其特征在于,所述根据所述第一匹配代价聚合值和所述第二匹配代价聚合值,确定所述第一区块中其他行列中的像素在至少一代价聚合方向上的第三匹配代价聚合值,包括:根据所述第一匹配代价聚合值和所述第二匹配代价聚合值,并行按照逐行和列的方式确定所述第一区块中其他行列中的像素在至少一代价聚合方向上的第三匹配代价聚合值。
- 根据权利要求3所述的方法,其特征在于,所述根据所述第一匹配代价聚合值和所述第二匹配代价聚合值,确定所述第一区块中其他行列中的像素在至少一代价聚合方向上的第三匹配代价聚合值,包括:根据所述第一匹配代价聚合值和所述第二匹配代价聚合值,按照逐点的方式确定所述第一区块中其他行列中的像素在至少一代价聚合方向上的第三匹配代价聚合值。
- 一种图像深度信息确定方法,其特征在于,包括:获取图像矩阵的参考行和参考列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值,所述第一组代价聚合方向是多个代价聚合方向中的部分聚合方向,所述图像矩阵与多个摄像头拍得的图像对应,匹配代价用于度量所述多个摄像头拍得的图像中相对应像素间的相似度;将所述参考行和所述参考列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值存入到存储空间中;根据所述参考行和所述参考列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值,确定其他行列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值,其中,所述其他行列为所述图像矩阵中除所述参考行和所述参考列之外的行列;确定所述图像矩阵的各像素在第二组代价聚合方向上各自对应的匹配代价 聚合值,所述第二组代价聚合方向由所述多个代价聚合方向中不包含在所述第一组代价聚合方向中的聚合方向组成;根据所述各像素在第一组代价聚合方向和第二组代价聚合方向上各自对应的匹配代价聚合值,确定所述各像素各自对应的总匹配代价聚合值;根据所述各像素各自对应的总匹配代价聚合值,确定所述图像的深度信息。
- 根据权利要求6所述的方法,其特征在于,所述将所述参考行和所述参考列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值存入到存储空间中,包括:将所述参考行和所述参考列中的第一像素在所述第一组代价聚合方向上各自对应的匹配代价聚合值存入存储空间中,其中,所述第一像素同时位于所述参考行和所述参考列中;仅将所述参考行中的第二像素在第一目标代价聚合方向上各自对应的匹配代价聚合值存入所述存储空间中;其中,所述第二像素在所述参考行中并且不在所述参考列中;仅将所述参考列中的第三像素在第二目标代价聚合方向上各自对应的匹配代价聚合值存入所述存储空间中,其中,所述第三像素在所述参考列中并且不在所述参考行中;其中,所述第一组代价聚合方向包含所述第一目标代价聚合方向和所述第二目标代价聚合方向,所述第一目标代价聚合方向和所述第二目标代价聚合方向不同。
- 根据权利要求6所述的方法,其特征在于,所述确定所述图像矩阵的各像素在第二组代价聚合方向上各自对应的匹配代价聚合值,包括:获取所述图像矩阵的参考行和参考列中的像素在第二组代价聚合方向上各自对应的匹配代价聚合值;根据所述参考行和所述参考列中的像素在第二组代价聚合方向上各自对应的匹配代价聚合值,确定所述其他行列中的像素在第二组代价聚合方向上各自对应的匹配代价聚合值。
- 根据权利要求8所述的方法,其特征在于,所述根据所述参考行和所述参考列中的像素在第二组代价聚合方向上各自对应的匹配代价聚合值,确定所述其他行列中的像素在第二组代价聚合方向上各自对应的匹配代价聚合值,包括:将所述图像矩阵旋转预设角度;根据旋转后的图像矩阵中所述参考行和所述参考列中的像素在第二组代价聚合方向上各自对应的匹配代价聚合值,确定所述其他行列中的像素在第二组代价聚合方向上各自对应的匹配代价聚合值。
- 根据权利要求6所述的方法,其特征在于,所述根据所述参考行和所述参考列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值,确定其他行列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值,包括:根据参考行、参考列,将图像矩阵划分为多个图像块,每个图像块中包含参考行和参考列中的一部分像素;根据每个图像块中包含的参考行和参考列中的一部分像素在第一组代价聚合方向上各自对应的匹配代价聚合值,确定所述每个图像块中其他行列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值;所述确定所述图像矩阵的各像素在第二组代价聚合方向上各自对应的匹配代价聚合值,包括:确定所述每个图像块中各像素在第二组代价聚合方向上各自对应的匹配代价聚合值;所述根据所述各像素在第一组代价聚合方向和第二组代价聚合方向上各自对应的匹配代价聚合值,确定所述各像素各自对应的总匹配代价聚合值,包括:根据所述每个图像块中包含的各像素在第一组代价聚合方向和第二组代价聚合方向上各自对应的匹配代价聚合值,确定所述各像素各自对应的总匹配代价聚合值。
- 根据权利要求10所述的方法,其特征在于,所述确定所述每个图像块中其他行列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值,包 括:按照第一设定方向遍历计算所述每个图像块中其他行列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值;所述确定所述每个图像块中各像素在第二组代价聚合方向上各自对应的匹配代价聚合值,包括:按照第二设定方向遍历计算所述每个图像块中各像素在第二组代价聚合方向上各自对应的匹配代价聚合值;第一设定方向与第二设定方向反向。
- 根据权利要求10所述的方法,其特征在于,所述根据每个图像块中包含的参考行和参考列中的一部分像素在第一组代价聚合方向上各自对应的匹配代价聚合值,确定所述每个图像块中其他行列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值,包括:对于每个图像块中的任一图像块,根据所述任一图像块中包含的参考行和参考列中的一部分像素在第一组代价聚合方向上各自对应的匹配代价聚合值,并行按照逐行和列的方式确定所述每个图像块中其他行列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值。
- 根据权利要求10所述的方法,其特征在于,所述根据每个图像块中包含的参考行和参考列中的一部分像素在第一组代价聚合方向上各自对应的匹配代价聚合值,确定所述每个图像块中其他行列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值,包括:对于每个图像块中的任一图像块,根据所述任一图像块中包含的参考行和参考列中的一部分像素在第一组代价聚合方向上各自对应的匹配代价聚合值,按照逐点的方式确定所述每个图像块中其他行列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值。
- 根据权利要求6所述的方法,其特征在于,所述方法还包括:根据所述图像矩阵的大小、进行匹配代价聚合计算处理的设备的计算能力、用于存储匹配代价聚合值的存储空间的大小中的一项或者多项,确定所述图像矩阵的参考行和参考列。
- 一种图像深度信息确定装置,其特征在于,包括存储器、处理器;其中,所述存储器上存储有可执行代码,当所述可执行代码被所述处理器执行时,使所述处理器实现:通过拍摄装置分别获得关于一物体的多个图像;将所述多个图像中的第一图像分割为多个区块;确定所述多个区块中至少一第一区块的对应的参考行中的像素与所述多个图像中的第二图像中的对应像素之间的第一匹配代价聚合值;确定所述第一区块的对应的参考列中的像素与所述多个图像中的所述第二图像中的对应像素之间的第二匹配代价聚合值;根据所述第一匹配代价聚合值和所述第二匹配代价聚合值,确定所述第一区块的像素在至少一代价聚合方向上的第三匹配代价聚合值,以用于确定所述第一区块的深度信息;其中,所述第一匹配代价聚合值和所述第二匹配代价聚合值的代价聚合方向不同。
- 根据权利要求15所述的装置,其特征在于,所述处理器还用于:获取所述多个区块中至少一第一区块的参考行中的像素与所述多个图像中的第二图像中的对应像素之间的第一匹配代价聚合值;将所述第一匹配代价聚合值存储到存储空间中;获取所述第一区块的参考列中的像素与所述第二图像中的对应像素之间的第二匹配代价聚合值;将所述第二匹配代价聚合值存储到所述存储空间中。
- 根据权利要求15所述的装置,其特征在于,所述处理器用于:根据所述第一匹配代价聚合值和所述第二匹配代价聚合值,确定所述第一区块中其他行列中的像素在至少一代价聚合方向上的第三匹配代价聚合值。
- 根据权利要求17所述的装置,其特征在于,所述处理器用于:对于所述第一区块,根据所述第一匹配代价聚合值和所述第二匹配代价聚合值,并行按照逐行和列的方式确定所述第一区块中其他行列中的像素在至少 一代价聚合方向上的第三匹配代价聚合值。
- 根据权利要求17所述的装置,其特征在于,所述处理器用于:对于所述第一区块,根据所述第一匹配代价聚合值和所述第二匹配代价聚合值,按照逐点的方式确定所述第一区块中其他行列中的像素在至少一代价聚合方向上的第三匹配代价聚合值。
- 一种图像深度信息确定装置,其特征在于,包括存储器、处理器;其中,所述存储器上存储有可执行代码,当所述可执行代码被所述处理器执行时,使所述处理器实现:获取图像矩阵的参考行和参考列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值,所述第一组代价聚合方向是多个代价聚合方向中的部分聚合方向,所述图像矩阵与多个摄像头拍得的图像对应,匹配代价用于度量所述多个摄像头拍得的图像中相对应像素间的相似度;将所述参考行和所述参考列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值存入到存储空间中;根据所述参考行和所述参考列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值,确定其他行列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值,其中,所述其他行列为所述图像矩阵中除所述参考行和所述参考列之外的行列;确定所述图像矩阵的各像素在第二组代价聚合方向上各自对应的匹配代价聚合值,所述第二组代价聚合方向由所述多个代价聚合方向中不包含在所述第一组代价聚合方向中的聚合方向组成;根据所述各像素在第一组代价聚合方向和第二组代价聚合方向上各自对应的匹配代价聚合值,确定所述各像素各自对应的总匹配代价聚合值;根据所述各像素各自对应的总匹配代价聚合值,确定所述图像的深度信息。
- 根据权利要求20所述的装置,其特征在于,所述处理器用于:将所述参考行和所述参考列中的第一像素在所述第一组代价聚合方向上各自对应的匹配代价聚合值存入存储空间中,其中,所述第一像素同时位于所述 参考行和所述参考列中;仅将所述参考行中的第二像素在第一目标代价聚合方向上各自对应的匹配代价聚合值存入所述存储空间中;其中,所述第二像素在所述参考行中并且不在所述参考列中;仅将所述参考列中的第三像素在第二目标代价聚合方向上各自对应的匹配代价聚合值存入所述存储空间中,其中,所述第三像素在所述参考列中并且不在所述参考行中;其中,所述第一组代价聚合方向包含所述第一目标代价聚合方向和所述第二目标代价聚合方向,所述第一目标代价聚合方向和所述第二目标代价聚合方向不同。
- 根据权利要求20所述的装置,其特征在于,所述处理器用于:获取所述图像矩阵的参考行和参考列中的像素在第二组代价聚合方向上各自对应的匹配代价聚合值;根据所述参考行和所述参考列中的像素在第二组代价聚合方向上各自对应的匹配代价聚合值,确定所述其他行列中的像素在第二组代价聚合方向上各自对应的匹配代价聚合值。
- 根据权利要求22所述的装置,其特征在于,所述处理器用于:将所述图像矩阵旋转预设角度;根据旋转后的图像矩阵中所述参考行和所述参考列中的像素在第二组代价聚合方向上各自对应的匹配代价聚合值,确定所述其他行列中的像素在第二组代价聚合方向上各自对应的匹配代价聚合值。
- 根据权利要求22所述的装置,其特征在于,所述处理器用于:根据参考行、参考列,将图像矩阵划分为多个图像块,每个图像块中包含参考行和参考列中的一部分像素;根据每个图像块中包含的参考行和参考列中的一部分像素在第一组代价聚合方向上各自对应的匹配代价聚合值,确定所述每个图像块中其他行列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值;确定所述每个图像块中各像素在第二组代价聚合方向上各自对应的匹配代价聚合值;根据所述每个图像块中包含的各像素在第一组代价聚合方向和第二组代价聚合方向上各自对应的匹配代价聚合值,确定所述各像素各自对应的总匹配代价聚合值。
- 根据权利要求24所述的装置,其特征在于,所述处理器用于:按照第一设定方向遍历计算所述每个图像块中其他行列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值;按照第二设定方向遍历计算所述每个图像块中各像素在第二组代价聚合方向上各自对应的匹配代价聚合值;第一设定方向与第二设定方向反向。
- 根据权利要求24所述的装置,其特征在于,所述处理器用于:对于每个图像块中的任一图像块,根据所述任一图像块中包含的参考行和参考列中的一部分像素在第一组代价聚合方向上各自对应的匹配代价聚合值,并行按照逐行和列的方式确定所述每个图像块中其他行列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值。
- 根据权利要求24所述的装置,其特征在于,所述处理器用于:对于每个图像块中的任一图像块,根据所述任一图像块中包含的参考行和参考列中的一部分像素在第一组代价聚合方向上各自对应的匹配代价聚合值,按照逐点的方式确定所述每个图像块中其他行列中的像素在第一组代价聚合方向上各自对应的匹配代价聚合值。
- 根据权利要求20所述的装置,其特征在于,所述处理器还用于:根据所述图像矩阵的大小、进行匹配代价聚合计算处理的设备的计算能力、用于存储匹配代价聚合值的存储空间的大小中的一项或者多项,确定所述图像矩阵的参考行和参考列。
- 一种电子设备,其特征在于,包括:拍摄装置;以及权利要求15-28中任意一项所述的图像深度信息确定装置。
- 一种计算机可读存储介质,其特征在于,所述存储介质为计算机可读存储介质,该计算机可读存储介质中存储有程序指令,所述程序指令用于实现权利要求1-14中任一项所述的图像深度信息确定方法。
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202080005529.6A CN112823378A (zh) | 2020-07-03 | 2020-07-03 | 图像深度信息确定方法、装置、设备和存储介质 |
PCT/CN2020/100108 WO2022000458A1 (zh) | 2020-07-03 | 2020-07-03 | 图像深度信息确定方法、装置、设备和存储介质 |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/CN2020/100108 WO2022000458A1 (zh) | 2020-07-03 | 2020-07-03 | 图像深度信息确定方法、装置、设备和存储介质 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2022000458A1 true WO2022000458A1 (zh) | 2022-01-06 |
Family
ID=75858134
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2020/100108 WO2022000458A1 (zh) | 2020-07-03 | 2020-07-03 | 图像深度信息确定方法、装置、设备和存储介质 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN112823378A (zh) |
WO (1) | WO2022000458A1 (zh) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114463409A (zh) * | 2022-02-11 | 2022-05-10 | 北京百度网讯科技有限公司 | 图像深度信息的确定方法、装置、电子设备和介质 |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113658242A (zh) * | 2021-08-23 | 2021-11-16 | 深圳市慧鲤科技有限公司 | 深度估计方法、装置、计算机设备及存储介质 |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
TW201525939A (zh) * | 2013-12-16 | 2015-07-01 | Ind Tech Res Inst | 深度精鍊與資料聚集的方法與系統 |
US9998725B2 (en) * | 2015-10-05 | 2018-06-12 | Electronics And Telecommunications Research Institute | Apparatus and method for generating depth information |
CN108460792A (zh) * | 2016-12-12 | 2018-08-28 | 南京理工大学 | 一种基于图像分割的高效聚焦立体匹配方法 |
CN110533710A (zh) * | 2019-08-22 | 2019-12-03 | 桂林电子科技大学 | 一种基于gpu的双目匹配算法的方法及处理装置 |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106815594A (zh) * | 2015-11-30 | 2017-06-09 | 展讯通信(上海)有限公司 | 立体匹配方法及装置 |
JP2019056623A (ja) * | 2017-09-21 | 2019-04-11 | 株式会社東芝 | 画像処理装置、及び、画像処理システム |
CN109919991A (zh) * | 2017-12-12 | 2019-06-21 | 杭州海康威视数字技术股份有限公司 | 一种深度信息确定方法、装置、电子设备及存储介质 |
CN110310320B (zh) * | 2019-07-09 | 2023-07-07 | 南京美基森信息技术有限公司 | 一种双目视觉匹配代价聚合优化方法 |
-
2020
- 2020-07-03 WO PCT/CN2020/100108 patent/WO2022000458A1/zh active Application Filing
- 2020-07-03 CN CN202080005529.6A patent/CN112823378A/zh active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
TW201525939A (zh) * | 2013-12-16 | 2015-07-01 | Ind Tech Res Inst | 深度精鍊與資料聚集的方法與系統 |
US9998725B2 (en) * | 2015-10-05 | 2018-06-12 | Electronics And Telecommunications Research Institute | Apparatus and method for generating depth information |
CN108460792A (zh) * | 2016-12-12 | 2018-08-28 | 南京理工大学 | 一种基于图像分割的高效聚焦立体匹配方法 |
CN110533710A (zh) * | 2019-08-22 | 2019-12-03 | 桂林电子科技大学 | 一种基于gpu的双目匹配算法的方法及处理装置 |
Non-Patent Citations (1)
Title |
---|
HUO GUANYING; LUO YING: "An Edge-constrained Iterative Cost Aggregation Method for Stereo Matching", 2019 IEEE INTERNATIONAL CONFERENCE ON ROBOTICS AND BIOMIMETICS (ROBIO), 6 December 2019 (2019-12-06), pages 1783 - 1790, XP033691875, DOI: 10.1109/ROBIO49542.2019.8961824 * |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114463409A (zh) * | 2022-02-11 | 2022-05-10 | 北京百度网讯科技有限公司 | 图像深度信息的确定方法、装置、电子设备和介质 |
CN114463409B (zh) * | 2022-02-11 | 2023-09-26 | 北京百度网讯科技有限公司 | 图像深度信息的确定方法、装置、电子设备和介质 |
US11783501B2 (en) | 2022-02-11 | 2023-10-10 | Beijing Baidu Netcom Science Technology Co., Ltd. | Method and apparatus for determining image depth information, electronic device, and media |
Also Published As
Publication number | Publication date |
---|---|
CN112823378A (zh) | 2021-05-18 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10559090B2 (en) | Method and apparatus for calculating dual-camera relative position, and device | |
US11838606B2 (en) | Methods and systems for large-scale determination of RGBD camera poses | |
EP3279803B1 (en) | Picture display method and device | |
CN106033621B (zh) | 一种三维建模的方法及装置 | |
KR101706216B1 (ko) | 고밀도 삼차원 영상 재구성 장치 및 방법 | |
TWI496114B (zh) | 影像追蹤裝置及其影像追蹤方法 | |
CN103426190B (zh) | 图像重构的方法及系统 | |
WO2022000458A1 (zh) | 图像深度信息确定方法、装置、设备和存储介质 | |
CN112150518B (zh) | 一种基于注意力机制的图像立体匹配方法及双目设备 | |
Lee et al. | Triangulation: why optimize? | |
US20170223333A1 (en) | Method and apparatus for processing binocular disparity image | |
CN107360354A (zh) | 拍照方法、装置、移动终端和计算机可读存储介质 | |
Bhayani et al. | Partially calibrated semi-generalized pose from hybrid point correspondences | |
CN115239912A (zh) | 一种基于视频图像的三维里面重建的方法 | |
Muresan et al. | A multi patch warping approach for improved stereo block matching | |
Ding et al. | Relative pose from a calibrated and an uncalibrated smartphone image | |
WO2017209213A1 (ja) | 画像処理装置、画像処理方法、及びコンピュータ読み取り可能な記録媒体 | |
CN112262411B (zh) | 图像关联方法、系统和装置 | |
CN113971629A (zh) | 图像恢复方法和装置 | |
Nousias et al. | A linear approach to absolute pose estimation for light fields | |
Tang et al. | Local subspace video stabilization | |
WO2022000456A1 (zh) | 图像处理方法、集成电路、装置及设备 | |
CN113688917B (zh) | 一种基于dem约束的双目视频图像匹配方法 | |
Ye et al. | Visual Odometry in HDR Environments by Using Spatially Varying Exposure Camera | |
WO2022000461A1 (zh) | 代价聚合方法、设备及存储介质 |
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: 20943778 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: 20943778 Country of ref document: EP Kind code of ref document: A1 |