Binocular image real-time stitching method, device and equipment based on weighted fusion strategy

By adopting a weighted fusion strategy in binocular image splicing, the problems of color inconsistency and obvious splicing edges are solved, seamless real-time splicing of binocular images is achieved, and image quality and care efficiency are improved.

CN117291804BActive Publication Date: 2024-09-13WUHAN SIMSHINE INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311280265.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-28
Publication Date
2024-09-13
Estimated Expiration
2043-09-28

AI Technical Summary

Technical Problem

It is difficult for the existing technology to effectively solve the problems of color inconsistency and obvious splicing edges in binocular image splicing, resulting in poor quality of the spliced ​​image and affecting the visual effect and subsequent processing.

Method used

A real-time binocular image splicing method based on a weighted fusion strategy is used to obtain real-time images from the first and second perspectives, perform color correction, matching analysis, depth map weighted averaging and image weighted fusion, and output the fused spliced ​​image.

Benefits of technology

It achieves seamless real-time splicing of binocular images, provides more realistic and accurate visual information and a more comprehensive field of view, improves nursing efficiency and accuracy, and enhances system reliability and monitoring quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117291804B
    Figure CN117291804B
Patent Text Reader

Abstract

The present invention relates to the field of image stitching technology, solves the problem that the existing technology cannot simply and effectively solve the problem of color inconsistency and realize seamless real-time stitching of binocular images, and provides a binocular image real-time stitching method, device and equipment based on a weighted fusion strategy. The method includes: obtaining a first real-time image from a first perspective and a second real-time image from a second perspective in an infant care scene; performing color correction on the first real-time image and outputting a first target image; performing matching analysis on the first target image and the second real-time image and outputting an overlapping area; obtaining a first depth map and a second depth map, outputting a first weight map and a second weight map; based on the first weight map and the second weight map, outputting the fused image as a stitched image. The present invention provides benefits such as real-time monitoring, consistent color information, overlapping area visual information, depth perception and panoramic stitching for infant care.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image stitching, and in particular to a binocular image real-time stitching method, device and equipment based on a weighted fusion strategy. Background Art

[0002] With the continuous development of camera technology, binocular cameras have been widely used in fields such as security monitoring, drone navigation, virtual reality and augmented reality.

[0003] For example, binocular image stitching has many applications in the field of infant care: by using binocular camera stitching technology, a wider field of view can be provided to monitor the activities and safety of infants; this technology can be used to monitor the position, posture and sleeping status of infants in bed, so as to help parents or caregivers to detect any unusual situations in time. In places such as infant rooms or nurseries, the use of binocular camera stitching technology can provide more accurate positioning and navigation functions; by identifying features such as furniture, doors and windows in the room, the system can help caregivers quickly locate the location of infants and provide navigation guidance, making the care process more convenient and efficient; binocular image stitching can be used to analyze the facial expressions and eyes of infants and young children, so as to achieve emotion recognition and emotion monitoring; by analyzing the facial expressions of infants and young children, the system can automatically judge the emotional state of infants and young children, such as happiness, sleepiness, anxiety, etc., so as to help caregivers better understand and meet the needs of infants and young children; binocular image stitching technology can also be used for developmental assessment and early diagnosis of infants and young children. By analyzing the movement, eye contact and behavior patterns of infants and young children, the system can provide objective data and indicators to help doctors or professionals evaluate the development of infants and young children and detect any potential developmental problems or diseases early. However, in actual applications in the field of infant care, the binocular camera stitching algorithm faces problems such as color inconsistency and obvious stitching edges, which may result in poor quality of the stitched image, affecting the visual effect and subsequent processing. To solve the above problems, the prior art has proposed some binocular camera stitching methods. However, these methods are still insufficient in solving the problems of color inconsistency and obvious stitching edges. For example, some methods ignore depth information when fusing images, resulting in unsatisfactory stitching effects. In addition, the prior art usually relies only on linear transformation or global feature-based methods when performing color correction, which may have limited effect when dealing with complex color differences between cameras.

[0004] The existing Chinese patent CN111062873A discloses a parallax image stitching and visualization method based on multiple pairs of binocular cameras, the method includes: combining the internal and external parameters of the binocular cameras, the placement angle between the cameras and the scene plane distance d to calculate the homography matrix H; the value range of d is 8 to 15m; using the obtained homography matrix H between the images, calculate the image overlapping area ROI, and model the overlapping area; using the homography matrix H to transform the image coordinate system of the parallax image; seamlessly stitching the optimal stitching line in step 5); when the number of binocular cameras is greater than two, a parallax image with a wider field of view is obtained. However, the above patent uses multiple pairs of binocular cameras for image stitching, which requires multiple cameras, and involves the combination of the internal and external parameters of the cameras, the adjustment of the camera placement angle, and the calculation of the homography matrix, which increases the cost and complexity of the system and requires more equipment and computing resources. At the same time, the method mentions that the calculation of the homography matrix and the modeling of the overlapping area are dependent on the placement angle between the cameras and the distance between the scene planes, which means that the method has certain limitations for specific conditions of the scene, such as the determination of the camera placement angle and the limitation of the scene distance range. In other scenes or angles, it may be necessary to readjust the parameters or recalculate the homography matrix, resulting in limited application.

[0005] Therefore, how to simply and effectively solve the color inconsistency problem and achieve seamless real-time stitching of binocular images is an urgent problem to be solved. Summary of the invention

[0006] In view of this, the present invention provides a binocular image real-time stitching method, device and equipment based on a weighted fusion strategy, which is used to solve the problem that the existing technology cannot simply and effectively solve the color inconsistency problem and realize seamless binocular image real-time stitching.

