A method for generating pictures based on intelligent shooting of computer vision

By improving the YOLOv5 algorithm and MobileNetV2 recognition technology, and combining pose recognition and fully convolutional network optimization, the problems of composition shift and noise processing in intelligent shooting are solved, thus improving image quality.

CN121304825BActive Publication Date: 2026-06-09SHANDONG TIAN JING ELECTRONICS TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHANDONG TIAN JING ELECTRONICS TECH CO LTD
Filing Date
2025-10-11
Publication Date
2026-06-09

AI Technical Summary

Technical Problem

Existing intelligent shooting technology cannot accurately adjust the composition, cannot identify and process different types of noise, and cannot effectively distinguish between people and background areas for differentiated optimization, resulting in low image quality.

Method used

The improved YOLOv5 algorithm accurately detects key points of the person, and the shooting angle is adjusted by combining eye and body posture recognition; MobileNetV2 is used to identify noise types and perform differential filtering; and a fully convolutional network is used to segment the person and background areas and optimize the fusion.

Benefits of technology

It achieves automatic composition and precise shooting, improving image clarity and overall aesthetics, and meeting users' needs for high-quality images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121304825B_ABST
    Figure CN121304825B_ABST
Patent Text Reader

Abstract

The present application belongs to the technical field of image processing, and particularly relates to a method for generating pictures by intelligent shooting based on computer vision. The steps include: S1, collecting an initial image of a target person, using an improved YOLOv5 algorithm with a Neck layer introducing an attention module to identify key points and center coordinates of the person, calculating an offset and adjusting a shooting angle or position to obtain an initial composition; S2, detecting eye and limb states through key point detection, determining a shooting intention, and then shooting to obtain an original image; S3, calculating noise features by dividing the original image, classifying noise based on MobileNetV2, and denoising accordingly, and correcting mixed noise through a residual network; S4, segmenting image regions by using a full convolution network, optimizing by verifying an intersection-over-union ratio, fusing a mask, and generating a target picture by global color balance. The present application improves the composition accuracy, denoising effect and image quality, and meets the demand for high-quality intelligent shooting.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of image processing technology, and in particular relates to a method for intelligent image generation based on computer vision. Background Technology

[0002] With the widespread adoption of smart shooting devices, the demand from ordinary users for high-quality images that can be generated without professional operation has increased significantly. However, most users lack photography and image processing knowledge, and when shooting manually, problems such as subjects deviating from the optimal composition position and images being noisy due to environmental interference are common. Existing smart shooting technologies have obvious shortcomings: First, composition adjustments often rely on fixed templates or simple centering strategies, without combining the coordinates of key points on the subject to calculate offsets for precise correction, easily resulting in the subject area deviating from the preset composition rules; Second, noise processing uses a single filtering algorithm, without first identifying the type of noise or distinguishing between the subject and background areas, easily causing blurred edges on the subject or incomplete background noise removal, resulting in insufficient detail and overall harmony in the image, failing to meet users' needs for high-quality smart shooting. Summary of the Invention

[0003] To address the technical problems existing in the background art described above, this invention proposes a method for intelligent image generation based on computer vision.

[0004] To achieve the above objectives, the technical solution adopted by the present invention includes the following steps:

[0005] S1. Use a shooting device to capture the initial image of the target person, and use a target detection algorithm to identify the position information of the person in the image, including the coordinates of the key points and the center coordinates of the person; calculate the offset between the coordinates of the key points of the person and the composition reference position according to the preset composition rules. If the offset exceeds the preset threshold, control the shooting device to adjust the shooting angle or position so that the person area is in a position that conforms to the composition rules, and obtain the initial composition.

[0006] S2. The initial composition is captured by using a key point detection algorithm to identify the subject's posture and begin shooting. The resulting image is used as the original image.

[0007] S3. Perform image preprocessing on the original image. The image preprocessing involves identifying the noise type of the original image and applying different processing methods to different types of noise to obtain a preprocessed image.

[0008] In step S3, image preprocessing is performed on the original image. This image preprocessing includes identifying the noise type of the original image and applying different processing methods to different types of noise. Specifically, this includes:

