WO2022012034A1 - Image processing method and apparatus, electronic device, and storage medium - Google Patents

Image processing method and apparatus, electronic device, and storage medium Download PDF

Info

Publication number
WO2022012034A1
WO2022012034A1 PCT/CN2021/075111 CN2021075111W WO2022012034A1 WO 2022012034 A1 WO2022012034 A1 WO 2022012034A1 CN 2021075111 W CN2021075111 W CN 2021075111W WO 2022012034 A1 WO2022012034 A1 WO 2022012034A1
Authority
WO
WIPO (PCT)
Prior art keywords
area
optimized
region
disparity
target
Prior art date
Application number
PCT/CN2021/075111
Other languages
French (fr)
Chinese (zh)
Inventor
王光甫
王珏
刘帅成
Original Assignee
北京迈格威科技有限公司
成都旷视金智科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京迈格威科技有限公司, 成都旷视金智科技有限公司 filed Critical 北京迈格威科技有限公司
Publication of WO2022012034A1 publication Critical patent/WO2022012034A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/50Depth or shape recovery
    • G06T7/55Depth or shape recovery from multiple images
    • G06T7/593Depth or shape recovery from multiple images from stereo images
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06T5/70
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/136Segmentation; Edge detection involving thresholding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/155Segmentation; Edge detection involving morphological operators
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/187Segmentation; Edge detection involving region growing; involving region merging; involving connected component labelling
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20024Filtering details
    • G06T2207/20028Bilateral filtering
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20228Disparity calculation for image-based rendering