[0007] The technical solution adopted by the present invention is:

[0008] In a first aspect, the present invention provides a binocular image real-time stitching method based on a weighted fusion strategy, characterized in that the method comprises:

[0009] S1: Acquire a first real-time image from a first perspective and a second real-time image from a second perspective different from the first perspective in a baby care scene;

[0010] S2: Performing color correction on the first real-time image, and outputting a first target image with the same color as the second real-time image;

[0011] S3: performing matching analysis on the first target image and the second real-time image, and outputting an overlapping area;

[0012] S4: Acquire a first depth map corresponding to the first target image and a second depth map corresponding to the second real-time image, perform weighted averaging processing on the first depth map and the second depth map, and output a first weight map and a second weight map;

[0013] S5: Performing weighted fusion processing on the first target image and the second real-time image according to the first weight map and the second weight map, and outputting the fused image as a stitched image.

[0014] Preferably, the S2 includes:

[0015] S21: Acquire a training image set related to infant care, wherein the training image set includes a first training image under the first perspective and a second training image under the second perspective;

[0016] S22: Acquire the color-corrected image of the first training image as a second target image, and output a loss function according to a color difference between the second target image and the second training image;

[0017] S23: training the deep learning model according to the loss function, and when the loss function is less than a preset threshold, outputting the trained deep learning model as a color correction model;

[0018] S24: Input the first real-time image into the color correction model, and output the first target image.

[0019] Preferably, the S22 includes:

[0020] S221: Acquire a channel difference between the second target image and the second training image;

[0021] S222: Squaring the channel difference to obtain the square error of each channel;

[0022] S223: Accumulate and sum the square errors of each channel and calculate the average, and output the loss function.

[0023] Preferably, S3 includes:

[0024] S31: Performing infant feature point detection on the first target image and the second real-time image to obtain a first feature point set in the first target image and a second feature point set in the second real-time image, wherein the infant feature points at least include: nose key points and mouth key points related to infant face occlusion judgment;

[0025] S32: Perform feature description on the first feature point set and the second feature point set, and output a first descriptor set and a second descriptor set;

[0026] S33: performing feature matching on the first descriptor set and the second descriptor set to obtain matching point pairs;

[0027] S34: outputting a homography matrix between the first target image and the second real-time image according to the matching point pairs;

[0028] S35: Mapping the first target image according to the homography matrix, and taking the intersection area of ​​the mapped image and the second real-time image as the overlapping area.

[0029] Preferably, the S4 includes:

[0030] S41: using a disparity estimation algorithm to obtain a first depth map corresponding to the first target image and a second depth map corresponding to the second real-time image;

[0031] S42: Calculate pixel gradients in the first depth map and pixel gradients in the second depth map respectively to obtain a first gradient map and a second gradient map;

[0032] S43: performing normalization processing on the first gradient map and the second gradient map to obtain a first normalized depth map and a second normalized depth map;

[0033] S44: performing weighted averaging on the first normalized gradient map and the second normalized gradient map to obtain the first weight map and the second weight map.

[0034] Preferably, the S41 includes:

[0035] S411: using a disparity estimation algorithm, obtaining a first dense depth map corresponding to the first target image and a second dense depth map corresponding to the second real-time image;

[0036] S412: normalizing the first dense depth map and the second dense depth map, mapping the first disparity value corresponding to the first dense depth map and the disparity value corresponding to the second dense depth map to a preset disparity range, and outputting the first depth map and the second depth map.

[0037] Preferably, the S44 includes:

[0038] S441: Obtaining a preset first weight parameter and a second weight parameter;

[0039] S442: performing weighted processing on the first depth map and the first normalized gradient map according to the first weight parameter, and outputting the first weight map;

[0040] S443: Perform weighted processing on the second depth map and the second normalized gradient map according to the second weight parameter, and output the second weight map.

[0041] In a second aspect, the present invention provides a binocular image real-time stitching device based on a weighted fusion strategy, the device comprising:

[0042] An image acquisition module, used to acquire a first real-time image from a first perspective and a second real-time image from a second perspective different from the first perspective in an infant care scene;

[0043] A color correction module, used to perform color correction on the first real-time image and output a first target image with the same color as the second real-time image;

[0044] A matching analysis module, used for performing matching analysis on the first target image and the second real-time image, and outputting an overlapping area;

[0045] A weight map acquisition module, used to acquire a first depth map corresponding to the first target image and a second depth map corresponding to the second real-time image, perform weighted averaging processing on the first depth map and the second depth map, and output a first weight map and a second weight map;

[0046] The image fusion module is used to perform weighted fusion processing on the first target image and the second real-time image according to the first weight map and the second weight map, and output the fused image as a stitched image.

[0047] In a third aspect, an embodiment of the present invention further provides an electronic device, comprising: at least one processor, at least one memory, and computer program instructions stored in the memory, which, when executed by the processor, implement the method of the first aspect in the above-mentioned embodiment.

[0048] In a fourth aspect, an embodiment of the present invention further provides a storage medium on which computer program instructions are stored, and when the computer program instructions are executed by a processor, the method of the first aspect in the above-mentioned embodiment is implemented.

[0049] In summary, the beneficial effects of the present invention are as follows:

