WO2023225825A1 - Position difference graph generation method and apparatus, electronic device, chip, and medium - Google Patents

Position difference graph generation method and apparatus, electronic device, chip, and medium Download PDF

Info

Publication number
WO2023225825A1
WO2023225825A1 PCT/CN2022/094569 CN2022094569W WO2023225825A1 WO 2023225825 A1 WO2023225825 A1 WO 2023225825A1 CN 2022094569 W CN2022094569 W CN 2022094569W WO 2023225825 A1 WO2023225825 A1 WO 2023225825A1
Authority
WO
WIPO (PCT)
Prior art keywords
pixel
position difference
image
pixels
value
Prior art date
Application number
PCT/CN2022/094569
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 上海玄戒技术有限公司
Priority to CN202280004634.7A priority Critical patent/CN116438568A/en
Priority to PCT/CN2022/094569 priority patent/WO2023225825A1/en
Publication of WO2023225825A1 publication Critical patent/WO2023225825A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N13/00Stereoscopic video systems; Multi-view video systems; Details thereof
    • H04N13/10Processing, recording or transmission of stereoscopic or multi-view image signals
    • H04N13/106Processing image signals
    • H04N13/122Improving the 3D impression of stereoscopic images by modifying image signal contents, e.g. by filtering or adding monoscopic depth cues

