Photographing focusing control method based on machine vision
Through the photography focus control method based on machine vision, deep learning and sparse coding technology are used to detect and optimize focus targets, and a dynamic focus optimization model is constructed, which solves the problem that the existing technology is difficult to achieve high-precision automatic focus in complex scenarios, and achieves an efficient and stable focus effect.
Patent Information
- Application Number
- CN202411952372.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-03-28
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing photography equipment is difficult to achieve high-precision automatic focusing in complex scenes. It is affected by noise and uneven light, and the image quality is low. It is difficult for traditional focusing technology to make full use of multi-dimensional visual information, resulting in unsatisfactory focus effect.
Using a photography focus control method based on machine vision, the target area is detected through image preprocessing, deep learning algorithm, multi-dimensional visual features are extracted through sparse encoding, dynamic focus optimization model and fuzzy logic control algorithm are constructed, and the focus parameters are dynamically adjusted to achieve high-precision focusing.
Achieve high-precision automatic focus in complex scenarios, improve imaging quality, adapt to changes in dynamic scenes, and improve the stability and real-time focus.
Smart Images

Figure CN119729207A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of photographic focus control, and in particular to a photographic focus control method based on machine vision. Background Art
[0002] With the rapid development of photography technology, especially in the field of smart devices and professional photography, autofocus technology has become one of the important factors affecting image quality. Traditional focusing methods mainly rely on focusing technology based on mechanical structures or simple photoelectric focusing technology. However, these methods often fail to meet the needs of high-precision focusing in complex scenes, such as low-light environments, dynamic object capture, and multi-target scenes.
[0003] In recent years, with the advancement of artificial intelligence and machine vision technology, focus control methods based on image analysis have gradually become a research hotspot. Machine vision technology uses computer vision algorithms to analyze image content to guide the focusing action of the lens. Compared with traditional methods, focus control technology based on machine vision can handle a variety of scenes more efficiently and adapt to different shooting needs. However, there are still the following problems: existing photographic equipment is affected by noise, uneven light, etc., and the image quality is low. It is difficult to accurately detect the target area and achieve precise focusing, especially in complex scenes. Focus shift is prone to occur; traditional focusing technology mostly relies on a single feature, and it is difficult to make full use of the target's gradient, edge, texture and other multi-dimensional visual information, resulting in unsatisfactory focusing effects in complex scenes, and it is impossible to dynamically adjust the target priority; existing methods are mostly based on fixed parameters or simple rules for focus adjustment, lacking the ability to optimize focus parameters for different scenes, and cannot give full play to the performance of photographic equipment. Summary of the invention
[0004] To solve the above problems, the present invention provides a photography focus control method based on machine vision, which solves the problem of how to accurately detect the target area in complex scenes through machine vision and artificial intelligence technology, make full use of multi-dimensional visual features, and dynamically optimize focusing parameters, thereby achieving high-precision automatic focusing and improving the focusing ability and imaging quality of photographic equipment in complex scenes.
[0005] To achieve the above object, the technical solution adopted by the present invention is:
[0006] A photography focus control method based on machine vision comprises the following steps:
[0007] S1: Collect multiple frames of image data of the photographic scene through a photographic device, and pre-process the image data, including denoising, grayscale conversion, and edge enhancement;
[0008] S2: Analyze the image data using machine vision technology and deep learning algorithms, automatically detect and identify target areas in the image, mark the focused subject objects, and dynamically adjust the focus priority of the target;
[0009] S3: Based on the identified target area, a sparse coding algorithm is used to extract multi-dimensional visual features, wherein the multi-dimensional visual features include gradient information, edge features, texture complexity and color contrast of the target;
[0010] S4: Based on the multi-dimensional visual features, an optimization algorithm is used to construct a dynamic focusing optimization model to calculate optimal focusing parameters, including focal length, aperture size and focusing speed;
[0011] S5: Use fuzzy logic control algorithm to evaluate the image clarity and the focus effect of the target area in real time, and adjust the focus parameters according to dynamic feedback;
[0012] S6: Controlling the photographic device based on the dynamically adjusted optimal focusing parameters, generating a final imaging result, and outputting a high-resolution focused image or video data.
[0013] Furthermore, the image data includes original color image data, grayscale image data, edge feature image data and depth image data of the target scene.
[0014] Furthermore, the step S2 includes the following steps:
[0015] S21: Based on machine vision technology, the Harris corner detection algorithm is used to extract the initial feature points in the image;
[0016] S22: Using a target detection algorithm based on a convolutional neural network, target recognition is performed on the area where the optimized feature points are located to obtain the category, position and bounding box of the target object in the image;
[0017] S23: Based on the target detection results, the target area is tracked by the optical flow method, and its motion vector and dynamic change characteristics are calculated to ensure the continuity and focus stability of the target in multiple frame images;
[0018] S24: For the identified target area, a weight allocation mechanism is used to calculate the focus priority of each target area according to the feature point density, motion vector and area complexity, and the focus target is dynamically adjusted according to the focus priority.
[0019] Furthermore, the formula of the target detection algorithm is as follows:
[0020]
[0021] Among them, P focus(i) represents the focus priority of target area i, that is, the comprehensive focus demand intensity of the area; D feat (i) represents the distribution of feature points in the target area; M vec (i) represents the intensity of the motion vector, which is used to calculate the dynamic changes of the target area in combination with the optical flow method; C comp (i) represents the regional complexity; C inter (i) represents the texture or edge similarity between the target region and the adjacent region; α, β and γ represent weights; ∈ represents a small positive number.
[0022] Furthermore, the focus priority includes static feature priority, dynamic feature priority, spatial position priority, target category priority, interactive priority and contrast priority.
[0023] Further, the step S4 includes the following steps:
[0024] S41: Based on the multi-dimensional visual features, a dynamic focus optimization model is constructed using a deep reinforcement learning algorithm; the dynamic focus optimization model includes a state space, an action space, and a reward mechanism; the state space represents the clarity of the current image features, the texture complexity of the target area, and the motion vector information; the action space includes operations for adjusting the focal length, aperture size, and focus speed; the reward mechanism is based on a clarity evaluation function, and a dynamic reward value is calculated in combination with the scoring of the focus effect of the target area and the overall imaging quality;
[0025] S42: using historical data and real-time image feedback through a strategy optimization method, iteratively updating the parameters of the dynamic focus optimization model to generate an optimal focus strategy for a specific scenario;
[0026] S43: Calculate the optimal focusing parameters of the current scene in real time using the dynamic focusing optimization model, and generate control instructions adapted to the current shooting environment.
[0027] Furthermore, the formula of the dynamic focusing optimization model is as follows:
[0028]
[0029] Among them, L(π θ ) indicates the best dynamic focusing effect; Represents the strategy π θ The statistical expectation of the generated trajectory τ; s t represents the observation value of the photographic device at time step t; a t represents the control operation performed by the photographic device at time step t; T represents the total number of control cycles during the dynamic focusing process; R(s t , a t ) represents the state s at evaluation time step t tand action a t The focusing effect of γ t represents the discount factor; C(s t , a t ) represents the adjustment parameter a t resource consumption or hardware limitations; t represents the cost weight coefficient; Q i (s t , a t ) represents the action a at evaluation time step t t The optimization effect on feature i; w i Represents the characteristic Q i The weight of .
[0030] Furthermore, the step S5 includes the following steps:
[0031] S51: Based on the fuzzy logic rule base and membership function, the image clarity is evaluated using the indicators of contrast, edge sharpness and texture details of the target area to generate the clarity level of the target area;
[0032] S52: calculating the deviation between the current imaging clarity of the target area and the ideal clarity target through a focusing effect evaluation function, and analyzing the applicability and improvement direction of the current focusing parameters;
[0033] S53: Based on the evaluation results, the focal length, aperture size and focusing speed are dynamically optimized using fuzzy logic control rules, and the final optimized focusing parameters are generated.
[0034] Furthermore, in step S6, multimodal imaging technology is used to combine infrared, ultrasonic and visible light sensor data to fuse multimodal information to generate a final focused imaging result.
[0035] The beneficial effects of the present invention are:
[0036] The present invention effectively improves the quality of image data through image preprocessing, including denoising, graying and edge enhancement, and provides a reliable foundation for subsequent target recognition and focus optimization. Combining machine vision technology and deep learning algorithm, accurate detection and recognition of image target areas are achieved, and the priority of focusing subjects can be dynamically marked and adjusted to ensure accurate focus on key targets. Multi-dimensional visual features such as gradient information, edge features, texture complexity and color contrast of the target are extracted through sparse coding algorithm, and the significance and complexity of the target object are fully considered. Combined with the dynamic focus optimization model constructed based on the optimization algorithm, the optimal focus parameters including focal length, aperture size and focus speed can be calculated to ensure that the imaging device can still obtain high-quality focusing effect in complex scenes. The fuzzy logic control algorithm evaluates the imaging clarity and the focusing effect of the target area in real time, constructs a dynamic feedback mechanism, and adjusts the focus parameters in real time according to the evaluation results. This closed-loop control mode can adapt to environmental changes (such as light, motion, etc.), improve the stability and real-time performance of focus, and is particularly suitable for shooting needs of dynamic scenes. Finally, the photographic equipment is controlled by dynamically adjusted optimal focus parameters to generate high-resolution focused images or video data. This method combines multi-frame data processing, visual feature optimization and real-time control technology, which not only significantly improves the imaging quality, but also improves the user's shooting experience, especially in dynamic or complex shooting scenes. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 It is a flow chart of a photography focus control method based on machine vision of the present invention.
[0038] Figure 2 It is a flowchart of step S2 provided in one embodiment of the present invention.
[0039] Figure 3 It is a flowchart diagram of step S4 provided in one embodiment of the present invention. DETAILED DESCRIPTION
[0040] See also Figure 1-3 As shown, the present invention relates to a photography focus control method based on machine vision.
[0041] Example
[0042] A photography focus control method based on machine vision comprises the following steps:
[0043] S1: Collect multiple frames of image data of a photographic scene through a photographic device, and preprocess the image data, including denoising, grayscale and edge enhancement; the image data includes original color image data, grayscale image data, edge feature image data and depth image data of the target scene.
[0044] Specifically, multiple frames of images of the target scene are collected by high-performance photographic equipment (such as a digital SLR camera or a smart phone). The collected images include color original image data, grayscale image data, edge feature image data, and depth image data. The depth image is collected by an infrared sensor to obtain the three-dimensional structure information of the target scene. In dynamic scenes (such as moving objects), multiple frames of images are continuously collected at a rate of 30 frames per second to ensure that clear details are captured.
[0045] Image preprocessing includes the following:
[0046] Denoising: Use Gaussian filtering and median filtering to remove noise from the image and enhance image quality.
[0047] Grayscale: Convert the original color image data into a grayscale image to reduce computational complexity and highlight the brightness information of the target area.
[0048] Edge enhancement: The Canny edge detection algorithm is used to enhance the edge features of the target scene and highlight the contour information of the significant area for subsequent processing.
[0049] S2: Analyze the image data using machine vision technology and deep learning algorithms, automatically detect and identify target areas in the image, mark the focused subject objects, and dynamically adjust the focus priority of the target;
[0050] Wherein, the step S2 comprises the following steps:
[0051] S21: Based on machine vision technology, the Harris corner detection algorithm is used to extract the initial feature points in the image;
[0052] S22: Using a target detection algorithm based on a convolutional neural network, target recognition is performed on the area where the optimized feature points are located to obtain the category, position and bounding box of the target object in the image;
[0053] Specifically, a pre-trained target detection model is loaded using a mature deep learning framework. These models have the ability to recognize common targets (such as people, animals, and vehicles). According to the specific scene requirements, the model can be fine-tuned to increase the recognition ability of custom target categories. The area where the feature points extracted in step 21 are located is divided into candidate regions (ROIs) as the input of target detection, which reduces the detection range and improves processing efficiency. For sparsely distributed feature points, the detection integrity is ensured by expanding the boundaries of the region of interest. The candidate regions are standardized, such as adjusting the image size, normalizing pixel values, and performing data enhancement (such as random rotation and cropping). The candidate regions are sent to the target detection model through batch processing to increase the processing speed.
[0054] The deep learning model scans and extracts features from the input area pixel by pixel, and generates a multi-scale feature map through the convolution layer. Based on the feature map, the model outputs the category label of the target (such as "person", "vehicle", "tree") and the classification confidence. If the classification confidence is lower than the set threshold (such as 50%), the system will filter out these targets to avoid misidentification. The detection model generates a bounding box for the identified target, which includes position and size information (such as the upper left corner coordinates and width and height). Using the non-maximum suppression (NMS) algorithm, the overlapping bounding boxes are merged and only the boxes with the highest confidence are retained. According to the overlapping relationship between the bounding box and the Harris feature point, the extracted feature points are classified into the corresponding target area. For each target area, the system generates a target data structure containing the category label, the bounding box location, and the distribution information of the feature points in the area. The detection results are superimposed on the image to visualize the category label, confidence, and bounding box of each target. If the detection result does not match the actual target of the scene, the system triggers re-detection or enables the backup model to improve accuracy.
[0055] S23: Based on the target detection results, the target area is tracked by the optical flow method, and its motion vector and dynamic change characteristics are calculated to ensure the continuity and focus stability of the target in multiple frame images;
[0056] Specifically, according to the bounding box result of step S22, a unique identifier (ID) is generated for each target area. The motion state information of the target is initialized, including the current position, speed and direction.
[0057] The optical flow method is used to track the feature points in each target area. The image is divided into different resolution levels, the approximate motion trajectory is tracked at the low-resolution level, and the precise adjustment is made at the high-resolution level. The displacement of the feature points between the current frame and the next frame is calculated to obtain the motion vector. If some feature points fail to be tracked, the newly detected feature points are dynamically replaced to ensure the continuity of tracking.
[0058] Update the center position of the target bounding box based on the average displacement of feature points calculated by the optical flow method. Dynamically adjust the target bounding box to ensure that it always contains most of the feature points. Calculate the speed and direction of movement based on the change in the target position to determine whether the target is moving quickly or stationary. Reduce jitter and error through trajectory smoothing algorithms (such as Kalman filtering) to improve the accuracy of motion prediction. In multi-target scenarios, perform optical flow tracking and dynamic characteristic analysis independently for each target area. For intersecting or overlapping target areas, use region segmentation algorithms (such as GrabCut) to re-divide the boundaries to avoid tracking confusion. When the target is blocked, out of view, or feature points are completely lost, the system triggers the re-detection process. Estimate the next position of the target through motion prediction methods (such as linear extrapolation or deep learning prediction models) and restart tracking. Perform time series analysis on the target's motion characteristics to extract dynamic change characteristics: the target's acceleration changes; whether the trajectory is regular (such as straight line motion or curved motion); whether the target has abnormal behavior (such as sudden stop or rapid turn).
[0059] S24: For the identified target area, a weight allocation mechanism is used to calculate the focus priority of each target area according to the feature point density, motion vector and area complexity, and the focus target is dynamically adjusted according to the focus priority; the focus priority includes static feature priority, dynamic feature priority, spatial position priority, target category priority, interactive priority and contrast priority.
[0060] In one embodiment, the focus priority includes the following types:
[0061] Static feature priority: Determine the priority based on the static visual features of the target area, including feature point density, edge clarity, texture complexity, and color contrast.
[0062] Dynamic characteristic priority: Combined with the motion characteristics of the target area, such as the intensity and change amplitude of the motion vector calculated by the optical flow method, dynamic objects or fast-moving targets have higher priority.
[0063] Spatial position priority: Based on the location distribution of the target area in the image, the central area or predefined focus area (such as the location of the face or specific subject) has a higher priority.
[0064] Target category priority: Different priorities are assigned according to the target categories (such as people, faces, vehicles, or other important objects) recognized by the deep learning model, and targets in key categories are focused on first.
[0065] Interactive Priority: Dynamically prioritize the user’s area of interest through user input or intelligent interaction with the camera device, so that it is given priority during the focusing process.
[0066] Contrast priority: Based on the difference between the target area and the adjacent areas (such as the difference in texture, color or edge features), the area with more significant difference has a higher priority.
[0067] In one embodiment, the focus priorities are sorted in descending order according to the following rules:
[0068] Target category priority: Target areas that match preset high-priority categories (such as people, faces, or user-specified objects) have the highest priority;
[0069] Priority of regional motion significance: target areas with significant dynamic changes (calculated based on motion vector strength) are prioritized over static areas to ensure clear capture of dynamic targets;
[0070] Feature point density priority: target areas with higher feature point density (such as areas with strong edge characteristics and rich textures) have higher priority than areas with sparse features;
[0071] Region complexity priority: Regions with higher texture complexity, edge complexity, and color contrast are prioritized over simple regions to optimize detail clarity;
[0072] Adjacent region difference priority: target regions with lower similarity to adjacent regions (such as regions with obvious edges or significant differences in texture features) are given higher priority than similar regions to highlight the main target;
[0073] Other areas: Background areas without significant features have the lowest priority and are optimized only when the previous priority targets have been focused.
[0074] Furthermore, the formula of the target detection algorithm is as follows:
[0075]
[0076] Among them, P focus( i) represents the focus priority of target area i, that is, the comprehensive focus demand intensity of the area; D feat (i) represents the distribution of feature points in the target area; M vec (i) represents the intensity of the motion vector, which is used to calculate the dynamic changes of the target area in combination with the optical flow method; C comp (i) represents the regional complexity, reflecting the richness of the texture and edge features of the target area; C inter (i) represents the texture or edge similarity between the target area and the adjacent area. The higher the value, the more difficult it is to distinguish the target from the background. α, β, and γ represent weights, which are used to balance the weights of feature point density, motion vector, and regional complexity in priority calculation. ∈ represents a small positive number, which is used to avoid zero value errors in square root calculation.
[0077] S3: Based on the identified target area, a sparse coding algorithm is used to extract multi-dimensional visual features, wherein the multi-dimensional visual features include gradient information, edge features, texture complexity and color contrast of the target;
[0078] It should be noted that in the detected target area, a sparse coding algorithm is applied to extract the multi-dimensional visual features of the image. Sparse coding improves the feature expression capability by finding a small number of feature vectors that can maximize the compression and highlight the target features.
[0079] Multi-dimensional visual feature extraction is as follows:
[0080] Gradient information: Use the Sobel operator to calculate the gradient direction and magnitude of the image to obtain the contour intensity information of the target area.
[0081] Edge features: Extract edge distribution information detected by Canny to identify the shape and outline of the target.
[0082] Texture complexity: Use local binary pattern (LBP) or wavelet transform method to analyze the texture characteristics of the target.
[0083] Color Contrast: Calculate the color contrast between the target area and the background in RGB space or Lab color space.
[0084] S4: Based on the multi-dimensional visual features, an optimization algorithm is used to construct a dynamic focusing optimization model to calculate optimal focusing parameters, including focal length, aperture size and focusing speed;
[0085] Wherein, the step S4 comprises the following steps:
[0086] S41: Based on the multi-dimensional visual features, a dynamic focus optimization model is constructed using a deep reinforcement learning algorithm; the dynamic focus optimization model includes a state space, an action space, and a reward mechanism; the state space represents the clarity of the current image features, the texture complexity of the target area, and the motion vector information; the action space includes operations for adjusting the focal length, aperture size, and focus speed; the reward mechanism is based on a clarity evaluation function, and a dynamic reward value is calculated in combination with the scoring of the focus effect of the target area and the overall imaging quality;
[0087] S42: using historical data and real-time image feedback through a strategy optimization method, iteratively updating the parameters of the dynamic focus optimization model to generate an optimal focus strategy for a specific scenario;
[0088] Specifically, the policy network and value network weights of the model are adjusted through the policy optimization method of deep reinforcement learning (such as DDPG or SAC). The model parameters are updated using historical data (such as samples shot in various scenes) and real-time feedback to ensure that the model adapts to various shooting conditions. Samples containing different scenes (such as motion scenes, static scenes, and low-light scenes) are extracted from previously shot data sets. Various focus parameter adjustments are simulated, and the correspondence between parameter adjustments and reward values is recorded as model training data. In the actual shooting process, the model continuously updates parameters based on real-time image data: the reward function is updated by instantly scoring the current shooting effect; the action selection strategy of the model is adjusted to make it more suitable for the current scene. During the training process, the strategy is verified to converge by monitoring the changes in the model reward value. The actual effect of the model is tested in different scenarios, such as the improvement of target clarity in dynamic scenes and the suppression of noise in low-light scenes.
[0089] S43: Calculate the optimal focusing parameters of the current scene in real time using the dynamic focusing optimization model, and generate control instructions adapted to the current shooting environment.
[0090] Specifically, in real-time shooting, the model receives multi-dimensional visual features of the current scene, including the clarity of the target area, texture complexity, and motion vectors. These features are mapped to specific values in the state space as model input. The dynamic focus optimization model selects the optimal action (adjusting focal length, aperture size, and focusing speed) based on the current state. According to the optimal action output by the model, specific control instructions are generated as follows:
[0091] Adjust the focal length: The position of the lens group is precisely controlled by a stepper motor to achieve focusing.
[0092] Adjust the aperture size: Set the appropriate opening degree through the aperture servo system.
[0093] Adjust focus speed: Switch focus mode to fast focus or precise focus.
[0094] During continuous shooting, the model monitors the shooting effect in real time and adjusts the focus parameters instantly based on image feedback. For example, when the target moves quickly, the focus speed is adjusted first to ensure that the target remains clear during movement. In complex scenes (such as low light, dynamic targets, multiple targets, etc.), the model comprehensively considers the scene characteristics and outputs the optimal parameters that take into account both clarity and imaging quality.
[0095] Furthermore, the formula of the dynamic focusing optimization model is as follows:
[0096]
[0097] Among them, L(π θ ) represents the best dynamic focusing effect; statistical expectation; st represents the observation value of the photographic device at time step t; a t Indicates that at time step t, the Represents the strategy π θ The generated trajectory τ represents the control operations performed by the shadow device; T represents the total number of control cycles during the dynamic focusing process; R(s t , a t ) represents the state s at evaluation time step t t and action a t The focusing effect of γ t represents the discount factor; C(s t , a t ) represents the adjustment parameter a t resource consumption or hardware limitations; t represents the cost weight coefficient; Q i (s t , a t ) represents the action a at evaluation time step t t The optimization effect on feature i; w i Represents the characteristic Q i The weight reflects the importance of each visual feature to the optimization target.
[0098] S5: Use fuzzy logic control algorithm to evaluate the image clarity and the focus effect of the target area in real time, and adjust the focus parameters according to dynamic feedback;
[0099] Wherein, the step S5 comprises the following steps:
[0100] S51: Based on the fuzzy logic rule base and membership function, the image clarity is evaluated using the indicators of contrast, edge sharpness and texture details of the target area to generate the clarity level of the target area;
[0101] S52: calculating the deviation between the current imaging clarity of the target area and the ideal clarity target through a focusing effect evaluation function, and analyzing the applicability and improvement direction of the current focusing parameters;
[0102] Specifically, the deviation value between the current imaging clarity of the target area and the ideal clarity target is calculated: the ideal clarity target is defined by user requirements or preset values (such as "excellent"); the current clarity level is given by the fuzzy evaluation result of S51. The deviation value is used to quantify the difference in imaging effect. The larger the value, the more the current focusing effect deviates from the ideal state.
[0103] Based on the current clarity level and deviation value, evaluate the applicability of the existing focus parameters (focal length, aperture size and focus speed): if the deviation value is small, it means that the current parameters basically meet the imaging requirements; if the deviation value is large, the focus parameters need to be readjusted.
[0104] By analyzing the source of the deviation value (such as insufficient contrast or low edge sharpness), determine the direction of improvement of the current focus parameters:
[0105] Insufficient contrast: You may need to increase the aperture size or adjust the exposure time.
[0106] Edge sharpness is low: You may need to adjust the focus or reduce the focus speed.
[0107] Low texture detail: May need to increase resolution or improve lighting conditions.
[0108] S53: Based on the evaluation results, the focal length, aperture size and focusing speed are dynamically optimized using fuzzy logic control rules, and the final optimized focusing parameters are generated.
[0109] S6: Based on the dynamically adjusted optimal focusing parameters, the photographic equipment is controlled to generate the final imaging result, and a high-resolution focused image or video data is output. In step S6, the multimodal imaging technology is used to combine the infrared, ultrasonic and visible light sensor data to fuse the multimodal information to generate the final focused imaging result.
[0110] It should be noted that the optimal focusing parameters (focal length, aperture size, focusing speed) calculated in step S4 are sent to the control module of the photographic device. Use an autofocus system (such as phase detection or contrast detection autofocus) to adjust the lens focal length in real time. Drive the lens group through a stepper motor to accurately adjust the focal length to focus on the target area. Use the aperture servo system to accurately adjust the aperture opening and closing size to balance the clarity and depth of field effect. Dynamically set the focus speed (fast focus or slow precision focus) to ensure the stability and accuracy of real-time focusing.
[0111] In dynamic scenes (such as the movement of the target object or the camera device), when shooting multiple frames continuously: Use motion prediction algorithms (such as Kalman filters) to predict the next position of the target and adjust the focus in advance. Combine gyroscope and accelerometer data to compensate for the jitter of the camera device to ensure accurate focus. Low light environment: Automatically increase ISO sensitivity and enable infrared auxiliary focus. High dynamic range scene: Adjust the exposure time according to the scene lighting distribution to ensure that both dark details and highlights can be clearly captured.
[0112] Multimodal data acquisition is as follows:
[0113] Infrared data: Infrared sensors capture thermal images of target scenes and are used to identify targets that are difficult to capture in low light or bright light.
[0114] Ultrasonic data: Use ultrasonic sensors to measure the distance between the target and the device to obtain high-precision depth information.
[0115] Visible light data: Use traditional optical sensors to capture color images of the scene, providing high-resolution texture information for the final image.
[0116] Use deep learning models (such as fusion convolutional neural networks, Fusion-CNN) to jointly analyze multimodal data: Align infrared images and visible light images at the pixel level, and enhance image details through feature weighting methods. Fuse depth data with color images to generate 3D reconstruction information of the scene for accurate target positioning. Dynamically adjust modality priority based on scene characteristics. For example: enhance the weight of infrared modality and weaken visible light modality in low-light environments; enhance visible light details and weaken the influence of depth modality in static scenes.
[0117] Use multi-frame super-resolution reconstruction algorithms (such as EDSR) to increase the output image resolution to 4K or higher. Perform noise suppression in the time and frequency domains on the fused image to improve the purity of the image. Adjust the contrast and saturation of the image through a color space mapping algorithm (such as Lab color space) to make the target area more prominent. For dynamic scenes, generate a high frame rate video stream (such as 60fps 4K video) by combining the best focus parameters frame by frame. Use motion smoothing technology (such as optical flow method) to eliminate the picture jump or jitter caused by focus adjustment in the video. Provide a variety of output formats (JPEG, TIFF, RAW, MP4) for users to choose. Store the processed image or video data in the device's internal memory or upload it to the cloud. Display the imaging effect through the device's real-time viewfinder or screen. If the target focus effect does not meet expectations, the focus area can be adjusted through the touch screen or voice command, and the device will respond immediately and refocus.
[0118] In summary, the present invention utilizes machine vision and deep learning technology to realize automatic detection of target areas, dynamic adjustment of focus priority, and optimization of focus parameters, thereby reducing manual operations and improving photography efficiency and accuracy. Infrared, ultrasonic, and visible light data are combined to generate clearer and more detailed imaging results, which have significant advantages, especially in low light, complex lighting, or dynamic scenes. Through optical flow tracking, dynamic focus optimization models, and fuzzy logic control, focus parameters can be adjusted in real time to ensure the continuity and clarity of the target area in multiple frames of images and adapt to dynamic scene changes. The focus priority is calculated based on multidimensional features such as the target category, motion characteristics, and spatial position, and a multidimensional weight model is used to ensure that key targets are focused on first, thereby improving the pertinence and effectiveness of imaging.
[0119] The present invention generates high-resolution, low-noise, and high-contrast imaging results by extracting multi-dimensional visual features through sparse coding, as well as deep learning-driven super-resolution algorithms and color adjustment techniques.
[0120] Deep reinforcement learning is introduced to build a dynamic focus optimization model. Through continuous learning and adjustment based on historical data and real-time feedback, the device can adapt to a variety of scenarios, such as dynamic target tracking, complex background recognition, and low-light shooting. It supports dynamic adjustment of the focus area through touch screen, voice and other interactive methods, responds to user needs in real time, and improves the convenience and practicality of the device. Harris corner detection and convolutional neural network are used to identify the target area in the image, and non-maximum suppression and bounding box optimization technology are combined to ensure the accuracy and robustness of target recognition. Through optical flow method and motion prediction algorithm, the device can cope with fast-moving targets or violent motion scenes and maintain clear imaging of the target area.
[0121] The present invention adopts dynamic weight allocation and cost weight optimization technology to balance focus accuracy and resource consumption, which helps to extend the service life of the device and battery life. From low-light environments to dynamic targets, from single targets to multi-target tracking, this method can generate high-quality imaging effects with significantly improved adaptability. Through multi-frame super-resolution reconstruction algorithms and motion smoothing technology, it supports 4K or higher resolution images and high frame rate video output, providing a guarantee for professional photography needs.
[0122] The above implementation modes are merely descriptions of the preferred implementation modes of the present invention, and are not intended to limit the scope of the present invention. Without departing from the design spirit of the present invention, various modifications and improvements made to the technical solutions of the present invention by ordinary engineering and technical personnel in the field shall fall within the protection scope determined by the claims of the present invention.
Claims
1. A photography focus control method based on machine vision, characterized in that: The following steps are involved: S1: Collect multiple frames of image data of the photographic scene through a photographic device, and pre-process the image data, including denoising, grayscale conversion, and edge enhancement; S2: Analyze the image data using machine vision technology and deep learning algorithms, automatically detect and identify target areas in the image, mark the focused subject objects, and dynamically adjust the focus priority of the target; S3: Based on the identified target area, a sparse coding algorithm is used to extract multi-dimensional visual features, wherein the multi-dimensional visual features include gradient information, edge features, texture complexity and color contrast of the target; S4: Based on the multi-dimensional visual features, an optimization algorithm is used to construct a dynamic focusing optimization model to calculate optimal focusing parameters, including focal length, aperture size and focusing speed; S5: Use fuzzy logic control algorithm to evaluate the image clarity and the focus effect of the target area in real time, and adjust the focus parameters according to dynamic feedback; S6: Controlling the photographic device based on the dynamically adjusted optimal focusing parameters, generating a final imaging result, and outputting a high-resolution focused image or video data.
2. The photography focus control method based on machine vision according to claim 1, characterized in that: The image data includes original color image data, grayscale image data, edge feature image data and depth image data of the target scene.
3. The photography focus control method based on machine vision according to claim 1, characterized in that: The step S2 comprises the following steps: S21: Based on machine vision technology, the Harris corner detection algorithm is used to extract the initial feature points in the image; S22: Using a target detection algorithm based on a convolutional neural network, target recognition is performed on the area where the optimized feature points are located to obtain the category, position and bounding box of the target object in the image; S23: Based on the target detection results, the target area is tracked by the optical flow method, and its motion vector and dynamic change characteristics are calculated to ensure the continuity and focus stability of the target in multiple frame images; S24: For the identified target area, a focus priority of each target area is calculated using a weight allocation mechanism according to the density of feature points, motion vectors and area complexity, and the focus target is dynamically adjusted according to the focus priority.
4. The photography focus control method based on machine vision according to claim 3, characterized in that: The formula of the target detection algorithm is as follows: Among them, P focus (i) represents the focus priority of target area i, that is, the comprehensive focus demand intensity of the area; D feat (i) represents the distribution of feature points in the target area; M vec (i) represents the intensity of the motion vector, which is used to calculate the dynamic changes of the target area in combination with the optical flow method; C comp (i) represents the regional complexity; C inter (i) represents the texture or edge similarity between the target region and the adjacent region; α, β and γ represent weights; ∈ represents a small positive number.
5. The photography focus control method based on machine vision according to claim 3, characterized in that: The focus priorities include static feature priority, dynamic feature priority, spatial position priority, target category priority, interactive priority and contrast priority.
6. The photography focus control method based on machine vision according to claim 1, characterized in that: The step S4 comprises the following steps: S41: Based on the multi-dimensional visual features, a dynamic focus optimization model is constructed using a deep reinforcement learning algorithm; the dynamic focus optimization model includes a state space, an action space, and a reward mechanism; the state space represents the clarity of the current image features, the texture complexity of the target area, and the motion vector information; the action space includes operations for adjusting the focal length, aperture size, and focus speed; the reward mechanism is based on a clarity evaluation function, and a dynamic reward value is calculated in combination with the scoring of the focus effect of the target area and the overall imaging quality; S42: using historical data and real-time image feedback through a strategy optimization method, iteratively updating the parameters of the dynamic focus optimization model to generate an optimal focus strategy for a specific scenario; S43: Calculate the optimal focusing parameters of the current scene in real time using the dynamic focusing optimization model, and generate control instructions adapted to the current shooting environment.
7. The photography focus control method based on machine vision according to claim 6, characterized in that: The formula of the dynamic focusing optimization model is as follows: Among them, L(π θ ) indicates the best dynamic focusing effect; Represents the strategy π θ The statistical expectation of the generated trajectory τ; s t represents the observation value of the photographic device at time step t; a t represents the control operation performed by the photographic device at time step t; T represents the total number of control cycles during the dynamic focusing process; R(s t , a t ) represents the state s at evaluation time step t t and action a t The focusing effect of γ t represents the discount factor; C(s t , a t ) represents the adjustment parameter a t resource consumption or hardware limitations; t represents the cost weight coefficient; Q i (s t , a t ) represents the action a at evaluation time step t t The optimization effect on feature i; w i Represents the characteristic Q i The weight of .
8. The photography focus control method based on machine vision according to claim 1, characterized in that: The step S5 comprises the following steps: S51: Based on the fuzzy logic rule base and membership function, the image clarity is evaluated using the indicators of contrast, edge sharpness and texture details of the target area to generate the clarity level of the target area; S52: calculating the deviation between the current imaging clarity of the target area and the ideal clarity target through a focusing effect evaluation function, and analyzing the applicability and improvement direction of the current focusing parameters; S53: Based on the evaluation results, the focal length, aperture size and focusing speed are dynamically optimized using fuzzy logic control rules, and the final optimized focusing parameters are generated.
9. The photography focus control method based on machine vision according to claim 1, characterized in that: In step S6, multimodal imaging technology is used to combine infrared, ultrasonic and visible light sensor data to fuse multimodal information to generate a final focused imaging result.
Citation Information
Cited By
Acquisition method and system based on camera motion data set
CN119941796A
A method and system for collecting camera motion datasets
CN119941796B
Imaging display method and system for head-mounted display equipment
CN120161953A
Multi-camera automatic identification USB camera device
CN120339564A
Control method and system for monitoring camera
CN120343399A