[0009] S31. First, the original image is divided into blocks, and the noise quantization features of each block are calculated, including Gaussian noise features, salt-and-pepper noise features, and Poisson noise features. The Gaussian noise features are calculated by the mean deviation and high-frequency component variance of the pixel values ​​within the block. The salt-and-pepper noise features are calculated by the jump rate of the pixel values ​​within the block. The Poisson noise features are calculated by the ratio of the mean to the variance of the pixel values ​​within the block.

[0010] S32. Construct a noise classification network based on MobileNetV2, and input the above features to realize the probability distribution of output noise. ,in These represent the probability distributions of Gaussian, salt and pepper, Poisson, and mixed noise, respectively.

[0011] S33, if If determined to be Gaussian noise, Gaussian filtering is applied; if Determined to be salt-and-pepper noise, it is processed using median filtering; if If the noise is determined to be Poisson noise, it is first converted to approximately Gaussian noise using Variance Stabilization Transform (VST). Bilateral filtering is applied to the human figure area to preserve edges, while Gaussian filtering is applied to the background area. Then, inverse VST is used to recover the image. If the above conditions are not met, then it belongs to... For mixed noise, the dominant noise type is first identified based on probability, and the corresponding single noise processing method is preferentially applied; then, a noise residual is generated through a residual learning network to correct the image and obtain a denoised preprocessed image.

[0012] S4. The preprocessed image is segmented into human and background regions using a semantic segmentation model. Semantic region masks are output, and the intersection-union ratio of each region is verified. Different optimization algorithms are used for different semantic regions. The optimized region masks are then fused at the pixel level. After global color balancing, the target image is generated.

[0013] Preferably, in step S1, the location information of a person in the image is identified using a target detection algorithm, including the coordinates of key points and the center coordinates of the person.

[0014] S11. First, acquire the initial RGB image. The enhanced image is obtained by processing the initial image using histogram equalization. ;

[0015] S12, Enhanced image The input is fed into the improved YOLOv5 algorithm, which introduces an attention module in the Neck layer, specifically including the extraction of multi-scale feature maps in the backbone network. For feature maps Global average pooling is used to obtain the channel feature vectors. Attention weights are output through a two-layer fully connected network. ,in For the Sigmoid function, They are two fully connected layers; through Weighted enhancement of human-related characteristics in, For channel-by-channel multiplication, and with The fusion yields an enhanced feature map. ;

[0016] S13, Based on Enhanced Feature Map Generate an initial target bounding box and select multiple points of the person as key points; if the visibility rate of the key points of the person is less than 0.6 in the area corresponding to the initial target bounding box, it is determined to be occlusion, the target bounding box is expanded, and the visibility rate of the key points of the person is recalculated until the set threshold is reached.

[0017] S14. Calculate the center coordinates and the coordinates of key points of the person in the target box based on the final target box.

[0018] Preferably, the initial composition in step S1 is achieved as follows: the coordinates of the baseline key points of the person are obtained according to the preset composition rules, and then the coordinates of the key points of the person in the current target frame are calculated to obtain the deviation of the coordinates of each key point; the deviation amount is obtained by normalizing and weighting the deviations of all key points of the person; if the deviation amount exceeds the preset threshold, the shooting device is controlled to adjust the shooting angle or position so that the person area is in a position that conforms to the composition rules, and the initial composition is obtained.

[0019] Preferably, step S2 involves taking a picture based on the intention to identify the person's posture using a key point detection algorithm in the initial composition, and the resulting image is used as the original image.

[0020] S21. Based on the initial composition, extract eye key points and limb key points from multiple frames using a key point detection algorithm, and smooth the key points in each frame.

[0021] S22. Calculate the average vertical distance between the two eyes as the eye opening and closing feature, set the effective range of eye opening and closing, and record the fixation ready state when the range is satisfied for three consecutive frames.

[0022] S23. While satisfying the gaze condition, calculate the displacement transformation rate of the extracted limb key points in the first and third frames to reflect the stability of the posture. If the average displacement transformation rate of all limb key points is less than the set threshold, it is recorded as a stable posture state. If both the gaze ready state and the stable posture state are satisfied at the same time, it is considered as the intention to start shooting and shooting is carried out.