[0050] The present invention provides a binocular image real-time stitching method, device and equipment based on a weighted fusion strategy. The method includes: obtaining a first real-time image of a first perspective and a second real-time image of a second perspective different from the first perspective in an infant care scene; performing color correction on the first real-time image, and outputting a first target image with the same color as the second real-time image; performing matching analysis on the first target image and the second real-time image, and outputting an overlapping area; obtaining a first depth map corresponding to the first target image and a second depth map corresponding to the second real-time image, performing weighted averaging processing on the first depth map and the second depth map, and outputting a first weight map and a second weight map; performing weighted fusion processing on the first target image and the second real-time image according to the first weight map and the second weight map, and outputting the fused image as a stitched image. The present invention realizes real-time monitoring of infant care scenes by acquiring a first real-time image of a first perspective and a second real-time image different from the first perspective, so that caregivers can observe the dynamic situation of infants at any time, discover abnormal situations in time and take corresponding measures; color correction is performed on the first real-time image, and a first target image with the same color as the second real-time image is output, so that the images under the two perspectives have consistent color information, and such color consistency can provide more real and accurate visual information, which is convenient for caregivers to observe and judge infant scenes; by matching and analyzing the first target image and the second real-time image, an overlapping area between them can be found, and such overlapping area can provide more comprehensive visual information, so that caregivers can better understand the activities of infants at different perspectives; according to the first weight map and the second weight map, the first target image and the second real-time image are weighted fused, and a fused spliced ​​image is output, and such a spliced ​​image provides more panoramic and detailed scene information, so that caregivers can observe the activities of infants more comprehensively, and improve care efficiency and accuracy. In summary, this solution provides benefits such as real-time monitoring, consistent color information, overlapping area visual information, depth perception and panoramic stitching for infant care. These advantages help improve the reliability, monitoring efficiency and quality of care systems, thereby providing better protection for the safety and health of infants and young children. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] In order to more clearly illustrate the technical solution of the embodiment of the present invention, the drawings required for use in the embodiment of the present invention will be briefly introduced below. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work, and these are all within the protection scope of the present invention.

[0052] Figure 1 It is a schematic diagram of the overall working process of the binocular image real-time stitching method based on the weighted fusion strategy in Example 1 of the present invention;

[0053] Figure 2 is a schematic diagram of a process of performing color correction on the first real-time image in Embodiment 1 of the present invention;

[0054] Figure 3 This is a schematic diagram of a process for obtaining a loss function in Embodiment 1 of the present invention;

[0055] Figure 4 This is a schematic diagram of the process of obtaining overlapping areas in Example 1 of the present invention;

[0056] Figure 5 This is a schematic diagram of a process for obtaining a weight map in Embodiment 1 of the present invention;

[0057] Figure 6 This is a schematic diagram of a process for obtaining a depth map in Embodiment 1 of the present invention;

[0058] Figure 7 Schematic diagram of the weighted processing process in Embodiment 1 of the present invention;

[0059] Figure 8 It is a structural block diagram of a binocular image real-time stitching device based on a weighted fusion strategy in Example 2 of the present invention;

[0060] Fig. 9 It is a schematic diagram of the structure of the electronic device in Embodiment 3 of the present invention. DETAILED DESCRIPTION

[0061] In order to make the purpose, technical solution and advantages of the embodiment of the present invention clearer, the technical solution in the embodiment of the present invention will be clearly and completely described in conjunction with the drawings in the embodiment of the present invention. It should be noted that, in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. In the description of the present invention, it should be understood that the orientation or position relationship indicated by the terms "center", "upper", "lower", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", etc. is based on the orientation or position relationship shown in the drawings, which is only for the convenience of describing the present application and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation of the present invention. Moreover, the term "include", "comprise" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such a process, method, article or device. In the absence of further restrictions, the elements defined by the phrase "comprising..." do not exclude the existence of other identical elements in the process, method, article or device comprising the elements. If there is no conflict, the embodiments of the present invention and the various features in the embodiments can be combined with each other, all within the protection scope of the present invention.

[0062] Example 1

[0063] See also Figure 1 Embodiment 1 of the present invention discloses a binocular image real-time stitching method based on a weighted fusion strategy, the method comprising:

[0064] S1: Acquire a first real-time image from a first perspective and a second real-time image from a second perspective different from the first perspective in a baby care scene;

[0065] Specifically, in a common infant care scenario, a first real-time image captured by a care camera at a first perspective and a second real-time image captured by a care camera at a second perspective are obtained, wherein the second perspective is different from the first perspective; by obtaining images from different perspectives, more comprehensive monitoring and observation are provided. The first perspective is usually obtained by installing a camera in a fixed position, such as the baby's bedside or in the corner of the room, to obtain a frontal perspective image of the baby. This perspective can provide direct facial features and expression information. The second perspective is obtained by installing another camera at a different position or angle. For example, the second camera can be placed on the other side of the room or at an angle close to the crib to provide different perspectives. This can obtain additional monitoring coverage, such as different postures or activities of the baby in the bed. By simultaneously obtaining real-time images from the first perspective and the second perspective, caregivers or parents can have a more comprehensive understanding of the status, behavior and safety of infants and young children. Such an image acquisition setting helps to provide more monitoring perspectives to meet the care needs of infants and young children.

[0066] S2: Performing color correction on the first real-time image, and outputting a first target image with the same color as the second real-time image;

[0067] Specifically, in the described scenario, the first real-time image is color corrected to make it have the same color characteristics as the second real-time image. This ensures that the images of the two perspectives are consistent in color, providing a more accurate and consistent visual experience, wherein color correction is an image processing technology that adjusts the color and tone of the image to match the color between different images. By color correcting the first real-time image, a first target image with the same color as the second real-time image is output; the color differences of different cameras, lighting conditions or sensors can be eliminated, so that the images of the two perspectives are more consistent in color, providing more real and reliable visual information. This helps to reduce the impact of color deviation on infant care and provide more accurate image information for reference and judgment by caregivers or parents.