Definitions

  • the present disclosure relates to the field of image processing, and in particular, to a position difference map generation method and device, electronic equipment, chips and media.
  • the optical flow map between different images taken at different times can be obtained to predict the movement of the moving object based on the optical flow map, and then adjust the image based on the predicted movement. Make adjustments.
  • the present disclosure provides a position difference map generation method and device, electronic equipment, chips and media, which can accurately generate a position difference map between two images.
  • a method for generating a location difference map including:
  • the initial position difference map contains at least one hole pixel with an unknown position difference value
  • the initial position difference map is divided into super pixels.
  • Each super pixel obtained by the division contains multiple pixels, and the corresponding holes are classified based on the position difference values of other pixels in the super pixel where each hole pixel is located. Complete the pixel value of the pixel.
  • a location difference map generating device including:
  • the calculation unit performs disparity calculation on the first image and the second image to obtain an initial position difference map;
  • the initial position difference map contains at least one hole pixel with an unknown position difference value;
  • the dividing unit divides the initial position difference map into super pixels.
  • Each super pixel obtained by the division contains multiple pixel points, and the position difference value pair is based on the position difference value of other pixel points in the super pixel where each hole pixel point is located. The pixel value of the corresponding hole pixel is completed.
  • a position difference map generation method is provided, which is applied to an image processor and includes:
  • the initial position difference map is divided into super pixels.
  • Each super pixel obtained by the division contains multiple pixels, and the corresponding holes are classified based on the position difference values of other pixels in the super pixel where each hole pixel is located.
  • the position difference value of the pixel is completed.
  • an electronic device including:
  • Memory used to store instructions executable by the processor
  • the processor implements the method described in the first aspect by running the executable instructions.
  • a computer-readable storage medium is provided, computer instructions are stored thereon, and when the instructions are executed by a processor, the steps of the method described in the first aspect are implemented.
  • dislocation calculation can be performed on the two to obtain an initial position difference map.
  • the initial position difference map can be divided into super pixels, and the position difference values of the hole pixels contained in the super pixels can be completed based on the position difference values of each pixel in the divided super pixels. It should be understood that since the present disclosure completes the position difference values of the hole pixels contained in each of them based on the divided super pixels, it avoids the problem of hole pixels in the position difference map generated by the related technology, which affects the final imaging. .
  • Figure 1 is a flow chart of a method for generating a position difference map according to an exemplary embodiment of the present disclosure
  • Figure 2 is a flow chart of a method for generating a disparity map according to an exemplary embodiment of the present disclosure
  • FIG. 3 is a schematic diagram of an initial disparity map according to an exemplary embodiment of the present disclosure
  • FIG. 4 is a schematic histogram diagram of an initial disparity map according to an exemplary embodiment of the present disclosure
  • FIG. 5 is a schematic diagram of an adjusted initial disparity map according to an exemplary embodiment of the present disclosure.
  • Figure 6 is a schematic diagram of a super-pixel division according to an exemplary embodiment of the present disclosure.
  • FIG. 7 is a schematic diagram of a brightness diagram of a main image according to an exemplary embodiment of the present disclosure.
  • FIG. 8 is a schematic diagram after adjusting the pixel points included in the super pixel according to an exemplary embodiment of the present disclosure
  • Figure 9 is a block diagram of a position difference map generating device according to an exemplary embodiment of the present disclosure.
  • Figure 10 is a block diagram of another location difference map generating device according to an exemplary embodiment of the present disclosure.
  • Figure 11 is a schematic structural diagram of an electronic device in an exemplary embodiment of the present disclosure.
  • first, second, third, etc. may be used to describe various information in the embodiments of the present disclosure, the information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other.
  • first information may also be called second information, and similarly, the second information may also be called first information.
  • word “if” as used herein may be interpreted as "when” or "when” or "in response to determining.”
  • the terms used in this article are “greater than” or “less than”, “higher than” or “lower than” when characterizing size relationships. But for those skilled in the art, it can be understood that: the term “greater than” also covers the meaning of “greater than or equal to”, and “less than” also covers the meaning of “less than or equal to”; the term “higher than” covers the meaning of “higher than or equal to”. “The meaning of “less than” also covers the meaning of "less than or equal to”.
  • an image composed of position difference values between various pixel points of different images may be called a position difference map.
  • the accuracy of the generated position difference map often determines the final imaging effect.
  • the two most typical position difference maps are: disparity map and optical flow map.
  • the disparity map refers to the image used to represent the position difference between the images captured by different cameras
  • the optical flow map refers to the image used to represent the position difference between the images captured by the moving object at different times. position difference between images.
  • imaging principle can be summarized as follows: image fusion of images captured by multiple cameras to supplement the details in the image, thereby improving the image quality.
  • the position difference of the same picture content in different images is represented by the above-mentioned disparity map.
  • disparity calculation can be performed based on the images captured by the two cameras, and we get Disparity map between two images. Since the position difference between the two cameras is fixed at the factory and is known, after obtaining the disparity map, based on the position difference between the two cameras and the disparity value of each pixel in the disparity map, The depth information of each pixel in the original image is obtained, and the two images are fused based on the depth information. Similar to the dual camera, when at least three cameras are used to capture images, the above operations can also be performed on any two captured images to obtain the depth information of the corresponding pixels, and then perform image fusion. Here No longer.
  • a disparity map is usually generated by performing disparity calculation on two captured images.
  • the principle of disparity calculation is: match pixels representing the same picture content in two images, and use the distance between the two matched pixels as the disparity value of the corresponding pixel.
  • To generate a disparity map in this way it is necessary to accurately match the content of the two images in order to accurately generate the disparity map.
  • every pixel in the two images will be accurately matched. It often happens that individual pixels in one image cannot be matched to the corresponding pixels in the other image.
  • the method of generating an optical flow map in related technologies is similar to the method of generating a disparity map, except that at least two images used to generate the optical flow map are: images taken by the same camera at different times of the same subject, and Images taken by different cameras on the same subject.
  • images taken by the same camera at different times of the same subject are: images taken by the same camera at different times of the same subject, and Images taken by different cameras on the same subject.
  • there are hole pixels with unknown optical flow values in the optical flow map obtained by the related technology which leads to poor quality of the adjusted image after any image is adjusted based on the optical flow map.
  • the present disclosure proposes a position difference map generation method to avoid the problem in related technologies that the final imaging based on the position difference map has poor quality due to the presence of hole pixels in the position difference map.
  • Figure 1 illustrates a method for generating a position difference map according to an exemplary embodiment of the present disclosure. As shown in Figure 1, the method may include the following steps:
  • Step 102 Calculate the disparity between the first image and the second image to obtain an initial position difference map; the initial position difference map contains at least one hole pixel with an unknown position difference value.
  • the present disclosure will further complete the position difference value operation of the hole pixels in the obtained initial position difference map to avoid the position difference value in the position difference map.
  • the initial position difference map can be divided into super pixels, where each super pixel obtained by the division includes multiple pixel points.
  • the position difference value of the hole pixel can be completed based on the position difference value of other pixels in the superpixel where each hole pixel is located.
  • this disclosure can refer to any two captured images as the first image and the second image, and perform position difference calculation on the two to obtain an initial position difference map.
  • any algorithm can be used to calculate the dislocation, for example, the BM (block matching, block matching) algorithm or the SGM (semi-global matching, semi-global matching algorithm) algorithm can be used.
  • the above two algorithms are schematic.
  • the specific algorithm used to calculate the dislocation can be determined by those skilled in the art according to actual needs, and this disclosure does not limit this.
  • the first image and the second image can be dedistorted before performing disparity calculation.
  • any de-distortion algorithm can be used to de-distort the first image and the second image, and the present disclosure does not limit this.
  • the first image and the second image can also be image aligned to more accurately calculate the disparity of the images.
  • the above-mentioned hole pixels can be filled in various scenarios.
  • different cameras can be used to capture images of the same subject to obtain a first image and a second image.
  • the disparity calculation of the first image and the second image can be Parallax calculation
  • the calculated position difference map can be a parallax map; for another example, in a sports scene, the same camera can be used to capture images of the same subject at different times to obtain the first image and the second image.
  • the position difference calculation performed on the first image and the second image may be an optical flow calculation
  • the calculated position difference map may be an optical flow map.
  • multi-camera scenes and sports scenes are schematic. The specific scene to which the technical solution of the present disclosure is applied can be determined by those skilled in the art according to actual needs, and the present disclosure does not limit this.
  • Step 104 Perform super-pixel division on the initial position difference map.
  • Each super pixel obtained by division includes multiple pixel points, and the position difference value pair is based on the position difference value of other pixel points in the super pixel where each hole pixel point is located. The position difference value of the corresponding hole pixel is completed.
  • the meaning of superpixel is: a set of pixels composed of multiple pixels.
  • the process of superpixel division can also be regarded as: the process of assigning all pixel points in the initial position difference map to different pixel point sets.
  • the initial position difference map can be divided into super pixels according to a preset size, so that each divided super pixel contains a preset number of pixels.
  • superpixels can be divided with a size of "3*3" so that each divided superpixel contains 9 pixels.
  • this example is only illustrative.
  • the specific size used for super-pixel division can be determined by those skilled in the art according to actual needs, and this disclosure does not limit this.
  • both the pixel value distribution of the image and the position difference value distribution of the position difference map show a certain degree of continuity, and the continuity of the two is usually similar.
  • the distribution of pixel values can reflect the distribution of position difference values to a certain extent.
  • the superpixels can also be adjusted based on the distribution of pixel values, so that there is a certain continuity between the pixels inside the adjusted superpixels, and thus the superpixels can be more accurately classified. Hole pixels inside the pixels are filled.
  • the pixel value distribution of the first image can be obtained, and the pixel points included in each superpixel can be adjusted according to the pixel value distribution.
  • the pixel value distribution can be used to characterize the flat area and the edge area in the first image, where the flat area refers to the area where the pixel value changes relatively gently, and the edge area refers to the area where the pixel value changes relatively rapidly. Area.
  • the present disclosure can set a preset value as a standard for dividing flat areas and edge areas. Pixels whose pixel difference from its own neighborhood pixels is not greater than the preset value can be determined to belong to the flat area, and pixels that are different from its own neighborhood pixels can be determined to belong to the flat area.
  • Pixels whose pixel difference value of neighboring pixels is greater than the preset value are determined to belong to the edge area.
  • the pixels included in the superpixel can be adjusted so that the pixels included in the adjusted superpixel belong to the same flat area or the same edge area.
  • the hole pixels contained in the super pixel are completed based on the position difference values of the pixels in the super pixels, and the position difference values completed for the hole pixels are more accurate.
  • a brightness map of the first image can be obtained as the above-mentioned pixel value distribution.
  • the pixels contained in each divided super pixel can be adjusted, so that each pixel in the same super pixel after adjustment and its neighbor pixels The brightness difference of the points does not exceed the preset brightness value.
  • the brightness map represents the brightness distribution of the first image, which is equivalent to determining the distribution of position difference values based on the distribution of brightness values.
  • the distribution of position difference values can be determined through the distribution of other types of pixel values, such as RGB values.
  • the first image refers to the image that is used as the reference image when calculating the disparity. For example, in a multi-camera scenario, since the imaging quality of the main camera is higher, the image captured by the main camera is usually used as the reference image when calculating the disparity.
  • the positional difference values of the hole pixels contained in the superpixels can be completed based on the positional difference values of the pixels contained in the superpixels.
  • This disclosure can use multiple methods to complete hole pixels.
  • the position difference values of other pixels in the superpixel where the hole pixel is located can be obtained first, and the obtained position differences can be calculated.
  • the calculated average value is used as the position difference value of any hole pixel.
  • weight values can also be added to the above-mentioned other pixel points. Then, the calculated average value of the position difference value of the other pixel points can be weighted average value.
  • weight values can be set for the above-mentioned other pixels in various ways. For example, the weight value can be set according to the distance between each pixel and the hole pixel, where the weight value of any pixel can be negatively correlated with the distance, that is, the weight of the pixel in the super pixel is closer to the hole pixel. The higher the value.
  • the weight of each pixel point is set in this way. value, the position difference value of the hole pixel can be determined more accurately.
  • the method of setting the weight value for each pixel according to the distance from the hole pixel is only illustrative. Those skilled in the art can also use other methods to set the weight value for each pixel according to actual needs. For example, they can also set the weight value for each pixel according to the distance from the hole pixel. The distance from the center of the superpixel to which it belongs sets a weight value for each pixel, and the relationship between the two can also be a negative correlation, which is not limited by this disclosure.
  • the position difference values of other pixels in the superpixel where the hole pixel is located can be obtained first, and each obtained position can be obtained.
  • the median value of the difference value is used as the position difference value of any hole pixel.
  • the position difference values of pixels whose position difference values are not within the preset disparity range in the initial position difference map can also be adjusted to unknown, so that the corresponding pixel points are converted into hole pixel points.
  • the position calculated based on the two pixels with the same picture content in the two images The difference value is usually not too large. If the position difference of a certain pixel is large and exceeds the preset range, it is likely that a matching error occurred when matching pixels based on the image content mentioned above. It can be seen that through the above method of converting pixels whose position difference values exceed the preset parallax range into hole pixels, the problem of position difference value calculation errors caused by inaccurate pixel matching can be effectively avoided.
  • the preset parallax range is mostly the upper limit of the position difference value.
  • the position difference value exceeds this
  • the corresponding pixels are converted into hole pixels.
  • a histogram of the initial position difference map can be generated, and the pixels in the histogram whose position difference value is higher than the preset position difference value can be converted into hole pixels.
  • the present disclosure can also determine pixels whose position difference value is smaller than the preset value as mismatched pixels. In this case, it is also possible to generate a histogram of the initial position difference map first, determine the number of values smaller than the preset value based on the histogram, and then convert the pixels with the position difference value to the hole pixels.
  • median filtering can also be performed on the first image to obtain the first image after removing noise, and based on the filtered first image
  • the pixel value continuity of each included pixel point is determined, and then a secondary completion of the position difference value is performed on the position difference map completed by the position difference value based on the pixel value continuity.
  • the bilateral operator principle FastBilateralSolver
  • the first image obtained through filtering and the position difference map completed through the position difference value can be used as the input of the bilateral operator algorithm.
  • the technical solution of the present disclosure can be applied to any type of electronic equipment.
  • the electronic equipment can be mobile terminals such as smartphones and tablet computers, or fixed terminals such as smart TVs and PCs (Personal Computers). terminal.
  • which type of electronic device is specifically used as the execution subject of the technical solution of the present disclosure can be determined by those skilled in the art according to actual needs, and the present disclosure does not limit this.
  • a distortion correction component an image alignment component, a disparity calculation component, a superpixel adjustment component, a position difference value completion component, etc. can be deployed in an electronic device to implement each step in the technical solution of the present disclosure.
  • the disparity calculation can be performed on the first image and the second image to obtain a pixel point containing at least one hole.
  • Initial position difference map the present disclosure can further divide the initial position difference map into super pixels, and supplement the position difference value of the corresponding hole pixel point based on the position difference value of other pixel points in the super pixel where each hole pixel point is located. Complete.
  • the pixel value distribution of the image is usually close to the position difference value distribution of its position difference map. Therefore, after the super pixels are obtained by dividing based on the preset size, the present disclosure can further obtain the pixel value distribution of the first image, and adjust the pixel points contained in the divided super pixels based on the pixel value distribution, so as to Make the pixels included in the adjusted superpixels be located in the same flat area or the same edge area. It should be understood that the position difference values of pixels located in the same flat area or the same edge area show a certain degree of continuity.
  • the pixels in the same super pixel are adjusted to the same flat area or the same edge area, and based on The position difference value of the pixels in the super pixel is used to complete the position difference value of the hole pixels in the super pixel, which can rely on its continuity characteristics to improve the accuracy of parallax completion of the hole pixels.
  • the central processing unit usually has a high load and image processing tasks take up a lot of resources, in order to improve the efficiency of image processing, technicians usually deploy an independent image processor to complete image processing tasks.
  • the present disclosure also proposes a disparity map generation method applied to an image processor.
  • this method most operations are consistent with the disparity map generation method applied to electronic devices described above, except that the image processor is described as the execution subject.
  • the image processor is described as the execution subject.
  • Step 1 Receive a first image generated by a first image sensor and a second image generated by a second image sensor; the first image and the second image are generated by the first camera to which the first image sensor belongs and the second image generated by the second image sensor.
  • the second camera to which the second image sensor belongs takes pictures of the same subject.
  • an electronic device may be equipped with an image sensor for image collection, so as to generate a first image and a second image corresponding to the same subject based on the collected raw data.
  • the image sensor can transmit the generated first image and the second image to the image processor, so that the image sensor performs position difference calculation on the first image and the second image to obtain a position difference map.
  • this embodiment since the technical solution of this embodiment is different from the position difference map generation method described above, only the execution subject is different. Therefore, this embodiment no longer performs disparity calculation, super-pixel division, and disparity value compensation.
  • the congruent operations will not be described in detail. For relevant content, please refer to the introduction above.
  • the present disclosure can be applied to both multi-camera scenes and sports scenes. Therefore, when this embodiment is applied to different scenarios, there are certain differences in the execution of this step. in,
  • the electronic device may be equipped with a first camera and a second camera, where the first camera includes a first image sensor and the second camera includes a second image sensor.
  • the actual execution process of this step may be: image acquisition is performed through the first image sensor and the second image sensor respectively, so that the first image sensor and the second image sensor generate images with the same object based on the collected original data.
  • the first image and the second image corresponding to the subject.
  • the first image sensor and the second image sensor can transmit the generated first image and the second image to the image processor, so that the image processor performs parallax calculation on the first image and the second image to obtain Disparity map.
  • the disparity value in the disparity map represents the difference in depth information, that is, the position information mentioned above refers to the depth information, usually “from the camera to the corresponding object in the image” “distance” (mostly refers to the distance information in the direction of the camera axis).
  • the disparity map is ultimately used for image fusion of the first image and the second image, which essentially improves the quality of the final imaging by improving the accuracy of image fusion.
  • the electronic device can call the assembled image sensor to collect images twice at different times to obtain the first image and the second image.
  • the continuous shooting mode can be turned on to continuously shoot the subject, or Use video mode for video shooting.
  • the subject and the electronic device may move relative to each other, so that the position information of the subject in the two images changes.
  • the image sensor can transmit the first image and the second image to the image processor, so that the image processor performs optical flow calculation on the first image and the second image to obtain an optical flow map.
  • the optical flow value in the optical flow map represents the position difference at different times, that is, the difference in position information mentioned above is the displacement.
  • the optical flow map is usually used to adjust a certain image. For example, based on the optical flow map and the image captured first, the image captured later is adjusted to eliminate afterimages, etc., thereby improving the quality of the final imaging.
  • this example is only illustrative.
  • the specific method of adjusting the image based on the optical flow map can be determined by those skilled in the art according to actual needs, and this embodiment does not limit this.
  • Step 2 Perform disparity calculation on the first image and the second image to obtain an initial disparity map.
  • the initial disparity map contains at least one hole pixel with unknown disparity value.
  • Step 3 Perform super-pixel division on the initial disparity map.
  • Each super-pixel obtained by the division contains multiple pixels, and the corresponding disparity values are based on the disparity values of other pixels in the super-pixel where each hole pixel is located. The disparity value of the hole pixel is completed.
  • the image processor in this embodiment can be mounted on different chips according to the actual situation.
  • it can be mounted on an ISP (Image Signal Processing) chip or an SoC (System on Chip) chip.
  • the specific chip to be mounted on can be determined by those skilled in the art according to actual needs, and this disclosure does not limit this.
  • FIG. 2 is a flowchart of a method for generating a disparity map according to an exemplary embodiment of the present disclosure. As shown in Figure 2, this method is applied to a smartphone equipped with at least two cameras and may include the following steps:
  • Step 201 Capture an image of the subject based on the main photography and the secondary photography.
  • the smartphone can be equipped with a main camera with better imaging effect and a secondary camera with relatively poor imaging effect. Then, when the user takes a picture of the subject through the dual camera mode, the smartphone can simultaneously call the main camera and the secondary camera to take pictures of the subject to obtain the main camera image and the secondary camera image.
  • Step 202 Use the SGM algorithm to calculate parallax on the captured main image and secondary image.
  • disparity calculation can be performed on the two based on the preset SGM algorithm to obtain an initial disparity map.
  • the initial disparity map obtained through disparity calculation can be shown in Figure 3, in which the disparity values of most pixels are known, but the disparity values of some pixels are still unknown.
  • the initial parallax map is mostly generated based on the main camera.
  • the disparity value of any pixel in the generated initial disparity map is used to represent "the distance between a pixel at the same position in the main image and a pixel in the secondary image that matches the content of the pixel.”
  • Step 203 Generate a histogram of the obtained initial disparity map.
  • disparity calculation actually calculates the distance between pixels with consistent content in the two images.
  • the content matching between pixels directly determines the accuracy of disparity calculation.
  • mismatching of pixels will inevitably occur in the actual matching process, resulting in inaccurate disparity values of corresponding pixels.
  • pixels containing inaccurate disparity values due to mismatching may be identified, and the identified pixels may be converted into hole pixels.
  • the pixel can be completed in the subsequent hole pixel completion operation. It is not difficult to see that this process is equivalent to correcting the pixels with inaccurate parallax values caused by mismatching.
  • the histogram of the initial disparity map can be obtained to determine pixels with a disparity value higher than a preset value as pixels with inaccurate disparity values, and convert the pixels into hole pixels.
  • the histogram obtained based on the initial disparity map shown in Figure 3 can be as shown in Figure 4, that is, the number of pixels with disparity values of each value can be statistically obtained. Assuming that the preset upper limit of the disparity value is 8, pixels with a disparity value exceeding 8 can be converted into hole pixels, that is, the initial disparity map shown in Figure 3 is converted into the disparity map shown in Figure 5.
  • pixels with inaccurate disparity values may also be determined without relying on the preset value. For example, after counting the number of pixels with disparity values of each value, the value with the smallest number of pixels can be determined, and the pixels with the disparity value of this value can be converted into hole pixels. How to specifically determine pixels with inaccurate disparity values and convert them into hole pixels can be determined by those skilled in the art according to actual conditions, and this embodiment does not limit this.
  • Step 204 Convert pixels in the initial disparity map whose disparity value exceeds a preset value into hole pixels based on the histogram.
  • Step 205 Perform super-pixel division on the initial disparity map according to a preset size.
  • the initial disparity map can be divided into super pixels according to a preset size. It should be stated that since the size of the initial disparity map is the same as that of the main image, and the pixels at the same position correspond to the same picture content, super-pixel division of the initial disparity map is equivalent to super-pixel division of the main image. , there are only differences in expression, but the actual meaning is the same.
  • the initial disparity map can be divided into super pixels with a size of "3*3" to obtain several super pixels containing 9 pixels as shown in Figure 6, such as super pixels A, B, and C.
  • superpixel A contains hole pixel point a
  • superpixel B contains hole pixel points b1 and b2
  • superpixel C contains hole pixel points c1 and c2.
  • Step 206 Obtain the brightness map of the main image.
  • Step 207 Adjust the pixels contained in the superpixel based on the brightness map.
  • the pixels contained in the super pixels can be further adjusted based on the brightness map.
  • the adjustment standard is: as pointed out above, the pixels in the adjusted super pixels belong to the same flat area or the same edge area. Among them, the number of pixels contained in the superpixels before and after adjustment can be further restricted to be the same.
  • the superpixels obtained by the division shown in Figure 6 are adjusted based on the brightness map shown in Figure 7 .
  • the superpixels obtained by adjusting superpixels A, B, and C respectively are superpixels A’, B’, and C’ as shown in Figure 8.
  • the pixels included in superpixel A' belong to the flat area on the left side of the image; the pixels included in superpixel B' belong to the edge area circled in Figure 7; and superpixel C' belongs to the flat area in the upper right corner of the image. .
  • Step 208 Complete the hole pixels in the superpixel based on the adjusted disparity value of each pixel in the superpixel.
  • hole pixels b1, b2, c1, c2 can also be filled in a similar way until all hole pixels in the image are filled, and a more accurate secondary image can be obtained. Disparity map of the main image. It should be understood that the above examples only use superpixels A, B, and C as examples to introduce the technical solutions in this specification. The operation methods of other pixels are also similar and will not be described again here.
  • the brightness map can also be divided into super pixels, and the divided super pixels in the brightness map can be adjusted.
  • the order of steps 205, 206, 207, and 208 can be adjusted.
  • the brightness map can be obtained first, and then the brightness map can be divided into super pixels based on the preset size, and then based on the brightness value of each pixel in the brightness map Adjust the divided superpixels. On this basis, the operation of completing the hole pixels based on the disparity value within the superpixel is performed.
  • the smartphone in this embodiment can perform disparity calculation on the two to obtain an initial disparity map between the two, and perform a disparity calculation on the initial disparity map.
  • Superpixel partitioning Furthermore, the divided superpixels can also be adjusted based on the brightness value of the main image, so that each pixel in the superpixel belongs to the same flat area or edge area.
  • the hole pixels contained in the super pixel are completed based on the disparity value of each pixel in the super pixel, which avoids the problem of image processing based on the disparity map due to the existence of hole pixels in the disparity map in related technologies. The problem of poor quality of the fused image.
  • FIG. 9 is a block diagram of a position difference map generating device according to an exemplary embodiment of the present disclosure.
  • the device includes a computing unit 901 and a dividing unit 902 .
  • the calculation unit 901 performs dislocation calculation on the first image and the second image to obtain an initial position difference map;
  • the initial position difference map contains at least one hole pixel with an unknown position difference value;
  • the dividing unit 902 performs super-pixel division on the initial position difference map.
  • Each super pixel obtained by division includes multiple pixel points, and is based on the position difference values of other pixel points in the super pixel where each hole pixel point is located. Complete the position difference value of the corresponding hole pixel.
  • the position difference map is a disparity map, and the first image and the second image are captured by different cameras for the same subject; or,
  • the position difference map is an optical flow map, and the first image and the second image are obtained by shooting the same subject at different times with the same camera.
  • the dividing unit 902 is further used for:
  • the initial position difference image is divided into super pixels according to a preset size, so that each divided super pixel contains a preset number of pixel points.
  • the dividing unit 902 is further used for:
  • the dividing unit 902 is further used for:
  • the dividing unit 902 is further used for:
  • the position difference value of each other pixel point in the super pixel where any hole pixel point is located is obtained, and the median value of the obtained position difference values is taken as the position difference value of any hole pixel point.
  • Figure 10 is a block diagram of another location difference map generating device according to an exemplary embodiment of the present disclosure. Based on the aforementioned embodiment shown in Figure 9, this embodiment also includes: a determination unit 903 , adjustment unit 904 and filtering unit 905.
  • Optional also includes:
  • Determining unit 903 determines the distribution of pixel values in the first image.
  • the distribution of pixel values is used to characterize the flat areas and edge areas in the first image; where the pixels in the flat area and their neighbors The pixel difference value of a pixel is not greater than the preset value, and the pixel difference value of a pixel in the edge area and its neighbor pixels is greater than the preset value;
  • the adjustment unit 904 adjusts the pixel points included in each super pixel based on the pixel value distribution, so that the adjusted pixel points in the same super pixel belong to the same flat area or the same edge area.
  • the determining unit 903 is further configured to: obtain the brightness map of the first image
  • the adjustment unit 904 is further configured to: based on the brightness value of each pixel point in the brightness map, adjust the pixel points contained in each divided super pixel, so that each pixel point in the same super pixel after adjustment is the same as its neighbor. The brightness difference of domain pixels does not exceed the preset brightness value.
  • the adjustment unit 904 is also used for:
  • the position difference values of pixels whose position difference values are not within the preset parallax range are adjusted to unknown, so that the corresponding pixels are converted into hole pixels.
  • the dividing unit 902 is also used to: determine the pixel value continuity of each included pixel point based on the filtered first image, and position the position difference map completed by the position difference value based on the determined pixel value continuity. Secondary completion of difference values.
  • the device embodiment since it basically corresponds to the method embodiment, please refer to the partial description of the method embodiment for relevant details.
  • the device embodiments described above are only illustrative.
  • the units described as separate components may or may not be physically separated.
  • the components shown as units may or may not be physical units, that is, they may be located in One location, or it can be distributed across multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the disclosed solution. Persons of ordinary skill in the art can understand and implement the method without any creative effort.
  • the present disclosure also provides a device for generating a location difference map, including: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to implement as described in any of the above embodiments
  • a method for generating a position difference map may include: performing disparity calculation on the first image and the second image to obtain an initial position difference map; the initial position difference map contains at least one hole pixel with an unknown position difference value. ; Perform super-pixel division on the initial position difference map. Each super-pixel obtained by the division contains multiple pixels, and the corresponding corresponding pixels are calculated based on the position difference values of other pixels in the super-pixel where each hole pixel is located. The position difference value of the hole pixel is completed.
  • the present disclosure also provides an electronic device.
  • the electronic device includes a memory and one or more programs, wherein the one or more programs are stored in the memory and configured to be processed by one or more processors.
  • Executing the one or more programs includes instructions for implementing the position difference map generation method as described in any of the above embodiments.
  • the method may include: performing disparity calculation on the first image and the second image to obtain An initial position difference map; the initial position difference map contains at least one hole pixel with an unknown position difference value; the initial position difference map is divided into super pixels, and each super pixel obtained by the division contains multiple pixels, And the position difference value of the corresponding hole pixel is completed based on the position difference value of other pixels in the superpixel where each hole pixel is located.
  • the present disclosure also provides a chip, which includes one or more interface circuits and one or more processors; the interface circuit is used to receive signals from the memory of the electronic device and send signals to the processor.
  • the signal includes a computer instruction stored in a memory; when the processor executes the computer instruction, the electronic device is caused to execute any of the position difference map generating methods described above.
  • FIG. 11 is a block diagram of a device 1100 for implementing a position difference map generation method according to an exemplary embodiment.
  • the device 1100 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, or the like.
  • the device 1100 may include one or more of the following components: a processing component 1102, a memory 1104, a power supply component 1106, a multimedia component 1108, an audio component 1110, an input/output (I/O) interface 1112, a sensor component 1114, and communications component 1116.
  • Processing component 1102 generally controls the overall operations of device 1100, such as operations associated with display, phone calls, data communications, camera operations, and recording operations.
  • the processing component 1102 may include one or more processors 1120 to execute instructions to complete all or part of the steps of the above method.
  • processing component 1102 may include one or more modules that facilitate interaction between processing component 1102 and other components.
  • processing component 1102 may include a multimedia module to facilitate interaction between multimedia component 1108 and processing component 1102.
  • Memory 1104 is configured to store various types of data to support operations at device 1100 . Examples of such data include instructions for any application or method operating on device 1100, contact data, phonebook data, messages, pictures, videos, etc.
  • Memory 1104 may be implemented by any type of volatile or non-volatile storage device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EEPROM), Programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk.
  • SRAM static random access memory
  • EEPROM electrically erasable programmable read-only memory
  • EEPROM erasable programmable read-only memory
  • EPROM Programmable read-only memory
  • PROM programmable read-only memory
  • ROM read-only memory
  • magnetic memory flash memory
  • flash memory magnetic or optical disk.
  • Power supply component 1106 provides power to various components of device 1100 .
  • Power supply components 1106 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to device 1100 .
  • Multimedia component 1108 includes a screen that provides an output interface between the device 1100 and the user.
  • the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user.
  • the touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide action.
  • multimedia component 1108 includes a front-facing camera and/or a rear-facing camera.
  • the front camera and/or the rear camera may receive external multimedia data.
  • Each front-facing camera and rear-facing camera can be a fixed optical lens system or have a focal length and optical zoom capabilities.
  • Audio component 1110 is configured to output and/or input audio signals.
  • audio component 1110 includes a microphone (MIC) configured to receive external audio signals when device 1100 is in operating modes, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 1104 or sent via communications component 1116 .
  • audio component 1110 also includes a speaker for outputting audio signals.
  • the I/O interface 1112 provides an interface between the processing component 1102 and a peripheral interface module.
  • the peripheral interface module may be a keyboard, a click wheel, a button, etc. These buttons may include, but are not limited to: Home button, Volume buttons, Start button, and Lock button.
  • Sensor component 1114 includes one or more sensors for providing various aspects of status assessment for device 1100 .
  • the sensor component 1114 can detect the open/closed state of the device 1100, the relative positioning of components, such as the display and keypad of the device 1100, and the sensor component 1114 can also detect a change in position of the device 1100 or a component of the device 1100. , the presence or absence of user contact with device 1100 , device 1100 orientation or acceleration/deceleration and temperature changes of device 1100 .
  • Sensor assembly 1114 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact.
  • Sensor assembly 1114 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications.
  • the sensor component 1114 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
  • Communications component 1116 is configured to facilitate wired or wireless communications between device 1100 and other devices.
  • the device 1100 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, 4G LTE, 5G NR (New Radio), or a combination thereof.
  • the communication component 1116 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel.
  • the communications component 1116 also includes a near field communications (NFC) module to facilitate short-range communications.
  • the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
  • RFID radio frequency identification
  • IrDA infrared data association
  • UWB ultra-wideband
  • Bluetooth Bluetooth
  • apparatus 1100 may be configured by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable Gate array (FPGA), controller, microcontroller, microprocessor or other electronic components are implemented for executing the above method.
  • ASICs application specific integrated circuits
  • DSPs digital signal processors
  • DSPDs digital signal processing devices
  • PLDs programmable logic devices
  • FPGA field programmable Gate array
  • controller microcontroller, microprocessor or other electronic components are implemented for executing the above method.
  • a non-transitory computer-readable storage medium including instructions such as a memory 1104 including instructions, which are executable by the processor 1120 of the device 1100 to complete the above method is also provided.
  • the non-transitory computer-readable storage medium may be ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.