Definitions

  • Binocular stereo vision has been widely used in industrial inspection, aerospace, robot navigation and other fields. Binocular stereo vision recovers the 3D depth information of the scene by calculating the disparity of spatial points on two images under the same scene.
  • Stereo matching is a key link in binocular stereo vision.
  • the result of stereo matching directly affects the 3D reconstruction effect, and stereo matching depends on the disparity map.
  • the disparity map obtained by stereo matching the two images used to generate the disparity map by the stereo matching algorithm
  • the disparity map often appears in the disparity map corresponding to some areas in the image used for generating the disparity map, such as weak texture areas A situation where the disparity value in the area is inaccurate. Therefore, after the disparity map is calculated, how to accurately determine the area to be optimized in the disparity map and how to optimize the disparity value of the pixels in the area to be optimized in the disparity map becomes a problem to be solved.
  • the present application provides an image processing method, an apparatus, an electronic device and a storage medium.
  • an image processing method including:
  • Determine all areas in the disparity map for determining the area to be optimized, and all areas used for determining the area to be optimized include at least one of the following items: at least one low-confidence area, at least one area corresponding to a weak texture area , at least one area corresponding to the repeated texture area, wherein, the low confidence area is determined by the confidence matrix of the disparity map output by the stereo matching algorithm used to generate the disparity map, and the weak texture area and the repeated texture area are determined by The images used to generate the disparity map are determined by detecting weak texture regions and repeating texture regions respectively;
  • the disparity values of the pixels in the to-be-optimized area are optimized to obtain an optimized disparity map.
  • determining the region to be optimized in the disparity map includes:
  • the determined union is determined as the region to be optimized.
  • optimizing the disparity values of the pixels in the area to be optimized to obtain an optimized disparity map includes:
  • morphological gradient extraction is performed on the target connected area to determine the edge of the target connected area; based on the original disparity value of the pixels in the area occupied by the edge of the target connected area, calculate The target disparity value of each pixel in the target connected area; modify the disparity value of each pixel in the target connected area to the target disparity value of each pixel.
  • determining a target connected region among all connected regions includes:
  • a connected region whose area is greater than the area threshold in all connected regions is determined as the target connected region.
  • calculating the target disparity value of each pixel in the target connected region based on the original disparity value of the pixels in the region occupied by the edge of the target connected region includes:
  • calculating the target disparity value of each pixel in the target connected area includes:
  • the method further includes:
  • a guided filtering algorithm and a fast bilateral filtering algorithm are used to smooth the region to be smoothed in the optimized disparity map.
  • an image processing apparatus including:
  • an associated area determination unit configured to determine all areas used for determining the area to be optimized, all areas used for determining the area to be optimized include at least one of the following items: at least one low-confidence area, at least one area with a weak texture a corresponding area, at least one area corresponding to a repetitive texture area, wherein the low confidence area is determined based on the confidence matrix of the disparity map output by the stereo matching algorithm used to generate the disparity map, the weak texture area , the repeated texture area is determined by performing weak texture area detection and repeated texture area detection on the image used to generate the disparity map respectively;
  • an area to be optimized determining unit configured to determine the area to be optimized in the disparity map based on all the areas used to determine the area to be optimized
  • the disparity map optimization unit is configured to optimize the disparity values of the pixels in the to-be-optimized area to obtain an optimized disparity map.
  • the region-to-be-optimized determination unit is further configured to determine a union of all regions used to determine the region to be optimized; and the determined union is determined as the region to be optimized.
  • the disparity map optimization unit includes:
  • the connected area optimization subunit is configured to use a connected area extraction algorithm to determine all connected areas in the area to be optimized; to determine the target connected area in all connected areas; for each target connected area, perform an operation on the target connected area. Morphological gradient extraction to determine the edge of the target connected area; based on the original disparity value of the pixels in the area occupied by the edge of the target connected area, calculate the target disparity of each pixel in the target connected area value; modify the disparity value of each pixel in the target connected region to the target disparity value of each pixel.
  • the connected region optimization subunit is further configured to determine a connected region whose area is greater than an area threshold among all connected regions as a target connected region.
  • the connected region optimization subunit is further configured to calculate the target for each pixel in the target connected region based on the original disparity values of all target pixels in the region occupied by the edge of the target connected region disparity value, where the target pixel is a pixel whose original disparity value is within a preset reasonable interval.
  • the connected area optimization sub-unit is further configured to calculate the average value of the original disparity values of all target pixels in the area occupied by the edge of the target connected area; take the average value as the target connected area The target disparity value for each pixel in the region.
  • the image processing apparatus further includes:
  • a smoothing unit configured to acquire feature information of an area corresponding to the area to be smoothed in the optimized disparity map in the image used to generate the disparity map
  • a guided filtering algorithm and a fast bilateral filtering algorithm are used to smooth the region to be smoothed in the optimized disparity map.
  • the pedestrian re-identification method and device realize the consideration of the low-confidence area in the disparity map, the area corresponding to the weak texture area in the disparity map, and the repeated texture area in the disparity map.
  • the association of the area with the area to be processed, based on all areas used to determine the area to be optimized including at least one of the following: at least one low confidence area, at least one area corresponding to a weak texture area, at least one area with Repeat the area corresponding to the texture area, accurately determine the area to be optimized in the disparity map, optimize the disparity value of the pixels in the area to be optimized, so as to accurately optimize the disparity map, and obtain a process with better optimization effect. Optimized disparity map.
  • FIG. 1 shows a flowchart of an image processing method provided by an embodiment of the present application
  • FIG. 2 shows a schematic flowchart of determining the area to be optimized in the disparity map
  • 3 shows a schematic flowchart of optimizing the disparity values of pixels in the area to be optimized in the disparity map
  • FIG. 4 shows a structural block diagram of an image processing apparatus provided by an embodiment of the present application
  • FIG. 5 shows a structural block diagram of an electronic device provided by an embodiment of the present application.
  • FIG. 1 shows a flowchart of an image processing method provided by an embodiment of the present application, and the method includes:
  • Step 101 Determine all areas in the disparity map for determining the area to be optimized.
  • all regions used to determine the region to be optimized include at least one of the following items: at least one low confidence region, at least one region corresponding to a weak texture region, at least one region corresponding to a repeated texture region area.
  • the low-confidence region in the disparity map can be used as the region for determining the region to be optimized. If the image used to generate the disparity map includes a weak texture area, correspondingly, the disparity map includes an area corresponding to the weak texture area, then the area corresponding to the weak texture area in the disparity map can be used as the area for determining the area to be optimized. area. If the image used to generate the disparity map includes a repeated texture area, correspondingly, the disparity map includes an area corresponding to the repeated texture area, and the area corresponding to the repeated texture area in the disparity map can be used as the area for determining the area to be optimized. area.
  • the disparity map is generated by stereo matching the left RGB image used to generate the disparity map and the right RGB image used to generate the disparity map by a stereo matching algorithm.
  • the pixel value of each pixel in the disparity map is a disparity value. Therefore, the pixel value of the pixel in the disparity map can be referred to as the disparity value of the pixel.
  • the stereo matching algorithm may be a traditional stereo matching algorithm such as SGBM and BM, or a stereo matching algorithm based on a convolutional neural network.
  • the output of the stereo matching algorithm includes a disparity map and a confidence matrix for the disparity map.
  • the confidence matrix elements in the confidence matrix correspond one-to-one with the disparity values of the pixels in the disparity map.
  • the value of the confidence matrix element in the confidence matrix is the confidence of the disparity value of the pixel in the disparity map corresponding to the confidence matrix element.
  • the position of the disparity value of the pixel in the disparity map is the same as the position of the confidence matrix element corresponding to the pixel in the confidence matrix, and the value of the confidence matrix element corresponding to the pixel is the confidence of the disparity value of this pixel.
  • the low-confidence area in the disparity map is an area in which the confidences of the pixels included in the disparity map are all smaller than the confidence threshold.
  • the number of low confidence regions in the disparity map may be one or more.
  • All pixels in the disparity map whose confidences of disparity values are smaller than the confidence threshold may be determined according to the confidence of each pixel in the disparity map described by the confidence matrix and the confidence threshold. At least one low-confidence region in the disparity map is determined according to the positions of all pixels in the disparity map having a confidence level of a disparity value less than a confidence level threshold.
  • the weak texture area may refer to the weak texture area in the left RGB image used to generate the disparity map.
  • the repeated texture area may refer to a repeated texture area in the left RGB image used to generate the disparity map.
  • weak texture area detection may be performed on the left RGB image used for generating the disparity map to determine the weak texture area in the left RGB image used for generating the disparity map.
  • Repeat texture region detection may be performed on the left RGB image used to generate the disparity map to determine repeated texture regions in the left RGB image used to generate the disparity map.
  • the determined number of weak texture areas may be one or more, in other words, the left RGB image used for generating the disparity map may include one or more Weak textured areas.
  • the determined number of repeated texture regions may be one or more, in other words, the left RGB image used for generating the disparity map may include one or more Repeat texture area.
  • each weak texture region corresponds to one region in the disparity map.
  • each repeated texture region corresponds to one region in the disparity map.
  • Each pixel in the disparity map corresponds to a pixel in the left RGB image used to generate the disparity map.
  • all pixels in the disparity map in the area corresponding to the weak texture area are composed of pixels in the disparity map corresponding to each pixel in the weak texture area, and the disparity map is the same as the pixel in the disparity map.
  • the area corresponding to the weak texture area is composed of the area occupied by the corresponding pixel of each pixel in all the weak texture areas. Therefore, for each weak texture area, after the weak texture area is determined through weak texture area detection, the area corresponding to the weak texture area in the disparity map can be determined.
  • all pixels in the disparity map in the region corresponding to the repeated texture region are composed of pixels in the disparity map corresponding to each pixel in the repeated texture region. Therefore, for each repeated texture region, after determining the repeated texture region through repeated texture region detection, a region corresponding to the repeated texture region in the disparity map can be determined.
  • a first pixel-level detection convolutional neural network may be used to perform weak texture region detection on the image used for generating the disparity map to determine the weak texture region in the image used for generating the disparity map.
  • a second pixel-level detection convolutional neural network may be used to perform repetitive texture region detection on the image used to generate the disparity map to determine repeated texture regions in the image used to generate the disparity map.
  • the first pixel-level detection convolutional neural network and the second pixel-level detection convolutional neural network are both neural networks used for semantic segmentation.
  • the structure of the first pixel-level detection convolutional neural network and the second pixel-level detection convolutional neural network same.
  • the first pixel-level detection convolutional neural network may be used to detect weak texture regions on the left RGB image used to generate the disparity map, so as to determine weak texture areas in the left RGB image used to generate the disparity map texture area.
  • the first pixel-level detection convolutional neural network is pre-trained with the training images. Each weakly textured region in the training image utilized to train the first pixel-level detection convolutional neural network is annotated.
  • the left RGB image used to generate the disparity map is input to the first pixel-level detection convolutional neural network, and the detection result output by the first pixel-level detection convolutional neural network may be an indication of the left RGB used to generate the disparity map. Whether each pixel in the image belongs to a weakly textured region of the image. Thus, according to the detection result, at least one weak texture area can be determined.
  • a second pixel-level detection convolutional neural network can be used to perform repetitive texture region detection on the left RGB image used to generate the disparity map to determine the repetition in the left RGB image used to generate the disparity map texture area.
  • the second pixel-level detection convolutional neural network is pre-trained with training. Repeated texture regions in the training image used to train the second pixel-level detection convolutional neural network are annotated.
  • the left RGB image used to generate the disparity map is input to the second pixel-level detection convolutional neural network, and the detection result output by the second pixel-level detection convolutional neural network may be an indication of the left RGB used to generate the disparity map Whether each pixel in the image belongs to an image with a repeating texture area. Thus, based on the detection result, at least one repeating texture region can be determined.
  • Step 102 Determine the area to be optimized in the disparity map based on all the areas used to determine the area to be optimized.
  • the independent area when determining the area to be optimized in the disparity map based on all the areas used to determine the area to be optimized, for each independent area in all the areas used to determine the area to be optimized, the independent area can be used as A subregion of the region to be optimized in the disparity map.
  • each area corresponding to the weak texture area corresponds to one weak texture area.
  • each region corresponding to the repeated texture region corresponds to one repeated texture region.
  • the independent area may refer to all the areas used for determining the area to be optimized that do not have overlapping parts with any other area used for determining the area to be optimized.
  • the non-independent regions may refer to all regions used for determining the regions to be optimized that have overlapping portions with at least one other region used for determining the regions to be optimized.
  • each area in all the areas used to determine the area to be optimized is an independent area, and the area to be optimized in the disparity map is determined by All areas used for determining the area to be optimized are composed, that is, the area to be optimized in the disparity map includes all areas used for determining the area to be optimized.
  • all the regions used to determine the region to be optimized include: at least one region of low confidence, at least one region corresponding to a weak texture region, and at least one region corresponding to a repeated texture region.
  • each low-confidence region is an independent region
  • each region in the disparity map corresponding to the weak texture region is The independent area
  • each area corresponding to the repeated texture area in the disparity map is an independent area
  • the area to be optimized in the disparity map is composed of each low-confidence area in the disparity map, each in the disparity map and weak.
  • the area corresponding to the texture area and each area in the disparity map corresponding to the repeated texture area are composed.
  • each overlapping portion belonging to the at least two dependent regions at the same time can be regarded as a sub-region of the region to be optimized in the disparity map.
  • the region to be optimized in the disparity map may be composed of each independent region, each of which simultaneously belongs to the overlapping portion of the at least two dependent regions.
  • the to-be-optimized area in the disparity map may include: each independent area, each overlapping part belonging to at least two dependent areas at the same time.
  • determining the region to be optimized in the disparity map includes: determining a union of all regions used for determining the region to be optimized; combining the determined union The set is determined as the region to be optimized in the disparity map.
  • the union of all the regions used to determine the region to be optimized is all the regions used to determine the region to be optimized.
  • the union of the regions used to determine the region to be optimized is taken as the region to be optimized, in other words, the region to be optimized consists of all the regions used to determine the region to be optimized.
  • all the regions used to determine the region to be optimized include: at least one region of low confidence, at least one region corresponding to a weak texture region, and at least one region corresponding to a repeated texture region.
  • the union of all the regions used to determine the region to be optimized is determined by each low-confidence region in the disparity map, the disparity map
  • Each of the regions corresponding to the weak texture region and each region corresponding to the repeated texture region in the disparity map is composed of, then the region to be optimized in the disparity map includes: each low-confidence region in the disparity map, the parallax Each region in the map corresponds to a weak texture region, and each region in the disparity map corresponds to a repeated texture region.
  • the union of all the regions used for determining the region to be optimized is determined by each independent region, each belonging to at least two dependent regions at the same time.
  • the areas to be optimized in the disparity map include: each independent area, each overlapping part belonging to at least two dependent areas at the same time, and each part belonging to only one dependent area and not the overlapping part.
  • FIG. 2 shows a schematic flowchart of determining an area to be optimized.
  • the area to be optimized may also be referred to as a parallax inaccuracy area.
  • the low confidence region in the disparity map can be determined according to the confidence matrix and the confidence threshold.
  • a low-confidence mask can be generated first.
  • Each pixel in the low-confidence mask corresponds to a pixel in the disparity map.
  • the pixel value of the pixel is a value of 1 indicating that the corresponding pixel belongs to the low-confidence region.
  • the pixel value of the pixel is a value of 0 indicating that its corresponding pixel does not belong to the low-confidence region.
  • the pixel value of the pixel is Modify it to 1 to get the mask image of the region to be optimized.
  • the to-be-optimized area mask image may be referred to as the to-be-optimized area mask.
  • Each pixel in the area mask to be optimized corresponds to one pixel in the disparity map.
  • the pixel value of the pixel corresponding to the pixel in the area to be optimized is 1 indicating that the corresponding pixel belongs to the area to be optimized, and the pixel value of the pixel corresponding to the pixel in the area not to be optimized It is a value of 0 indicating that its corresponding pixel does not belong to the area to be optimized.
  • All the pixels in the to-be-optimized area in the disparity map are composed of pixels corresponding to each pixel with a pixel value of 1 in each of the to-be-optimized area masks. Therefore, after obtaining the area mask to be optimized, the area to be optimized in the disparity map can be determined.
  • Step 103 Optimize the disparity values of the pixels in the area to be optimized to obtain an optimized disparity map.
  • the disparity values of the pixels in the area to be optimized are optimized.
  • Each pixel in the disparity map has an original disparity value.
  • the target disparity value of the pixel can be determined, and the disparity value of the pixel can be modified to the target disparity value. Therefore, the disparity value of the pixel is changed from the original disparity value of the pixel to the target disparity value of the pixel.
  • the target disparity value of the pixel For each pixel in the area to be optimized, when determining the target disparity value of the pixel, for each pixel in the area to be optimized, you can search for an effective pixel in the disparity map that is closest to the pixel and does not belong to the area to be optimized. For disparity pixels, the disparity value of the found effective disparity pixel can be used as the target pixel value of the pixel.
  • the method further includes: acquiring feature information of a region corresponding to the region to be smoothed in the optimized disparity map in the image used to generate the disparity map; based on the feature information, using a guided filtering algorithm and a fast bilateral The filtering algorithm smoothes the area to be smoothed in the optimized disparity map.
  • the area corresponding to the area to be smoothed in the optimized disparity map may be the area occupied by the subject in the left RGB image used to generate the disparity map.
  • the area corresponding to the to-be-smoothed area in the optimized disparity map may occupy the portrait area for the portrait in the left RGB image used to generate the disparity map.
  • the region to be smoothed in the optimized disparity map corresponds to the portrait region in the left RGB image for generating the disparity map.
  • the feature information of the area corresponding to the area to be smoothed in the optimized disparity map in the image used for generating the disparity map is information based on smoothing the area to be smoothed in the optimized disparity map.
  • the area corresponding to the area to be smoothed in the optimized disparity map is the portrait area in the left RGB image used to generate the disparity map, and the feature information may be the left RGB image used to generate the disparity map.
  • the gradient of each pixel in the portrait region is the portrait area in the left RGB image used to generate the disparity map.
  • the guided filtering algorithm and the fast bilateral filtering algorithm can be used to determine the region to be smoothed in the optimized disparity map. for smoothing. Therefore, the optimized disparity map is smoother, especially in the edge region, the change is not abrupt and the consistency is maintained.
  • optimizing the disparity values of pixels in the region to be optimized to obtain an optimized disparity map includes: determining all connected regions in the region to be optimized by using a connected region extraction algorithm; determining target connectivity in all connected regions area; for each target connected area, perform morphological gradient extraction on the target connected area to determine the edge of the target connected area; based on the original disparity value of the pixels in the area occupied by the edge of the target connected area, calculate the The target disparity value of each pixel in the target connected area; modify the disparity value of each pixel in the target connected area to the target disparity value of each pixel.
  • the connected area extraction algorithm can be used to determine each connected area in the mask area to be optimized based on the mask image of the area to be optimized corresponding to the disparity map, that is, the area mask to be optimized. a connected region.
  • the pixel value of each pixel in the area to be optimized mask image corresponding to each pixel in the area to be optimized is 1, and the area to be optimized in the disparity map can be quickly located through the mask image of the area to be optimized.
  • a connected region extraction algorithm may be used to extract a connected region in the region to be optimized in the disparity map, and each connected region in the region to be optimized in the disparity map is determined.
  • a target connected region in the region to be optimized can be determined.
  • each connected area can be individually used as a target connected area.
  • determining a target connected area in all connected areas includes: determining a connected area whose area is greater than an area threshold in all connected areas as a target connected area.
  • the connected regions with smaller areas can be eliminated, and the eliminated connected regions can be called ineffective regions.
  • morphological gradient extraction can be performed on the target connected region to determine the edge of the target connected region; based on the target connected region The original disparity value of the pixels in the area occupied by the edge of , calculate the target disparity value of each pixel in the target connected area; modify the disparity value of each pixel in the target connected area to Target disparity value.
  • morphological gradient extraction is performed on the target connected region to calculate the difference between the expansion map of the target connected region and the erosion map of the connected region to determine the edge of the target connected region.
  • the target of each pixel in the target connected region can be calculated based on the original disparity value of the pixels in the region occupied by the edge of the target connected region Parallax value.
  • the median of the original disparity values of all pixels in the region occupied by the edge of the target connected region or the average of all pixels in the region occupied by the edge of the target connected region can be determined value, the median or the average value is used as the target disparity value of each pixel in the target connected area, and the target disparity value of each pixel in the target connected area is the median or the average value value.
  • the disparity value of each pixel in the target connected area For each target connected area, after calculating the target disparity value of each pixel in the target connected area, you can, for each target connected area, modify the disparity value of each pixel in the target connected area to each The target disparity value of one pixel, that is, the disparity value filling is performed for each target connected area respectively, and the target disparity value of each pixel in the target connected area is filled to the position of the pixel. For each pixel in any target connected region, the disparity value of the pixel changes from the original disparity value to the target disparity value.
  • the disparity value of the pixels in each target connected region is optimized to obtain an optimized disparity map.
  • calculating the target disparity value of each pixel in the target connected region includes: based on The original disparity values of all target pixels in the area occupied by the edge of the target connected area are calculated, and the target disparity value of each pixel in the target connected area is calculated, wherein the original disparity value of the target pixel is in the preset value Pixels within a reasonable range.
  • the target disparity value of each pixel in the connected region can be calculated based on the original disparity values of all target pixels in the region occupied by the edge of the target connected region.
  • the median of the original disparity values of all target pixels in the region occupied by the edge of the target connected region can be determined, and the median is taken as the value of each pixel in the target connected region.
  • the target disparity value, the target disparity value of each pixel in the target connected region is the median.
  • calculating the target disparity value of each pixel in the target connected region based on the original disparity values of all target pixels in the region occupied by the edge of the target connected region includes: : Calculate the average value of the original disparity values of all target pixels in the area occupied by the edge of the target connected area; use the average value as the target disparity value of each pixel in the target connected area.
  • the average value of the original disparity values of all target pixels in the area occupied by the edge of the target connected area can be used as the target disparity of each pixel in the target connected area
  • the target disparity value of each pixel in the target connected region is the average value of the original disparity values of all target pixels in the region occupied by the edge of the target connected region.
  • the disparity value of each pixel in the target connected region is determined by the original
  • the disparity value becomes the average value of the original disparity values of all target pixels in the area occupied by the edge of the target connected area.
  • FIG. 3 shows a schematic flowchart of optimizing the disparity values of pixels in the area to be optimized in the disparity map.
  • Optimizing the disparity values of pixels in the area to be optimized in the disparity map may also be referred to as a local compensation algorithm.
  • a connected region extraction algorithm is used to determine each connected region in the region to be optimized based on the mask image of the region to be optimized corresponding to the disparity map, that is, the region mask to be optimized.
  • the pixel value of each pixel in the to-be-optimized area mask corresponding to each pixel in the to-be-optimized area mask is 1, and the to-be-optimized area mask can be used to quickly locate the to-be-optimized area.
  • the connected region extraction algorithm can be used to extract the connected region of the region to be optimized, and each connected region in the region to be optimized can be determined.
  • the connected regions whose area is larger than the area threshold are determined as the target connected regions, so that the connected regions with smaller areas are eliminated, that is, the ineffective regions.
  • morphological gradient extraction is performed on the target connected region to determine the edge of the target connected region.
  • the average value of the original disparity values of all target pixels in the region occupied by the edge of the target connected region can be used as the target disparity value of each pixel in the target connected region.
  • Disparity filling is performed on each target connected area, that is, for each target connected area, the target disparity value of each pixel in the target connected area is filled to the position of the pixel.
  • the disparity value of each pixel in the target connected area is changed from the original disparity value to the average value of the original disparity values of all target pixels in the area occupied by the edge of the target connected area.
  • FIG. 4 shows a structural block diagram of an image processing apparatus provided by an embodiment of the present application.
  • the image processing apparatus includes: an associated area determination unit 401 , a to-be-optimized area determination unit 402 , and a disparity map optimization unit 403 .
  • an associated area determination unit configured to determine all areas in the disparity map for determining the area to be optimized, all areas used for determining the area to be optimized include at least one of the following items: at least one low-confidence area, at least one regions corresponding to regions of weak texture, at least one region corresponding to regions of repeated texture, wherein regions of low confidence are determined based on a confidence matrix of the disparity map output by a stereo matching algorithm used to generate the disparity map , the weak texture area and the repeated texture area are determined by respectively performing weak texture area detection and repeated texture area detection on the image used to generate the disparity map;
  • an area to be optimized determining unit configured to determine the area to be optimized in the disparity map based on all the areas used to determine the area to be optimized
  • the disparity map optimization unit is configured to optimize the disparity values of the pixels in the to-be-optimized area to obtain an optimized disparity map.
  • the region-to-be-optimized determination unit is further configured to determine a union of all regions used to determine the region to be optimized; and determine the determined union as the region to be optimized in the disparity map.
  • the disparity map optimization unit includes:
  • the connected area optimization subunit is configured to use a connected area extraction algorithm to determine all connected areas in the area to be optimized; to determine the target connected area in all connected areas; for each target connected area, perform an operation on the target connected area. Morphological gradient extraction to determine the edge of the target connected area; based on the original disparity value of the pixels in the area occupied by the edge of the target connected area, calculate the target disparity of each pixel in the target connected area value; modify the disparity value of each pixel in the target connected region to the target disparity value of each pixel.
  • the connected region optimization subunit is further configured to determine a connected region whose area is greater than an area threshold among all connected regions as a target connected region.
  • the connected region optimization subunit is further configured to calculate a target for each pixel in the target connected region based on the original disparity values of all target pixels in the region occupied by the edge of the target connected region disparity value, where the target pixel is a pixel whose original disparity value is within a preset reasonable interval.
  • the connected area optimization sub-unit is further configured to calculate the average value of the original disparity values of all target pixels in the area occupied by the edge of the target connected area; take the average value as the target connected area The target disparity value for each pixel in the region.
  • the image processing apparatus further includes:
  • a smoothing unit configured to acquire feature information of an area corresponding to the area to be smoothed in the optimized disparity map in the image used to generate the disparity map
  • a guided filtering algorithm and a fast bilateral filtering algorithm are used to smooth the region to be smoothed in the optimized disparity map.
  • FIG. 5 is a structural block diagram of an electronic device provided in this embodiment.
  • the electronic device includes a processing component 522, which further includes one or more processors, and a memory resource, represented by memory 532, for storing instructions, such as application programs, executable by the processing component 522.
  • An application program stored in memory 532 may include one or more modules, each corresponding to a set of instructions.
  • the processing component 522 is configured to execute instructions to perform the above-described methods.
  • the electronic device may also include a power supply assembly 526 configured to perform power management of the electronic device, a wired or wireless network interface 550 configured to connect the electronic device to a network, and an input output (I/O) interface 558.
  • the electronic device may operate based on an operating system stored in memory 532, such as Windows ServerTM, MacOS XTM, UnixTM, LinuxTM, FreeBSDTM or the like.
  • a storage medium including instructions such as a memory including instructions, is also provided, and the instructions are executable by an electronic device to perform the above method.
  • the storage medium may be a non-transitory computer-readable storage medium, for example, the non-transitory computer-readable storage medium may be ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage equipment, etc.
  • references herein to "one embodiment,” “an embodiment,” or “one or more embodiments” means that a particular feature, structure, or characteristic described in connection with an embodiment is included in at least one embodiment of the present invention. Also, please note that instances of the phrase “in one embodiment” herein are not necessarily all referring to the same embodiment.
  • any reference signs placed between parentheses shall not be construed as limiting the claim.
  • the word “comprising” does not exclude the presence of elements or steps not listed in a claim.
  • the word “a” or “an” preceding an element does not exclude the presence of a plurality of such elements.
  • the invention can be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means may be embodied by one and the same item of hardware.
  • the use of the words first, second, and third, etc. do not denote any order. These words can be interpreted as names.