[0068] In one embodiment, see Figure 2 , said S2 comprises:

[0069] S21: Acquire a training image set, wherein the training image set includes a first training image under the first viewing angle and a second training image under the second viewing angle;

[0070] Specifically, a pre-prepared training image set is obtained, which includes a first training image at a first perspective and a second training image at a second perspective. The training image set will be used to train a model or algorithm to learn color mapping and other features between images. The first training image at the first perspective refers to an image sample from a first-perspective camera, which is used to train a model or algorithm. These images are usually taken from actual shots at infant care sites, capturing infants' facial expressions, postures, or other relevant information; the second training image at the second perspective refers to an image sample from a second-perspective camera, which is used to train a model or algorithm. These images are also taken from infant care sites, providing image information at different perspectives and observation angles. By collecting such a training image set and pairing the images from the first perspective and the second perspective, an effective training data set is established for the color correction task.

[0071] S22: using the color-corrected image of the first training image as a second target image, and obtaining a loss function according to a difference between the second target image and the second training image;

[0072] Specifically, a loss function L is predefined to measure the color difference between the second target image after color correction of the first training image and the second training image; by obtaining the loss function, the difference between the second target image and the second training image can be quantified for training and optimizing the color correction model or algorithm.

[0073] In one embodiment, see Figure 3 , the S22 comprises:

[0074] S221: Acquire a channel difference between the second target image and the second training image;

[0075] Specifically, three difference images are obtained by performing pixel-by-pixel subtraction on each channel between the second target image and the second training image. The difference between the second target image and the second training image on each channel is specifically calculated as follows:

[0076] ΔR=I 1'_i(:,:,0)-I 2_i(:,:,0)

[0077] ΔG=I 1'_i(:,:,1)-I 2_i(:,:,1)

[0078] ΔB=I 1'_i(:,:,2)–I 2_i(:,:,2)

[0079] Where I 1' represents the second target image, I2 represents the second training image, (:,:,:) represents the three channels of the image. 0, 1, 2 represent the red, green, and blue channels respectively, ΔR represents the difference of the red channel, ΔG represents the difference of the green channel, and ΔB represents the difference of the blue channel.

[0080] S222: Squaring the channel difference to obtain the square error of each channel;

[0081] Specifically, for each channel, the square of the difference image is calculated to obtain three square error images: SE_R, SE_G and SE_B. The square error on each channel is calculated as follows:

[0082] SE_R=ΔR^2

[0083] SE_G=ΔG^2

[0084] SE_B=ΔB^2

[0085] Among them, SE_R represents the square error of the red channel, SE_G represents the square error of the green channel, and SE_B represents the square error of the blue channel.

[0086] S223: Accumulate and sum the square errors of each channel and calculate the average, and output the loss function.

[0087] Specifically, the three squared error images are summed at each pixel position to obtain a total squared error image. Then the sum of all pixels is divided by the number of pixels in the image (N*H*W) to obtain the final MSE loss:

[0088] L=1 / (N*H*W)*Σ(SE_R+SE_G+SE_B)

[0089] Where N is the number of image pairs, H is the height of the image, and W is the width of the image. By summing and averaging the squared errors of the pixels of all images, a scalar value that measures the accuracy of the color match can be obtained. Smaller loss values ​​indicate better color matching, while larger loss values ​​indicate larger color differences.

[0090] S23: training the deep learning model, and when the loss function is less than a preset threshold, using the trained deep learning model as a color correction model;

[0091] Specifically, by calculating the loss function, the difference between the second target image and the second training image can be quantified for training and optimizing the color correction model, which uses a U-Net neural network model. The parameters of the U-Net neural network model are updated using the stochastic gradient descent method to minimize the loss function, and the minimization criterion is that the loss function is less than a preset threshold, so that the first training image after color correction can be as close as possible to the color characteristics of the second training image, thereby achieving visual consistency and accurate color correction, wherein the stochastic gradient descent method is a commonly used optimization algorithm for updating the parameters of the neural network model.

[0092] S24: Input the first real-time image into the color correction model, and output the first target image.

[0093] S3: performing matching analysis on the first target image and the second real-time image, and outputting an overlapping area;

[0094] Specifically, a matching analysis is performed on the first target image and the second real-time image, and an overlapping area is output. The output overlapping area can be used for subsequent image stitching or fusion operations to generate a stitched image or a composite image, thereby achieving image display or information extraction with a wider field of view.

[0095] In one embodiment, see Figure 4 , said S3 comprises:

[0096] S31: Performing infant feature point detection on the first target image and the second real-time image to obtain a first feature point set in the first target image and a second feature point set in the second real-time image, wherein the infant feature points at least include: nose key points and mouth key points related to infant face occlusion judgment;

[0097] Specifically, first, the infant image is processed using the YOLOV8S target detection model to detect the infant face area in the image; in the infant face area obtained by target detection, a special key point detection algorithm, such as a facial key point detection model or a feature point detection algorithm, is used to detect the nose key points and the mouth key points; the detected nose key points and mouth key points are combined into a feature point set, which will be used for subsequent analysis and care scene applications. YOLOV8S is an efficient target detection model that can detect the infant face area in the image in real time, thereby quickly determining the area of ​​interest, thereby reducing the computational complexity of subsequent processing. YOLOV8S can detect multiple targets at the same time, which means that it can detect multiple infant face areas in one image, so it is suitable for multiple infant care scenes. Through a special key point detection algorithm, the nose key points and the mouth key points can be accurately detected, and the infant's head posture, facial expression, and nose and mouth position information can be accurately obtained. Combined with YOLOV8S target detection and key point detection, the automation of infant care can be realized. By analyzing the detected feature points, the system can determine the state and emotion of the infant, detect abnormal situations in time, and automatically notify caregivers for processing. Infant feature point detection can provide more comprehensive and accurate information, helping caregivers to fully understand the state and situation of the infant, thereby improving care efficiency and safety.