[0023] Preferably, in step S33, when the noise is mixed noise, the dominant noise type is identified based on probability, and the corresponding single noise processing method is preferentially adopted; then, the noise residual is generated through a residual learning network to correct the image and obtain the denoised preprocessed image. The specific implementation is as follows:

[0024] S331. First, identify the dominant noise type based on the noise probability output by the noise classification network, and then process it using the corresponding single noise processing method.

[0025] S332. Generate noisy residuals through a residual learning network, and insert NFAM into the bottleneck layer (Bottleneck) of the residual learning network; extract feature maps from the output features of the bottleneck layer. Calculate channel attention weights ,in For global average pooling, For a fully connected network, the feature maps are weighted to obtain weighted feature maps. ;

[0026] S333, Then generate a character mask based on the character's key point coordinates. The obtained weighted feature map Performing 3×3 convolution and ReLU activation operations yields the residuals in the character region. The same background mask is generated. Perform 5×5 convolution and Tanh activation on the weighted feature map to generate background region residuals. ; obtain the final noise residual ;

[0027] S334. Use the obtained residual to correct the image to obtain the corrected image. ,in For the corrected image, This is the image after being processed using the corresponding single noise reduction method.

[0028] Preferably, step S4 uses a semantic segmentation model to segment the preprocessed image into a person region and a background region, outputs a semantic region mask, and verifies the intersection-union ratio of each region. For different semantic regions, different optimization algorithms are used to perform pixel-level fusion of the optimized region masks. After global color balancing, the specific implementation of generating the target image is as follows:

[0029] S41. Construct a semantic segmentation model based on a fully convolutional network, perform semantic segmentation on the preprocessed image, and output an initial semantic region mask containing the human region and the background region.

[0030] S42. Calculate the intersection-union ratio (IU) of the initial semantic region mask and the labeled mask, and judge according to the preset IU threshold. If the region mask is satisfied, retain the mask of that region; otherwise, return to the previous step to optimize the semantic segmentation model and recalculate the parameters until the preset IU threshold is satisfied.

[0031] S43. To address the visual differences between the character area and the background area, design different optimization algorithms and output the region masks for both. and Then, the region masks of the two are fused pixel-level to obtain a fused mask;

[0032] S44. Finally, after global color balance processing, the target image is generated.

[0033] Preferably, in step S43, an edge-preserving guided filtering algorithm is used to optimize the character area in different optimization algorithms to obtain the optimized pixel values: ,in, To optimize the pixel values, For the pixel values ​​of the preprocessed image, The total number of pixels in the window. The average pixel value within the window; the optimized mask for the character area is:

[0034] ,in The initial semantic region mask for the person region output by the semantic segmentation model; mean filtering is applied to the background region to obtain the optimized pixel values. The optimized background area mask is ,in The initial semantic region mask of the background region output by the semantic segmentation model.

[0035] Compared with existing technologies, the advantages and positive effects of this invention are as follows: By improving YOLOv5 (adding an attention module to the Neck layer), it accurately detects key points and coordinates of the subject, calculates offsets to adjust the shooting angle, and solves the problem of existing compositions relying on fixed templates; it combines key points of the eyes and limbs to judge the shooting intention and avoids misshooting; it uses MobileNetV2 to identify noise types and filter them accordingly, and uses a residual network to correct mixed noise, overcoming the defects of single filtering; it uses a fully convolutional network to segment the subject and background, and uses optimization algorithms (guided filtering for the subject and mean filtering for the background) and verifies the cross-over ratio; through global color balancing, it takes into account both the smoothness of the subject's edges and the background, significantly improving image quality and meeting users' needs for high-quality intelligent shooting. Attached Figure Description

[0036] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0037] Figure 1 This is a flowchart illustrating the structure of a computer vision-based intelligent image generation method. Detailed Implementation

[0038] To better understand the above-mentioned objectives, features, and advantages of the present invention, the present invention will be further described below in conjunction with the accompanying drawings and embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in these embodiments can be combined with each other.

[0039] Numerous specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways than those described herein, and therefore the invention is not limited to the specific embodiments disclosed in the following specification.