Abstract

Embodiments of the present application provide an image processing method and apparatus, an electronic device, and a storage medium. The method comprises: determining all regions used for determining a region to be optimized, the all regions used for determining a region to be optimized comprising at least one of the following: at least one low-confidence region, at least one region corresponding to a weak texture region, and at least one region corresponding to a repeating texture region; determining, on the basis of all regions used for determining a region to be optimized, a region to be optimized in a disparity map; and optimizing disparity values of pixels in the region to be optimized to obtain an optimized disparity map. A region to be optimized in a disparity map is accurately determined, and disparity values of pixels in the region to be optimized in the disparity map are optimized to accurately optimize the disparity map, thereby obtaining an optimized disparity map having a better optimization effect.

Description

图像处理方法、装置、电子设备及存储介质Image processing method, device, electronic device and storage medium
本申请要求在2020年7月14日提交中国专利局、申请号为202010676768.6、发明名称为“图像处理方法、装置、电子设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed on July 14, 2020 with the application number 202010676768.6 and the title of the invention is "image processing method, device, electronic device and storage medium", the entire contents of which are incorporated by reference in this application.
技术领域technical field
计算机领域computer field
背景技术Background technique
双目立体视觉在工业检测、航空航天、机器人导航等领域均得到了广泛的运用。双目立体视觉通过计算同一场景下空间点在两个图像上的视差来恢复场景的三维深度信息。Binocular stereo vision has been widely used in industrial inspection, aerospace, robot navigation and other fields. Binocular stereo vision recovers the 3D depth information of the scene by calculating the disparity of spatial points on two images under the same scene.
立体匹配是双目立体视觉中的关键环节,立体匹配的结果直接影响三维重构效果,立体匹配依赖于视差图。Stereo matching is a key link in binocular stereo vision. The result of stereo matching directly affects the 3D reconstruction effect, and stereo matching depends on the disparity map.
在通过立体匹配算法对用于生成视差图的两个图像进行立体匹配得到的视差图中,经常出现在视差图中的与用于生成视差图的图像中的一些区域例如弱纹理区域相对应的区域中的视差值不准确的情况。因此,在计算出视差图之后,如何准确地确定视差图中的需要优化的待优化区域,对视差图中的待优化区域中的像素的视差值进行优化成为一个需要解决的问题。In the disparity map obtained by stereo matching the two images used to generate the disparity map by the stereo matching algorithm, the disparity map often appears in the disparity map corresponding to some areas in the image used for generating the disparity map, such as weak texture areas A situation where the disparity value in the area is inaccurate. Therefore, after the disparity map is calculated, how to accurately determine the area to be optimized in the disparity map and how to optimize the disparity value of the pixels in the area to be optimized in the disparity map becomes a problem to be solved.
发明内容SUMMARY OF THE INVENTION
为克服相关技术中存在的问题,本申请提供一种图像处理方法、装置、电子设备及存储介质。In order to overcome the problems existing in the related art, the present application provides an image processing method, an apparatus, an electronic device and a storage medium.
根据本申请实施例的第一方面,提供一种图像处理方法,包括:According to a first aspect of the embodiments of the present application, an image processing method is provided, including:
确定视差图中的所有用于确定待优化区域的区域,所有用于确定待优化区域的区域包括以下项中的至少一项:至少一个低置信度区域、至少一个与弱纹理区域相对应的区域、至少一个与重复纹理区域相对应的区域,其中,低置信度区域通过用于生成所述视差图的立体匹配算法输出的视差图的置信度矩阵而确定,弱纹理区域、重复纹理区域通过对用于生成所述视差图的 图像分别进行弱纹理区域检测、重复纹理区域检测而确定;Determine all areas in the disparity map for determining the area to be optimized, and all areas used for determining the area to be optimized include at least one of the following items: at least one low-confidence area, at least one area corresponding to a weak texture area , at least one area corresponding to the repeated texture area, wherein, the low confidence area is determined by the confidence matrix of the disparity map output by the stereo matching algorithm used to generate the disparity map, and the weak texture area and the repeated texture area are determined by The images used to generate the disparity map are determined by detecting weak texture regions and repeating texture regions respectively;
基于所有用于确定待优化区域的区域,确定视差图中的待优化区域;Determine the area to be optimized in the disparity map based on all the areas used to determine the area to be optimized;
对所述待优化区域中的像素的视差值进行优化,得到经过优化的视差图。The disparity values of the pixels in the to-be-optimized area are optimized to obtain an optimized disparity map.
在一些实施例中,基于所有用于确定待优化区域的区域,确定所述视差图中的待优化区域包括:In some embodiments, based on all the regions used to determine the region to be optimized, determining the region to be optimized in the disparity map includes:
确定所有用于确定待优化区域的区域的并集;Determine the union of all regions used to determine the region to be optimized;
将确定的并集确定为待优化区域。The determined union is determined as the region to be optimized.
在一些实施例中,对所述待优化区域中的像素的视差值进行优化,得到经过优化的视差图包括:In some embodiments, optimizing the disparity values of the pixels in the area to be optimized to obtain an optimized disparity map includes:
利用连通域提取算法确定所述待优化区域中的所有连通区域;Determine all connected regions in the to-be-optimized region by using a connected region extraction algorithm;
确定所有连通区域中的目标连通区域;Determine the target connected region among all connected regions;
对于每一个目标连通区域,对所述目标连通区域进行形态学梯度提取,以确定所述目标连通区域的边缘;基于所述目标连通区域的边缘占据的区域中的像素的原始视差值,计算所述目标连通区域中的每一个像素的目标视差值;将所述目标连通区域中的每一个像素的视差值修改为每一个像素的目标视差值。For each target connected area, morphological gradient extraction is performed on the target connected area to determine the edge of the target connected area; based on the original disparity value of the pixels in the area occupied by the edge of the target connected area, calculate The target disparity value of each pixel in the target connected area; modify the disparity value of each pixel in the target connected area to the target disparity value of each pixel.
在一些实施例中,确定所有连通区域中的目标连通区域包括:In some embodiments, determining a target connected region among all connected regions includes:
将所有连通区域中的面积大于面积阈值的连通区域确定为目标连通区域。A connected region whose area is greater than the area threshold in all connected regions is determined as the target connected region.
在一些实施例中,基于所述目标连通区域的边缘占据的区域中的像素的原始视差值,计算所述目标连通区域中的每一个像素的目标视差值包括:In some embodiments, calculating the target disparity value of each pixel in the target connected region based on the original disparity value of the pixels in the region occupied by the edge of the target connected region includes:
基于所述目标连通区域的边缘占据的区域中的所有目标像素的原始视差值,计算所述目标连通区域中的每一个像素的目标视差值,其中,目标像素为具有的原始视差值处于预设合理区间内的像素。Based on the original disparity values of all target pixels in the area occupied by the edge of the target connected area, calculate the target disparity value of each pixel in the target connected area, wherein the target pixel has the original disparity value of Pixels within a preset reasonable range.
在一些实施例中,基于所述目标连通区域的边缘占据的区域中的所有目标像素的原始视差值,计算所述目标连通区域中的每一个像素的目标视差值包括:In some embodiments, based on the original disparity values of all target pixels in the area occupied by the edge of the target connected area, calculating the target disparity value of each pixel in the target connected area includes:
计算所述目标连通区域的边缘占据的区域中的所有目标像素的原始视差值的平均值;将所述平均值作为所述目标连通区域中的每一个像素的目标 视差值。Calculate the average value of the original disparity values of all target pixels in the area occupied by the edge of the target connected area; take the average value as the target disparity value of each pixel in the target connected area.
在一些实施例中,所述方法还包括:In some embodiments, the method further includes:
获取用于生成视差图的图像中的与经过优化的视差图中的待平滑区域相对应的区域的特征信息;obtaining feature information of the region corresponding to the region to be smoothed in the optimized disparity map in the image used to generate the disparity map;
基于所述特征信息,利用引导滤波算法和快速双边滤波算法对经过优化的视差图中的待平滑区域进行平滑处理。Based on the feature information, a guided filtering algorithm and a fast bilateral filtering algorithm are used to smooth the region to be smoothed in the optimized disparity map.
根据本申请实施例的第二方面,提供一种图像处理装置,包括:According to a second aspect of the embodiments of the present application, an image processing apparatus is provided, including:
关联区域确定单元,被配置为确定所有用于确定待优化区域的区域,所有用于确定待优化区域的区域包括以下项中的至少一项:至少一个低置信度区域、至少一个与弱纹理区域相对应的区域、至少一个与重复纹理区域相对应的区域,其中,低置信度区域基于用于生成所述视差图的立体匹配算法输出的所述视差图的置信度矩阵而确定,弱纹理区域、重复纹理区域通过对用于生成所述视差图的图像分别进行弱纹理区域检测、重复纹理区域检测而确定;an associated area determination unit, configured to determine all areas used for determining the area to be optimized, all areas used for determining the area to be optimized include at least one of the following items: at least one low-confidence area, at least one area with a weak texture a corresponding area, at least one area corresponding to a repetitive texture area, wherein the low confidence area is determined based on the confidence matrix of the disparity map output by the stereo matching algorithm used to generate the disparity map, the weak texture area , the repeated texture area is determined by performing weak texture area detection and repeated texture area detection on the image used to generate the disparity map respectively;
待优化区域确定单元,被配置为基于所有用于确定待优化区域的区域,确定视差图中的待优化区域;an area to be optimized determining unit, configured to determine the area to be optimized in the disparity map based on all the areas used to determine the area to be optimized;
视差图优化单元,被配置为对所述待优化区域中的像素的视差值进行优化,得到经过优化的视差图。The disparity map optimization unit is configured to optimize the disparity values of the pixels in the to-be-optimized area to obtain an optimized disparity map.
在一些实施例中,待优化区域确定单元进一步被配置为确定所有用于确定待优化区域的区域的并集;将确定的并集确定为待优化区域。In some embodiments, the region-to-be-optimized determination unit is further configured to determine a union of all regions used to determine the region to be optimized; and the determined union is determined as the region to be optimized.
在一些实施例中,视差图优化单元包括:In some embodiments, the disparity map optimization unit includes:
连通区域优化子单元,被配置为利用连通域提取算法确定所述待优化区域中的所有连通区域;确定所有连通区域中的目标连通区域;对于每一个目标连通区域,对所述目标连通区域进行形态学梯度提取,以确定所述目标连通区域的边缘;基于所述目标连通区域的边缘占据的区域中的像素的原始视差值,计算所述目标连通区域中的每一个像素的目标视差值;将所述目标连通区域中的每一个像素的视差值修改为每一个像素的目标视差值。The connected area optimization subunit is configured to use a connected area extraction algorithm to determine all connected areas in the area to be optimized; to determine the target connected area in all connected areas; for each target connected area, perform an operation on the target connected area. Morphological gradient extraction to determine the edge of the target connected area; based on the original disparity value of the pixels in the area occupied by the edge of the target connected area, calculate the target disparity of each pixel in the target connected area value; modify the disparity value of each pixel in the target connected region to the target disparity value of each pixel.
在一些实施例中,连通区域优化子单元进一步被配置为将所有连通区域中的面积大于面积阈值的连通区域确定为目标连通区域。In some embodiments, the connected region optimization subunit is further configured to determine a connected region whose area is greater than an area threshold among all connected regions as a target connected region.
在一些实施例中,连通区域优化子单元进一步被配置为基于所述目标连 通区域的边缘占据的区域中的所有目标像素的原始视差值,计算所述目标连通区域中的每一个像素的目标视差值,其中,目标像素为具有的原始视差值处于预设合理区间内的像素。In some embodiments, the connected region optimization subunit is further configured to calculate the target for each pixel in the target connected region based on the original disparity values of all target pixels in the region occupied by the edge of the target connected region disparity value, where the target pixel is a pixel whose original disparity value is within a preset reasonable interval.
在一些实施例中,连通区域优化子单元进一步被配置为计算所述目标连通区域的边缘占据的区域中的所有目标像素的原始视差值的平均值;将所述平均值作为所述目标连通区域中的每一个像素的目标视差值。In some embodiments, the connected area optimization sub-unit is further configured to calculate the average value of the original disparity values of all target pixels in the area occupied by the edge of the target connected area; take the average value as the target connected area The target disparity value for each pixel in the region.
在一些实施例中,图像处理装置还包括:In some embodiments, the image processing apparatus further includes:
平滑单元,被配置为获取用于生成视差图的图像中的与经过优化的视差图中的待平滑区域相对应的区域的特征信息;a smoothing unit, configured to acquire feature information of an area corresponding to the area to be smoothed in the optimized disparity map in the image used to generate the disparity map;
基于所述特征信息,利用引导滤波算法和快速双边滤波算法对经过优化的视差图中的待平滑区域进行平滑处理。Based on the feature information, a guided filtering algorithm and a fast bilateral filtering algorithm are used to smooth the region to be smoothed in the optimized disparity map.
本申请实施例提供的行人再识别方法、装置,实现了考虑了视差图中的低置信度区域、视差图中的与弱纹理区域相对应的区域、视差图中的与重复纹理区域相对应的区域与待处理区域的关联性,基于包括以下项中的至少一项的所有用于确定待优化区域的区域:至少一个低置信度区域、至少一个与弱纹理区域相对应的区域、至少一个与重复纹理区域相对应的区域,准确地确定视差图中的待优化区域,对待优化区域中的像素的视差值进行优化,以对视差图进行准确地优化,得到具有较好的优化效果的经过优化的视差图。The pedestrian re-identification method and device provided by the embodiments of the present application realize the consideration of the low-confidence area in the disparity map, the area corresponding to the weak texture area in the disparity map, and the repeated texture area in the disparity map. The association of the area with the area to be processed, based on all areas used to determine the area to be optimized including at least one of the following: at least one low confidence area, at least one area corresponding to a weak texture area, at least one area with Repeat the area corresponding to the texture area, accurately determine the area to be optimized in the disparity map, optimize the disparity value of the pixels in the area to be optimized, so as to accurately optimize the disparity map, and obtain a process with better optimization effect. Optimized disparity map.
上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术手段,而可依照说明书的内容予以实施,并且为了让本发明的上述和其它目的、特征和优点能够更明显易懂,以下特举本发明的具体实施方式。The above description is only an overview of the technical solutions of the present invention, in order to be able to understand the technical means of the present invention more clearly, it can be implemented according to the content of the description, and in order to make the above and other objects, features and advantages of the present invention more obvious and easy to understand , the following specific embodiments of the present invention are given.
附图说明Description of drawings
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the accompanying drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description These are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can also be obtained according to these drawings without creative efforts.
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本申请的实施例,并与说明书一起用于解释本申请的原理。The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description serve to explain the principles of the application.
图1示出了本申请实施例提供的图像处理方法的流程图;FIG. 1 shows a flowchart of an image processing method provided by an embodiment of the present application;
图2示出了确定视差图中的待优化区域的流程示意图;FIG. 2 shows a schematic flowchart of determining the area to be optimized in the disparity map;
图3示出了对视差图中的待优化区域中的像素的视差值进行优化的流程示意图;3 shows a schematic flowchart of optimizing the disparity values of pixels in the area to be optimized in the disparity map;
图4示出了本申请实施例提供的图像处理装置的结构框图;FIG. 4 shows a structural block diagram of an image processing apparatus provided by an embodiment of the present application;
图5示出了本申请实施例提供的电子设备的结构框图。FIG. 5 shows a structural block diagram of an electronic device provided by an embodiment of the present application.
具体实施例specific embodiment
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the purposes, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments These are some embodiments of the present invention, but not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
下面结合附图和实施例对本申请作进一步的详细说明。可以理解的是,此处所描述的具体实施例仅仅用于解释相关发明,而非对该发明的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与有关发明相关的部分。The present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the related invention, but not to limit the invention. In addition, it should be noted that, for the convenience of description, only the parts related to the related invention are shown in the drawings.
需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。下面将参考附图并结合实施例来详细说明本申请。It should be noted that the embodiments in the present application and the features of the embodiments may be combined with each other in the case of no conflict. The present application will be described in detail below with reference to the accompanying drawings and in conjunction with the embodiments.
图1示出了本申请实施例提供的图像处理方法的流程图,该方法包括:FIG. 1 shows a flowchart of an image processing method provided by an embodiment of the present application, and the method includes:
步骤101,确定视差图中的所有用于确定待优化区域的区域。Step 101: Determine all areas in the disparity map for determining the area to be optimized.
在本申请中,所有用于确定待优化区域的区域包括以下项中的至少一项:至少一个低置信度区域、至少一个与弱纹理区域相对应的区域、至少一个与重复纹理区域相对应的区域。In this application, all regions used to determine the region to be optimized include at least one of the following items: at least one low confidence region, at least one region corresponding to a weak texture region, at least one region corresponding to a repeated texture region area.
在本申请中,若视差图包括低置信度区域,则视差图中的低置信度区域可以作为用于确定用于确定待优化区域的区域。若用于生成视差图的图像包括弱纹理区域,相应的,视差图包括与弱纹理区域相对应的区域,则视差图中的与弱纹理区域相对应的区域可以作为用于确定待优化区域的区域。若用于生成视差图的图像包括重复纹理区域,相应的,视差图包括与重复纹理区域相对应的区域,则视差图中的与重复纹理区域相对应的区域可以作为用于确定待优化区域的区域。In the present application, if the disparity map includes a low-confidence region, the low-confidence region in the disparity map can be used as the region for determining the region to be optimized. If the image used to generate the disparity map includes a weak texture area, correspondingly, the disparity map includes an area corresponding to the weak texture area, then the area corresponding to the weak texture area in the disparity map can be used as the area for determining the area to be optimized. area. If the image used to generate the disparity map includes a repeated texture area, correspondingly, the disparity map includes an area corresponding to the repeated texture area, and the area corresponding to the repeated texture area in the disparity map can be used as the area for determining the area to be optimized. area.
视差图通过立体匹配算法对用于生成该视差图的左侧RGB图像和用于 生成该视差图的右侧RGB图像进行立体匹配而生成。视差图中的每一个像素的像素值各自为一个视差值,因此,可以将视差图中的像素的像素值称之为像素的视差值。The disparity map is generated by stereo matching the left RGB image used to generate the disparity map and the right RGB image used to generate the disparity map by a stereo matching algorithm. The pixel value of each pixel in the disparity map is a disparity value. Therefore, the pixel value of the pixel in the disparity map can be referred to as the disparity value of the pixel.
立体匹配算法可以为SGBM、BM等传统的立体匹配算法,也可以为基于卷积神经网络的立体匹配算法。The stereo matching algorithm may be a traditional stereo matching algorithm such as SGBM and BM, or a stereo matching algorithm based on a convolutional neural network.
立体匹配算法的输出结果包括视差图和视差图的置信度矩阵。The output of the stereo matching algorithm includes a disparity map and a confidence matrix for the disparity map.
置信度矩阵中的置信度矩阵元素与视差图中的像素的视差值一一对应。置信度矩阵中的置信度矩阵元素的取值为置信度矩阵元素对应的视差图中的像素的视差值的置信度。The confidence matrix elements in the confidence matrix correspond one-to-one with the disparity values of the pixels in the disparity map. The value of the confidence matrix element in the confidence matrix is the confidence of the disparity value of the pixel in the disparity map corresponding to the confidence matrix element.
对于视差图中的每一个像素,该像素的视差值在视差图中的位置与该像素对应的置信度矩阵元素在置信度矩阵中的位置相同,该像素对应的置信度矩阵元素的取值为该像素的视差值的置信度。For each pixel in the disparity map, the position of the disparity value of the pixel in the disparity map is the same as the position of the confidence matrix element corresponding to the pixel in the confidence matrix, and the value of the confidence matrix element corresponding to the pixel is the confidence of the disparity value of this pixel.
视差图中的低置信度区域为视差图中的包括的像素的置信度均小于置信度阈值的区域。视差图中的低置信度区域的数量可以为一个或多个。The low-confidence area in the disparity map is an area in which the confidences of the pixels included in the disparity map are all smaller than the confidence threshold. The number of low confidence regions in the disparity map may be one or more.
可以根据在置信度矩阵描述的视差图中的每一个像素的置信度、置信度阈值,确定视差图中的所有具有的视差值的置信度小于置信度阈值的像素。根据视差图中的所有具有的视差值的置信度小于置信度阈值的像素的位置,确定出视差图中的至少一个低置信度区域。All pixels in the disparity map whose confidences of disparity values are smaller than the confidence threshold may be determined according to the confidence of each pixel in the disparity map described by the confidence matrix and the confidence threshold. At least one low-confidence region in the disparity map is determined according to the positions of all pixels in the disparity map having a confidence level of a disparity value less than a confidence level threshold.
在本申请中,弱纹理区域可以是指用于生成视差图的左侧RGB图像中的弱纹理区域。重复纹理区域可以是指用于生成视差图的左侧RGB图像中的重复纹理区域。In this application, the weak texture area may refer to the weak texture area in the left RGB image used to generate the disparity map. The repeated texture area may refer to a repeated texture area in the left RGB image used to generate the disparity map.
在本申请中,可以对用于生成视差图的左侧RGB图像进行弱纹理区域检测,以确定用于生成视差图的左侧RGB图像中的弱纹理区域。可以对用于生成视差图的左侧RGB图像进行重复纹理区域检测,以确定用于生成该视差图的左侧RGB图像中的重复纹理区域。In the present application, weak texture area detection may be performed on the left RGB image used for generating the disparity map to determine the weak texture area in the left RGB image used for generating the disparity map. Repeat texture region detection may be performed on the left RGB image used to generate the disparity map to determine repeated texture regions in the left RGB image used to generate the disparity map.
在用于生成视差图的左侧RGB图像包括弱纹理区域时,确定出的弱纹理区域的数量可以为一个或多个,换言之,用于生成视差图的左侧RGB图像可以包括一个或多个弱纹理区域。在用于生成视差图的左侧RGB图像包括重复纹理区域时,确定出的重复纹理区域的数量可以为一个或多个,换言之,用于生成视差图的左侧RGB图像可以包括一个或多个重复纹理区域。When the left RGB image used for generating the disparity map includes weak texture areas, the determined number of weak texture areas may be one or more, in other words, the left RGB image used for generating the disparity map may include one or more Weak textured areas. When the left RGB image used for generating the disparity map includes repeated texture regions, the determined number of repeated texture regions may be one or more, in other words, the left RGB image used for generating the disparity map may include one or more Repeat texture area.
在弱纹理区域的数量为多个时,每一个弱纹理区域各自对应视差图中的一个区域。在重复纹理区域的数量为多个时,每一个重复纹理区域各自对应视差图中的一个区域。When there are multiple weak texture regions, each weak texture region corresponds to one region in the disparity map. When the number of repeated texture regions is multiple, each repeated texture region corresponds to one region in the disparity map.
视差图中的每一个像素各自对应用于生成该视差图的左侧RGB图像中的一个像素。Each pixel in the disparity map corresponds to a pixel in the left RGB image used to generate the disparity map.
对于每一个弱纹理区域,视差图中的与该弱纹理区域相对应的区域中的所有像素由该弱纹理区域中的每一个像素各自对应的视差图中的像素组成,视差图中的与该弱纹理区域相对应的区域为所有该弱纹理区域中的每一个像素各自对应的像素占据的区域组成。因此,对于每一个弱纹理区域,在通过弱纹理区域检测来确定该弱纹理区域之后,可以确定视差图中的与该弱纹理区域相对应的区域。For each weak texture area, all pixels in the disparity map in the area corresponding to the weak texture area are composed of pixels in the disparity map corresponding to each pixel in the weak texture area, and the disparity map is the same as the pixel in the disparity map. The area corresponding to the weak texture area is composed of the area occupied by the corresponding pixel of each pixel in all the weak texture areas. Therefore, for each weak texture area, after the weak texture area is determined through weak texture area detection, the area corresponding to the weak texture area in the disparity map can be determined.
对于每一个重复纹理区域,视差图中的与该重复纹理区域相对应的区域中的所有像素由该重复纹理区域中的每一个像素各自对应的视差图中的像素组成。因此,对于每一个重复纹理区域,在在通过重复纹理区域检测来确定该重复纹理区域之后,可以确定视差图中的与该重复纹理区域相对应的区域。For each repeated texture region, all pixels in the disparity map in the region corresponding to the repeated texture region are composed of pixels in the disparity map corresponding to each pixel in the repeated texture region. Therefore, for each repeated texture region, after determining the repeated texture region through repeated texture region detection, a region corresponding to the repeated texture region in the disparity map can be determined.
在本申请中,可以利用第一像素级检测卷积神经网络对用于生成视差图的图像进行弱纹理区域检测,以确定用于生成视差图的图像中的弱纹理区域。可以利用第二像素级检测卷积神经网络对用于生成视差图的图像进行重复纹理区域检测,以确定用于生成视差图的图像中的重复纹理区域。In the present application, a first pixel-level detection convolutional neural network may be used to perform weak texture region detection on the image used for generating the disparity map to determine the weak texture region in the image used for generating the disparity map. A second pixel-level detection convolutional neural network may be used to perform repetitive texture region detection on the image used to generate the disparity map to determine repeated texture regions in the image used to generate the disparity map.
第一像素级检测卷积神经网络、第二像素级检测卷积神经网络均为用于语义分割的神经网络,第一像素级检测卷积神经网络、第二像素级检测卷积神经网络的结构相同。The first pixel-level detection convolutional neural network and the second pixel-level detection convolutional neural network are both neural networks used for semantic segmentation. The structure of the first pixel-level detection convolutional neural network and the second pixel-level detection convolutional neural network same.
在本申请中,可以利用第一像素级检测卷积神经网络对用于生成该视差图的左侧RGB图像进行弱纹理区域检测,以确定用于生成该视差图的左侧RGB图像中的弱纹理区域。In the present application, the first pixel-level detection convolutional neural network may be used to detect weak texture regions on the left RGB image used to generate the disparity map, so as to determine weak texture areas in the left RGB image used to generate the disparity map texture area.
预先利用训练图像对第一像素级检测卷积神经网络进行训练。对第一像素级检测卷积神经网络进行训练所利用的训练图像中的每一个弱纹理区域被标注。The first pixel-level detection convolutional neural network is pre-trained with the training images. Each weakly textured region in the training image utilized to train the first pixel-level detection convolutional neural network is annotated.
将用于生成该视差图的左侧RGB图像输入到第一像素级检测卷积神经 网络,第一像素级检测卷积神经网络输出的检测结果可以为指示用于生成该视差图的左侧RGB图像中的每一个像素是否属于弱纹理区域的图像。从而,根据该检测结果,可以确定至少一个弱纹理区域。The left RGB image used to generate the disparity map is input to the first pixel-level detection convolutional neural network, and the detection result output by the first pixel-level detection convolutional neural network may be an indication of the left RGB used to generate the disparity map. Whether each pixel in the image belongs to a weakly textured region of the image. Thus, according to the detection result, at least one weak texture area can be determined.
在本申请中,可以利用第二像素级检测卷积神经网络对用于生成该视差图的左侧RGB图像进行重复纹理区域检测,以确定用于生成该视差图的左侧RGB图像中的重复纹理区域。In the present application, a second pixel-level detection convolutional neural network can be used to perform repetitive texture region detection on the left RGB image used to generate the disparity map to determine the repetition in the left RGB image used to generate the disparity map texture area.
预先利用训练对第二像素级检测卷积神经网络进行训练。对第二像素级检测卷积神经网络进行训练所利用的训练图像中的重复纹理区域被标注。The second pixel-level detection convolutional neural network is pre-trained with training. Repeated texture regions in the training image used to train the second pixel-level detection convolutional neural network are annotated.
将用于生成该视差图的左侧RGB图像输入到第二像素级检测卷积神经网络,第二像素级检测卷积神经网络输出的检测结果可以为指示用于生成该视差图的左侧RGB图像中的每一个像素是否属于重复纹理区域的图像。从而,根据该检测结果,可以确定至少一个重复纹理区域。The left RGB image used to generate the disparity map is input to the second pixel-level detection convolutional neural network, and the detection result output by the second pixel-level detection convolutional neural network may be an indication of the left RGB used to generate the disparity map Whether each pixel in the image belongs to an image with a repeating texture area. Thus, based on the detection result, at least one repeating texture region can be determined.
步骤102,基于所有用于确定待优化区域的区域,确定视差图中的待优化区域。Step 102: Determine the area to be optimized in the disparity map based on all the areas used to determine the area to be optimized.
在本申请中,在基于所有用于确定待优化区域的区域,确定视差图中的待优化区域时,可以对于所有用于确定待优化区域的区域中的每一个独立区域,将该独立区域作为视差图中的待优化区域的一个子区域。In this application, when determining the area to be optimized in the disparity map based on all the areas used to determine the area to be optimized, for each independent area in all the areas used to determine the area to be optimized, the independent area can be used as A subregion of the region to be optimized in the disparity map.
当弱纹理区域的数量为多个时,每一个与弱纹理区域相对应的区域各自对应一个弱纹理区域。When the number of weak texture areas is multiple, each area corresponding to the weak texture area corresponds to one weak texture area.
当重复纹理区域的数量为多个时,每一个与重复纹理区域相对应的区域各自对应一个重复纹理区域。When the number of repeated texture regions is multiple, each region corresponding to the repeated texture region corresponds to one repeated texture region.
独立区域可以是指所有用于确定待优化区域中的、不与所有用于确定待优化区域中的任意一个其他的区域具有重叠部分的区域。The independent area may refer to all the areas used for determining the area to be optimized that do not have overlapping parts with any other area used for determining the area to be optimized.
非独立区域可以是指所有用于确定待优化区域中的、与所有用于确定待优化区域中的至少一个其他的区域具有重叠部分的区域。The non-independent regions may refer to all regions used for determining the regions to be optimized that have overlapping portions with at least one other region used for determining the regions to be optimized.
在所有用于确定待优化区域的区域中的任意两个区域均无重叠的情况下,所有用于确定待优化区域的区域中的每一个区域均为独立区域,视差图中的待优化区域由所有用于确定待优化区域的区域组成,即视差图中的待优化区域包括所有用于确定待优化区域的区域。In the case where any two areas in all the areas used to determine the area to be optimized do not overlap, each area in all the areas used to determine the area to be optimized is an independent area, and the area to be optimized in the disparity map is determined by All areas used for determining the area to be optimized are composed, that is, the area to be optimized in the disparity map includes all areas used for determining the area to be optimized.
例如,所有用于确定待优化区域的区域包括:至少一个低置信度区域、 至少一个与弱纹理区域相对应的区域、至少一个与重复纹理区域相对应的区域。在所有用于确定待优化区域的区域中的任意两个区域均无重叠的情况下,每一个低置信度区域均为独立区域、视差图中的每一个与弱纹理区域相对应的区域均为独立区域、视差图中的每一个与重复纹理区域相对应的区域均为独立区域,则视差图中的待优化区域由视差图中的每一个低置信度区域、视差图中的每一个与弱纹理区域相对应的区域、视差图中的每一个与重复纹理区域相对应的区域组成。For example, all the regions used to determine the region to be optimized include: at least one region of low confidence, at least one region corresponding to a weak texture region, and at least one region corresponding to a repeated texture region. Under the condition that any two regions in all the regions used to determine the region to be optimized do not overlap, each low-confidence region is an independent region, and each region in the disparity map corresponding to the weak texture region is The independent area, each area corresponding to the repeated texture area in the disparity map is an independent area, then the area to be optimized in the disparity map is composed of each low-confidence area in the disparity map, each in the disparity map and weak. The area corresponding to the texture area and each area in the disparity map corresponding to the repeated texture area are composed.
在所有用于确定待优化区域的区域包括至少两个非独立区域的情况下,可以将每一个同时属于至少两个非独立区域的重叠部分各自作为视差图中的待优化区域的一个子区域。In the case that all the regions used to determine the region to be optimized include at least two dependent regions, each overlapping portion belonging to the at least two dependent regions at the same time can be regarded as a sub-region of the region to be optimized in the disparity map.
在所有用于确定待优化区域的区域包括至少两个非独立区域的情况下,视差图中的待优化区域可以由每一个独立区域、每一个同时属于至少两个非独立区域的重叠部分组成。视差图中的待优化区域可以包括:每一个独立区域、每一个同时属于至少两个非独立区域的重叠部分。In the case that all the regions used to determine the region to be optimized include at least two dependent regions, the region to be optimized in the disparity map may be composed of each independent region, each of which simultaneously belongs to the overlapping portion of the at least two dependent regions. The to-be-optimized area in the disparity map may include: each independent area, each overlapping part belonging to at least two dependent areas at the same time.
在一些实施例中,基于视差图中的所有用于确定待优化区域的区域,确定该视差图中的待优化区域包括:确定所有用于确定待优化区域的区域的并集;将确定的并集确定为视差图中的待优化区域。In some embodiments, based on all the regions in the disparity map for determining the region to be optimized, determining the region to be optimized in the disparity map includes: determining a union of all regions used for determining the region to be optimized; combining the determined union The set is determined as the region to be optimized in the disparity map.
在所有用于确定待优化区域的区域中的任意两个区域均无重叠的情况下,所有用于确定待优化区域的区域的并集即为所有用于确定待优化区域的区域,可以将所有用于确定待优化区域的区域的并集作为待优化区域,换言之,待优化区域由所有用于确定待优化区域的区域组成。In the case where any two regions in all the regions used to determine the region to be optimized do not overlap, the union of all the regions used to determine the region to be optimized is all the regions used to determine the region to be optimized. The union of the regions used to determine the region to be optimized is taken as the region to be optimized, in other words, the region to be optimized consists of all the regions used to determine the region to be optimized.
例如,所有用于确定待优化区域的区域包括:至少一个低置信度区域、至少一个与弱纹理区域相对应的区域、至少一个与重复纹理区域相对应的区域。在所有用于确定待优化区域的区域中的任意两个区域均无重叠的情况下,所有用于确定待优化区域的区域的并集由视差图中的每一个低置信度区域、视差图中的每一个与弱纹理区域相对应的区域、视差图中的每一个与重复纹理区域相对应的区域组成,则视差图中的待优化区域包括:视差图中的每一个低置信度区域、视差图中的每一个与弱纹理区域相对应的区域、视差图中的每一个与重复纹理区域相对应的区域。For example, all the regions used to determine the region to be optimized include: at least one region of low confidence, at least one region corresponding to a weak texture region, and at least one region corresponding to a repeated texture region. In the case that any two regions in all the regions used to determine the region to be optimized have no overlap, the union of all the regions used to determine the region to be optimized is determined by each low-confidence region in the disparity map, the disparity map Each of the regions corresponding to the weak texture region and each region corresponding to the repeated texture region in the disparity map is composed of, then the region to be optimized in the disparity map includes: each low-confidence region in the disparity map, the parallax Each region in the map corresponds to a weak texture region, and each region in the disparity map corresponds to a repeated texture region.
在所有用于确定待优化区域的区域包括至少两个非独立区域的情况下, 所有用于确定待优化区域的区域的并集由每一个独立区域、每一个同时属于至少两个非独立区域的重叠部分、每一个仅属于一个非独立区域并且不是重叠部分的部分组成。则视差图中的待优化区域包括:每一个独立区域、每一个同时属于至少两个非独立区域的重叠部分、每一个仅属于一个非独立区域并且不是重叠部分的部分。In the case that all the regions used for determining the region to be optimized include at least two dependent regions, the union of all the regions used for determining the region to be optimized is determined by each independent region, each belonging to at least two dependent regions at the same time. Overlapping parts, each of which belongs to only one dependent region and which are not overlapping parts. Then, the areas to be optimized in the disparity map include: each independent area, each overlapping part belonging to at least two dependent areas at the same time, and each part belonging to only one dependent area and not the overlapping part.
请参考图2,其示出了确定待优化区域的流程示意图。Please refer to FIG. 2 , which shows a schematic flowchart of determining an area to be optimized.
待优化区域也可称之为视差不准确区域。可以根据置信度矩阵、置信度阈值确定视差图中的低置信度区域。The area to be optimized may also be referred to as a parallax inaccuracy area. The low confidence region in the disparity map can be determined according to the confidence matrix and the confidence threshold.
可以首先生成低置信度mask。低置信度mask中的每一个像素各自对应视差图中的一个像素。A low-confidence mask can be generated first. Each pixel in the low-confidence mask corresponds to a pixel in the disparity map.
在低置信度mask中,对于每一个与属于低置信度区域的像素相对应的像素,该像素像素值为指示其对应的像素属于低置信度区域的数值1。对于除了所有与属于低置信度区域的像素相对应的像素之外的每一个像素,该像素像素值为指示其对应的像素不属于低置信度区域的数值0。In the low-confidence mask, for each pixel corresponding to a pixel belonging to the low-confidence region, the pixel value of the pixel is a value of 1 indicating that the corresponding pixel belongs to the low-confidence region. For each pixel except all pixels corresponding to pixels belonging to the low-confidence region, the pixel value of the pixel is a value of 0 indicating that its corresponding pixel does not belong to the low-confidence region.
在低置信度mask中,对于每一个像素值为0并且其对应的视差图中的像素属于与弱纹理区域相对应的区域或与重复纹理区域相对应的区域的像素,将该像素的像素值修改为1,以得到待优化区域掩码图像。In the low-confidence mask, for each pixel whose value is 0 and the pixel in the corresponding disparity map belongs to the region corresponding to the weak texture region or the region corresponding to the repeated texture region, the pixel value of the pixel is Modify it to 1 to get the mask image of the region to be optimized.
待优化区域掩码图像可以称之为待优化区域mask。The to-be-optimized area mask image may be referred to as the to-be-optimized area mask.
待优化区域mask中的每一个像素各自对应视差图中的一个像素。Each pixel in the area mask to be optimized corresponds to one pixel in the disparity map.
在待优化区域mask中,与待优化区域中的像素相对应的像素的像素值为指示其对应的像素属于待优化区域的数值1,与非待优化区域中的像素相对应的像素的像素值为指示其对应的像素不属于待优化区域的数值0。In the mask of the area to be optimized, the pixel value of the pixel corresponding to the pixel in the area to be optimized is 1 indicating that the corresponding pixel belongs to the area to be optimized, and the pixel value of the pixel corresponding to the pixel in the area not to be optimized It is a value of 0 indicating that its corresponding pixel does not belong to the area to be optimized.
视差图中的待优化区域中的所有像素由待优化区域mask中的每一个具有的像素值为1的像素各自对应的像素组成。因此,在得到待优化区域mask之后,可以确定视差图中的待优化区域。All the pixels in the to-be-optimized area in the disparity map are composed of pixels corresponding to each pixel with a pixel value of 1 in each of the to-be-optimized area masks. Therefore, after obtaining the area mask to be optimized, the area to be optimized in the disparity map can be determined.
步骤103,对待优化区域中的像素的视差值进行优化,得到经过优化的视差图。Step 103: Optimize the disparity values of the pixels in the area to be optimized to obtain an optimized disparity map.
在本申请中,在确定视差图中的待优化区域之后,对待优化区域中的像素的视差值进行优化。In the present application, after the area to be optimized in the disparity map is determined, the disparity values of the pixels in the area to be optimized are optimized.
视差图中的每一个像素各自具有一个原始视差值。在对待优化区域中的 像素的视差值进行优化时,可以对于待优化区域中的每一个像素,确定该像素的目标视差值,将该像素的视差值修改为目标视差值。从而,该像素的视差值由该像素的原始视差值变成该像素的目标视差值。Each pixel in the disparity map has an original disparity value. When optimizing the disparity value of the pixel in the area to be optimized, for each pixel in the area to be optimized, the target disparity value of the pixel can be determined, and the disparity value of the pixel can be modified to the target disparity value. Therefore, the disparity value of the pixel is changed from the original disparity value of the pixel to the target disparity value of the pixel.
在将视差图的待优化区域中的每一个像素的像素值分别修改为相应的目标视差值之后,得到经过优化的视差图。After the pixel value of each pixel in the to-be-optimized area of the disparity map is modified to the corresponding target disparity value, an optimized disparity map is obtained.
在对于待优化区域中的每一个像素,确定该像素的目标视差值时,可以对于待优化区域中的每一个像素,查找视差图中的与该像素距离最近并且不属于待优化区域的有效视差像素,可以将该查找出的有效视差像素的视差值作为该像素的目标像素值。For each pixel in the area to be optimized, when determining the target disparity value of the pixel, for each pixel in the area to be optimized, you can search for an effective pixel in the disparity map that is closest to the pixel and does not belong to the area to be optimized. For disparity pixels, the disparity value of the found effective disparity pixel can be used as the target pixel value of the pixel.
在一些实施例中,还包括:获取用于生成视差图的图像中的与经过优化的视差图中的待平滑区域相对应的区域的特征信息;基于该特征信息,利用引导滤波算法和快速双边滤波算法对经过优化的视差图中的待平滑区域进行平滑处理。In some embodiments, the method further includes: acquiring feature information of a region corresponding to the region to be smoothed in the optimized disparity map in the image used to generate the disparity map; based on the feature information, using a guided filtering algorithm and a fast bilateral The filtering algorithm smoothes the area to be smoothed in the optimized disparity map.
与经过优化的视差图中的待平滑区域相对应的区域可以为用于生成该视差图的左侧RGB图像中的拍摄主体占据的区域。The area corresponding to the area to be smoothed in the optimized disparity map may be the area occupied by the subject in the left RGB image used to generate the disparity map.
例如,在人像模式下,与经过优化的视差图中的待平滑区域相对应的区域可以为用于生成该视差图的左侧RGB图像中的人像占据人像区域。换言之,经过优化的视差图中的待平滑区域对应用于生成该视差图的左侧RGB图像中的人像区域。For example, in the portrait mode, the area corresponding to the to-be-smoothed area in the optimized disparity map may occupy the portrait area for the portrait in the left RGB image used to generate the disparity map. In other words, the region to be smoothed in the optimized disparity map corresponds to the portrait region in the left RGB image for generating the disparity map.
用于生成视差图的图像中的与经过优化的视差图中的待平滑区域相对应的区域的特征信息为在对经过优化的视差图中的待平滑区域进行平滑处理时所基于的信息。The feature information of the area corresponding to the area to be smoothed in the optimized disparity map in the image used for generating the disparity map is information based on smoothing the area to be smoothed in the optimized disparity map.
例如,与经过优化的视差图中的待平滑区域相对应的区域为用于生成该视差图的左侧RGB图像中的人像区域,特征信息可以为用于生成该视差图的左侧RGB图像中的人像区域中的每一个像素的梯度。For example, the area corresponding to the area to be smoothed in the optimized disparity map is the portrait area in the left RGB image used to generate the disparity map, and the feature information may be the left RGB image used to generate the disparity map. The gradient of each pixel in the portrait region.
可以基于用于生成视差图的图像中的与经过优化的视差图中的待平滑区域相对应的区域的特征信息,利用引导滤波算法和快速双边滤波算法对经过优化的视差图中的待平滑区域进行平滑处理。从而,使得经过优化的视差图更加平滑,尤其在边缘区域变化不突兀并且保持良好的一致性。Based on the feature information of the region corresponding to the region to be smoothed in the optimized disparity map in the image used to generate the disparity map, the guided filtering algorithm and the fast bilateral filtering algorithm can be used to determine the region to be smoothed in the optimized disparity map. for smoothing. Therefore, the optimized disparity map is smoother, especially in the edge region, the change is not abrupt and the consistency is maintained.
在一些实施例中,对待优化区域中的像素的视差值进行优化,得到经过 优化的视差图包括:利用连通域提取算法确定待优化区域中的所有连通区域;确定所有连通区域中的目标连通区域;对于每一个目标连通区域,对该目标连通区域进行形态学梯度提取,以确定该目标连通区域的边缘;基于该目标连通区域的边缘占据的区域中的像素的原始视差值,计算该目标连通区域中的每一个像素的目标视差值;将目标连通区域中的每一个像素的视差值修改为每一个像素的目标视差值。In some embodiments, optimizing the disparity values of pixels in the region to be optimized to obtain an optimized disparity map includes: determining all connected regions in the region to be optimized by using a connected region extraction algorithm; determining target connectivity in all connected regions area; for each target connected area, perform morphological gradient extraction on the target connected area to determine the edge of the target connected area; based on the original disparity value of the pixels in the area occupied by the edge of the target connected area, calculate the The target disparity value of each pixel in the target connected area; modify the disparity value of each pixel in the target connected area to the target disparity value of each pixel.
在利用连通域提取算法确定待优化区域中的每一个连通区域时,可以利用连通域提取算法基于视差图对应的待优化区域掩码图像即待优化区域mask,确定待优化掩码区域中的每一个连通区域。待优化区域中的每一个像素各自对应的待优化区域掩码图像中的像素的像素值均为1,通过待优化区域掩码图像,可以快速地定位视差图中的待优化区域。然后,可以利用连通域提取算法对视差图中的待优化区域进行连通区域提取,确定视差图中的待优化区域中的每一个连通区域。When using the connected domain extraction algorithm to determine each connected area in the area to be optimized, the connected area extraction algorithm can be used to determine each connected area in the mask area to be optimized based on the mask image of the area to be optimized corresponding to the disparity map, that is, the area mask to be optimized. a connected region. The pixel value of each pixel in the area to be optimized mask image corresponding to each pixel in the area to be optimized is 1, and the area to be optimized in the disparity map can be quickly located through the mask image of the area to be optimized. Then, a connected region extraction algorithm may be used to extract a connected region in the region to be optimized in the disparity map, and each connected region in the region to be optimized in the disparity map is determined.
在本申请中,在确定待优化区域中的每一个连通区域之后,可以确定待优化区域中的目标连通区域。In the present application, after each connected region in the region to be optimized is determined, a target connected region in the region to be optimized can be determined.
在本申请中,每一个连通区域可以各自作为一个目标连通区域。In the present application, each connected area can be individually used as a target connected area.
在一些实施例中,确定所有连通区域中的目标连通区域包括:将所有连通区域中的面积大于面积阈值的连通区域确定为目标连通区域。In some embodiments, determining a target connected area in all connected areas includes: determining a connected area whose area is greater than an area threshold in all connected areas as a target connected area.
通过将所有连通区域中的面积大于面积阈值的连通区域确定为目标连通区域,可以剔除面积较小的连通区域,被剔除的连通区域可以称之为非有效区域。By determining the connected regions whose area is larger than the area threshold in all connected regions as target connected regions, the connected regions with smaller areas can be eliminated, and the eliminated connected regions can be called ineffective regions.
在本申请中,在确定所有连通区域中的目标连通区域之后,对于每一个目标连通区域,可以对该目标连通区域进行形态学梯度提取,以确定该目标连通区域的边缘;基于该目标连通区域的边缘占据的区域中的像素的原始视差值,计算该目标连通区域中的每一个像素的目标视差值;将该目标连通区域中的每一个像素的视差值修改为每一个像素的目标视差值。In this application, after determining the target connected regions in all connected regions, for each target connected region, morphological gradient extraction can be performed on the target connected region to determine the edge of the target connected region; based on the target connected region The original disparity value of the pixels in the area occupied by the edge of , calculate the target disparity value of each pixel in the target connected area; modify the disparity value of each pixel in the target connected area to Target disparity value.
对于每一个目标连通区域,对该目标连通区域进行形态学梯度提取,来计算该目标连通区域的膨胀图与该连通区域的腐蚀图之差,以确定该目标连通区域的边缘。For each target connected region, morphological gradient extraction is performed on the target connected region to calculate the difference between the expansion map of the target connected region and the erosion map of the connected region to determine the edge of the target connected region.
在确定每一个目标连通区域的边缘之后,可以对于每一个目标连通区 域,基于该目标连通区域的边缘占据的区域中的像素的原始视差值,计算该目标连通区域中的每一个像素的目标视差值。After the edge of each target connected region is determined, for each target connected region, the target of each pixel in the target connected region can be calculated based on the original disparity value of the pixels in the region occupied by the edge of the target connected region Parallax value.
例如,对于每一个目标连通区域,可以确定该目标连通区域的边缘占据的区域中的所有像素的原始视差值中的中位数或该目标连通区域的边缘占据的区域中的所有像素的平均值,将该中位数或该平均值作为该目标连通区域中的每一个像素的目标视差值,该目标连通区域中的每一个像素的目标视差值均为该中位数或该平均值。For example, for each target connected region, the median of the original disparity values of all pixels in the region occupied by the edge of the target connected region or the average of all pixels in the region occupied by the edge of the target connected region can be determined value, the median or the average value is used as the target disparity value of each pixel in the target connected area, and the target disparity value of each pixel in the target connected area is the median or the average value value.
在对于每一个目标连通区域,计算该目标连通区域中的每一个像素的目标视差值之后,可以对于每一个目标连通区域,将该目标连通区域中的每一个像素的视差值修改为每一个像素的目标视差值,即对于每一个目标连通区域分别进行视差值填充,将该目标连通区域中的每一个像素的目标视差值填充到该像素的位置。对于任意一个目标连通区域中的每一个像素,该像素的视差值由原始的视差值变为目标视差值。For each target connected area, after calculating the target disparity value of each pixel in the target connected area, you can, for each target connected area, modify the disparity value of each pixel in the target connected area to each The target disparity value of one pixel, that is, the disparity value filling is performed for each target connected area respectively, and the target disparity value of each pixel in the target connected area is filled to the position of the pixel. For each pixel in any target connected region, the disparity value of the pixel changes from the original disparity value to the target disparity value.
从而,对每一个目标连通区域中的像素的视差值进行优化,得到经过优化的视差图。Therefore, the disparity value of the pixels in each target connected region is optimized to obtain an optimized disparity map.
在一些实施例中,对于每一个目标连通区域,基于该目标连通区域的边缘占据的区域中的像素的原始视差值,计算该目标连通区域中的每一个像素的目标视差值包括:基于该目标连通区域的边缘占据的区域中的所有目标像素的原始视差值,计算该目标连通区域中的每一个像素的目标视差值,其中,目标像素为具有的原始视差值处于预设合理区间内的像素。In some embodiments, for each target connected region, based on the original disparity value of the pixels in the region occupied by the edge of the target connected region, calculating the target disparity value of each pixel in the target connected region includes: based on The original disparity values of all target pixels in the area occupied by the edge of the target connected area are calculated, and the target disparity value of each pixel in the target connected area is calculated, wherein the original disparity value of the target pixel is in the preset value Pixels within a reasonable range.
在本申请中,对于每一个目标连通区域,可以基于该目标连通区域的边缘占据的区域中的所有目标像素的原始视差值,计算连通区域中的每一个像素的目标视差值。In this application, for each target connected region, the target disparity value of each pixel in the connected region can be calculated based on the original disparity values of all target pixels in the region occupied by the edge of the target connected region.
对于每一个目标连通区域,可以确定该目标连通区域的边缘占据的区域中的所有目标像素的原始视差值中的中位数,将该中位数作为该目标连通区域中的每一个像素的目标视差值,该目标连通区域中的每一个像素的目标视差值均为该中位数。For each target connected region, the median of the original disparity values of all target pixels in the region occupied by the edge of the target connected region can be determined, and the median is taken as the value of each pixel in the target connected region. The target disparity value, the target disparity value of each pixel in the target connected region is the median.
在一些实施例中,对于每一个目标连通区域,基于该目标连通区域的边缘占据的区域中的所有目标像素的原始视差值,计算该目标连通区域中的每一个像素的目标视差值包括:计算该目标连通区域的边缘占据的区域中的所 有目标像素的原始视差值的平均值;将该平均值作为该目标连通区域中的每一个像素的目标视差值。In some embodiments, for each target connected region, calculating the target disparity value of each pixel in the target connected region based on the original disparity values of all target pixels in the region occupied by the edge of the target connected region includes: : Calculate the average value of the original disparity values of all target pixels in the area occupied by the edge of the target connected area; use the average value as the target disparity value of each pixel in the target connected area.
在本申请中,对于每一个目标连通区域,可以将该目标连通区域的边缘占据的区域中的所有目标像素的原始视差值的平均值作为该目标连通区域中的每一个像素的目标视差值,该目标连通区域中的每一个像素的目标视差值均为该目标连通区域的边缘占据的区域中的所有目标像素的原始视差值的平均值。In this application, for each target connected area, the average value of the original disparity values of all target pixels in the area occupied by the edge of the target connected area can be used as the target disparity of each pixel in the target connected area The target disparity value of each pixel in the target connected region is the average value of the original disparity values of all target pixels in the region occupied by the edge of the target connected region.
从而,对于每一个目标连通区域,在将目标连通区域中的每一个像素的视差值修改为每一个像素的目标视差值之后,该目标连通区域中的每一个像素的视差值由原始视差值变为该目标连通区域的边缘占据的区域中的所有目标像素的原始视差值的平均值。Therefore, for each target connected region, after modifying the disparity value of each pixel in the target connected region to the target disparity value of each pixel, the disparity value of each pixel in the target connected region is determined by the original The disparity value becomes the average value of the original disparity values of all target pixels in the area occupied by the edge of the target connected area.
请参考图3,其示出了对视差图中的待优化区域中的像素的视差值进行优化的流程示意图。Please refer to FIG. 3 , which shows a schematic flowchart of optimizing the disparity values of pixels in the area to be optimized in the disparity map.
对视差图中的待优化区域中的像素的视差值进行优化也可称之为局部补偿算法。Optimizing the disparity values of pixels in the area to be optimized in the disparity map may also be referred to as a local compensation algorithm.
首先利用连通域提取算法基于视差图对应的待优化区域掩码图像即待优化区域mask,确定待优化区域中的每一个连通区域。待优化区域中的每一个像素各自对应的待优化区域mask中的像素的像素值均为1,通过待优化区域mask,可以快速地定位待优化区域。然后,可以利用连通域提取算法对待优化区域进行连通区域提取,确定待优化区域中的每一个连通区域。First, a connected region extraction algorithm is used to determine each connected region in the region to be optimized based on the mask image of the region to be optimized corresponding to the disparity map, that is, the region mask to be optimized. The pixel value of each pixel in the to-be-optimized area mask corresponding to each pixel in the to-be-optimized area mask is 1, and the to-be-optimized area mask can be used to quickly locate the to-be-optimized area. Then, the connected region extraction algorithm can be used to extract the connected region of the region to be optimized, and each connected region in the region to be optimized can be determined.
将所有连通区域中的面积大于面积阈值的连通区域确定为目标连通区域,从而,剔除面积较小的连通区域即非有效区域。In all connected regions, the connected regions whose area is larger than the area threshold are determined as the target connected regions, so that the connected regions with smaller areas are eliminated, that is, the ineffective regions.
对于每一个目标连通区域,对该目标连通区域进行形态学梯度提取,以确定该目标连通区域的边缘。For each target connected region, morphological gradient extraction is performed on the target connected region to determine the edge of the target connected region.
对于每一个目标连通区域,可以将该目标连通区域的边缘占据的区域中的所有目标像素的原始视差值的平均值作为该目标连通区域中的每一个像素的目标视差值。For each target connected region, the average value of the original disparity values of all target pixels in the region occupied by the edge of the target connected region can be used as the target disparity value of each pixel in the target connected region.
对每一个目标连通区域进行视差填充,即对于每一个目标连通区域,将该目标连通区域中的每一个像素的目标视差值填充到该像素的位置。Disparity filling is performed on each target connected area, that is, for each target connected area, the target disparity value of each pixel in the target connected area is filled to the position of the pixel.
对于每一个目标连通区域,该目标连通区域中的每一个像素的视差值由 原始视差值变为该目标连通区域的边缘占据的区域中的所有目标像素的原始视差值的平均值。For each target connected area, the disparity value of each pixel in the target connected area is changed from the original disparity value to the average value of the original disparity values of all target pixels in the area occupied by the edge of the target connected area.
请参考图4,其示出了本申请实施例提供的图像处理装置的结构框图。图像处理装置包括:关联区域确定单元401,待优化区域确定单元402,视差图优化单元403。Please refer to FIG. 4 , which shows a structural block diagram of an image processing apparatus provided by an embodiment of the present application. The image processing apparatus includes: an associated area determination unit 401 , a to-be-optimized area determination unit 402 , and a disparity map optimization unit 403 .
关联区域确定单元,被配置为确定视差图中的所有用于确定待优化区域的区域,所有用于确定待优化区域的区域包括以下项中的至少一项:至少一个低置信度区域、至少一个与弱纹理区域相对应的区域、至少一个与重复纹理区域相对应的区域,其中,低置信度区域基于用于生成所述视差图的立体匹配算法输出的所述视差图的置信度矩阵而确定,弱纹理区域、重复纹理区域通过对用于生成所述视差图的图像分别进行弱纹理区域检测、重复纹理区域检测而确定;an associated area determination unit, configured to determine all areas in the disparity map for determining the area to be optimized, all areas used for determining the area to be optimized include at least one of the following items: at least one low-confidence area, at least one regions corresponding to regions of weak texture, at least one region corresponding to regions of repeated texture, wherein regions of low confidence are determined based on a confidence matrix of the disparity map output by a stereo matching algorithm used to generate the disparity map , the weak texture area and the repeated texture area are determined by respectively performing weak texture area detection and repeated texture area detection on the image used to generate the disparity map;
待优化区域确定单元,被配置为基于所有用于确定待优化区域的区域,确定视差图中的待优化区域;an area to be optimized determining unit, configured to determine the area to be optimized in the disparity map based on all the areas used to determine the area to be optimized;
视差图优化单元,被配置为对所述待优化区域中的像素的视差值进行优化,得到经过优化的视差图。The disparity map optimization unit is configured to optimize the disparity values of the pixels in the to-be-optimized area to obtain an optimized disparity map.
在一些实施例中,待优化区域确定单元进一步被配置为确定所有用于确定待优化区域的区域的并集;将确定的并集确定为所述视差图中的待优化区域。In some embodiments, the region-to-be-optimized determination unit is further configured to determine a union of all regions used to determine the region to be optimized; and determine the determined union as the region to be optimized in the disparity map.
在一些实施例中,视差图优化单元包括:In some embodiments, the disparity map optimization unit includes:
连通区域优化子单元,被配置为利用连通域提取算法确定所述待优化区域中的所有连通区域;确定所有连通区域中的目标连通区域;对于每一个目标连通区域,对所述目标连通区域进行形态学梯度提取,以确定所述目标连通区域的边缘;基于所述目标连通区域的边缘占据的区域中的像素的原始视差值,计算所述目标连通区域中的每一个像素的目标视差值;将所述目标连通区域中的每一个像素的视差值修改为每一个像素的目标视差值。The connected area optimization subunit is configured to use a connected area extraction algorithm to determine all connected areas in the area to be optimized; to determine the target connected area in all connected areas; for each target connected area, perform an operation on the target connected area. Morphological gradient extraction to determine the edge of the target connected area; based on the original disparity value of the pixels in the area occupied by the edge of the target connected area, calculate the target disparity of each pixel in the target connected area value; modify the disparity value of each pixel in the target connected region to the target disparity value of each pixel.
在一些实施例中,连通区域优化子单元进一步被配置为将所有连通区域中的面积大于面积阈值的连通区域确定为目标连通区域。In some embodiments, the connected region optimization subunit is further configured to determine a connected region whose area is greater than an area threshold among all connected regions as a target connected region.
在一些实施例中,连通区域优化子单元进一步被配置为基于所述目标连通区域的边缘占据的区域中的所有目标像素的原始视差值,计算所述目标连 通区域中的每一个像素的目标视差值,其中,目标像素为具有的原始视差值处于预设合理区间内的像素。In some embodiments, the connected region optimization subunit is further configured to calculate a target for each pixel in the target connected region based on the original disparity values of all target pixels in the region occupied by the edge of the target connected region disparity value, where the target pixel is a pixel whose original disparity value is within a preset reasonable interval.
在一些实施例中,连通区域优化子单元进一步被配置为计算所述目标连通区域的边缘占据的区域中的所有目标像素的原始视差值的平均值;将所述平均值作为所述目标连通区域中的每一个像素的目标视差值。In some embodiments, the connected area optimization sub-unit is further configured to calculate the average value of the original disparity values of all target pixels in the area occupied by the edge of the target connected area; take the average value as the target connected area The target disparity value for each pixel in the region.
在一些实施例中,图像处理装置还包括:In some embodiments, the image processing apparatus further includes:
平滑单元,被配置为获取用于生成视差图的图像中的与经过优化的视差图中的待平滑区域相对应的区域的特征信息;a smoothing unit, configured to acquire feature information of an area corresponding to the area to be smoothed in the optimized disparity map in the image used to generate the disparity map;
基于所述特征信息,利用引导滤波算法和快速双边滤波算法对经过优化的视差图中的待平滑区域进行平滑处理。Based on the feature information, a guided filtering algorithm and a fast bilateral filtering algorithm are used to smooth the region to be smoothed in the optimized disparity map.
图5是本实施例提供的一种电子设备的结构框图。电子设备包括处理组件522,其进一步包括一个或多个处理器,以及由存储器532所代表的存储器资源,用于存储可由处理组件522执行的指令,例如应用程序。存储器532中存储的应用程序可以包括一个或一个以上的每一个对应于一组指令的模块。此外,处理组件522被配置为执行指令,以执行上述方法。FIG. 5 is a structural block diagram of an electronic device provided in this embodiment. The electronic device includes a processing component 522, which further includes one or more processors, and a memory resource, represented by memory 532, for storing instructions, such as application programs, executable by the processing component 522. An application program stored in memory 532 may include one or more modules, each corresponding to a set of instructions. Additionally, the processing component 522 is configured to execute instructions to perform the above-described methods.
电子设备还可以包括一个电源组件526被配置为执行电子设备的电源管理,一个有线或无线网络接口550被配置为将电子设备连接到网络,和一个输入输出(I/O)接口558。电子设备可以操作基于存储在存储器532的操作系统,例如Windows ServerTM,MacOS XTM,UnixTM,LinuxTM,FreeBSDTM或类似。The electronic device may also include a power supply assembly 526 configured to perform power management of the electronic device, a wired or wireless network interface 550 configured to connect the electronic device to a network, and an input output (I/O) interface 558. The electronic device may operate based on an operating system stored in memory 532, such as Windows Server™, MacOS X™, Unix™, Linux™, FreeBSD™ or the like.
在示例性实施例中,还提供了一种包括指令的存储介质,例如包括指令的存储器,上述指令可由电子设备执行以完成上述方法。可选地,存储介质可以是非临时性计算机可读存储介质,例如,所述非临时性计算机可读存储介质可以是ROM、随机存取存储器(RAM)、CD-ROM、磁带、软盘和光数据存储设备等。In an exemplary embodiment, a storage medium including instructions, such as a memory including instructions, is also provided, and the instructions are executable by an electronic device to perform the above method. Alternatively, the storage medium may be a non-transitory computer-readable storage medium, for example, the non-transitory computer-readable storage medium may be ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage equipment, etc.
本领域技术人员在考虑说明书及实践这里公开的发明后,将容易想到本申请的其它实施方案。本申请旨在涵盖本申请的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本申请的一般性原理并包括本申请未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本申请的真正范围和精神由下面的权利要求指出。Other embodiments of the present application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses or adaptations of this application that follow the general principles of this application and include common knowledge or conventional techniques in the technical field not disclosed in this application . The specification and examples are to be regarded as exemplary only, with the true scope and spirit of the application being indicated by the following claims.
应当理解的是,本申请并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本申请的范围仅由所附的权利要求来限制。It is to be understood that the present application is not limited to the precise structures described above and illustrated in the accompanying drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the application is limited only by the appended claims.
本文中所称的“一个实施例”、“实施例”或者“一个或者多个实施例”意味着,结合实施例描述的特定特征、结构或者特性包括在本发明的至少一个实施例中。此外,请注意,这里“在一个实施例中”的词语例子不一定全指同一个实施例。Reference herein to "one embodiment," "an embodiment," or "one or more embodiments" means that a particular feature, structure, or characteristic described in connection with an embodiment is included in at least one embodiment of the present invention. Also, please note that instances of the phrase "in one embodiment" herein are not necessarily all referring to the same embodiment.
在此处所提供的说明书中,说明了大量具体细节。然而,能够理解,本发明的实施例可以在没有这些具体细节的情况下被实践。在一些实例中,并未详细示出公知的方法、结构和技术,以便不模糊对本说明书的理解。In the description provided herein, numerous specific details are set forth. It will be understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
在权利要求中,不应将位于括号之间的任何参考符号构造成对权利要求的限制。单词“包含”不排除存在未列在权利要求中的元件或步骤。位于元件之前的单词“一”或“一个”不排除存在多个这样的元件。本发明可以借助于包括有若干不同元件的硬件以及借助于适当编程的计算机来实现。在列举了若干装置的单元权利要求中,这些装置中的若干个可以是通过同一个硬件项来具体体现。单词第一、第二、以及第三等的使用不表示任何顺序。可将这些单词解释为名称。In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention can be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means may be embodied by one and the same item of hardware. The use of the words first, second, and third, etc. do not denote any order. These words can be interpreted as names.