[0098] S32: Perform feature description on the first feature point set and the second feature point set, and output a first descriptor set and a second descriptor set;

[0099] Specifically, the ORB descriptor algorithm is used to calculate the first descriptor set and the second descriptor set of the feature point sets K1 and K2. The ORB descriptor algorithm can handle the situation where there are rotation changes in the image by introducing rotation invariance based on FAST corner detection. It calculates the direction of each feature point so that the descriptor has a certain degree of rotation invariance.

[0100] S33: performing feature matching on the first descriptor set and the second descriptor set to obtain matching point pairs;

[0101] Specifically, the brute force matching method and the nearest neighbor ratio test method are used to match the first descriptor and the second descriptor. The brute force matching method simply calculates the distance between all feature point pairs and selects the nearest matching point pair. The nearest neighbor ratio test method further screens the matching point pairs, that is, on the basis of brute force matching, the descriptors of each feature point are sorted according to the distance, and then only the two matching pairs with the closest distance are retained. Then the nearest neighbor ratio test is applied, and when the distance of the first matching pair is significantly smaller than the distance of the second matching pair, it is considered to be a valid match. The use of the brute force matching method and the nearest neighbor ratio test method can provide a preliminary matching result in feature matching, and further eliminate a part of the false matches, thereby improving the accuracy of the extraction of overlapping areas.

[0102] S34: outputting a homography matrix between the first target image and the second real-time image according to the matching point pairs;

[0103] Specifically, the RANSAC method is used to estimate the homography matrix H between the first target image and the second real-time image based on the matching point pairs. The RANSAC method is an iterative parameter estimation algorithm that randomly selects subsets of matching point pairs and calculates the homography matrix based on these subsets, and finally selects the homography matrix with the maximum number of internal points as the estimation result.

[0104] S35: Mapping the first target image according to the homography matrix, and taking the intersection area of ​​the mapped image and the second real-time image as the overlapping area.

[0105] Specifically, the first target image is mapped to a new image I1_new according to the homography matrix H, the area beyond the range is set to black, and the intersection area of ​​the new image I1_new and the second real-time image is calculated, which is the required overlapping area C; this overlapping area is the common area between the two images and can be used for subsequent image fusion, alignment or other related tasks. At the same time, during the mapping process, the pixels beyond the range of the first target image will be set to black or other background colors. This ensures that the overlapping area C contains only valid pixels common to the two images, avoiding the influence of invalid or noise pixels in the overlapping area.

[0106] S4: Acquire a first depth map corresponding to the first target image and a second depth map corresponding to the second real-time image, perform weighted averaging processing on the first depth map and the second depth map, and output a first weight map and a second weight map;

[0107] In one embodiment, see Figure 5 , said S4 comprises:

[0108] S41: using a disparity estimation algorithm to obtain a first depth map corresponding to the first target image and a second depth map corresponding to the second real-time image;

[0109] Specifically, a first depth map corresponding to the first target image and a second depth map corresponding to the second real-time image are obtained by using a disparity estimation algorithm. The disparity estimation is to infer the distance information of the object in the scene by analyzing the displacement difference between the corresponding pixels in the two images. The distance information of the object in the scene can be estimated by the first depth map and the second depth map.

[0110] In one embodiment, see Figure 6 , the S41 comprises:

[0111] S411: using a disparity estimation algorithm, obtaining a first dense depth map corresponding to the first target image and a second dense depth map corresponding to the second real-time image;

[0112] Specifically, the BM algorithm is mainly used to calculate the dense depth map: the first target image and the second real-time image are preprocessed, including grayscale, denoising and other operations. Converting the image to a grayscale image can reduce the amount of calculation, and denoising can improve the accuracy of depth estimation; the two images are divided into blocks of equal size, each of which is called a search area; for each pixel in the search area, the most similar pixel is searched in the second real-time image, and its matching cost is calculated. Common matching costs include pixel difference, grayscale difference, etc.; for each pixel, the matching costs in its surrounding neighborhood are aggregated, and the aggregation can be performed using cumulative sum, average value, etc.; based on the matching cost, the pixel with the smallest disparity value is selected as the final disparity value. The disparity value represents the horizontal displacement of the pixel in the first target image relative to the pixel in the second real-time image; combined with the internal and external parameters of the camera, the disparity value is converted into a depth value. The first dense depth map corresponding to the first target image and the second dense depth map corresponding to the second real-time image can be calculated by triangulation and other methods. Through the first and second dense depth maps, the depth information of each pixel in the image can be understood,

[0113] S412: normalizing the first dense depth map and the second dense depth map, mapping the first disparity value corresponding to the first dense depth map and the disparity value corresponding to the second dense depth map to a preset disparity range, and outputting the first depth map and the second depth map.

[0114] Specifically, after the first dense depth map and the second dense depth map are calculated using the BM algorithm, under normal circumstances, the range of the depth value can be arbitrary, but for the convenience of use and representation, the depth value is mapped to a range between 0 and 1, thereby outputting the normalized first depth map and the second depth map. By mapping the depth value to a fixed range, subsequent stitching processing and analysis are facilitated.

[0115] S42: Calculate pixel gradients in the first depth map and pixel gradients in the second depth map respectively to obtain a first gradient map and a second gradient map;