[0040] In practice, with the widespread use of smartphones, drones, and home cameras, more and more ordinary users want to obtain high-quality images without professional photography skills. However, existing intelligent shooting methods still have significant shortcomings. Composition during the shooting process often relies on fixed templates or simple centering strategies, failing to intelligently adjust based on the actual distribution of key points on the subject, resulting in the subject often deviating from the ideal compositional position. Secondly, changes in ambient lighting, electronic sensor noise, and compression loss introduce various types of noise. Existing methods typically use a single filtering algorithm for noise reduction, failing to design differentiated processing schemes for different noise types, easily leading to loss of image details or blurred edges. Finally, in processing the subject and background, existing technologies often optimize the entire image as a whole, ignoring the visual differences between the subject and background areas, resulting in final images that are not ideal in terms of clarity, color reproduction, and overall aesthetics. To solve the above problems, this invention proposes a computer vision-based intelligent shooting image generation method. Through target detection, pose recognition, noise type recognition, and fusion of regional optimization, it can achieve automatic composition, precise shooting, intelligent noise reduction, and regional optimization. The specific implementation process is as follows... Figure 1 As shown.

[0041] First, an initial image of the target person is captured using a shooting device. To ensure that the subject in the shooting result always conforms to the preset composition rules, the position information of the person in the image is identified by a target detection algorithm, including the coordinates of the key points and the center coordinates of the person. The offset between the coordinates of the key points of the person and the composition reference position is calculated according to the preset composition rules. If the offset exceeds the preset threshold, the shooting device is controlled to adjust the shooting angle or position so that the person area is in a position that conforms to the composition rules, thus obtaining the initial composition.

[0042] The method of identifying the position information of people in an image through a target detection algorithm, including the coordinates of key points and the center coordinates of the person, includes first acquiring an initial RGB image. The enhanced image is obtained by processing the initial image using histogram equalization. ; Enhanced image The input is fed into the improved YOLOv5 algorithm, which introduces an attention module in the Neck layer, specifically including the extraction of multi-scale feature maps in the backbone network. For feature maps Global average pooling is used to obtain the channel feature vectors. Attention weights are output through a two-layer fully connected network. ,in For the Sigmoid function, They are two fully connected layers; through Weighted enhancement of human-related characteristics in, For channel-by-channel multiplication, and with The fusion yields an enhanced feature map. Based on enhanced feature maps An initial bounding box is generated, and multiple points on the person are selected as keypoints. If the visibility rate of the detected keypoints on the person is less than 0.6 in the region corresponding to the initial bounding box, it is considered occlusion, and the bounding box is enlarged. The visibility rate of the detected keypoints on the person is recalculated until a set threshold is reached. The center coordinates and the coordinates of the keypoints on the person within the bounding box are calculated based on the final bounding box. Specifically, an initial RGB image is first acquired. To avoid color shift caused by directly equalizing the three channels separately, the RGB image is first converted to a luminance-chrominance space. Histogram equalization is performed only on the luminance channel to enhance the overall contrast. Then, the processed luminance and the original chrominance channels are combined to obtain an enhanced RGB image. This enhanced image is input into an improved YOLOv5 network for detection. After extracting three-scale features in the Backbone, YOLOv5 performs mid-scale feature equalization (denoted as ) in the Neck layer. Insert channel attention module: for Global average pooling is used to obtain the channel description vector, which is then passed through two fully connected layers (using ReLU for non-linearity) and normalized with Sigmoid to obtain the channel attention weights W. Channel enhancement is obtained by multiplying each channel sequentially. and to Perform upsampling and downsampling The system performs stitching and fusion to generate an enhanced feature map, which is then fed into the Neck feature fusion structure for scale integration. Based on the enhanced feature map, the detection head first generates an initial bounding box, and simultaneously outputs a heatmap of predefined keypoints (such as eyes, nose, shoulders, elbows, wrists, etc.) from a dedicated keypoint branch. For each keypoint, the peak position on the heatmap is taken, and the coordinates are refined using sub-pixel interpolation. If the peak amplitude or response is lower than a set threshold, it is considered invisible. The keypoint visibility rate is calculated as the number of visible keypoints divided by the total number of keypoints. When the visibility rate is less than 0.6, the initial bounding box is enlarged proportionally, and the enlarged image area is re-input into the detection and keypoint branch. This expansion and re-detection process is repeated until the visibility rate is ≥0.6 or the maximum number of iterations is reached. Finally, the center coordinates (box center) are calculated using the converged bounding box, and the keypoint coordinates, refined at the sub-pixel level, are output as the keypoint coordinates of the person. This process balances robustness to weakly visible areas with keypoint localization accuracy, ensuring the reliability of person localization and keypoint extraction even under occlusion or compositional shifts.