Abstract

The present disclosure relates to a position difference graph generation method and apparatus, an electronic device, a chip, and a medium. The method comprises: performing position difference calculation on a first image and a second image to obtain an initial position difference graph, the initial position difference graph comprising at least one hole pixel point having an unknown position difference value; and performing superpixel division on the initial position difference graph, each superpixel obtained by division comprising a plurality of pixel points, and complementing the position difference value of the corresponding hole pixel point on the basis of the position difference values of other pixel points in the superpixel where each hole pixel point is located.

Description

位置差异图生成方法及装置、电子设备、芯片及介质Position difference map generation method and device, electronic equipment, chip and medium 技术领域Technical field
本公开涉及图像处理领域,尤其涉及一种位置差异图生成方法及装置、电子设备、芯片及介质。The present disclosure relates to the field of image processing, and in particular, to a position difference map generation method and device, electronic equipment, chips and media.
背景技术Background technique
为了提高影像作品的质量,时下的大多数电子设备在进行图像或视频拍摄时,通常都需要优先获取用于表征不同图像的各个像素点之间的位置关系的位置差异图,以基于该位置差异图对相应的图像进行调整。In order to improve the quality of image works, most electronic devices nowadays usually need to first obtain a position difference map used to characterize the position relationship between various pixels of different images when shooting images or videos, so as to based on the position difference. Adjust the corresponding image.
例如,在多摄场景下,需要获取不同摄像头拍摄得到的图像之间的视差图,以基于该视差图对拍摄得到的多个图像进行图像融合。再例如,在对运动物体进行拍摄时,可以获取在不同时刻拍摄得到的不同图像之间的光流图,以基于该光流图预测运动物体的运动情况,进而根据预测得到的运动情况对图像进行调整。For example, in a multi-camera scenario, it is necessary to obtain a disparity map between images captured by different cameras, so as to perform image fusion on multiple images captured based on the disparity map. For another example, when shooting a moving object, the optical flow map between different images taken at different times can be obtained to predict the movement of the moving object based on the optical flow map, and then adjust the image based on the predicted movement. Make adjustments.
发明内容Contents of the invention
有鉴于此,本公开提供一种位置差异图生成方法及装置、电子设备、芯片及介质,能够准确生成两个图像之间的位置差异图。In view of this, the present disclosure provides a position difference map generation method and device, electronic equipment, chips and media, which can accurately generate a position difference map between two images.
根据本公开的第一方面,提供一种位置差异图生成方法,包括:According to a first aspect of the present disclosure, a method for generating a location difference map is provided, including:
对第一图像和第二图像进行位差计算,得到初始位置差异图;所述初始位置差异图中包含至少一个位置差异值未知的空洞像素点;Perform dislocation calculation on the first image and the second image to obtain an initial position difference map; the initial position difference map contains at least one hole pixel with an unknown position difference value;
对所述初始位置差异图进行超像素划分,划分得到的每一超像素均包含多个像素点,并基于各个空洞像素点所位于的超像素中的其他像素点的位置差异值对相应的空洞像素点的像素值进行补全。The initial position difference map is divided into super pixels. Each super pixel obtained by the division contains multiple pixels, and the corresponding holes are classified based on the position difference values of other pixels in the super pixel where each hole pixel is located. Complete the pixel value of the pixel.
根据本公开的第二方面,提供一种位置差异图生成装置,包括:According to a second aspect of the present disclosure, a location difference map generating device is provided, including:
计算单元,对第一图像和第二图像进行位差计算,得到初始位置差异图;所述初始位置差异图中包含至少一个位置差异值未知的空洞像素点;The calculation unit performs disparity calculation on the first image and the second image to obtain an initial position difference map; the initial position difference map contains at least one hole pixel with an unknown position difference value;
划分单元,对所述初始位置差异图进行超像素划分,划分得到的每一超像素均包含多个像素点,并基于各个空洞像素点所位于的超像素中的其他像素点的位置差异值对相应的空洞像素点的像素值进行补全。The dividing unit divides the initial position difference map into super pixels. Each super pixel obtained by the division contains multiple pixel points, and the position difference value pair is based on the position difference value of other pixel points in the super pixel where each hole pixel point is located. The pixel value of the corresponding hole pixel is completed.
根据本公开的第三方面,提供一种位置差异图生成方法,应用于图像处理器,包括:According to a third aspect of the present disclosure, a position difference map generation method is provided, which is applied to an image processor and includes:
接收图像传感器生成的第一图像和第二图像;所述第一图像和所述第二图像由所述图像传感器所属的摄像头针对同一被摄主体拍摄得到;Receive the first image and the second image generated by the image sensor; the first image and the second image are captured by the camera to which the image sensor belongs, aiming at the same subject;
对所述第一图像和第二图像进行位差计算,得到初始位置差异图,所述初始位置差异图中包含至少一个位置差异值未知的空洞像素点;Perform dislocation calculation on the first image and the second image to obtain an initial position difference map, where the initial position difference map contains at least one hole pixel with an unknown position difference value;
对所述初始位置差异图进行超像素划分,划分得到的每一超像素均包含多个像素点,并基于各个空洞像素点所位于的超像素中的其他像素点的位置差异值对相应的空洞像素点的位置差异值进行补全。The initial position difference map is divided into super pixels. Each super pixel obtained by the division contains multiple pixels, and the corresponding holes are classified based on the position difference values of other pixels in the super pixel where each hole pixel is located. The position difference value of the pixel is completed.
根据本公开的第四方面,提供一种电子设备,包括:According to a fourth aspect of the present disclosure, an electronic device is provided, including:
处理器;processor;
用于存储处理器可执行指令的存储器;Memory used to store instructions executable by the processor;
其中,所述处理器通过运行所述可执行指令以实现如第一方面所述的方法。Wherein, the processor implements the method described in the first aspect by running the executable instructions.
根据本公开的第五方面,提供一种计算机可读存储介质,其上存储有计算机指令,该指令被处理器执行时实现如第一方面所述方法的步骤。According to a fifth aspect of the present disclosure, a computer-readable storage medium is provided, computer instructions are stored thereon, and when the instructions are executed by a processor, the steps of the method described in the first aspect are implemented.
在本公开的技术方案中,在获得第一图像和第二图像之后,可以对两者进行位差计算,以得到初始位置差异图。在此基础上,即可对初始位置差异图进行超像素划分,并基于划分得到的超像素中的各个像素点的位置差异值对其中包含的空洞像素点进行位置差异值补全。应当理解的是,由于本公开基于划分得到的超像素对各自包含的空洞像素点进行了位置差异值补全,避免了相关技术生成的位置差异图中存在空洞像素点,而影响最终成像的问题。In the technical solution of the present disclosure, after obtaining the first image and the second image, dislocation calculation can be performed on the two to obtain an initial position difference map. On this basis, the initial position difference map can be divided into super pixels, and the position difference values of the hole pixels contained in the super pixels can be completed based on the position difference values of each pixel in the divided super pixels. It should be understood that since the present disclosure completes the position difference values of the hole pixels contained in each of them based on the divided super pixels, it avoids the problem of hole pixels in the position difference map generated by the related technology, which affects the final imaging. .
附图说明Description of the drawings
为了更清楚地说明本公开实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本公开的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the drawings needed to be used in the description of the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present disclosure. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without exerting any creative effort.
图1是本公开一示例性实施例示出的一种位置差异图生成方法的流程图;Figure 1 is a flow chart of a method for generating a position difference map according to an exemplary embodiment of the present disclosure;
图2是本公开一示例性实施例示出的一种视差图生成方法的流程图;Figure 2 is a flow chart of a method for generating a disparity map according to an exemplary embodiment of the present disclosure;
图3是本公开一示例性实施例示出的一种初始视差图的示意图;FIG. 3 is a schematic diagram of an initial disparity map according to an exemplary embodiment of the present disclosure;
图4是本公开一示例性实施例示出的一种初始视差图的直方图示意图;FIG. 4 is a schematic histogram diagram of an initial disparity map according to an exemplary embodiment of the present disclosure;
图5是本公开一示例性实施例示出的一种调整后的初始视差图的示意图;FIG. 5 is a schematic diagram of an adjusted initial disparity map according to an exemplary embodiment of the present disclosure;
图6是本公开一示例性实施例示出的一种超像素划分的示意图;Figure 6 is a schematic diagram of a super-pixel division according to an exemplary embodiment of the present disclosure;
图7是本公开一示例性实施例示出的一种主摄图像的亮度图的示意图;FIG. 7 is a schematic diagram of a brightness diagram of a main image according to an exemplary embodiment of the present disclosure;
图8是本公开一示例性实施例示出的一种对超像素包含的像素点进行调整后的示意图;FIG. 8 is a schematic diagram after adjusting the pixel points included in the super pixel according to an exemplary embodiment of the present disclosure;
图9是本公开一示例性实施例示出的一种位置差异图生成装置的框图;Figure 9 is a block diagram of a position difference map generating device according to an exemplary embodiment of the present disclosure;
图10是本公开一示例性实施例示出的另一种位置差异图生成装置的框图;Figure 10 is a block diagram of another location difference map generating device according to an exemplary embodiment of the present disclosure;
图11是本公开一示例性实施例中一种电子设备的结构示意图。Figure 11 is a schematic structural diagram of an electronic device in an exemplary embodiment of the present disclosure.
具体实施方式Detailed ways
下面将结合本公开实施例中的附图,对本公开实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本公开一部分实施例,而不是全部的实施例。基于本公开中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本公开保护的范围。The technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only some of the embodiments of the present disclosure, rather than all of the embodiments. Based on the embodiments in this disclosure, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of this disclosure.
在本公开实施例使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本公开实施例。在本公开实施例和所附权利要求书中所使用的单数形式的“一种”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。还应当理解,本文中使用的术语“和/或”是指并包含一个或多个相关联的列出项目的任何或所有可能组合。The terminology used in the embodiments of the present disclosure is for the purpose of describing specific embodiments only and is not intended to limit the embodiments of the present disclosure. As used in the embodiments of the present disclosure and the appended claims, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly dictates otherwise. It will also be understood that the term "and/or" as used herein refers to and includes any and all possible combinations of one or more of the associated listed items.
应当理解,尽管在本公开实施例可能采用术语第一、第二、第三等来描述各种信息,但这些信息不应限于这些术语。这些术语仅用来将同一类型的信息彼此区分开。例如,在不脱离本公开实施例范围的 情况下,第一信息也可以被称为第二信息,类似地,第二信息也可以被称为第一信息。取决于语境,如在此所使用的词语“如果”可以被解释成为“在……时”或“当……时”或“响应于确定”。It should be understood that although the terms first, second, third, etc. may be used to describe various information in the embodiments of the present disclosure, the information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other. For example, without departing from the scope of the embodiments of the present disclosure, the first information may also be called second information, and similarly, the second information may also be called first information. Depending on the context, the word "if" as used herein may be interpreted as "when" or "when" or "in response to determining."
出于简洁和便于理解的目的,本文在表征大小关系时,所使用的术语为“大于”或“小于”、“高于”或“低于”。但对于本领域技术人员来说,可以理解:术语“大于”也涵盖了“大于等于”的含义,“小于”也涵盖了“小于等于”的含义;术语“高于”涵盖了“高于等于”的含义,“低于”也涵盖了“低于等于”的含义。For the purpose of simplicity and ease of understanding, the terms used in this article are "greater than" or "less than", "higher than" or "lower than" when characterizing size relationships. But for those skilled in the art, it can be understood that: the term "greater than" also covers the meaning of "greater than or equal to", and "less than" also covers the meaning of "less than or equal to"; the term "higher than" covers the meaning of "higher than or equal to". "The meaning of "less than" also covers the meaning of "less than or equal to".
时下的电子设备,例如智能手机、平板电脑等为了提高拍摄得到的图像的成像效果,通常会拍摄多帧图像,以基于不同图像之间的位置差异,进行图像调整,进而得到最终图像。In order to improve the imaging effect of the captured images, current electronic devices, such as smartphones and tablets, usually capture multiple frames of images to adjust the images based on the position differences between different images to obtain the final image.
在本公开中,可以将不同图像的各个像素点之间的位置差异值组成的图像称作位置差异图。在实际应用中,生成的位置差异图的准确度,往往决定了最终的成像效果。In the present disclosure, an image composed of position difference values between various pixel points of different images may be called a position difference map. In practical applications, the accuracy of the generated position difference map often determines the final imaging effect.
最为典型的两种位置差异图即为:视差图和光流图。其中,视差图指的是:用于表征被摄主体在不同摄像头拍摄得到的图像之间的位置差异的图像;而光流图指的是:用于表征运动对象在不同时刻拍摄得到的图像之间的位置差异的图像。下面,以视差图为例,对相关技术中生成视差图的方式作简单介绍:The two most typical position difference maps are: disparity map and optical flow map. Among them, the disparity map refers to the image used to represent the position difference between the images captured by different cameras; and the optical flow map refers to the image used to represent the position difference between the images captured by the moving object at different times. position difference between images. Below, taking the disparity map as an example, we will briefly introduce the method of generating disparity maps in related technologies:
为了提高成像质量,电子设备通常装配有多个摄像头,以在需要进行图像拍摄时,可以通过多个摄像头对同一被摄主体进行图像拍摄。其成像原理可以概括为:将多个摄像头分别拍摄得到的图像进行图像融合,以对图像中的细节进行补充,进而达到提高画质的目的。In order to improve imaging quality, electronic devices are usually equipped with multiple cameras, so that when image capture is required, images of the same subject can be captured through multiple cameras. The imaging principle can be summarized as follows: image fusion of images captured by multiple cameras to supplement the details in the image, thereby improving the image quality.
然而,在实际的图像融合过程中,由于各个摄像头装配于电子设备的不同位置,致使拍摄得到的图像也存在一定的差异。因此,在进行图像融合之前,首先需要确定同一画面内容在不同图像中的位置差异,以根据该位置差异进行图像融合。唯有如此,才能对不同图像进行准确融合,达到提高画质的目的。However, in the actual image fusion process, since each camera is installed at different positions of the electronic device, there are certain differences in the captured images. Therefore, before performing image fusion, it is first necessary to determine the position difference of the same picture content in different images, so that image fusion can be performed based on the position difference. Only in this way can different images be accurately fused to achieve the purpose of improving image quality.
在图像处理领域中,同一画面内容在不同图像中的位置差异通过上述视差图进行表征,例如,在采用双摄进行图像拍摄的情况下,可以基于两个摄像头拍摄得到的图像进行视差计算,得到两个图像之间的视差图。由于两个摄像头的位置差异在出厂时便已固定,是已知的,因此,在得到视差图之后,即可基于两摄像头之间的位置差异,以及视差图中各个像素点的视差值,得到原始图像中各个像素点的深度信息,并基于该深度信息对两图像进行图像融合。与双摄相类似的,在采用至少三个摄像头进行图像拍摄的情况下,也可以对拍摄得到的任意两个图像执行上述操作,以得到相应像素点的深度信息,进而进行图像融合,在此不再赘述。In the field of image processing, the position difference of the same picture content in different images is represented by the above-mentioned disparity map. For example, when dual cameras are used to capture images, disparity calculation can be performed based on the images captured by the two cameras, and we get Disparity map between two images. Since the position difference between the two cameras is fixed at the factory and is known, after obtaining the disparity map, based on the position difference between the two cameras and the disparity value of each pixel in the disparity map, The depth information of each pixel in the original image is obtained, and the two images are fused based on the depth information. Similar to the dual camera, when at least three cameras are used to capture images, the above operations can also be performed on any two captured images to obtain the depth information of the corresponding pixels, and then perform image fusion. Here No longer.
由上述介绍不难看出,视差图的准确程度决定了最终成像的图像画质。在相关技术中,通常通过对拍摄得到的两个图像进行视差计算的方式,生成视差图。视差计算的原理为:在两图像中匹配表征同一画面内容的像素点,并将匹配到的两像素点之间的距离作为相应像素点的视差值。通过该方式生成视差图,需要在两图像中精准匹配画面内容,才能够准确生成视差图。然而,在实际匹配应用过程中,无法保证对两图像中的每一像素点都精准匹配,时常出现某一图像中的个别像素点无法在另一图像中未匹配到相对应的像素点的情况(例如某一摄像头与被摄主体之间的路径被物体遮挡等原因),致使生成的视差图中存在部分像素点视差值未知的情况,视差值未知的像素点又被称作空洞像素点。显然,由于存在空洞像素点,该视差图显然是不准确的,必然导致图像融合得到的图像的画质不佳。From the above introduction, it is easy to see that the accuracy of the disparity map determines the quality of the final image. In the related art, a disparity map is usually generated by performing disparity calculation on two captured images. The principle of disparity calculation is: match pixels representing the same picture content in two images, and use the distance between the two matched pixels as the disparity value of the corresponding pixel. To generate a disparity map in this way, it is necessary to accurately match the content of the two images in order to accurately generate the disparity map. However, in the actual matching application process, there is no guarantee that every pixel in the two images will be accurately matched. It often happens that individual pixels in one image cannot be matched to the corresponding pixels in the other image. (For example, the path between a certain camera and the subject is blocked by objects, etc.), resulting in the generated disparity map where the disparity values of some pixels are unknown. Pixels with unknown disparity values are also called hole pixels. point. Obviously, due to the existence of hole pixels, the disparity map is obviously inaccurate, which will inevitably lead to poor image quality of the image obtained by image fusion.
相关技术生成光流图的方式,与生成视差图的方式相类似,只不过用于生成的光流图的至少两个图像为:同一摄像头在不同时刻对同一被摄主体拍摄得到的图像,而非不同摄像头对同一被摄主体拍摄得 到的图像。与此相对应的,相关技术得到的光流图中存在光流值未知的空洞像素点,进而导致基于光流图对任一图像调整后,调整后的图像质量不佳。The method of generating an optical flow map in related technologies is similar to the method of generating a disparity map, except that at least two images used to generate the optical flow map are: images taken by the same camera at different times of the same subject, and Images taken by different cameras on the same subject. Correspondingly, there are hole pixels with unknown optical flow values in the optical flow map obtained by the related technology, which leads to poor quality of the adjusted image after any image is adjusted based on the optical flow map.
为此,本公开提出了一种位置差异图生成方法,以避免相关技术中由于位置差异图中存在空洞像素点,而导致基于位置差异图得到的最终成像,质量不佳的问题。To this end, the present disclosure proposes a position difference map generation method to avoid the problem in related technologies that the final imaging based on the position difference map has poor quality due to the presence of hole pixels in the position difference map.
图1为本公开一示例性实施例示出的一种位置差异图生成方法。如图1所示,该方法可以包括以下步骤:Figure 1 illustrates a method for generating a position difference map according to an exemplary embodiment of the present disclosure. As shown in Figure 1, the method may include the following steps:
步骤102,对第一图像和第二图像进行位差计算,得到初始位置差异图;所述初始位置差异图中包含至少一个位置差异值未知的空洞像素点。Step 102: Calculate the disparity between the first image and the second image to obtain an initial position difference map; the initial position difference map contains at least one hole pixel with an unknown position difference value.
由上文介绍可知,相关技术中之所以无法获得高质量图像,是由于其通过位差计算得到的位置差异图中存在空洞像素点导致的。As can be seen from the above introduction, the reason why high-quality images cannot be obtained in related technologies is due to the existence of hole pixels in the position difference map obtained through dislocation calculation.
有鉴于此,本公开在对拍摄得到的两个图像进行位差计算后,会进一步对得到的初始位置差异图中的空洞像素点进行位置差异值补全的操作,以避免由于位置差异图中存在空洞像素点,而导致基于位置差异图得到的最终成像质量不高的问题。In view of this, after calculating the position difference between the two captured images, the present disclosure will further complete the position difference value operation of the hole pixels in the obtained initial position difference map to avoid the position difference value in the position difference map. There are hole pixels, which leads to the problem that the final imaging quality based on the position difference map is not high.
在本公开中,在生成初始位置差异图后,可以对初始位置差异图进行超像素划分,其中,划分得到的每一超像素均包含多个像素点。在此基础上,即可基于各个空洞像素点所位于的超像素中的其他像素点的位置差异值,对该空洞像素点的是位置差异值进行补全。In the present disclosure, after the initial position difference map is generated, the initial position difference map can be divided into super pixels, where each super pixel obtained by the division includes multiple pixel points. On this basis, the position difference value of the hole pixel can be completed based on the position difference value of other pixels in the superpixel where each hole pixel is located.
应当理解的是,在图像中位置较为接近的像素点的像素值存在一定的连续性。与此相类似的,图像中位置较为接近的像素点的位置信息也存在一定的连续性,而位置信息决定了相应像素点的位置差异值,致使图像中位置较为接近的像素点之间的位置差异值也存在一定的连续性。因此,基于同一超像素内部的像素点的位置差异值,对其中包含的空洞像素点的位置差异值进行补全,相当于是利用超像素内部的像素点之间的位置差异值连续性,对空洞像素点进行位置差异值补全,具有较高的准确度。It should be understood that there is a certain continuity in the pixel values of pixels that are relatively close in the image. Similarly, there is a certain degree of continuity in the position information of pixels that are closer in the image, and the position information determines the position difference value of the corresponding pixels, resulting in the position difference between the pixels that are closer in the image. There is also some continuity in the difference values. Therefore, based on the position difference values of pixels within the same super pixel, completing the position difference values of the hole pixels contained in it is equivalent to using the continuity of the position difference values between pixels within the super pixel to complete the hole The position difference value of pixels is completed with high accuracy.
可见,通过划分超像素,并基于划分得到的超像素内的像素点的位置差异值,对相应超像素内的空洞像素点进行位置差异值补全,能够获得较为准确的位置差异图,进而提高最终融合得到的图像的画质。It can be seen that by dividing the super pixels and completing the position difference values of the hole pixels in the corresponding super pixels based on the position difference values of the pixels in the divided super pixels, a more accurate position difference map can be obtained, thereby improving the The quality of the final fused image.
需要声明的是,本公开可以将拍摄得到的任意两个图像,称作第一图像和第二图像,并对两者进行位差计算,以得到初始位置差异图。其中,可以采用任一种算法进行位差计算,例如,可以采用BM(block matching,块匹配)算法或者SGM(semi-global matching,半全局匹配算法)算法。当然,上述两种算法均是示意性的,具体采用何种算法进行位差计算,可由本领域技术人员根据实际需求确定,本公开对此不作限制。It should be noted that this disclosure can refer to any two captured images as the first image and the second image, and perform position difference calculation on the two to obtain an initial position difference map. Among them, any algorithm can be used to calculate the dislocation, for example, the BM (block matching, block matching) algorithm or the SGM (semi-global matching, semi-global matching algorithm) algorithm can be used. Of course, the above two algorithms are schematic. The specific algorithm used to calculate the dislocation can be determined by those skilled in the art according to actual needs, and this disclosure does not limit this.
在本公开中,由于摄像头在图像拍摄时很可能产生一定的畸变,因此,在进行位差计算之前,可以对第一图像和第二图像进行去畸变。在实际应用中,可以采用任一种去畸变算法对第一图像和第二图像进行去畸变,本公开对此不作限制。除此之外,在完成针对第一图像和第二图像的去畸变操作之后,还可以对第一图像和第二图像进行图像对齐,以更为准确地对图像进行位差计算。In the present disclosure, since the camera is likely to produce certain distortion when capturing images, the first image and the second image can be dedistorted before performing disparity calculation. In practical applications, any de-distortion algorithm can be used to de-distort the first image and the second image, and the present disclosure does not limit this. In addition, after completing the dedistortion operation on the first image and the second image, the first image and the second image can also be image aligned to more accurately calculate the disparity of the images.
在本公开中,可以在多种场景下对上述空洞像素点进行补全。例如,在多摄场景下,可以通过不同的摄像头针对同一被摄主体进行图像拍摄,以得到第一图像和第二图像,此时,对第一图像和第二图像进行的位差计算可以为视差计算,计算得到的位置差异图则可以为视差图;再例如,在运动场景下,可以通过同一摄像头在不同时刻对同一被摄主体进行图像拍摄,以得到第一图像和第二图像,此时,对第 一图像和第二图像进行的位差计算可以为光流计算,计算得到的位置差异图则可以为光流图。当然,多摄场景和运动场景,均是示意性的,具体将本公开的技术方案应用于哪一场景,可由本领域技术人员根据实际需求确定,本公开对此不作限制。In the present disclosure, the above-mentioned hole pixels can be filled in various scenarios. For example, in a multi-camera scenario, different cameras can be used to capture images of the same subject to obtain a first image and a second image. In this case, the disparity calculation of the first image and the second image can be Parallax calculation, the calculated position difference map can be a parallax map; for another example, in a sports scene, the same camera can be used to capture images of the same subject at different times to obtain the first image and the second image. When , the position difference calculation performed on the first image and the second image may be an optical flow calculation, and the calculated position difference map may be an optical flow map. Of course, multi-camera scenes and sports scenes are schematic. The specific scene to which the technical solution of the present disclosure is applied can be determined by those skilled in the art according to actual needs, and the present disclosure does not limit this.
步骤104,对所述初始位置差异图进行超像素划分,划分得到的每一超像素均包含多个像素点,并基于各个空洞像素点所位于的超像素中的其他像素点的位置差异值对相应的空洞像素点的位置差异值进行补全。Step 104: Perform super-pixel division on the initial position difference map. Each super pixel obtained by division includes multiple pixel points, and the position difference value pair is based on the position difference value of other pixel points in the super pixel where each hole pixel point is located. The position difference value of the corresponding hole pixel is completed.
在本公开中,超像素的含义为:由多个像素点组成的像素点集合。换言之,超像素划分的过程也可以视为是:将初始位置差异图中的所有像素点划归于不同的像素点集合的过程。In this disclosure, the meaning of superpixel is: a set of pixels composed of multiple pixels. In other words, the process of superpixel division can also be regarded as: the process of assigning all pixel points in the initial position difference map to different pixel point sets.
在本公开中,可以按照预设尺寸对初始位置差异图进行超像素划分,以使划分得到的每一超像素包含的像素点为预设数量。例如,可以以“3*3”这一尺寸进行超像素划分,以使划分得到的每一超像素均包含9个像素点。当然,该举例仅是示意性的,具体采用何种尺寸可进行超像素划分,可由本领域技术人员根据实际需求确定,本公开对此不作限制。In the present disclosure, the initial position difference map can be divided into super pixels according to a preset size, so that each divided super pixel contains a preset number of pixels. For example, superpixels can be divided with a size of "3*3" so that each divided superpixel contains 9 pixels. Of course, this example is only illustrative. The specific size used for super-pixel division can be determined by those skilled in the art according to actual needs, and this disclosure does not limit this.
正如上文所述的,图像的像素值分布和位置差异图的位置差异值分布均呈现一定的连续性,且两者的连续性通常是相似的。举例说明,在拍摄人像时,人的面部某块皮肤各个位置的像素值存在一定的连续性;而该块皮肤各个位置的位置信息也存在一定的连续性,由于位置差异值受位置信息影响,因此,位置差异值之间同样存在连续性。可见,像素值分布情况能够在一定程度上反应位置差异值的分布情况。As mentioned above, both the pixel value distribution of the image and the position difference value distribution of the position difference map show a certain degree of continuity, and the continuity of the two is usually similar. For example, when shooting a portrait, there is a certain continuity in the pixel values of various positions of a certain piece of skin on the person's face; and there is also a certain degree of continuity in the position information of each position of the skin. Since the position difference value is affected by the position information, Therefore, there is also continuity between position difference values. It can be seen that the distribution of pixel values can reflect the distribution of position difference values to a certain extent.
有鉴于此,在划分得到超像素后,还可以基于像素值的分布情况对超像素进行调整,以使调整后的超像素内部的像素点之间存在一定的连续性,进而更准确地对超像素内部的空洞像素点进行补全。In view of this, after the superpixels are divided, the superpixels can also be adjusted based on the distribution of pixel values, so that there is a certain continuity between the pixels inside the adjusted superpixels, and thus the superpixels can be more accurately classified. Hole pixels inside the pixels are filled.
例如,可以获取第一图像的像素值分布情况,并按照该像素值分布情况对各个超像素所包含的像素点进行调整。应当理解的是,像素值分布情况可以用于表征第一图像中的平坦区域和边缘区域,其中,平坦区域指的是像素值变化较为平缓的区域,而边缘区域指的是像素值变化较为急速的区域。本公开可以设置一预设值,以作为划分平坦区域和边缘区域的标准,可以将与自身邻域像素点的像素差值不大于预设值的像素点确定为属于平坦区域,而将与自身邻域像素点的像素差值大于预设值的像素点确定为属于边缘区域。在此基础上,即可对超像素中包含的像素点进行调整,以使调整后的超像素中包含的像素点属于同一平坦区域或同一边缘区域。For example, the pixel value distribution of the first image can be obtained, and the pixel points included in each superpixel can be adjusted according to the pixel value distribution. It should be understood that the pixel value distribution can be used to characterize the flat area and the edge area in the first image, where the flat area refers to the area where the pixel value changes relatively gently, and the edge area refers to the area where the pixel value changes relatively rapidly. Area. The present disclosure can set a preset value as a standard for dividing flat areas and edge areas. Pixels whose pixel difference from its own neighborhood pixels is not greater than the preset value can be determined to belong to the flat area, and pixels that are different from its own neighborhood pixels can be determined to belong to the flat area. Pixels whose pixel difference value of neighboring pixels is greater than the preset value are determined to belong to the edge area. On this basis, the pixels included in the superpixel can be adjusted so that the pixels included in the adjusted superpixel belong to the same flat area or the same edge area.
应当理解的是,当超像素内包含的像素点属于同一平坦区域或同一边缘区域时,意味着相应超像素内的各个像素点之间的位置差异值变化存在一定的连续性。此时,基于超像素内的像素点的位置差异值对其包含的空洞像素点进行补全,为空洞像素点补全的位置差异值较为准确。It should be understood that when the pixel points included in a super pixel belong to the same flat area or the same edge area, it means that there is a certain continuity in the change in position difference value between each pixel point in the corresponding super pixel. At this time, the hole pixels contained in the super pixel are completed based on the position difference values of the pixels in the super pixels, and the position difference values completed for the hole pixels are more accurate.
在本公开中,可以获得第一图像的亮度图,以作为上述像素值分布情况。在此基础上,即可基于亮度图中各个像素点的亮度值,对划分得到的各个超像素所包含的像素点进行调整,以使调整后的同一超像素内的各个像素点与其邻域像素点的亮度差值不超过预设亮度值。In the present disclosure, a brightness map of the first image can be obtained as the above-mentioned pixel value distribution. On this basis, based on the brightness value of each pixel in the brightness map, the pixels contained in each divided super pixel can be adjusted, so that each pixel in the same super pixel after adjustment and its neighbor pixels The brightness difference of the points does not exceed the preset brightness value.
应当理解的是,亮度图表征的为第一图像的亮度分布情况,相当于是根据亮度值的分布情况确定位置差异值的分布情况。当然,在实际应用中,由于各种像素值的分布情况都存在一定的相似性,因此,可以通过其他类型的像素值,例如RGB值的分布情况确定位置差异值的分布情况。It should be understood that the brightness map represents the brightness distribution of the first image, which is equivalent to determining the distribution of position difference values based on the distribution of brightness values. Of course, in practical applications, since there is a certain similarity in the distribution of various pixel values, the distribution of position difference values can be determined through the distribution of other types of pixel values, such as RGB values.
需要声明的是,在实际的位差计算过程中,是将两图像中的一个图像作为基准图像,并将“另一图像中与该基准图像中的任一像素点画面内容相匹配的像素点”与该任一像素点之间的距离,作为该任一 像素点的位置差异值。换言之,初始位置差异图中任一像素点的位置差异值,用于表征基准图像中相同位置的像素点与“另一图像中与该相同位置的像素点画面内容匹配的像素点”之间的距离。因此,在基于第一图像的亮度值分布情况,对超像素内包含的像素点进行调整时,该第一图像指的是:位差计算时,被作为基准图像的图像。例如,在多摄场景下,由于主摄的成像素质较高,因此,通常将主摄拍摄得到的图像作为位差计算时的基准图像。It should be stated that in the actual disparity calculation process, one of the two images is used as the reference image, and "pixels in the other image that match the content of any pixel in the reference image are "The distance between " and any pixel is used as the position difference value of any pixel. In other words, the position difference value of any pixel in the initial position difference map is used to characterize the difference between the pixel at the same position in the reference image and "the pixel in another image that matches the content of the pixel at the same position." distance. Therefore, when adjusting the pixels included in the superpixel based on the brightness value distribution of the first image, the first image refers to the image that is used as the reference image when calculating the disparity. For example, in a multi-camera scenario, since the imaging quality of the main camera is higher, the image captured by the main camera is usually used as the reference image when calculating the disparity.
在本公开中,在划分得到超像素后,即可基于超像素中包含的像素点的位置差异值对该超像素中包含的空洞像素点进行位置差异值补全。本公开可以采用多种方式对空洞像素点进行补全。In the present disclosure, after the superpixels are divided, the positional difference values of the hole pixels contained in the superpixels can be completed based on the positional difference values of the pixels contained in the superpixels. This disclosure can use multiple methods to complete hole pixels.
在一实施例中,在对任一空洞像素点进行补全时,可以优先获取该任一空洞像素点所位于的超像素中的其他像素点的位置差异值,并计算获取到的各个位置差异值的平均值,以将计算得到的平均值作为该任一空洞像素点的位置差异值。In one embodiment, when completing any hole pixel, the position difference values of other pixels in the superpixel where the hole pixel is located can be obtained first, and the obtained position differences can be calculated. The calculated average value is used as the position difference value of any hole pixel.
在本实施例中,为了更加准确地对空洞像素点进行位置差异值补全,还可以为上述其他像素点附加权重值,那么,计算得到的其他像素点的位置差异值的平均值可以为加权平均值。本实施例可以通过多种方式为上述其他像素点设置权重值。例如,可以根据各个像素点与空洞像素点的距离设置权重值,其中,任一像素点的权重值可以与该距离呈负相关,即超像素内距离空洞像素点距离越近的像素点的权重值越高。应当理解的是,由于位置差异值存在连续性,使得距离空洞像素点越近的像素点的位置差异值与该空洞像素点的位置差异值越接近,因此,通过该方式设置各个像素点的权重值,能够较为准确地确定出空洞像素点的位置差异值。当然,根据与空洞像素点的距离为各个像素点设置权重值的方式仅是示意性的,本领域技术人员也可以根据实际需求采用其他方式为各个像素点设置权重值,例如,还可以根据与所属超像素中心的距离为各个像素点设置权重值,两者之间的关系也可以为负相关,本公开对此不作限制。In this embodiment, in order to more accurately complete the position difference value of the hole pixel point, weight values can also be added to the above-mentioned other pixel points. Then, the calculated average value of the position difference value of the other pixel points can be weighted average value. In this embodiment, weight values can be set for the above-mentioned other pixels in various ways. For example, the weight value can be set according to the distance between each pixel and the hole pixel, where the weight value of any pixel can be negatively correlated with the distance, that is, the weight of the pixel in the super pixel is closer to the hole pixel. The higher the value. It should be understood that due to the continuity of the position difference values, the position difference values of pixels that are closer to the hole pixel point are closer to the position difference value of the hole pixel point. Therefore, the weight of each pixel point is set in this way. value, the position difference value of the hole pixel can be determined more accurately. Of course, the method of setting the weight value for each pixel according to the distance from the hole pixel is only illustrative. Those skilled in the art can also use other methods to set the weight value for each pixel according to actual needs. For example, they can also set the weight value for each pixel according to the distance from the hole pixel. The distance from the center of the superpixel to which it belongs sets a weight value for each pixel, and the relationship between the two can also be a negative correlation, which is not limited by this disclosure.
在另一实施例中,在对任一空洞像素点进行位置差异值补全时,可以优先获取空洞像素点所位于的超像素中的其他像素点的位置差异值,并取获取到的各个位置差异值的中值,以作为该任一空洞像素点的位置差异值。In another embodiment, when completing the position difference value of any hole pixel, the position difference values of other pixels in the superpixel where the hole pixel is located can be obtained first, and each obtained position can be obtained. The median value of the difference value is used as the position difference value of any hole pixel.
当然,上述举例仅是示意性的,具体如何根据超像素内的像素点的位置差异值对空洞像素点进行位置差异值补全,可由本领域技术人员根据实际需求设置,本公开对此不作限制。Of course, the above examples are only illustrative. Specifically, how to complete the position difference value of the hole pixel point according to the position difference value of the pixel point in the super pixel can be set by those skilled in the art according to actual needs, and this disclosure does not limit this. .
在本公开中,还可以将初始位置差异图中,位置差异值不在预设视差范围内的像素点的位置差异值调整为未知,以使相应像素点转变为空洞像素点。应当理解的是,对于针对同一被摄主体拍摄得到的两个图像,由于画面内容一致的区域位置信息几乎是一致的,因此,基于两个图像中画面内容一致的两个像素点计算得到的位置差异值通常不会太大。若某一像素点的位置差异值较大,超出预设的范围,很有可能是在上文提及的根据画面内容对像素点进行匹配时,发生了匹配错误的情况。可见,通过上述将位置差异值超出预设视差范围的像素点转变为空洞像素点的方式,能够有效避免像素点匹配不准确而导致的位置差异值计算错误的问题。In the present disclosure, the position difference values of pixels whose position difference values are not within the preset disparity range in the initial position difference map can also be adjusted to unknown, so that the corresponding pixel points are converted into hole pixel points. It should be understood that for two images taken of the same subject, since the position information of the area with the same picture content is almost the same, therefore, the position calculated based on the two pixels with the same picture content in the two images The difference value is usually not too large. If the position difference of a certain pixel is large and exceeds the preset range, it is likely that a matching error occurred when matching pixels based on the image content mentioned above. It can be seen that through the above method of converting pixels whose position difference values exceed the preset parallax range into hole pixels, the problem of position difference value calculation errors caused by inaccurate pixel matching can be effectively avoided.
应当理解的是,在大多数情况下,匹配错误通常会导致计算得到的位置差异值偏大,因此,设定的预设视差范围多为位置差异值的上限,其中,当位置差异值超出该上限时,则将相应的像素点转变为空洞像素点。在一种可行的实施方式中,可以生成初始位置差异图的直方图,并将直方图中位置差异值高于预设位置差异值的像素点转变为空洞像素点。It should be understood that in most cases, matching errors usually lead to the calculated position difference value being too large. Therefore, the preset parallax range is mostly the upper limit of the position difference value. When the position difference value exceeds this When the upper limit is reached, the corresponding pixels are converted into hole pixels. In a feasible implementation, a histogram of the initial position difference map can be generated, and the pixels in the histogram whose position difference value is higher than the preset position difference value can be converted into hole pixels.
除此之外,由于图像中的像素点数量是较大的,通常能够覆盖较多数值的位置差异值,当位置差异值为某些数值的像素点数量较少时,很可能是由于误匹配导致的。因此,本公开还可以将位置差异值小于预设值的像素点确定为误匹配的像素点。在该情况下,也可以优先生成初始位置差异图的直方图,并根据直方图确定出数量小于预设值的数值,进而将位置差异值为该数值的像素点转换成空洞像素点。In addition, since the number of pixels in the image is large, it can usually cover a larger number of position difference values. When the number of pixels with a position difference value of certain values is small, it is likely to be due to mismatching. caused. Therefore, the present disclosure can also determine pixels whose position difference value is smaller than the preset value as mismatched pixels. In this case, it is also possible to generate a histogram of the initial position difference map first, determine the number of values smaller than the preset value based on the histogram, and then convert the pixels with the position difference value to the hole pixels.
在本公开中,在基于超像素对空洞像素点进行位置差异值补全之后,还可以对第一图像进行中值滤波,以得到去除噪声后的第一图像,并基于滤波得到的第一图像确定出所包含的各个像素点的像素值连续情况,进而基于该像素值连续情况对经由位置差异值补全的位置差异图进行位置差异值的二次补全。例如,在采用双边算子原理(FastBilateralSolver)对位置差异图进行二次补全时,可以将经由滤波得到的第一图像和经由位置差异值补全的位置差异图作为双边算子算法的输入,以输出位置差异值二次补全后的位置差异图In the present disclosure, after completing position difference values of hole pixels based on super pixels, median filtering can also be performed on the first image to obtain the first image after removing noise, and based on the filtered first image The pixel value continuity of each included pixel point is determined, and then a secondary completion of the position difference value is performed on the position difference map completed by the position difference value based on the pixel value continuity. For example, when using the bilateral operator principle (FastBilateralSolver) to perform secondary completion of the position difference map, the first image obtained through filtering and the position difference map completed through the position difference value can be used as the input of the bilateral operator algorithm. Position difference map after secondary completion with output position difference value
需要声明的是,本公开技术方案可以应用于任意类型的电子设备中,例如该电子设备可以为智能手机、平板电脑等移动终端,也可以为智能电视、PC(个人计算机,Personal Computer)等固定终端。具体将哪一种类型的电子设备作为本公开技术方案的执行主体可以由本领域技术人员根据实际需求确定,本公开对此不作限制。It should be noted that the technical solution of the present disclosure can be applied to any type of electronic equipment. For example, the electronic equipment can be mobile terminals such as smartphones and tablet computers, or fixed terminals such as smart TVs and PCs (Personal Computers). terminal. Which type of electronic device is specifically used as the execution subject of the technical solution of the present disclosure can be determined by those skilled in the art according to actual needs, and the present disclosure does not limit this.
还需声明的是,本公开既可以通过软件的方式实现本公开的技术方案,也可以通过各种实体组件实现本公开的技术方案。例如,可以在电子设备中部署畸变校正组件、图像对齐组件、位差计算组件、超像素调整组件、位置差异值补全组件等,以实现本公开技术方案中的各个步骤。It should also be stated that the technical solution of the present disclosure can be implemented not only through software, but also through various entity components. For example, a distortion correction component, an image alignment component, a disparity calculation component, a superpixel adjustment component, a position difference value completion component, etc. can be deployed in an electronic device to implement each step in the technical solution of the present disclosure.
由上述介绍可知,本公开在获取到对同一被摄主体进行拍摄得到的第一图像和第二图像时,可以对第一图像和第二图像进行位差计算,以得到包含至少一个空洞像素点的初始位置差异图。在此基础上,本公开可以进一步对初始位置差异图进行超像素划分,并基于各个空洞像素点所位于的超像素中的其他像素点的位置差异值对相应空洞像素点的位置差异值进行补全。It can be seen from the above introduction that when the present disclosure obtains the first image and the second image obtained by photographing the same subject, the disparity calculation can be performed on the first image and the second image to obtain a pixel point containing at least one hole. Initial position difference map. On this basis, the present disclosure can further divide the initial position difference map into super pixels, and supplement the position difference value of the corresponding hole pixel point based on the position difference value of other pixel points in the super pixel where each hole pixel point is located. Complete.
应当理解的是,由于位置差异值的分布存在一定的连续性。因此,基于同一超像素内的像素点的位置差异值对该超像素包含的空洞像素点进行位置差异值补全较为准确,相当于基于位置差异值存在连续性的特性,对空洞像素点的位置差异值进行补全,其准确度较高,避免了相关技术中由于位置差异图中存在位置差异值未知的空洞像素点,而导致基于位置差异图得到的最终成像质量不高的问题。It should be understood that there is a certain continuity in the distribution of position difference values. Therefore, it is more accurate to complete the position difference value of the hole pixel contained in the super pixel based on the position difference value of the pixels in the same super pixel, which is equivalent to the position difference value of the hole pixel based on the continuity characteristics of the position difference value. The difference value is used for completion, which has high accuracy and avoids the problem in related technologies that the final imaging quality based on the position difference map is not high due to the presence of empty pixels with unknown position difference values in the position difference map.
进一步的,由于图像的像素值分布情况通常与其位置差异图的位置差异值分布情况较为接近。因此,本公开在基于预设尺寸划分得到超像素后,还可以进一步获取第一图像的像素值分布情况,以基于该像素值分布情况,对划分得到的超像素包含的像素点进行调整,以使调整后的超像素中包含的像素点位于同一平坦区域或同一边缘区域。应当理解的是,位于同一平坦区域或同一边缘区域内的像素点的位置差异值呈现一定的连续性,因此,将同一超像素内的像素点调整至同一平坦区域或同一边缘区域内,并基于超像素内的像素点的位置差异值对该超像素内的空洞像素点进行位置差异值补全,能够依赖其存在连续性的特性,提高对空洞像素点进行视差补全的准确度。Furthermore, the pixel value distribution of the image is usually close to the position difference value distribution of its position difference map. Therefore, after the super pixels are obtained by dividing based on the preset size, the present disclosure can further obtain the pixel value distribution of the first image, and adjust the pixel points contained in the divided super pixels based on the pixel value distribution, so as to Make the pixels included in the adjusted superpixels be located in the same flat area or the same edge area. It should be understood that the position difference values of pixels located in the same flat area or the same edge area show a certain degree of continuity. Therefore, the pixels in the same super pixel are adjusted to the same flat area or the same edge area, and based on The position difference value of the pixels in the super pixel is used to complete the position difference value of the hole pixels in the super pixel, which can rely on its continuity characteristics to improve the accuracy of parallax completion of the hole pixels.
应当理解的是,尽管在上文中指出:本公开的技术方案应用于电子设备。但是,在实际应用中,是由电子设备中包含的实体组件执行上文所介绍的多个操作。例如,上述操作可以由电子设备的中央处理器执行,也可以由电子设备中独立部署的图像处理器执行。It should be understood that although it is pointed out above that the technical solution of the present disclosure is applicable to electronic equipment. However, in actual applications, it is the physical components contained in the electronic device that perform the multiple operations described above. For example, the above operations may be performed by a central processing unit of the electronic device, or may be performed by an image processor independently deployed in the electronic device.
由于中央处理器通常负载较高,且图像处理任务占用资源较多,因此,为了提升图像处理的效率, 技术人员通常会单独部署独立的图像处理器,用于完成图像处理任务。Since the central processing unit usually has a high load and image processing tasks take up a lot of resources, in order to improve the efficiency of image processing, technicians usually deploy an independent image processor to complete image processing tasks.
有鉴于此,本公开还提出了一种应用于图像处理器的视差图生成方法。在该方法中,大多数操作与上文所述的应用于电子设备的视差图生成方法一致,只不过是将图像处理器作为执行主体进行描述。相关内容均可参照上文的介绍,在下文中不再赘述。In view of this, the present disclosure also proposes a disparity map generation method applied to an image processor. In this method, most operations are consistent with the disparity map generation method applied to electronic devices described above, except that the image processor is described as the execution subject. For relevant content, please refer to the above introduction and will not be repeated below.
在该视差图生成方法中,可以包括以下步骤:In this disparity map generation method, the following steps may be included:
步骤1:接收第一图像传感器生成的第一图像和第二图像传感器生成的第二图像;所述第一图像和所述第二图像由所述第一图像传感器所属的第一摄像头和所述第二图像传感器所属的第二摄像头针对同一被摄主体拍摄得到。Step 1: Receive a first image generated by a first image sensor and a second image generated by a second image sensor; the first image and the second image are generated by the first camera to which the first image sensor belongs and the second image generated by the second image sensor. The second camera to which the second image sensor belongs takes pictures of the same subject.
在本实施例中,可以通过电子设备装配图像传感器进行图像采集,以基于采集到的原始数据生成与同一被摄主体对应的第一图像和第二图像。在此基础上,图像传感器可以将生成的第一图像和第二图像传输至图像处理器,以由图像传感器对第一图像和第二图像进行位差计算,以得到位置差异图。In this embodiment, an electronic device may be equipped with an image sensor for image collection, so as to generate a first image and a second image corresponding to the same subject based on the collected raw data. On this basis, the image sensor can transmit the generated first image and the second image to the image processor, so that the image sensor performs position difference calculation on the first image and the second image to obtain a position difference map.
如上所述,由于本实施例的技术方案与上文所述的位置差异图生成方法,仅存在执行主体的不同,因此,本实施例不再对位差计算、超像素划分、视差值补全等操作进行赘述,相关内容均可参照上文的介绍。As mentioned above, since the technical solution of this embodiment is different from the position difference map generation method described above, only the execution subject is different. Therefore, this embodiment no longer performs disparity calculation, super-pixel division, and disparity value compensation. The congruent operations will not be described in detail. For relevant content, please refer to the introduction above.
如上所述,本公开既可以应用于多摄场景,又可以应用于运动场景。因此,本实施例在应用于不同场景时,本步骤的执行操作也存在一定的差异。其中,As mentioned above, the present disclosure can be applied to both multi-camera scenes and sports scenes. Therefore, when this embodiment is applied to different scenarios, there are certain differences in the execution of this step. in,
在多摄场景下,电子设备中可以装配有第一摄像头和第二摄像头,且第一摄像头包含第一图像传感器、第二摄像头包含第二图像传感器。在此基础上,本步骤的实际执行过程可以为:通过第一图像传感器和第二图像传感器,分别进行图像采集,以便第一图像传感器和第二图像传感器基于采集到的原始数据生成与同一被摄主体对应的第一图像和第二图像。在此基础上,第一图像传感器和第二图像传感器可以将生成的第一图像和第二图像传输至图像处理器,以由图像处理器对第一图像和第二图像进行视差计算,以得到视差图。In a multi-camera scenario, the electronic device may be equipped with a first camera and a second camera, where the first camera includes a first image sensor and the second camera includes a second image sensor. On this basis, the actual execution process of this step may be: image acquisition is performed through the first image sensor and the second image sensor respectively, so that the first image sensor and the second image sensor generate images with the same object based on the collected original data. The first image and the second image corresponding to the subject. On this basis, the first image sensor and the second image sensor can transmit the generated first image and the second image to the image processor, so that the image processor performs parallax calculation on the first image and the second image to obtain Disparity map.
需要声明的是,在多摄场景下,视差图中的视差值表征的为深度信息差异,即上文所述的位置信息指的是深度信息,通常为“由摄像头到图像画面中相应物体的距离”(多指摄像头轴线方向上的距离信息)。而视差图最终用于第一图像和第二图像的图像融合,本质上是通过提高图像融合准确度的方式,提高最终成像的质量。It should be stated that in a multi-camera scenario, the disparity value in the disparity map represents the difference in depth information, that is, the position information mentioned above refers to the depth information, usually "from the camera to the corresponding object in the image" "distance" (mostly refers to the distance information in the direction of the camera axis). The disparity map is ultimately used for image fusion of the first image and the second image, which essentially improves the quality of the final imaging by improving the accuracy of image fusion.
而在运动场景下,电子设备可以调用装配的图像传感器在不同时刻进行两次图像采集,以得到的第一图像和第二图像,例如,可以开启连拍模式对被摄主体进行连续拍摄,或者采用视频模式进行视频拍摄。在该过程中,被摄主体和电子设备可以发生相对运动,以使被摄主体在两图像中的位置信息发生变化。在此基础上,图像传感器即可将第一图像和第二图像传输至图像处理器,以由图像处理器对第一图像和第二图像进行光流计算,以得到光流图。In a sports scene, the electronic device can call the assembled image sensor to collect images twice at different times to obtain the first image and the second image. For example, the continuous shooting mode can be turned on to continuously shoot the subject, or Use video mode for video shooting. During this process, the subject and the electronic device may move relative to each other, so that the position information of the subject in the two images changes. On this basis, the image sensor can transmit the first image and the second image to the image processor, so that the image processor performs optical flow calculation on the first image and the second image to obtain an optical flow map.
需要声明的是,在运动场景下,光流图中的光流值表征的为不同时刻的位置差异,即上文所述的位置信息差异为位移。而光流图通常用于对某一图像的调整,例如,基于光流图和优先拍摄得到的图像,对后拍摄得到的图像进行调整,以消除残影等,进而提高最终成像的质量。当然,该举例仅是示意性的,具体如何基于光流图对图像进行调整,可由本领域技术人员根据实际需求确定,本实施例对此不作限制。It should be stated that in a sports scene, the optical flow value in the optical flow map represents the position difference at different times, that is, the difference in position information mentioned above is the displacement. The optical flow map is usually used to adjust a certain image. For example, based on the optical flow map and the image captured first, the image captured later is adjusted to eliminate afterimages, etc., thereby improving the quality of the final imaging. Of course, this example is only illustrative. The specific method of adjusting the image based on the optical flow map can be determined by those skilled in the art according to actual needs, and this embodiment does not limit this.
步骤2:对所述第一图像和第二图像进行视差计算,得到初始视差图,所述初始视差图中包含至少 一个视差值未知的空洞像素点。Step 2: Perform disparity calculation on the first image and the second image to obtain an initial disparity map. The initial disparity map contains at least one hole pixel with unknown disparity value.
步骤3:对所述初始视差图进行超像素划分,划分得到的每一超像素均包含多个像素点,并基于各个空洞像素点所位于的超像素中的其他像素点的视差值对相应的空洞像素点的视差值进行补全。Step 3: Perform super-pixel division on the initial disparity map. Each super-pixel obtained by the division contains multiple pixels, and the corresponding disparity values are based on the disparity values of other pixels in the super-pixel where each hole pixel is located. The disparity value of the hole pixel is completed.
需要声明的是,本实施例中的图像处理器可以根据实际情况搭载于不同的芯片,例如,可以搭载于ISP(Image Signal Processing,图像信号处理)芯片或者SoC(System on Chip,系统级)芯片,具体搭载于何种芯片可以由本领域技术人员根据实际需求确定,本公开对此不作限制。It should be noted that the image processor in this embodiment can be mounted on different chips according to the actual situation. For example, it can be mounted on an ISP (Image Signal Processing) chip or an SoC (System on Chip) chip. , the specific chip to be mounted on can be determined by those skilled in the art according to actual needs, and this disclosure does not limit this.
图2为本公开一示例性实施例示出的一种视差图生成方法的流程图。如图2所示,该方法应用于装配有至少两个摄像头的智能手机,可以包括以下步骤:FIG. 2 is a flowchart of a method for generating a disparity map according to an exemplary embodiment of the present disclosure. As shown in Figure 2, this method is applied to a smartphone equipped with at least two cameras and may include the following steps:
步骤201,基于主摄和副摄对被摄主体进行图像拍摄。Step 201: Capture an image of the subject based on the main photography and the secondary photography.
在本实施例中,智能手机可以装配有成像效果较好的主摄,以及成像效果相对较差的副摄。那么,当用户通过双摄模式对被摄主体进行拍摄时,智能手机可以同时调用主摄和副摄对被摄主体进行拍摄,以得到主摄图像和副摄图像。In this embodiment, the smartphone can be equipped with a main camera with better imaging effect and a secondary camera with relatively poor imaging effect. Then, when the user takes a picture of the subject through the dual camera mode, the smartphone can simultaneously call the main camera and the secondary camera to take pictures of the subject to obtain the main camera image and the secondary camera image.
步骤202,通过SGM算法对拍摄到的主摄图像和副摄图像进行视差计算。Step 202: Use the SGM algorithm to calculate parallax on the captured main image and secondary image.
在本实施例中,在得到主摄图像和副摄图像后,即可基于预设的SGM算法对两者进行视差计算,以得到初始视差图。例如,通过视差计算得到的初始视差图可以如图3所示,其中,大部分像素点都已经知晓视差值,但仍存在部分像素点视差值未知。In this embodiment, after obtaining the main image and the secondary image, disparity calculation can be performed on the two based on the preset SGM algorithm to obtain an initial disparity map. For example, the initial disparity map obtained through disparity calculation can be shown in Figure 3, in which the disparity values of most pixels are known, but the disparity values of some pixels are still unknown.
需要声明的是,由于主摄的成像素质较高,因此,多是以主摄为基准生成初始视差图。换言之,生成的初始视差图中任一像素点的视差值,用于表征“主摄图像中同一位置的像素点,与副摄图像中与该像素点内容相匹配的像素点的距离”。It should be noted that due to the high imaging quality of the main camera, the initial parallax map is mostly generated based on the main camera. In other words, the disparity value of any pixel in the generated initial disparity map is used to represent "the distance between a pixel at the same position in the main image and a pixel in the secondary image that matches the content of the pixel."
步骤203,生成获取到的初始视差图的直方图。Step 203: Generate a histogram of the obtained initial disparity map.
正如上文所介绍的,视差计算实际计算的为两图像中画面内容一致的像素点之间的距离,像素点之间的内容匹配直接决定了视差计算的准确度。然而,实际的匹配过程难免出现像素点误匹配的情况,导致相应像素点的视差值不准确。As introduced above, disparity calculation actually calculates the distance between pixels with consistent content in the two images. The content matching between pixels directly determines the accuracy of disparity calculation. However, mismatching of pixels will inevitably occur in the actual matching process, resulting in inaccurate disparity values of corresponding pixels.
因此,在本实施例中,还可以在生成初始视差图后,识别出其中包含的由于误匹配导致的视差值不准确的像素点,并将识别出的像素点转换为空洞像素点。在此基础上,即可在后续空洞像素点补全的操作中,对该像素点进行补全。不难看出,该过程相当于对误匹配导致的视差值不准确的像素点进行了校正。Therefore, in this embodiment, after the initial disparity map is generated, pixels containing inaccurate disparity values due to mismatching may be identified, and the identified pixels may be converted into hole pixels. On this basis, the pixel can be completed in the subsequent hole pixel completion operation. It is not difficult to see that this process is equivalent to correcting the pixels with inaccurate parallax values caused by mismatching.
在本实施例中,可以获取初始视差图的直方图,以将视差值高于预设值的像素点确定为视差值不准确的像素点,并将该像素点转化为空洞像素点。举例而言,基于图3所示的初始视差图得到的直方图可以如图4所示,即可统计得到视差值为各个数值的像素点的数量。假设预设的视差值上限为8,那么即可将视差值超过8的像素点转化为空洞像素点,即将图3所示的初始视差图转化为图5所示的视差图。In this embodiment, the histogram of the initial disparity map can be obtained to determine pixels with a disparity value higher than a preset value as pixels with inaccurate disparity values, and convert the pixels into hole pixels. For example, the histogram obtained based on the initial disparity map shown in Figure 3 can be as shown in Figure 4, that is, the number of pixels with disparity values of each value can be statistically obtained. Assuming that the preset upper limit of the disparity value is 8, pixels with a disparity value exceeding 8 can be converted into hole pixels, that is, the initial disparity map shown in Figure 3 is converted into the disparity map shown in Figure 5.
当然,该举例仅是示意性的,也可以不依赖预设值确定视差值不准确的像素点。例如,可以在统计得到视差值为各个数值的像素点数量之后,确定出其中像素点数量最少的数值,并将视差值为该数值的像素点转化为空洞像素点。具体如何确定出视差值确定不准确的像素点,并将其转化为空洞像素点,可由本领域技术人员根据实际情况确定,本实施例对此不作限制。Of course, this example is only illustrative, and pixels with inaccurate disparity values may also be determined without relying on the preset value. For example, after counting the number of pixels with disparity values of each value, the value with the smallest number of pixels can be determined, and the pixels with the disparity value of this value can be converted into hole pixels. How to specifically determine pixels with inaccurate disparity values and convert them into hole pixels can be determined by those skilled in the art according to actual conditions, and this embodiment does not limit this.
步骤204,基于直方图将初始视差图中视差值超出预设值的像素点转换为空洞像素点。Step 204: Convert pixels in the initial disparity map whose disparity value exceeds a preset value into hole pixels based on the histogram.
步骤205,按照预设尺寸对初始视差图进行超像素划分。Step 205: Perform super-pixel division on the initial disparity map according to a preset size.
在本实施例中,可以按照预设尺寸对初始视差图进行超像素划分。需要声明的是,由于初始视差图与主摄图像尺寸一致,且相同位置的像素点对应于相同的画面内容,因此,对初始视差图进行超像素划分,相当于是对主摄图像进行超像素划分,仅仅是表达上存在不同,实际含义一致。In this embodiment, the initial disparity map can be divided into super pixels according to a preset size. It should be stated that since the size of the initial disparity map is the same as that of the main image, and the pixels at the same position correspond to the same picture content, super-pixel division of the initial disparity map is equivalent to super-pixel division of the main image. , there are only differences in expression, but the actual meaning is the same.
承接上述举例,可以以“3*3”的规格尺寸,对初始视差图进行超像素划分,得到如图6所示的包含9个像素点的若干超像素,如超像素A、B、C。其中,超像素A中包含空洞像素点a、超像素B中包含空洞像素点b1和b2、超像素C中包含空洞像素点c1、c2。Following the above example, the initial disparity map can be divided into super pixels with a size of "3*3" to obtain several super pixels containing 9 pixels as shown in Figure 6, such as super pixels A, B, and C. Among them, superpixel A contains hole pixel point a, superpixel B contains hole pixel points b1 and b2, and superpixel C contains hole pixel points c1 and c2.
步骤206,获取主摄图像的亮度图。Step 206: Obtain the brightness map of the main image.
承接上述举例,假设获取到的主摄图像的亮度图如图7所示,其中,圈出部分的像素点与其邻域像素点的亮度差值较大,属于主摄图像中的边缘区域,而其他像素点与邻域像素点的亮度差值较小,属于平坦区域。步骤207,基于亮度图对超像素包含的像素点进行调整。Following the above example, assume that the obtained brightness map of the main camera image is as shown in Figure 7. Among them, the brightness difference between the circled pixels and their neighboring pixels is large and belongs to the edge area in the main camera image, while The brightness difference between other pixels and neighboring pixels is small and belongs to a flat area. Step 207: Adjust the pixels contained in the superpixel based on the brightness map.
本实施例在获得亮度图后,即可进一步基于亮度图对超像素包含的像素点进行调整,调整的标准为:上文指出的使调整后的超像素内的像素点属于同一平坦区域或同一边缘区域。其中,还可以进一步限制调整前后的超像素包含的像素点数量一致。In this embodiment, after obtaining the brightness map, the pixels contained in the super pixels can be further adjusted based on the brightness map. The adjustment standard is: as pointed out above, the pixels in the adjusted super pixels belong to the same flat area or the same edge area. Among them, the number of pixels contained in the superpixels before and after adjustment can be further restricted to be the same.
承接上述举例,假设基于图7所示的亮度图对图6所示的划分得到的超像素进行调整。那么,对超像素A、B、C分别进行调整得到的超像素为如图8所示的超像素A’、B’、C’。其中,超像素A’包含的像素点均属于图像左侧的平坦区域;超像素B’包含的像素点均属于图7圈出的边缘区域;而超像素C’则属于图像右上角的平坦区域。Following the above example, assume that the superpixels obtained by the division shown in Figure 6 are adjusted based on the brightness map shown in Figure 7 . Then, the superpixels obtained by adjusting superpixels A, B, and C respectively are superpixels A’, B’, and C’ as shown in Figure 8. Among them, the pixels included in superpixel A' belong to the flat area on the left side of the image; the pixels included in superpixel B' belong to the edge area circled in Figure 7; and superpixel C' belongs to the flat area in the upper right corner of the image. .
步骤208,基于调整后的超像素内的各个像素点的视差值对超像素内的空洞像素点进行补全。Step 208: Complete the hole pixels in the superpixel based on the adjusted disparity value of each pixel in the superpixel.
承接上述举例,在获得调整后的超像素A’、B’、C’之后,即可基于超像素A’中的像素点的视差值对空洞像素点a进行补全,假设采用取平均值的方式对其进行补全,那么,超像素A’中的各个像素点的视差均值为:(2*2+3*2+4+5+7*2)/8=4.125。由于视差值通常取整数,因此,可以将4作为空洞像素点a的视差值。Following the above example, after obtaining the adjusted superpixels A', B', and C', the hole pixel a can be completed based on the disparity value of the pixel in the superpixel A', assuming that averaging is used To complete it, then the average disparity value of each pixel in super pixel A' is: (2*2+3*2+4+5+7*2)/8=4.125. Since the disparity value is usually an integer, 4 can be used as the disparity value of the hole pixel point a.
对于其他空洞像素点,如空洞像素点b1、b2、c1、c2也可以采用类似的方式进行补全,直至图像中的所有空洞像素点均被补全,即可得到较为准确的副摄图像与主摄图像的视差图。应当理解的是,上述举例仅仅是以超像素A、B、C为例,对本说明书的技术方案进行介绍,对于其他部分的像素点的操作方式也是类似,在此不再赘述。Other hole pixels, such as hole pixels b1, b2, c1, c2, can also be filled in a similar way until all hole pixels in the image are filled, and a more accurate secondary image can be obtained. Disparity map of the main image. It should be understood that the above examples only use superpixels A, B, and C as examples to introduce the technical solutions in this specification. The operation methods of other pixels are also similar and will not be described again here.
需要声明的是,由于亮度图与视差图、主摄图像的尺寸也是一致的,对亮度图进行超像素划分,也相当于是对视差图进行超像素划分。因此,在实际操作中,也可以对亮度图进行超像素划分,并对亮度图中划分好的超像素进行调整。在该情况下,可以调整步骤205、206、207、208的顺序,例如,可以优先获取亮度图,再基于预设尺寸对亮度图进行超像素划分,然后基于亮度图中各个像素点的亮度值对划分好的超像素进行调整。在此基础上,再执行基于超像素内的视差值对空洞像素点进行补全的操作。It should be noted that since the size of the brightness map, the disparity map, and the main camera image are also consistent, super-pixel division of the brightness map is also equivalent to super-pixel division of the disparity map. Therefore, in actual operation, the brightness map can also be divided into super pixels, and the divided super pixels in the brightness map can be adjusted. In this case, the order of steps 205, 206, 207, and 208 can be adjusted. For example, the brightness map can be obtained first, and then the brightness map can be divided into super pixels based on the preset size, and then based on the brightness value of each pixel in the brightness map Adjust the divided superpixels. On this basis, the operation of completing the hole pixels based on the disparity value within the superpixel is performed.
由上述技术方案可知,本实施例中的智能手机在获取到主摄图像和副摄图像后,可以对两者进行视差计算,以得到两者之间的初始视差图,并对初始视差图进行超像素划分。进一步的,还可以基于主摄图像的亮度值对划分得到的超像素进行调整,以使超像素内的各个像素点属于同一平坦区域或边缘区域。在此基础上,基于超像素内的各个像素点的视差值对其所包含的空洞像素点进行补全,避免了相关技术 中由于视差图中存在空洞像素点,而导致基于视差图进行图像融合得到的图像画质不佳的问题。It can be seen from the above technical solution that after acquiring the main camera image and the secondary camera image, the smartphone in this embodiment can perform disparity calculation on the two to obtain an initial disparity map between the two, and perform a disparity calculation on the initial disparity map. Superpixel partitioning. Furthermore, the divided superpixels can also be adjusted based on the brightness value of the main image, so that each pixel in the superpixel belongs to the same flat area or edge area. On this basis, the hole pixels contained in the super pixel are completed based on the disparity value of each pixel in the super pixel, which avoids the problem of image processing based on the disparity map due to the existence of hole pixels in the disparity map in related technologies. The problem of poor quality of the fused image.
图9是本公开一示例性实施例示出的一种位置差异图生成装置的框图。参照图9,该装置包括计算单元901和划分单元902。FIG. 9 is a block diagram of a position difference map generating device according to an exemplary embodiment of the present disclosure. Referring to FIG. 9 , the device includes a computing unit 901 and a dividing unit 902 .
计算单元901,对第一图像和第二图像进行位差计算,得到初始位置差异图;所述初始位置差异图中包含至少一个位置差异值未知的空洞像素点;The calculation unit 901 performs dislocation calculation on the first image and the second image to obtain an initial position difference map; the initial position difference map contains at least one hole pixel with an unknown position difference value;
划分单元902,对所述初始位置差异图进行超像素划分,划分得到的每一超像素均包含多个像素点,并基于各个空洞像素点所位于的超像素中的其他像素点的位置差异值对相应的空洞像素点的位置差异值进行补全。The dividing unit 902 performs super-pixel division on the initial position difference map. Each super pixel obtained by division includes multiple pixel points, and is based on the position difference values of other pixel points in the super pixel where each hole pixel point is located. Complete the position difference value of the corresponding hole pixel.
可选的,optional,
所述位置差异图为视差图,所述第一图像和所述第二图像由不同摄像头针对同一被摄主体拍摄得到;或者,The position difference map is a disparity map, and the first image and the second image are captured by different cameras for the same subject; or,
所述位置差异图为光流图,所述第一图像和所述第二图像由同一摄像头在不同时刻对同一被摄主体拍摄得到。The position difference map is an optical flow map, and the first image and the second image are obtained by shooting the same subject at different times with the same camera.
可选的,划分单元902进一步用于:Optionally, the dividing unit 902 is further used for:
按照预设尺寸对所述初始位置差异图像进行超像素划分,以使划分得到的每一超像素中包含的像素点为预设数量。The initial position difference image is divided into super pixels according to a preset size, so that each divided super pixel contains a preset number of pixel points.
可选的,划分单元902进一步用于:Optionally, the dividing unit 902 is further used for:
获取任一空洞像素点所位于的超像素中的其他各个像素点的位置差异值,并计算获取到的各个位置差异值的平均值,以将计算得到的平均值作为所述任一空洞像素点的位置差异值。可选的,划分单元902进一步用于:Obtain the position difference value of each other pixel point in the superpixel where any hole pixel is located, and calculate the average value of each obtained position difference value, so as to use the calculated average value as the any hole pixel point position difference value. Optionally, the dividing unit 902 is further used for:
计算获取到的各个位置差异值的加权平均值;其中,任一其他像素点的权重值与该任一其他像素点与所述任一空洞像素点的距离呈负相关。Calculate the weighted average of the obtained position difference values; wherein, the weight value of any other pixel is negatively correlated with the distance between the any other pixel and any hole pixel.
可选的,划分单元902进一步用于:Optionally, the dividing unit 902 is further used for:
获取任一空洞像素点所位于的超像素中的其他各个像素点的位置差异值,并取获取到的各个位置差异值的中值,以作为所述任一空洞像素点的位置差异值。The position difference value of each other pixel point in the super pixel where any hole pixel point is located is obtained, and the median value of the obtained position difference values is taken as the position difference value of any hole pixel point.
如图10所示,图10是本公开一示例性实施例示出的另一种位置差异图生成装置的框图,该实施例在前述图9所示实施例的基础上,还包括:确定单元903、调整单元904和滤波单元905。As shown in Figure 10, Figure 10 is a block diagram of another location difference map generating device according to an exemplary embodiment of the present disclosure. Based on the aforementioned embodiment shown in Figure 9, this embodiment also includes: a determination unit 903 , adjustment unit 904 and filtering unit 905.
可选的,还包括:Optional, also includes:
确定单元903,确定所述第一图像中的像素值分布情况,所述像素值分布情况用于表征所述第一图像中的平坦区域和边缘区域;其中,平坦区域中的像素点与其邻域像素点的像素差值不大于预设值,边缘区域中的像素点与其邻域像素点的像素差值大于预设值;Determining unit 903 determines the distribution of pixel values in the first image. The distribution of pixel values is used to characterize the flat areas and edge areas in the first image; where the pixels in the flat area and their neighbors The pixel difference value of a pixel is not greater than the preset value, and the pixel difference value of a pixel in the edge area and its neighbor pixels is greater than the preset value;
调整单元904,基于所述像素值分布情况对各个超像素所包含的像素点进行调整,以使调整后的同一超像素内的像素点属于同一平坦区域或同一边缘区域。The adjustment unit 904 adjusts the pixel points included in each super pixel based on the pixel value distribution, so that the adjusted pixel points in the same super pixel belong to the same flat area or the same edge area.
可选的,optional,
确定单元903进一步用于:获取所述第一图像的亮度图;The determining unit 903 is further configured to: obtain the brightness map of the first image;
调整单元904进一步用于:基于所述亮度图中各个像素点的亮度值,对划分得到的各个超像素所包 含的像素点进行调整,以使调整后的同一超像素内的各个像素点与其邻域像素点的亮度差值不超过预设亮度值。The adjustment unit 904 is further configured to: based on the brightness value of each pixel point in the brightness map, adjust the pixel points contained in each divided super pixel, so that each pixel point in the same super pixel after adjustment is the same as its neighbor. The brightness difference of domain pixels does not exceed the preset brightness value.
可选的,调整单元904还被用于:Optionally, the adjustment unit 904 is also used for:
将所述初始位置差异图中,位置差异值不在预设视差范围内的像素点的位置差异值调整为未知,以使相应像素点转变为空洞像素点。In the initial position difference map, the position difference values of pixels whose position difference values are not within the preset parallax range are adjusted to unknown, so that the corresponding pixels are converted into hole pixels.
可选的,optional,
还包括:滤波单元905,对所述第一图像进行中值滤波,以得到去除噪声后的第一图像;It also includes: a filtering unit 905 that performs median filtering on the first image to obtain the first image after removing noise;
划分单元902还被用于:基于滤波得到的第一图像确定出所包含的各个像素点的像素值连续情况,以基于确定出的像素值连续情况对经由位置差异值补全的位置差异图进行位置差异值二次补全。The dividing unit 902 is also used to: determine the pixel value continuity of each included pixel point based on the filtered first image, and position the position difference map completed by the position difference value based on the determined pixel value continuity. Secondary completion of difference values.
对于装置实施例而言,由于其基本对应于方法实施例,所以相关之处参见方法实施例的部分说明即可。以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本公开方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。As for the device embodiment, since it basically corresponds to the method embodiment, please refer to the partial description of the method embodiment for relevant details. The device embodiments described above are only illustrative. The units described as separate components may or may not be physically separated. The components shown as units may or may not be physical units, that is, they may be located in One location, or it can be distributed across multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the disclosed solution. Persons of ordinary skill in the art can understand and implement the method without any creative effort.
相应的,本公开还提供一种位置差异图生成装置,包括:处理器;用于存储处理器可执行指令的存储器;其中,所述处理器被配置为实现如上述实施例中任一所述的位置差异图生成方法,比如该方法可以包括:对第一图像和第二图像进行位差计算,得到初始位置差异图;所述初始位置差异图中包含至少一个位置差异值未知的空洞像素点;对所述初始位置差异图进行超像素划分,划分得到的每一超像素均包含多个像素点,并基于各个空洞像素点所位于的超像素中的其他像素点的位置差异值对相应的空洞像素点的位置差异值进行补全。Correspondingly, the present disclosure also provides a device for generating a location difference map, including: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to implement as described in any of the above embodiments A method for generating a position difference map. For example, the method may include: performing disparity calculation on the first image and the second image to obtain an initial position difference map; the initial position difference map contains at least one hole pixel with an unknown position difference value. ; Perform super-pixel division on the initial position difference map. Each super-pixel obtained by the division contains multiple pixels, and the corresponding corresponding pixels are calculated based on the position difference values of other pixels in the super-pixel where each hole pixel is located. The position difference value of the hole pixel is completed.
相应的,本公开还提供一种电子设备,所述电子设备包括有存储器,以及一个或者一个以上的程序,其中一个或者一个以上程序存储于存储器中,且经配置以由一个或者一个以上处理器执行所述一个或者一个以上程序包含用于实现如上述实施例中任一所述的位置差异图生成方法的指令,比如该方法可以包括:对第一图像和第二图像进行位差计算,得到初始位置差异图;所述初始位置差异图中包含至少一个位置差异值未知的空洞像素点;对所述初始位置差异图进行超像素划分,划分得到的每一超像素均包含多个像素点,并基于各个空洞像素点所位于的超像素中的其他像素点的位置差异值对相应的空洞像素点的位置差异值进行补全。Correspondingly, the present disclosure also provides an electronic device. The electronic device includes a memory and one or more programs, wherein the one or more programs are stored in the memory and configured to be processed by one or more processors. Executing the one or more programs includes instructions for implementing the position difference map generation method as described in any of the above embodiments. For example, the method may include: performing disparity calculation on the first image and the second image to obtain An initial position difference map; the initial position difference map contains at least one hole pixel with an unknown position difference value; the initial position difference map is divided into super pixels, and each super pixel obtained by the division contains multiple pixels, And the position difference value of the corresponding hole pixel is completed based on the position difference value of other pixels in the superpixel where each hole pixel is located.
相应的,本公开还提供一种芯片,所述芯片包括一个或多个接口电路和一个或多个处理器;所述接口电路用于从电子设备的存储器接收信号,并向所述处理器发送所述信号,所述信号包括存储器中存储的计算机指令;当所述处理器执行所述计算机指令时,使得所述电子设备执行上文所述的任一种位置差异图生成方法。Correspondingly, the present disclosure also provides a chip, which includes one or more interface circuits and one or more processors; the interface circuit is used to receive signals from the memory of the electronic device and send signals to the processor. The signal includes a computer instruction stored in a memory; when the processor executes the computer instruction, the electronic device is caused to execute any of the position difference map generating methods described above.
图11是根据一示例性实施例示出的一种用于实现位置差异图生成方法的装置1100的框图。例如,装置1100可以是移动电话,计算机,数字广播终端,消息收发设备,游戏控制台,平板设备,医疗设备,健身设备,个人数字助理等。FIG. 11 is a block diagram of a device 1100 for implementing a position difference map generation method according to an exemplary embodiment. For example, the device 1100 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, or the like.
参照图11,装置1100可以包括以下一个或多个组件:处理组件1102,存储器1104,电源组件1106,多媒体组件1108,音频组件1110,输入/输出(I/O)的接口1112,传感器组件1114,以及通信组件1116。Referring to Figure 11, the device 1100 may include one or more of the following components: a processing component 1102, a memory 1104, a power supply component 1106, a multimedia component 1108, an audio component 1110, an input/output (I/O) interface 1112, a sensor component 1114, and communications component 1116.
处理组件1102通常控制装置1100的整体操作,诸如与显示,电话呼叫,数据通信,相机操作和记录操作相关联的操作。处理组件1102可以包括一个或多个处理器1120来执行指令,以完成上述的方法的全部或部分步骤。此外,处理组件1102可以包括一个或多个模块,便于处理组件1102和其他组件之间的交互。例如,处理组件1102可以包括多媒体模块,以方便多媒体组件1108和处理组件1102之间的交互。 Processing component 1102 generally controls the overall operations of device 1100, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 1102 may include one or more processors 1120 to execute instructions to complete all or part of the steps of the above method. Additionally, processing component 1102 may include one or more modules that facilitate interaction between processing component 1102 and other components. For example, processing component 1102 may include a multimedia module to facilitate interaction between multimedia component 1108 and processing component 1102.
存储器1104被配置为存储各种类型的数据以支持在装置1100的操作。这些数据的示例包括用于在装置1100上操作的任何应用程序或方法的指令,联系人数据,电话簿数据,消息,图片,视频等。存储器1104可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘。 Memory 1104 is configured to store various types of data to support operations at device 1100 . Examples of such data include instructions for any application or method operating on device 1100, contact data, phonebook data, messages, pictures, videos, etc. Memory 1104 may be implemented by any type of volatile or non-volatile storage device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EEPROM), Programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk.
电源组件1106为装置1100的各种组件提供电力。电源组件1106可以包括电源管理系统,一个或多个电源,及其他与为装置1100生成、管理和分配电力相关联的组件。 Power supply component 1106 provides power to various components of device 1100 . Power supply components 1106 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to device 1100 .
多媒体组件1108包括在所述装置1100和用户之间的提供一个输出接口的屏幕。在一些实施例中,屏幕可以包括液晶显示器(LCD)和触摸面板(TP)。如果屏幕包括触摸面板,屏幕可以被实现为触摸屏,以接收来自用户的输入信号。触摸面板包括一个或多个触摸传感器以感测触摸、滑动和触摸面板上的手势。所述触摸传感器可以不仅感测触摸或滑动动作的边界,而且还检测与所述触摸或滑动操作相关的持续时间和压力。在一些实施例中,多媒体组件1108包括一个前置摄像头和/或后置摄像头。当装置1100处于操作模式,如拍摄模式或视频模式时,前置摄像头和/或后置摄像头可以接收外部的多媒体数据。每个前置摄像头和后置摄像头可以是一个固定的光学透镜系统或具有焦距和光学变焦能力。 Multimedia component 1108 includes a screen that provides an output interface between the device 1100 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide action. In some embodiments, multimedia component 1108 includes a front-facing camera and/or a rear-facing camera. When the device 1100 is in an operating mode, such as a shooting mode or a video mode, the front camera and/or the rear camera may receive external multimedia data. Each front-facing camera and rear-facing camera can be a fixed optical lens system or have a focal length and optical zoom capabilities.
音频组件1110被配置为输出和/或输入音频信号。例如,音频组件1110包括一个麦克风(MIC),当装置1100处于操作模式,如呼叫模式、记录模式和语音识别模式时,麦克风被配置为接收外部音频信号。所接收的音频信号可以被进一步存储在存储器1104或经由通信组件1116发送。在一些实施例中,音频组件1110还包括一个扬声器,用于输出音频信号。 Audio component 1110 is configured to output and/or input audio signals. For example, audio component 1110 includes a microphone (MIC) configured to receive external audio signals when device 1100 is in operating modes, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 1104 or sent via communications component 1116 . In some embodiments, audio component 1110 also includes a speaker for outputting audio signals.
I/O接口1112为处理组件1102和外围接口模块之间提供接口,上述外围接口模块可以是键盘,点击轮,按钮等。这些按钮可包括但不限于:主页按钮、音量按钮、启动按钮和锁定按钮。The I/O interface 1112 provides an interface between the processing component 1102 and a peripheral interface module. The peripheral interface module may be a keyboard, a click wheel, a button, etc. These buttons may include, but are not limited to: Home button, Volume buttons, Start button, and Lock button.
传感器组件1114包括一个或多个传感器,用于为装置1100提供各个方面的状态评估。例如,传感器组件1114可以检测到装置1100的打开/关闭状态,组件的相对定位,例如所述组件为装置1100的显示器和小键盘,传感器组件1114还可以检测装置1100或装置1100一个组件的位置改变,用户与装置1100接触的存在或不存在,装置1100方位或加速/减速和装置1100的温度变化。传感器组件1114可以包括接近传感器,被配置用来在没有任何的物理接触时检测附近物体的存在。传感器组件1114还可以包括光传感器,如CMOS或CCD图像传感器,用于在成像应用中使用。在一些实施例中,该传感器组件1114还可以包括加速度传感器,陀螺仪传感器,磁传感器,压力传感器或温度传感器。 Sensor component 1114 includes one or more sensors for providing various aspects of status assessment for device 1100 . For example, the sensor component 1114 can detect the open/closed state of the device 1100, the relative positioning of components, such as the display and keypad of the device 1100, and the sensor component 1114 can also detect a change in position of the device 1100 or a component of the device 1100. , the presence or absence of user contact with device 1100 , device 1100 orientation or acceleration/deceleration and temperature changes of device 1100 . Sensor assembly 1114 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 1114 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor component 1114 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
通信组件1116被配置为便于装置1100和其他设备之间有线或无线方式的通信。装置1100可以接入基于通信标准的无线网络,如WiFi,2G或3G,4G LTE、5G NR(New Radio)或它们的组合。在一个示例性实施例中,通信组件1116经由广播信道接收来自外部广播管理系统的广播信号或广播相关信息。在一个示例性实施例中,所述通信组件1116还包括近场通信(NFC)模块,以促进短程通信。例 如,在NFC模块可基于射频识别(RFID)技术,红外数据协会(IrDA)技术,超宽带(UWB)技术,蓝牙(BT)技术和其他技术来实现。 Communications component 1116 is configured to facilitate wired or wireless communications between device 1100 and other devices. The device 1100 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, 4G LTE, 5G NR (New Radio), or a combination thereof. In one exemplary embodiment, the communication component 1116 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, the communications component 1116 also includes a near field communications (NFC) module to facilitate short-range communications. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
在示例性实施例中,装置1100可以被一个或多个应用专用集成电路(ASIC)、数字信号处理器(DSP)、数字信号处理设备(DSPD)、可编程逻辑器件(PLD)、现场可编程门阵列(FPGA)、控制器、微控制器、微处理器或其他电子元件实现,用于执行上述方法。In an exemplary embodiment, apparatus 1100 may be configured by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable Gate array (FPGA), controller, microcontroller, microprocessor or other electronic components are implemented for executing the above method.
在示例性实施例中,还提供了一种包括指令的非临时性计算机可读存储介质,例如包括指令的存储器1104,上述指令可由装置1100的处理器1120执行以完成上述方法。例如,所述非临时性计算机可读存储介质可以是ROM、随机存取存储器(RAM)、CD-ROM、磁带、软盘和光数据存储设备等。In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions, such as a memory 1104 including instructions, which are executable by the processor 1120 of the device 1100 to complete the above method is also provided. For example, the non-transitory computer-readable storage medium may be ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
本领域技术人员在考虑说明书及实践这里公开的公开后,将容易想到本公开的其它实施方案。本公开旨在涵盖本公开的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本公开的一般性原理并包括本公开未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本公开的真正范围和精神由下面的权利要求指出。Other embodiments of the disclosure will be readily apparent to those skilled in the art from consideration of the specification and practice of the disclosure herein. The present disclosure is intended to cover any variations, uses, or adaptations of the disclosure that follow the general principles of the disclosure and include common common sense or customary technical means in the technical field that are not disclosed in the disclosure. . It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
应当理解的是,本公开并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本公开的范围仅由所附的权利要求来限制。It is to be understood that the present disclosure is not limited to the precise structures described above and illustrated in the accompanying drawings, and various modifications and changes may be made without departing from the scope thereof. The scope of the disclosure is limited only by the appended claims.
以上所述仅为本公开的较佳实施例而已,并不用以限制本公开,凡在本公开的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本公开保护的范围之内。The above are only preferred embodiments of the present disclosure and are not intended to limit the present disclosure. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present disclosure shall be included in this disclosure. within the scope of protection.