[0116] Specifically, the gradient map can be calculated by the Sobel operator or other edge detection operators. For each pixel position (x, y), the transverse gradient Gx and the longitudinal gradient Gy can be calculated respectively, and the gradient amplitude G(x, y) is calculated based on these two components. Taking the Sobel operator as an example, the gradient calculation process is as follows: Apply the Sobel operator to the depth map D1 to calculate the transverse gradient Gx1 and the longitudinal gradient Gy1:

[0117] Gx1(x,y)=D1(x+1,y)-D1(x-1,y);

[0118] Gy1(x,y)=D1(x,y+1)-D1(x,y-1);

[0119] Apply the Sobel operator to the depth map D2 to calculate the lateral gradient Gx2 and the longitudinal gradient Gy2:

[0120] Gx2(x,y)=D2(x+1,y)-D2(x-1,y);

[0121] Gy2(x,y)=D2(x,y+1)-D2(x,y-1);

[0122] Calculate the gradient magnitude G(x,y): G(x,y)=sqrt(Gx(x,y)^2+Gy(x,y)^2);

[0123] Among them, Gx(x,y)=Gx1(x,y)+Gx2(x,y), Gy(x,y)=Gy1(x,y)+Gy2(x,y);

[0124] The gradient map reflects the rate of change or edge strength of each pixel in the depth map, and can be used for subsequent edge detection, feature extraction, image segmentation and other tasks. By calculating the gradient amplitude, we can obtain the gradient strength information of each pixel, and then analyze the structure and edge information of the image.

[0125] S43: performing normalization processing on the first gradient map and the second gradient map to obtain a first normalized depth map and a second normalized depth map;

[0126] Specifically, get the minimum and maximum values ​​of the gradient graphs G1 and G2, denoted as min_G1 and max_G1, min_G2 and max_G2; normalize the gradient graph G1 and map its value range to [0,1]:

[0127] G1_norm=(G1-min_G1) / (max_G1-min_G1)

[0128] Normalize the gradient map G2 and map its value range to [0,1]:

[0129] G2_norm=(G2-min_G2) / (max_G2-min_G2)

[0130] The normalized gradient maps G1_norm and G2_norm will have values ​​in the range [0,1], making the intensity information of the gradient more convenient to compare and analyze.

[0131] S44: performing weighted averaging on the first normalized gradient map and the second normalized gradient map to obtain the first weight map and the second weight map.

[0132] Specifically, the first normalized gradient map G1_norm and the second normalized gradient map G2_norm are weighted and averaged. Since the weighted average process takes into account the gradient information of the two images, the contribution of each can be controlled by setting the weights. The final first weight map and the second weight map can be used in subsequent image fusion or processing to better retain important gradient information.

[0133] In one embodiment, see Figure 7 , the S44 comprises:

[0134] S441: Obtaining a preset first weight parameter and a second weight parameter;

[0135] S442: performing weighted processing on the first depth map and the first normalized gradient map according to the first weight parameter, and outputting the first weight map;

[0136] S443: Perform weighted processing on the second depth map and the second normalized gradient map according to the second weight parameter, and output the second weight map.

[0137] Specifically, a first weight parameter α1 and a second weight parameter α2 are defined, where 0<=α1, α2<=1, to balance the contribution of depth information and gradient information. Then, for each pixel position (x, y), the first weight map W1 and the second weight map W2 are calculated:

[0138] W1(x,y)=α*D1_norm(x,y)+(1-α1)*G1_norm(x,y)

[0139] W2(x,y)=α*D2_norm(x,y)+(1-α2)*G2_norm(x,y)

[0140] Among them, D1_norm and D2_norm represent the normalized depth maps D1 and D2 respectively.

[0141] S5: Performing weighted fusion processing on the first target image and the second real-time image according to the first weight map and the second weight map, and outputting the fused image as a stitched image.

[0142] Specifically, the first weight map is applied to the first target image, the second weight map is applied to the second real-time image, and weighted fusion is performed on the overlapping area. The weighted fusion refers to the following calculation method:

[0143] I_new(x,y)=W1(x,y)*I 3(x,y)+W2(x,y)*I4(x,y)

[0144] Among them, I 3(x, y) is the pixel value in the first target image, I4(x, y) is the pixel value in the second real-time image, and I_new(x, y) is the fused spliced ​​image. Weighted fusion can flexibly control the fusion result according to the distribution of the weight map, retain important information, achieve smooth transition, and adapt to the needs of different scenes, thereby improving the quality and expressiveness of the output spliced ​​image.

[0145] Example 2

[0146] See also Figure 8 Embodiment 2 of the present invention further provides a binocular image real-time stitching device based on a weighted fusion strategy, the device comprising:

[0147] An image acquisition module, used to acquire a first real-time image from a first perspective and a second real-time image from a second perspective different from the first perspective in an infant care scene;

[0148] A color correction module, used to perform color correction on the first real-time image and output a first target image with the same color as the second real-time image;

[0149] A matching analysis module, used for performing matching analysis on the first target image and the second real-time image, and outputting an overlapping area;

[0150] A weight map acquisition module, used to acquire a first depth map corresponding to the first target image and a second depth map corresponding to the second real-time image, perform weighted averaging processing on the first depth map and the second depth map, and output a first weight map and a second weight map;

[0151] The image fusion module is used to perform weighted fusion processing on the first target image and the second real-time image according to the first weight map and the second weight map, and output the fused image as a stitched image.