[0043] Then, based on preset composition rules, the coordinates of the baseline key points of the person are obtained. Next, the coordinates of the key points of the person in the current target frame are calculated, and the deviation of each key point's coordinates is determined. The deviations of all key points are normalized and weighted to obtain the total deviation. If the deviation exceeds a preset threshold, the shooting device is controlled to adjust the shooting angle or position so that the person area is positioned according to the composition rules, thus obtaining the initial composition. Specifically, to achieve the effect of accurately placing the person in the preset composition position, a closed-loop positioning and control scheme based on key point deviation is adopted, resulting in automatic generation of the initial composition without manual fine-tuning. First, based on preset composition rules (such as the rule of thirds, the golden ratio, or a custom template), the set of baseline key point coordinates of the person is calculated according to the image resolution. Then, the detected target frame and the actual coordinates of the key points of the person are read, and the deviation vector is calculated point by point and normalized using the length of the target frame diagonal or the image diagonal to obtain the normalized deviation value for each point. Each key point is assigned an importance weight (the weights sum to 1), and the weighted deviation is calculated as the overall deviation measure. If the offset exceeds the preset threshold, a control command is generated based on the average offset direction and magnitude of the high-weight key points to control the shooting device to adjust the shooting angle or position.

[0044] To avoid erroneous shots caused by unstable user posture or lack of preparation, a keypoint detection algorithm is used to dynamically analyze key points of the eyes and limbs to determine the user's shooting intention. The algorithm identifies the user's posture based on the initial composition and initiates the shot accordingly; the resulting image is used as the original image. Specifically, based on the initial composition, multiple frames of eye and limb keypoints are extracted using the keypoint detection algorithm, and each frame's keypoints are smoothed. The average vertical distance between the eyes is calculated as the eye opening feature, and an effective range for eye opening is defined. When three consecutive frames meet this range, it is considered a gaze-ready state. Simultaneously, the displacement transformation rate of the extracted limb keypoints in the first and third frames is calculated to reflect posture stability. If the average displacement transformation rate of all limb keypoints is less than a set threshold, it is considered a posture-stable state. If both the gaze-ready state and the posture-stable state are met simultaneously, the intention to start shooting is considered, and the shot is initiated. Specifically, the system first extracts the user's eye and limb keypoints from consecutive video frames using a keypoint detection algorithm. The keypoint coordinate sequence for each frame is then temporally smoothed (e.g., by moving average or Kalman filtering) to reduce the impact of jitter and noise. For eye keypoints, the vertical distance between the upper and lower eyelids is calculated and averaged across multiple frames to obtain eye opening / closing characteristics. An effective interval is defined; if the eye opening / closing of three consecutive frames falls within this interval, the user is considered to be in a gaze-ready state. Simultaneously, displacement calculations are performed on limb keypoints across multiple frames. The Euclidean distance between corresponding keypoints in the first and third frames is divided by a reference scale to obtain the displacement transformation rate. The average displacement transformation rate of all keypoints is then calculated. If this value is below a preset threshold, the user's posture is considered stable. The system triggers a shooting command only when both the gaze-ready state and posture stability are simultaneously achieved, using the image at that moment as the final original image. This mechanism enables automatic shooting while ensuring user focus and posture stability, significantly reducing the probability of accidental captures and improving the user experience.

[0045] To effectively address different types of noise, a noise identification and classification method is employed, and differentiated denoising strategies are selected based on noise characteristics. Image preprocessing is performed on the original image, which involves identifying the noise type and applying different processing methods to different types of noise to obtain a preprocessed image.