Claims (15)

  1. 一种位置差异图生成方法,其特征在于,包括:A method for generating a position difference map, which is characterized by including:
    对第一图像和第二图像进行位差计算,得到初始位置差异图;所述初始位置差异图中包含至少一个位置差异值未知的空洞像素点;Perform dislocation calculation on the first image and the second image to obtain an initial position difference map; the initial position difference map contains at least one hole pixel with an unknown position difference value;
    对所述初始位置差异图进行超像素划分,划分得到的每一超像素均包含多个像素点,并基于各个空洞像素点所位于的超像素中的其他像素点的位置差异值对相应的空洞像素点的位置差异值进行补全。The initial position difference map is divided into super pixels. Each super pixel obtained by the division contains multiple pixels, and the corresponding holes are classified based on the position difference values of other pixels in the super pixel where each hole pixel is located. The position difference value of the pixel is completed.
  2. 根据权利要求1所述的方法,其特征在于,The method according to claim 1, characterized in that:
    所述位置差异图为视差图,所述第一图像和所述第二图像由不同摄像头针对同一被摄主体拍摄得到;或者,The position difference map is a disparity map, and the first image and the second image are captured by different cameras for the same subject; or,
    所述位置差异图为光流图,所述第一图像和所述第二图像由同一摄像头在不同时刻对同一被摄主体拍摄得到。The position difference map is an optical flow map, and the first image and the second image are obtained by shooting the same subject at different times with the same camera.
  3. 根据权利要求1所述的方法,其特征在于,所述对所述初始位置差异图进行超像素划分,包括:The method according to claim 1, characterized in that said super-pixel division of the initial position difference map includes:
    按照预设尺寸对所述初始位置差异图像进行超像素划分,以使划分得到的每一超像素中包含的像素点为预设数量。The initial position difference image is divided into super pixels according to a preset size, so that each divided super pixel contains a preset number of pixel points.
  4. 根据权利要求1所述的方法,其特征在于,还包括:The method according to claim 1, further comprising:
    确定所述第一图像中的像素值分布情况,所述像素值分布情况用于表征所述第一图像中的平坦区域和边缘区域;其中,平坦区域中的像素点与其邻域像素点的像素差值不大于预设值,边缘区域中的像素点与其邻域像素点的像素差值大于预设值;Determine the distribution of pixel values in the first image. The distribution of pixel values is used to characterize the flat area and edge area in the first image; wherein, the pixels in the flat area and the pixels in its neighbor pixels are The difference is not greater than the preset value, and the pixel difference between the pixels in the edge area and its neighbor pixels is greater than the preset value;
    基于所述像素值分布情况对各个超像素所包含的像素点进行调整,以使调整后的同一超像素内的像素点属于同一平坦区域或同一边缘区域。The pixel points included in each super pixel are adjusted based on the pixel value distribution, so that the adjusted pixel points in the same super pixel belong to the same flat area or the same edge area.
  5. 根据权利要求4所述的方法,其特征在于,The method according to claim 4, characterized in that:
    所述确定所述第一图像中的像素值分布情况,包括:获取所述第一图像的亮度图;Determining the distribution of pixel values in the first image includes: obtaining a brightness map of the first image;
    所述基于所述像素值分布情况对各个超像素所包含的像素点进行调整,包括:基于所述亮度图中各个像素点的亮度值,对划分得到的各个超像素所包含的像素点进行调整,以使调整后的同一超像素内的各个像素点与其邻域像素点的亮度差值不超过预设亮度值。Adjusting the pixel points included in each super pixel based on the pixel value distribution includes: adjusting the pixel points included in each divided super pixel based on the brightness value of each pixel point in the brightness map. , so that the adjusted brightness difference between each pixel in the same super pixel and its neighboring pixels does not exceed the preset brightness value.
  6. 根据权利要求1所述的方法,其特征在于,基于任一空洞像素点所位于的超像素中的其他像素点的位置差异值对所述任一空洞像素点的位置差异值进行补全,包括:The method according to claim 1, characterized in that, the position difference value of any hole pixel point is completed based on the position difference value of other pixel points in the super pixel where any hole pixel point is located, including: :
    获取任一空洞像素点所位于的超像素中的其他各个像素点的位置差异值,并计算获取到的各个位置差异值的平均值,以将计算得到的平均值作为所述任一空洞像素点的位置差异值。Obtain the position difference value of each other pixel point in the superpixel where any hole pixel is located, and calculate the average value of each obtained position difference value, so as to use the calculated average value as the any hole pixel point position difference value.
  7. 根据权利要求6所述的方法,其特征在于,所述计算获取到的各个位置差异值的平均值,包括:The method according to claim 6, characterized in that the calculation of the average value of each obtained position difference value includes:
    计算获取到的各个位置差异值的加权平均值;其中,任一其他像素点的权重值与该任一其他像素点与所述任一空洞像素点的距离呈负相关。Calculate the weighted average of the obtained position difference values; wherein, the weight value of any other pixel is negatively correlated with the distance between the any other pixel and any hole pixel.
  8. 根据权利要求1所述的方法,其特征在于,基于任一空洞像素点所位于的超像素中的其他像素点的位置差异值对所述任一空洞像素点的位置差异值进行补全,包括:The method according to claim 1, characterized in that, the position difference value of any hole pixel point is completed based on the position difference value of other pixel points in the super pixel where any hole pixel point is located, including: :
    获取任一空洞像素点所位于的超像素中的其他各个像素点的位置差异值,并取获取到的各个位置差 异值的中值,以作为所述任一空洞像素点的位置差异值。Obtain the position difference value of each other pixel point in the superpixel where any hole pixel is located, and take the median value of the obtained position difference values as the position difference value of any hole pixel point.
  9. 根据权利要求1所述的方法,其特征在于,还包括:The method according to claim 1, further comprising:
    将所述初始位置差异图中,位置差异值不在预设视差范围内的像素点的位置差异值调整为未知,以使相应像素点转变为空洞像素点。In the initial position difference map, the position difference values of pixels whose position difference values are not within the preset parallax range are adjusted to unknown, so that the corresponding pixels are converted into hole pixels.
  10. 根据权利要求1所述的方法,其特征在于,还包括:The method according to claim 1, further comprising:
    对所述第一图像进行中值滤波,以得到去除噪声后的第一图像;Perform median filtering on the first image to obtain a first image after removing noise;
    基于滤波得到的第一图像确定出所包含的各个像素点的像素值连续情况,以基于确定出的像素值连续情况对经由位置差异值补全的位置差异图进行位置差异值二次补全。Based on the filtered first image, the pixel value continuity of each included pixel point is determined, and the position difference map is supplemented by the position difference value for a second time based on the determined pixel value continuity.
  11. 一种位置差异图生成装置,其特征在于,包括:A device for generating a position difference map, which is characterized in that it includes:
    计算单元,对第一图像和第二图像进行位差计算,得到初始位置差异图;所述初始位置差异图中包含至少一个位置差异值未知的空洞像素点;The calculation unit performs disparity calculation on the first image and the second image to obtain an initial position difference map; the initial position difference map contains at least one hole pixel with an unknown position difference value;
    划分单元,对所述初始位置差异图进行超像素划分,划分得到的每一超像素均包含多个像素点,并基于各个空洞像素点所位于的超像素中的其他像素点的位置差异值对相应的空洞像素点的位置差异值进行补全。The dividing unit divides the initial position difference map into super pixels. Each super pixel obtained by the division contains multiple pixel points, and the position difference value pair is based on the position difference value of other pixel points in the super pixel where each hole pixel point is located. The position difference value of the corresponding hole pixel is completed.
  12. 一种位置差异图生成方法,其特征在于,应用于图像处理器,包括:A position difference map generation method, characterized in that it is applied to an image processor and includes:
    接收图像传感器生成的第一图像和第二图像;所述第一图像和所述第二图像由所述图像传感器所属的摄像头针对同一被摄主体拍摄得到;Receive the first image and the second image generated by the image sensor; the first image and the second image are captured by the camera to which the image sensor belongs, aiming at the same subject;
    对所述第一图像和第二图像进行位差计算,得到初始位置差异图,所述初始位置差异图中包含至少一个位置差异值未知的空洞像素点;Perform dislocation calculation on the first image and the second image to obtain an initial position difference map, where the initial position difference map contains at least one hole pixel with an unknown position difference value;
    对所述初始位置差异图进行超像素划分,划分得到的每一超像素均包含多个像素点,并基于各个空洞像素点所位于的超像素中的其他像素点的位置差异值对相应的空洞像素点的位置差异值进行补全。The initial position difference map is divided into super pixels. Each super pixel obtained by the division contains multiple pixels, and the corresponding holes are classified based on the position difference values of other pixels in the super pixel where each hole pixel is located. The position difference value of the pixel is completed.
  13. 一种电子设备,其特征在于,包括:An electronic device, characterized by including:
    处理器;processor;
    用于存储处理器可执行指令的存储器;Memory used to store instructions executable by the processor;
    其中,所述处理器通过运行所述可执行指令以实现如权利要求1-10中任一项所述的方法。Wherein, the processor implements the method according to any one of claims 1-10 by running the executable instructions.
  14. 一种计算机可读存储介质,其上存储有计算机指令,其特征在于,该指令被处理器执行时实现如权利要求1-10中任一项所述方法的步骤。A computer-readable storage medium on which computer instructions are stored, characterized in that when the instructions are executed by a processor, the steps of the method according to any one of claims 1-10 are implemented.
  15. 一种芯片,其特征在于,A chip characterized by:
    包括一个或多个接口电路和一个或多个处理器;所述接口电路用于从电子设备的存储器接收信号,并向所述处理器发送所述信号,所述信号包括存储器中存储的计算机指令;当所述处理器执行所述计算机指令时,使得所述电子设备执行权利要求1至10任一项、权利要求12所述的位置差异图生成方法。Comprising one or more interface circuits and one or more processors; the interface circuit is used to receive signals from a memory of an electronic device and send the signals to the processor, where the signals include computer instructions stored in the memory ; When the processor executes the computer instructions, the electronic device is caused to execute the position difference map generation method described in any one of claims 1 to 10 and claim 12.