Claims (11)

  1. 一种图像处理方法,其特征在于,所述方法包括:An image processing method, characterized in that the method comprises:
    确定视差图中的所有用于确定待优化区域的区域,所有用于确定待优化区域的区域包括以下项中的至少一项:至少一个低置信度区域、至少一个与弱纹理区域相对应的区域、至少一个与重复纹理区域相对应的区域,其中,低置信度区域基于用于生成所述视差图的立体匹配算法输出的所述视差图的置信度矩阵而确定,弱纹理区域、重复纹理区域通过对用于生成所述视差图的图像分别进行弱纹理区域检测、重复纹理区域检测而确定;Determine all areas in the disparity map for determining the area to be optimized, and all areas used for determining the area to be optimized include at least one of the following items: at least one low-confidence area, at least one area corresponding to a weak texture area , at least one area corresponding to the repeated texture area, wherein, the low confidence area is determined based on the confidence matrix of the disparity map output by the stereo matching algorithm used to generate the disparity map, the weak texture area, the repeated texture area Determined by performing weak texture region detection and repeated texture region detection on the image used to generate the disparity map;
    基于所有用于确定待优化区域的区域,确定所述视差图中的待优化区域;determining the region to be optimized in the disparity map based on all the regions used to determine the region to be optimized;
    对所述待优化区域中的像素的视差值进行优化,得到经过优化的视差图。The disparity values of the pixels in the to-be-optimized area are optimized to obtain an optimized disparity map.
  2. 根据权利要求1所述的方法,其特征在于,基于所有用于确定待优化区域的区域,确定所述视差图中的待优化区域包括:The method according to claim 1, wherein, based on all the regions used to determine the region to be optimized, determining the region to be optimized in the disparity map comprises:
    确定所有用于确定待优化区域的区域的并集;Determine the union of all regions used to determine the region to be optimized;
    将确定的并集确定为所述视差图中的待优化区域。The determined union is determined as the region to be optimized in the disparity map.
  3. 根据权利要求1所述的方法,其特征在于,对所述待优化区域中的像素的视差值进行优化,得到经过优化的视差图包括:The method according to claim 1, wherein, optimizing the disparity value of the pixels in the area to be optimized, and obtaining an optimized disparity map comprises:
    利用连通域提取算法确定所述待优化区域中的所有连通区域;Determine all connected regions in the to-be-optimized region by using a connected region extraction algorithm;
    确定所有连通区域中的目标连通区域;Determine the target connected region among all connected regions;
    对于每一个目标连通区域,对所述目标连通区域进行形态学梯度提取,以确定所述目标连通区域的边缘;基于所述目标连通区域的边缘占据的区域中的像素的原始视差值,计算所述目标连通区域中的每一个像素的目标视差值;将所述目标连通区域中的每一个像素的视差值修改为每一个像素的目标视差值。For each target connected area, morphological gradient extraction is performed on the target connected area to determine the edge of the target connected area; based on the original disparity value of the pixels in the area occupied by the edge of the target connected area, calculate The target disparity value of each pixel in the target connected area; modify the disparity value of each pixel in the target connected area to the target disparity value of each pixel.
  4. 根据权利要求3所述的方法,其特征在于,确定所有连通区域中的目标连通区域包括:The method according to claim 3, wherein determining the target connected region in all connected regions comprises:
    将所有连通区域中的面积大于面积阈值的连通区域确定为目标连通区 域。A connected region whose area is greater than the area threshold in all connected regions is determined as the target connected region.
  5. 根据权利要求4所述的方法,其特征在于,基于所述目标连通区域的边缘占据的区域中的像素的原始视差值,计算所述目标连通区域中的每一个像素的目标视差值包括:The method according to claim 4, wherein calculating the target disparity value of each pixel in the target connected area based on the original disparity value of the pixels in the area occupied by the edge of the target connected area comprises: :
    基于所述目标连通区域的边缘占据的区域中的所有目标像素的原始视差值,计算所述目标连通区域中的每一个像素的目标视差值,其中,目标像素为具有的原始视差值处于预设合理区间内的像素。Based on the original disparity values of all target pixels in the area occupied by the edge of the target connected area, calculate the target disparity value of each pixel in the target connected area, wherein the target pixel has the original disparity value of Pixels within a preset reasonable range.
  6. 根据权利要求5所述的方法,其特征在于,基于所述目标连通区域的边缘占据的区域中的所有目标像素的原始视差值,计算所述目标连通区域中的每一个像素的目标视差值包括:The method according to claim 5, wherein the target disparity of each pixel in the target connected area is calculated based on the original disparity values of all target pixels in the area occupied by the edge of the target connected area Values include:
    计算所述目标连通区域的边缘占据的区域中的所有目标像素的原始视差值的平均值;Calculate the average value of the original disparity values of all target pixels in the area occupied by the edge of the target connected area;
    将所述平均值作为所述目标连通区域中的每一个像素的目标视差值。The average value is taken as the target disparity value of each pixel in the target connected region.
  7. 根据权利要求1-6之一所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1-6, wherein the method further comprises:
    获取所述用于生成所述视差图的图像中的与经过优化的视差图中的待平滑区域相对应的区域的特征信息;acquiring feature information of the region corresponding to the region to be smoothed in the optimized disparity map in the image used to generate the disparity map;
    基于所述特征信息,利用引导滤波算法和快速双边滤波算法对经过优化的视差图中的待平滑区域进行平滑处理。Based on the feature information, a guided filtering algorithm and a fast bilateral filtering algorithm are used to smooth the region to be smoothed in the optimized disparity map.
  8. 一种图像处理装置,其特征在于,所述装置包括:An image processing device, characterized in that the device comprises:
    关联区域确定单元,被配置为确定视差图中的所有用于确定待优化区域的区域,所有用于确定待优化区域的区域包括以下项中的至少一项:至少一个低置信度区域、至少一个与弱纹理区域相对应的区域、至少一个与重复纹理区域相对应的区域,其中,低置信度区域基于用于生成所述视差图的立体匹配算法输出的所述视差图的置信度矩阵而确定,弱纹理区域、重复纹理区域通过对用于生成所述视差图的图像分别进行弱纹理区域检测、重复纹理区域检测而确定;an associated area determination unit, configured to determine all areas in the disparity map for determining the area to be optimized, all areas used for determining the area to be optimized include at least one of the following items: at least one low-confidence area, at least one regions corresponding to regions of weak texture, at least one region corresponding to regions of repeated texture, wherein regions of low confidence are determined based on a confidence matrix of the disparity map output by a stereo matching algorithm used to generate the disparity map , the weak texture area and the repeated texture area are determined by respectively performing weak texture area detection and repeated texture area detection on the image used to generate the disparity map;
    待优化区域确定单元,被配置为基于所有用于确定待优化区域的区域,确定所述视差图中的待优化区域;an area to be optimized determining unit, configured to determine the area to be optimized in the disparity map based on all the areas used to determine the area to be optimized;
    视差图优化单元,被配置为对所述待优化区域中的像素的视差值进行优化,得到经过优化的视差图。The disparity map optimization unit is configured to optimize the disparity values of the pixels in the to-be-optimized area to obtain an optimized disparity map.
  9. 一种电子设备,包括:An electronic device comprising:
    处理器;processor;
    用于存储所述处理器可执行指令的存储器;a memory for storing the processor-executable instructions;
    其中,所述处理器被配置为执行所述指令,以实现如权利要求1至7中任一项所述的方法。wherein the processor is configured to execute the instructions to implement the method of any of claims 1-7.
  10. 一种存储介质,当所述存储介质中的指令由电子设备的处理器执行时,使得电子设备能够执行如权利要求1至7中任一项所述的方法。A storage medium, when instructions in the storage medium are executed by a processor of an electronic device, enabling the electronic device to perform the method according to any one of claims 1 to 7.
  11. 一种计算机程序产品,包括计算机可读代码,当所述计算机可读代码在电子设备上运行时,使得电子设备执行如权利要求1-7中任一项所述的方法。A computer program product comprising computer readable code which, when run on an electronic device, causes the electronic device to perform the method of any of claims 1-7.