[0046] Specifically, the original image is first divided into blocks, and the noise quantization features of each block are calculated, including Gaussian noise features, salt-and-pepper noise features, and Poisson noise features. The Gaussian noise features are calculated by determining the mean deviation and high-frequency component variance of the pixel values ​​within the block. The salt-and-pepper noise features are calculated by determining the jump rate of the pixel values ​​within the block. The Poisson noise features are calculated by determining the ratio of the mean to the variance of the pixel values ​​within the block. A noise classification network is constructed based on MobileNetV2, and the above features are input to achieve the probability distribution of output noise. ,in Let be the probability distributions of Gaussian, salt-and-pepper, Poisson, and mixed noise, respectively; if If determined to be Gaussian noise, Gaussian filtering is applied; if Determined to be salt-and-pepper noise, it is processed using median filtering; if If the noise is determined to be Poisson noise, it is first converted to approximately Gaussian noise using Variance Stabilization Transform (VST). Bilateral filtering is applied to the human figure area to preserve edges, while Gaussian filtering is applied to the background area. Then, inverse VST is used to recover the image. If the above conditions are not met, then it belongs to... For mixed noise, the dominant noise type is first identified based on probability, and the corresponding single noise processing method is preferentially adopted; then, the noise residual is generated by the residual learning network to correct the image and obtain the denoised preprocessed image.

[0047] The specific implementation of the step of identifying the dominant noise type based on probability when the noise is mixed, prioritizing the use of the corresponding single noise processing method, and then using a residual learning network to generate noise residuals to correct the image and obtain a denoised preprocessed image is as follows: First, the dominant noise type is identified based on the noise probability output by the noise classification network, and the corresponding single noise processing method is used for processing; noise residuals are generated through a residual learning network, and NFAM is inserted into the bottleneck layer (Bottleneck) of the residual learning network; the feature map of the bottleneck layer output features is then processed. Calculate channel attention weights ,in For global average pooling, For a fully connected network, the feature maps are weighted to obtain weighted feature maps. Then, a character mask is generated based on the character's key point coordinates. The obtained weighted feature map Performing 3×3 convolution and ReLU activation operations yields the residuals in the character region. The same background mask is generated. Perform 5×5 convolution and Tanh activation on the weighted feature map to generate background region residuals. ; obtain the final noise residual The obtained residuals are used to correct the image, resulting in the corrected image. ,in For the corrected image, This is the image after processing using a single noise reduction method. This process enables dual optimization of detail in the subject area and smoothness of the background under complex mixed noise conditions. It avoids blurring of the subject's edges while ensuring a clean and natural background, thus significantly improving image quality and providing a high-quality input image for subsequent intelligent shooting composition and generation processes.

[0048] Finally, a semantic segmentation model is used to segment the preprocessed image into human and background regions, outputting semantic region masks and verifying the intersection-union (IU) ratio of each region. Different optimization algorithms are employed for different semantic regions, and the optimized region masks are fused pixel-level. After global color balancing, the target image is generated. Specifically, a semantic segmentation model is built based on a fully convolutional network, using the preprocessed image as input and outputting binarized initial semantic region masks—human and background masks. During training, a dataset with pixel-level annotations is used, and a combination of cross-entropy loss and Dice loss is employed to improve the segmentation accuracy of small objects and boundaries. After model inference, the IU ratio of the obtained initial masks and manually annotated masks is calculated. A preset IU threshold is used; if the region mask is satisfied, it is retained; otherwise, the parameters in the previous step of optimizing the semantic segmentation model are recalculated until the preset IU threshold is met. Different optimization algorithms are designed to address the visual differences between human and background regions, outputting region masks for both. and The region masks of the two are then fused pixel-wise to obtain a fused mask; for the human figure region, an edge-preserving guided filtering algorithm is used to optimize the pixel values.

[0049] ,in, To optimize the pixel values, For the pixel values ​​of the preprocessed image, The total number of pixels in the window. The average pixel value within the window; the optimized mask for the character area is:

[0050] ,in The initial semantic region mask for the person region output by the semantic segmentation model; mean filtering is applied to the background region to obtain the optimized pixel values. The optimized background area mask is ,in The initial semantic region mask for the background area output by the semantic segmentation model. Finally, global color balancing is performed, and the overall color cast is corrected using the grayscale world algorithm. Contrast and saturation are then fine-tuned according to the target style (through local histogram equalization or global curve adjustment). After completing the above steps, the final target image is generated.