PCT/CN2022/094569 2022-05-23 2022-05-23 Position difference graph generation method and apparatus, electronic device, chip, and medium WO2023225825A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202280004634.7A CN116438568A (en) 2022-05-23 2022-05-23 Position difference map generation method and device, electronic equipment, chip and medium
PCT/CN2022/094569 WO2023225825A1 (en) 2022-05-23 2022-05-23 Position difference graph generation method and apparatus, electronic device, chip, and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2022/094569 WO2023225825A1 (en) 2022-05-23 2022-05-23 Position difference graph generation method and apparatus, electronic device, chip, and medium

Publications (1)

Publication Number Publication Date
WO2023225825A1 true WO2023225825A1 (en) 2023-11-30

Family

ID=87106585

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/094569 WO2023225825A1 (en) 2022-05-23 2022-05-23 Position difference graph generation method and apparatus, electronic device, chip, and medium

Country Status (2)

Country Link
CN (1) CN116438568A (en)
WO (1) WO2023225825A1 (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120313932A1 (en) * 2011-06-10 2012-12-13 Samsung Electronics Co., Ltd. Image processing method and apparatus
US20140002605A1 (en) * 2012-06-27 2014-01-02 Imec Taiwan Co. Imaging system and method
CN109584166A (en) * 2017-09-29 2019-04-05 株式会社理光 Disparity map denseization method, apparatus and computer readable storage medium
CN110033426A (en) * 2018-01-12 2019-07-19 杭州海康威视数字技术股份有限公司 A kind of device for being handled disparity estimation image
CN110660088A (en) * 2018-06-30 2020-01-07 华为技术有限公司 Image processing method and device
CN111432194A (en) * 2020-03-11 2020-07-17 北京迈格威科技有限公司 Disparity map hole filling method and device, electronic equipment and storage medium
CN112347882A (en) * 2020-10-27 2021-02-09 中德(珠海)人工智能研究院有限公司 Intelligent sorting control method and intelligent sorting control system

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20150053438A (en) * 2013-11-08 2015-05-18 한국전자통신연구원 Stereo matching system and method for generating disparity map using the same
CN110533701A (en) * 2018-05-25 2019-12-03 杭州海康威视数字技术股份有限公司 A kind of image parallactic determines method, device and equipment
CN109146814B (en) * 2018-08-20 2021-02-23 Oppo广东移动通信有限公司 Image processing method, image processing device, storage medium and electronic equipment
CN109640066B (en) * 2018-12-12 2020-05-22 深圳先进技术研究院 Method and device for generating high-precision dense depth image
CN109961507B (en) * 2019-03-22 2020-12-18 腾讯科技(深圳)有限公司 Face image generation method, device, equipment and storage medium
US20210004962A1 (en) * 2019-07-02 2021-01-07 Qualcomm Incorporated Generating effects on images using disparity guided salient object detection
CN111127355A (en) * 2019-12-17 2020-05-08 上海工程技术大学 Method for finely complementing defective light flow graph and application thereof
CN112884682B (en) * 2021-01-08 2023-02-21 福州大学 Stereo image color correction method and system based on matching and fusion

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120313932A1 (en) * 2011-06-10 2012-12-13 Samsung Electronics Co., Ltd. Image processing method and apparatus
US20140002605A1 (en) * 2012-06-27 2014-01-02 Imec Taiwan Co. Imaging system and method
CN109584166A (en) * 2017-09-29 2019-04-05 株式会社理光 Disparity map denseization method, apparatus and computer readable storage medium
CN110033426A (en) * 2018-01-12 2019-07-19 杭州海康威视数字技术股份有限公司 A kind of device for being handled disparity estimation image
CN110660088A (en) * 2018-06-30 2020-01-07 华为技术有限公司 Image processing method and device
CN111432194A (en) * 2020-03-11 2020-07-17 北京迈格威科技有限公司 Disparity map hole filling method and device, electronic equipment and storage medium
CN112347882A (en) * 2020-10-27 2021-02-09 中德(珠海)人工智能研究院有限公司 Intelligent sorting control method and intelligent sorting control system

Also Published As

Publication number Publication date
CN116438568A (en) 2023-07-14

Similar Documents

Publication Publication Date Title
KR102310430B1 (en) Filming method, apparatus and device
CN109671106B (en) Image processing method, device and equipment
US9973672B2 (en) Photographing for dual-lens device using photographing environment determined using depth estimation
US10810720B2 (en) Optical imaging method and apparatus
WO2019183813A1 (en) Image capture method and device
US11532076B2 (en) Image processing method, electronic device and storage medium
KR101916355B1 (en) Photographing method of dual-lens device, and dual-lens device
WO2016011747A1 (en) Skin color adjustment method and device
CN110958401B (en) Super night scene image color correction method and device and electronic equipment
EP3544286B1 (en) Focusing method, device and storage medium
US10187566B2 (en) Method and device for generating images
WO2016029465A1 (en) Image processing method and apparatus and electronic device
CN112911165A (en) Endoscope exposure method, device and computer readable storage medium
US10009545B2 (en) Image processing apparatus and method of operating the same
CN105210362B (en) Image adjusting apparatus, image adjusting method, and image capturing apparatus
WO2018219274A1 (en) Method and apparatus for denoising processing, storage medium and terminal
WO2023225825A1 (en) Position difference graph generation method and apparatus, electronic device, chip, and medium
CN111726531B (en) Image shooting method, processing method, device, electronic equipment and storage medium
CN114143471A (en) Image processing method, system, mobile terminal and computer readable storage medium
WO2019134513A1 (en) Shot focusing method, device, storage medium, and electronic device
CN114339022A (en) Camera shooting parameter determining method and neural network model training method
KR102458470B1 (en) Image processing method and apparatus, camera component, electronic device, storage medium
EP4304188A1 (en) Photographing method and apparatus, medium and chip
KR102494696B1 (en) Method and device for generating an image
WO2019072222A1 (en) Image processing method and device and apparatus

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

Country of ref document: EP

Kind code of ref document: A1