[0152] Specifically, a binocular image real-time stitching device based on a weighted fusion strategy provided by an embodiment of the present invention is adopted, and the device includes: an image acquisition module, used to acquire a first real-time image of a first perspective and a second real-time image of a second perspective different from the first perspective in an infant care scene; a color correction module, used to perform color correction on the first real-time image, and output a first target image with the same color as the second real-time image; a matching analysis module, used to perform matching analysis on the first target image and the second real-time image, and output an overlapping area; a weight map acquisition module, used to acquire a first depth map corresponding to the first target image and a second depth map corresponding to the second real-time image, perform weighted averaging processing on the first depth map and the second depth map, and output a first weight map and a second weight map; an image fusion module, used to perform weighted fusion processing on the first target image and the second real-time image according to the first weight map and the second weight map, and output the fused image as a stitched image. The device realizes real-time monitoring of the infant care scene by acquiring a first real-time image of a first perspective and a second real-time image different from the first perspective. The caregiver can observe the dynamic situation of the infant at any time, discover abnormal situations in time and take corresponding measures; the first real-time image is color corrected, and a first target image with the same color as the second real-time image is output, so that the images under the two perspectives have consistent color information. Such color consistency can provide more real and accurate visual information, which is convenient for the caregiver to observe and judge the infant scene; by matching and analyzing the first target image and the second real-time image, the overlapping area between them can be found, and such overlapping area can provide more comprehensive visual information, so that the caregiver can better understand the activities of the infant at different perspectives; according to the first weight map and the second weight map, the first target image and the second real-time image are weighted fused, and the fused spliced ​​image is output. Such a spliced ​​image provides more panoramic and detailed scene information, so that the caregiver can observe the activities of the infant more comprehensively and improve the efficiency and accuracy of care. In summary, this solution provides benefits such as real-time monitoring, consistent color information, overlapping area visual information, depth perception and panoramic stitching for infant care. These advantages help improve the reliability, monitoring efficiency and quality of care systems, thereby providing better protection for the safety and health of infants and young children.

[0153] Example 3

[0154] In addition, combined Figure 1 The binocular image real-time stitching method based on the weighted fusion strategy of the embodiment 1 of the present invention described above can be implemented by an electronic device. Fig. 9 A schematic diagram of the hardware structure of an electronic device provided in Embodiment 3 of the present invention is shown.

[0155] The electronic device may include a processor and a memory storing computer program instructions.

[0156] Specifically, the processor may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present invention.