[0051] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any other way. Any person skilled in the art may make changes or modifications to the above-disclosed technical content to create equivalent embodiments for application in other fields. However, any simple modifications, equivalent changes, and modifications made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the protection scope of the present invention.

Claims

1. A method for intelligent image generation based on computer vision, characterized in that, Includes the following steps: S1. Use a shooting device to capture the initial image of the target person, and use a target detection algorithm to identify the position information of the person in the image, including the coordinates of the key points and the center coordinates of the person; calculate the offset between the coordinates of the key points of the person and the composition reference position according to the preset composition rules. If the offset exceeds the preset threshold, control the shooting device to adjust the shooting angle or position so that the person area is in a position that conforms to the composition rules, and obtain the initial composition. S2. The initial composition is analyzed using a key point detection algorithm to identify the subject's posture, determine the shooting intention, and then the shooting operation is performed. The resulting image is used as the original image. S3. Perform image preprocessing on the original image. The image preprocessing involves identifying the noise type of the original image and applying different processing methods to different types of noise to obtain a preprocessed image. In step S3, image preprocessing is performed on the original image. This image preprocessing includes identifying the noise type of the original image and applying different processing methods to different types of noise. Specifically, this includes: S31. First, the original image is divided into blocks, and the noise quantization features of each block are calculated, including Gaussian noise features, salt-and-pepper noise features, and Poisson noise features. The Gaussian noise features are calculated by the mean deviation and high-frequency component variance of the pixel values ​​within the block. The salt-and-pepper noise features are calculated by the jump rate of the pixel values ​​within the block. The Poisson noise features are calculated by the ratio of the mean to the variance of the pixel values ​​within the block. S32. Construct a noise classification network based on MobileNetV2, and input the above-mentioned noise quantization features to realize the probability distribution of output noise. ,in These represent the probability distributions of Gaussian, salt and pepper, Poisson, and mixed noise, respectively. S33, if If determined to be Gaussian noise, Gaussian filtering is applied; if Determined to be salt-and-pepper noise, it is processed using median filtering; if If the noise is determined to be Poisson noise, it is first converted to approximate Gaussian noise using Variance Stabilization Transform (VST). Bilateral filtering is applied to the human figure area to preserve edges, while Gaussian filtering is applied to the background area. Then, inverse VST is used to restore the image. If the noise does not meet the criteria for Gaussian noise, salt-and-pepper noise, or Poisson noise, it is classified as... For mixed noise, the dominant noise type is first identified based on probability, and the corresponding single noise processing method is preferentially applied; then, a noise residual is generated through a residual learning network to correct the image and obtain a denoised preprocessed image. S4. The preprocessed image is segmented into human and background regions using a semantic segmentation model. Semantic region masks are output, and the intersection-union ratio of each region is verified. Different optimization algorithms are used for different semantic regions. The optimized region masks are then fused at the pixel level. After global color balancing, the target image is generated.

2. The method for generating images based on computer vision using intelligent shooting according to claim 1, characterized in that, The implementation of step S1, which involves identifying the location information of a person in an image using a target detection algorithm, including the coordinates of key points and the center coordinates of the person, includes: S11. First, acquire the initial RGB image. The enhanced image is obtained by processing the initial image using histogram equalization. ; S12, Enhanced image The improved YOLOv5 algorithm model is input, which introduces an attention module in the Neck layer, specifically including the extraction of multi-scale feature maps in the backbone network. For feature maps Global average pooling is used to obtain the channel feature vectors. Attention weights are output through a two-layer fully connected network. ,in For the Sigmoid function, They are two fully connected layers; through Weighted enhancement of human-related characteristics in, For channel-by-channel multiplication, and with The fusion yields an enhanced feature map. ; S13, Based on Enhanced Feature Map Generate an initial target bounding box and select multiple feature points in the human image as human key points; if the visibility rate of the human key points detected in the region corresponding to the initial target bounding box is less than 0.6, it is determined to be occlusion, the target bounding box is expanded, and the visibility rate of the human key points is recalculated until the set threshold is reached. S14. Calculate the center coordinates and the coordinates of key points of the person in the target box based on the final target box.