PCT/CN2021/075111 2020-07-14 2021-02-03 Image processing method and apparatus, electronic device, and storage medium WO2022012034A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010676768.6 2020-07-14
CN202010676768.6A CN112053394A (en) 2020-07-14 2020-07-14 Image processing method, image processing device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
WO2022012034A1 true WO2022012034A1 (en) 2022-01-20

Family

ID=73602728

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/075111 WO2022012034A1 (en) 2020-07-14 2021-02-03 Image processing method and apparatus, electronic device, and storage medium

Country Status (2)

Country Link
CN (1) CN112053394A (en)
WO (1) WO2022012034A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112053394A (en) * 2020-07-14 2020-12-08 北京迈格威科技有限公司 Image processing method, image processing device, electronic equipment and storage medium
CN116563186A (en) * 2023-05-12 2023-08-08 中山大学 Real-time panoramic sensing system and method based on special AI sensing chip

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7561732B1 (en) * 2005-02-04 2009-07-14 Hrl Laboratories, Llc Method and apparatus for three-dimensional shape estimation using constrained disparity propagation
CN103226821A (en) * 2013-04-27 2013-07-31 山西大学 Stereo matching method based on disparity map pixel classification correction optimization
CN110443186A (en) * 2019-07-31 2019-11-12 深圳市道通智能航空技术有限公司 Solid matching method, picture processing chip and mobile carrier
CN111402152A (en) * 2020-03-10 2020-07-10 北京迈格威科技有限公司 Disparity map processing method and device, computer equipment and storage medium
CN112053394A (en) * 2020-07-14 2020-12-08 北京迈格威科技有限公司 Image processing method, image processing device, electronic equipment and storage medium

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8666144B2 (en) * 2010-09-02 2014-03-04 Edge 3 Technologies, Inc. Method and apparatus for determining disparity of texture
CN104915927B (en) * 2014-03-11 2018-08-07 株式会社理光 Anaglyph optimization method and device
WO2016176840A1 (en) * 2015-05-06 2016-11-10 北京大学深圳研究生院 Depth/disparity map post-processing method and device
CN108596975B (en) * 2018-04-25 2022-03-29 华南理工大学 Stereo matching algorithm for weak texture region

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7561732B1 (en) * 2005-02-04 2009-07-14 Hrl Laboratories, Llc Method and apparatus for three-dimensional shape estimation using constrained disparity propagation
CN103226821A (en) * 2013-04-27 2013-07-31 山西大学 Stereo matching method based on disparity map pixel classification correction optimization
CN110443186A (en) * 2019-07-31 2019-11-12 深圳市道通智能航空技术有限公司 Solid matching method, picture processing chip and mobile carrier
CN111402152A (en) * 2020-03-10 2020-07-10 北京迈格威科技有限公司 Disparity map processing method and device, computer equipment and storage medium
CN112053394A (en) * 2020-07-14 2020-12-08 北京迈格威科技有限公司 Image processing method, image processing device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN112053394A (en) 2020-12-08