[0157] The memory may include a large capacity memory for data or instructions. By way of example and not limitation, the memory may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. Where appropriate, the memory may include a removable or non-removable (or fixed) medium. Where appropriate, the memory may be inside or outside a data processing device. In a particular embodiment, the memory is a non-volatile solid-state memory. In a particular embodiment, the memory includes a read-only memory (ROM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically rewritable ROM (EAROM) or a flash memory or a combination of two or more of these.

[0158] The processor implements any one of the binocular image real-time stitching methods based on the weighted fusion strategy in the above embodiments by reading and executing the computer program instructions stored in the memory.

[0159] In one example, the electronic device may further include a communication interface and a bus. Fig. 9 As shown, the processor, memory, and communication interface are connected via a bus and communicate with each other.

[0160] The communication interface is mainly used to implement communication between the modules, devices, units and / or equipment in the embodiments of the present invention.

[0161] The bus includes hardware, software or both, and the parts of the device are coupled to each other. For example, but not limitation, the bus may include accelerated graphics port (AGP) or other graphics bus, enhanced industrial standard architecture (EISA) bus, front side bus (FSB), hypertransport (HT) interconnection, industrial standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In suitable cases, the bus may include one or more buses. Although the embodiment of the present invention describes and shows a specific bus, the present invention considers any suitable bus or interconnection.

[0162] Example 4

[0163] In addition, in combination with the binocular image real-time stitching method based on the weighted fusion strategy in the above embodiment 1, embodiment 4 of the present invention can also provide a computer-readable storage medium for implementation. The computer-readable storage medium stores computer program instructions; when the computer program instructions are executed by the processor, any binocular image real-time stitching method based on the weighted fusion strategy in the above embodiments is implemented.

[0164] In summary, the embodiments of the present invention provide a binocular image real-time stitching method, device and equipment based on a weighted fusion strategy.

[0165] It should be clear that the present invention is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present invention is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present invention.

[0166] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present invention are programs or code segments that are used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.

[0167] It should also be noted that the exemplary embodiments mentioned in the present invention describe some methods or systems based on a series of steps or devices. However, the present invention is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiments, or in a different order from the embodiments, or several steps can be performed simultaneously.

[0168] The above is only a specific implementation of the present invention. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of the system, module and unit described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. It should be understood that the protection scope of the present invention is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be covered within the protection scope of the present invention.

Claims

1. A binocular image real-time stitching method based on weighted fusion strategy, characterized in that: The method comprises: S1: Acquire a first real-time image from a first perspective and a second real-time image from a second perspective different from the first perspective in a baby care scene; S2: Performing color correction on the first real-time image, and outputting a first target image with the same color as the second real-time image; S3: performing matching analysis on the first target image and the second real-time image, and outputting an overlapping area; S4: Acquire a first depth map corresponding to the first target image and a second depth map corresponding to the second real-time image, perform weighted averaging processing on the first depth map and the second depth map, and output a first weight map and a second weight map; S5: performing weighted fusion processing on the first target image and the second real-time image according to the first weight map and the second weight map, and outputting the fused image as a stitched image; The S3 includes: S31: Performing infant feature point detection on the first target image and the second real-time image to obtain a first feature point set in the first target image and a second feature point set in the second real-time image, wherein the infant feature points at least include: nose key points and mouth key points related to infant face occlusion judgment; S32: Perform feature description on the first feature point set and the second feature point set, and output a first descriptor set and a second descriptor set; S33: performing feature matching on the first descriptor set and the second descriptor set to obtain matching point pairs; S34: outputting a homography matrix between the first target image and the second real-time image according to the matching point pairs; S35: mapping the first target image according to the homography matrix, and taking the intersection area of ​​the mapped image and the second real-time image as the overlapping area; The S4 includes: S41: using a disparity estimation algorithm to obtain a first depth map corresponding to the first target image and a second depth map corresponding to the second real-time image; S42: Calculate pixel gradients in the first depth map and pixel gradients in the second depth map respectively to obtain a first gradient map and a second gradient map; S43: performing normalization processing on the first gradient map and the second gradient map to obtain a first normalized depth map and a second normalized depth map; S44: performing weighted averaging on the first normalized gradient map and the second normalized gradient map to obtain the first weight map and the second weight map; The S41 includes: S411: using a disparity estimation algorithm, obtaining a first dense depth map corresponding to the first target image and a second dense depth map corresponding to the second real-time image; S412: performing normalization processing on the first dense depth map and the second dense depth map, mapping the first disparity value corresponding to the first dense depth map and the disparity value corresponding to the second dense depth map to a preset disparity range, and outputting the first depth map and the second depth map; The S44 includes: S441: Obtaining a preset first weight parameter and a second weight parameter; S442: performing weighted processing on the first depth map and the first normalized gradient map according to the first weight parameter, and outputting the first weight map; S443: Perform weighted processing on the second depth map and the second normalized gradient map according to the second weight parameter, and output the second weight map.

2. The binocular image real-time stitching method based on weighted fusion strategy according to claim 1, characterized in that: The S2 includes: S21: Acquire a training image set related to infant care, wherein the training image set includes a first training image under the first perspective and a second training image under the second perspective; S22: Acquire the color-corrected image of the first training image as a second target image, and output a loss function according to a color difference between the second target image and the second training image; S23: training the deep learning model according to the loss function, and when the loss function is less than a preset threshold, outputting the trained deep learning model as a color correction model; S24: Input the first real-time image into the color correction model, and output the first target image.

3. The binocular image real-time stitching method based on weighted fusion strategy according to claim 2 is characterized in that: The S22 includes: S221: Acquire a channel difference between the second target image and the second training image; S222: Squaring the channel difference to obtain the square error of each channel; S223: Accumulate and sum the square errors of each channel and calculate the average, and output the loss function.

4. A binocular image real-time stitching device based on weighted fusion strategy, characterized in that: The device comprises: An image acquisition module, used to acquire a first real-time image from a first perspective and a second real-time image from a second perspective different from the first perspective in an infant care scene; A color correction module, used to perform color correction on the first real-time image and output a first target image with the same color as the second real-time image; A matching analysis module, used for performing matching analysis on the first target image and the second real-time image, and outputting an overlapping area; A weight map acquisition module, used to acquire a first depth map corresponding to the first target image and a second depth map corresponding to the second real-time image, perform weighted averaging processing on the first depth map and the second depth map, and output a first weight map and a second weight map; An image fusion module, configured to perform weighted fusion processing on the first target image and the second real-time image according to the first weight map and the second weight map, and output the fused image as a spliced ​​image; The matching analysis of the first target image and the second real-time image and outputting the overlapping area comprises: Performing infant feature point detection on the first target image and the second real-time image to obtain a first feature point set in the first target image and a second feature point set in the second real-time image, wherein the infant feature points at least include: nose key points and mouth key points related to infant face occlusion judgment; Performing feature description on the first feature point set and the second feature point set, and outputting a first descriptor set and a second descriptor set; Performing feature matching on the first descriptor set and the second descriptor set to obtain matching point pairs; Outputting a homography matrix between the first target image and the second real-time image according to the matching point pairs; Mapping the first target image according to the homography matrix, and taking the intersection area of ​​the mapped image and the second real-time image as the overlapping area; The acquiring of a first depth map corresponding to the first target image and a second depth map corresponding to the second real-time image, performing weighted averaging processing on the first depth map and the second depth map, and outputting a first weight map and a second weight map comprises: Using a disparity estimation algorithm, obtaining a first depth map corresponding to the first target image and a second depth map corresponding to the second real-time image; Calculate pixel gradients in the first depth map and pixel gradients in the second depth map respectively to obtain a first gradient map and a second gradient map; Normalizing the first gradient map and the second gradient map to obtain a first normalized depth map and a second normalized depth map; Performing weighted averaging on the first normalized gradient map and the second normalized gradient map to obtain the first weight map and the second weight map; The method of obtaining a first depth map corresponding to the first target image and a second depth map corresponding to the second real-time image by using a disparity estimation algorithm includes: Using a disparity estimation algorithm, obtaining a first dense depth map corresponding to the first target image and a second dense depth map corresponding to the second real-time image; Normalizing the first dense depth map and the second dense depth map, mapping a first disparity value corresponding to the first dense depth map and a disparity value corresponding to the second dense depth map to a preset disparity range, and outputting the first depth map and the second depth map; The step of performing weighted averaging on the first normalized gradient map and the second normalized gradient map to obtain the first weight map and the second weight map comprises: Obtaining a preset first weight parameter and a second weight parameter; performing weighted processing on the first depth map and the first normalized gradient map according to the first weight parameter, and outputting the first weight map; The second depth map and the second normalized gradient map are weighted according to the second weight parameter, and the second weight map is output.

5. An electronic device, characterized in that: include: At least one processor, at least one memory and computer program instructions stored in the memory, when the computer program instructions are executed by the processor, implement the method according to any one of claims 1 to 3.

6. A storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 3 is implemented.