3. The method for generating images based on computer vision according to claim 1, characterized in that, The initial composition in step S1 is achieved as follows: the coordinates of the baseline key points of the person are obtained according to the preset composition rules, and then the coordinates of the key points of the person in the current target frame are calculated to obtain the deviation of the coordinates of each key point; the deviation amount is obtained by normalizing and weighting the deviations of all key points of the person; if the deviation amount exceeds the preset threshold, the shooting device is controlled to adjust the shooting angle or position so that the person area is in a position that conforms to the composition rules, and the initial composition is obtained.

4. The method for generating images based on computer vision using intelligent shooting according to claim 1, characterized in that, Step S2 involves identifying the subject's posture using a key point detection algorithm to determine the shooting intention and perform the shooting operation. The resulting image serves as the original image. S21. Based on the initial composition, extract eye key points and limb key points from multiple frames using a key point detection algorithm, and smooth the key points in each frame. S22. Calculate the average vertical distance between the two eyes as the eye opening and closing feature, set the effective range of eye opening and closing, and record the fixation ready state when the range is satisfied for three consecutive frames. S23. While satisfying the gaze condition, calculate the displacement transformation rate of the extracted limb key points in the first and third frames to reflect the stability of the posture. If the average displacement transformation rate of all limb key points is less than the set threshold, it is recorded as a stable posture state. If both the gaze ready state and the stable posture state are satisfied at the same time, it is considered as the intention to start shooting and shooting is carried out.

5. The method for generating images based on computer vision using intelligent shooting according to claim 1, characterized in that, In step S33, when the noise is mixed noise, the dominant noise type is identified based on probability, and the corresponding single noise processing method is preferentially adopted; then, the noise residual is generated through a residual learning network to correct the image and obtain the denoised preprocessed image. The specific implementation is as follows: S331. First, identify the dominant noise type based on the noise probability output by the noise classification network, and then process it using the corresponding single noise processing method. S332. Generate noisy residuals through a residual learning network, and insert NFAM into the bottleneck layer of the residual learning network, Bottleneck. Feature map of the bottleneck layer output features Calculate channel attention weights ,in For global average pooling, For a fully connected network, the feature maps are weighted to obtain weighted feature maps. ; S333, Then generate a character mask based on the character's key point coordinates. The obtained weighted feature map Performing 3×3 convolution and ReLU activation operations yields the residuals in the character region. The same background mask is generated. Perform 5×5 convolution and Tanh activation on the weighted feature map to generate background region residuals. ; obtain the final noise residual ; S334. Use the obtained residual to correct the image to obtain the corrected image. ,in For the corrected image, This is the image after being processed using the corresponding single noise reduction method.

6. The method for generating images based on computer vision using intelligent shooting according to claim 1, characterized in that, Step S4 uses a semantic segmentation model to segment the preprocessed image into human and background regions, outputs semantic region masks, and verifies the intersection-union ratio (IUU) of each region. For different semantic regions, different optimization algorithms are used to perform pixel-level fusion of the optimized region masks. After global color balancing, the target image is generated. The specific implementation is as follows: S41. Construct a semantic segmentation model based on a fully convolutional network, perform semantic segmentation on the preprocessed image, and output an initial semantic region mask containing the human region and the background region. S42. Calculate the intersection-union ratio (IU) of the initial semantic region mask and the labeled mask, and judge according to the preset IU threshold. If the region mask is satisfied, retain the mask of that region; otherwise, return to the previous step to optimize the semantic segmentation model and recalculate the parameters until the preset IU threshold is satisfied. S43. To address the visual differences between the character area and the background area, design different optimization algorithms and output the region masks for both. and Then, the region masks of the two are fused pixel-level to obtain a fused mask; S44. Finally, after global color balance processing, the target image is generated.

7. The method for generating images based on computer vision using intelligent shooting according to claim 6, characterized in that, In step S43, different optimization algorithms are designed, and the edge-preserving guided filtering algorithm is used to optimize the human figure area to obtain the optimized pixel value: ,in, To optimize the pixel values, For the pixel values ​​of the preprocessed image, The total number of pixels in the window. The average pixel value within the window; the optimized mask for the character area is: ,in The initial semantic region mask for the person region output by the semantic segmentation model; the optimized pixel values ​​are obtained by applying mean filtering to the background region. The optimized background area mask is ,in The initial semantic region mask of the background region output by the semantic segmentation model.