Similar Documents

Publication Publication Date Title
Yao et al. Curvature aided Hough transform for circle detection
US9767567B2 (en) Method and apparatus for separating foreground image, and non-transitory computer-readable recording medium
Feng et al. Local background enclosure for RGB-D salient object detection
US11748894B2 (en) Video stabilization method and apparatus and non-transitory computer-readable medium
WO2022012034A1 (en) Image processing method and apparatus, electronic device, and storage medium
CN110349086B (en) Image splicing method under non-concentric imaging condition
CN111340749B (en) Image quality detection method, device, equipment and storage medium
JP2011138500A (en) Method and system for determining disparity search range in stereo video
CN111160291B (en) Human eye detection method based on depth information and CNN
CN112465746A (en) Method for detecting small defects in radiographic film
TW202011266A (en) Neural network system for image matching and location determination, method, and device
CN114463603B (en) Training method and device for image detection model, electronic equipment and storage medium
KR20140048449A (en) Liver segmentation method in a medical image
EP2536123A1 (en) Image processing method and image processing apparatus
US11461597B2 (en) Object likelihood estimation device, method, and program
Srikakulapu et al. Depth estimation from single image using defocus and texture cues
CN116758280A (en) Target detection method, device, equipment and storage medium
Cai et al. Hole-filling approach based on convolutional neural network for depth image-based rendering view synthesis
WO2018223370A1 (en) Temporal and space constraint-based video saliency testing method and system
JP2020144686A (en) Model creating system, and model creating method
CN104751431A (en) Method and device based on image processing
JPH05256613A (en) Method and device for parallax computing from stereo picture and measuring device for depth
KR102389295B1 (en) Method and Apparatus for Instance Segmentation Based Object Size Estimation from Single Indoor Image
US11475614B2 (en) Image processing apparatus and non-transitory computer readable medium for calculating a position at which to superimpose a design object onto an image
CN113312979B (en) Image processing method and device, electronic equipment, road side equipment and cloud control platform

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: 21842022

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205 DATED 16.05.2023)

122 Ep: pct application non-entry in european phase

Ref document number: 21842022

Country of ref document: EP

Kind code of ref document: A1