Lens focusing method based on network camera

By performing frame image processing on the webcam video stream and calculating the focal length using the image analysis algorithm, automatic focus is achieved, which solves the problem of poor consistency of manual focus and improves the accuracy and system stability of lens focus.

CN119031244APending Publication Date: 2024-11-26JIANGSU ANVIZ INTELLIGENT SECURITY CO LTD

Patent Information

Application Number
CN202411039076.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-30
Publication Date
2024-11-26

AI Technical Summary

Technical Problem

In the prior art, the artificial focus adjustment method has poor focus consistency due to human factors, and there is a lack of efficient automation solutions.

Method used

By performing video streaming on the target area captured by the webcam, frame images are obtained frame by frame, feature values ​​are extracted, focal length is calculated using image analysis algorithm, and compared with standard focal length, the camera is automatically adjusted to improve focus accuracy.

Benefits of technology

It improves the accuracy of lens focus and the stable operation of the camera system, reduces artificial misjudgment, and enhances focus efficiency and consistency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119031244A_ABST
    Figure CN119031244A_ABST
Patent Text Reader

Abstract

The invention provides a lens focusing method based on a network camera, and belongs to the technical field of lens focusing. The method comprises the following steps: step 1, shooting a target area through a target camera to obtain an original video stream; 2, preprocessing to obtain a first video stream, processing the first video stream frame by frame, sequencing according to time logic, and configuring a sequence constant label for each frame to obtain a frame image column; 3, extracting image parameters and key features of each reference image frame of the frame image column; step 4, according to the key features and by using an image analysis algorithm, obtaining a shooting focal length of the target camera of each reference image frame to the corresponding reference image frame; and 5, comparing the shooting focal length with the standard focal length of the corresponding reference image frame to judge whether the focal length of the corresponding reference image frame is qualified or not, obtaining the focal length condition of the target camera according to the qualification condition of all the reference image frames, and focusing the target camera. The focusing precision of the lens is improved, and high efficiency and universality are achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of lens focusing, and in particular to a lens focusing method based on a network camera. Background Art

[0002] At present, with the rapid development of modern technology, camera detection and monitoring technology is widely used in various industries. In particular, due to the development of big data, network cameras are more convenient and quick to use. In the existing technology, manual focusing is usually adopted, that is, the operator manually adjusts the lens, and then observes the image on the display screen to judge whether the focusing result is correct. In addition, there are some automated focusing devices that can automatically focus the lens and prompt the focusing result through indicator lights or voice. However, there are some problems with the existing manual focusing method. First, due to the influence of human factors, the focusing result may vary from person to person, resulting in poor consistency of focusing.

[0003] Therefore, the present invention proposes a lens focusing method based on a network camera. Summary of the invention

[0004] The present invention provides a lens focusing method based on a network camera, which is used to obtain an original video by shooting a target area with a camera to be focused. The original video is processed frame by frame, and the camera focal length corresponding to the current frame is obtained according to an algorithm after obtaining a feature value of a specific frame image, and the target camera is focused after comparing it with the standard focal length. The focusing accuracy is improved and the stable operation of the camera system is guaranteed.

[0005] On the one hand, the present invention provides a lens focusing method based on a network camera, comprising: Step 1: Use the target camera to shoot the target area and obtain the original video stream of the target area; Step 2: pre-processing the original video stream to obtain a first video stream, processing the first video stream frame by frame to obtain a frame image sequence, sorting the frame image sequence according to time logic and configuring a sequence constant label for each frame; Step 3: Based on the standard extraction of numbers and sequential constant labels, multiple reference image frames of the frame image column are extracted for image processing, image parameters of each reference image frame are obtained, and key features are obtained; Step 4: Obtain the shooting focal length of the target camera of each reference image frame to the corresponding reference image frame according to the key features and using the image analysis algorithm; Step 5: Compare the shooting focal length with the standard focal length of the corresponding reference image frame to determine whether the focal length of the corresponding reference image frame is qualified, obtain the focal length of the target camera based on the qualified status of all reference image frames, and adjust the focus of the target camera based on the focal length status.

[0006] On the other hand, the target area is photographed by the target camera to obtain the original video stream of the target area, including: Determine the relative position of the target area to be photographed and the target camera, obtain relative configuration parameters, and complete the configuration of the target camera; After the configuration is completed, start the target camera and initialize the target camera according to the pre-focus parameters of the target camera; The target area is started to be photographed to obtain an original video stream of the target area.

[0007] On the other hand, preprocessing the original video stream to obtain a first video stream includes: Cut out the useless parts of the original video stream and convert it into a video stream according to a preset standard format; Processing the primary video stream according to a preset first resolution to obtain a secondary video stream; The secondary video stream is corrected and stabilized to obtain the first video stream.

[0008] On the other hand, the first video stream is processed frame by frame to obtain a frame image sequence, including: Loading the first video stream into a preset video processing library, obtaining video parameters of the first video stream, determining a predetermined number of frames according to a frame number-video duration-video rate mapping table, and processing the first video stream frame by frame according to the predetermined number of frames to obtain a plurality of images; The multiple images are time-logically sorted according to the timestamp of each frame of the first video stream, and each frame is configured with a unique sequence constant label according to the sorted position; Gets a sequence of frame images consisting of frame images with sequential constant labels.

[0009] On the other hand, based on the standard extraction number and the order constant label, multiple reference image frames of the frame image sequence are extracted, including: Processing all original frame images in the frame image sequence to enhance contrast and brightness according to standard light parameters to obtain a brightness contrast image; Get the color parameters of any brightness contrast image and get the luminous flux: ;in, Indicates the luminous flux of the current brightness contrast image, K represents the proportional constant of the luminous flux, Represents the total spectral radiation intensity function of the current brightness contrast image, n means that the current brightness contrast image has n spectral colors, represents the color temperature function, represents the i-th spectral color, represents the light intensity coefficient of the i-th spectral color, represents the initial light intensity coefficient, e represents the preset lens sensitivity, Indicates the preset initial spectrum color; According to the standard classification range of luminous flux, the original frame image corresponding to the brightness contrast image is classified into the light perception category of the corresponding interval; Based on the standard extraction number and the sequential constant label and in combination with the number of images in each light sensitivity category, the extraction amount based on each light sensitivity category is determined, and a corresponding number of reference image frames are extracted in the corresponding light sensitivity category.

[0010] On the other hand, the reference image frames are processed to obtain key features and image parameters of each reference image frame, including: Extracting image parameters of any reference image frame, and performing grayscale conversion processing on the reference image frame to obtain a first grayscale image, iterating the Gaussian blur operation m times on the first grayscale image to generate a set of Gaussian image pyramids with a dimension of m; According to the Gaussian scale space algorithm, the Gaussian difference of the Gaussian images of two adjacent layers is calculated. According to the number of layers where the maximum Gaussian difference occurs, the pixel point with the maximum absolute value of the gradient deviation of the corresponding layer is found by grayscale gradient processing, and it is determined as the feature key point. The feature key points and the surrounding pixel points are compared with each other in different directions to obtain feature points of the feature key points and the surrounding pixel points, and the key features of the reference image frame are jointly constructed based on the feature points.

[0011] On the other hand, the focal length of the target camera of each reference image frame for the corresponding reference image frame is obtained according to the key features and by using the image analysis algorithm, including: Map any reference image frame to the camera coordinate system, and calculate the image distance based on the key features of the reference image frame: ;in, represents the image distance of the reference image frame, represents the image distance conversion function, represents the feature point resolution of all camera coordinate systems of the reference image frame, represents the horizontal translation function, represents the translation function in the vertical direction, represents the preset translation vector of the jth feature point, represents the horizontal coordinate of the jth feature point, represents the ordinate of the jth feature point, Indicates that there are q feature points in total; Constructing a real coordinate system according to an image analysis algorithm to obtain the object distance of the reference image frame; The shooting focal length corresponding to the reference image frame is calculated according to the relationship between the object distance and the image distance.

[0012] On the other hand, focusing the target camera is performed according to the focal length, including: Compare the shooting focal length with the standard focal length of any reference image frame, and if the deviation from the standard focal length is greater than a preset deviation, determine that the focal length of the corresponding reference image frame is unqualified, otherwise determine that it is qualified; Obtaining a ratio of the qualified number of all reference image frames to the frame image column dimension, and if the ratio is greater than a preset qualified ratio, determining that the reference image frame is qualified, otherwise determining that the reference image frame is unqualified; A deviation translation function is constructed according to the standard focal length and the mean deviation of any reference image frame, and the focus translation range of the target camera is obtained in combination with the standard focal length imaging requirements, and the target camera is controlled to adjust according to the focus translation range.

[0013] The present invention provides a lens focusing method based on a network camera, which is used to obtain an original video by shooting a target area with a camera to be focused. The original video is processed frame by frame, and the camera focal length corresponding to the current frame is obtained according to an algorithm after obtaining a feature value of a specific frame image, and the target camera is focused after comparing it with the standard focal length. The focusing accuracy is improved and the stable operation of the camera system is guaranteed. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0015] Figure 1 The present invention is a flowchart of a lens focusing method based on a network camera provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0016] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0017] Embodiment 1: like Figure 1 As shown, an embodiment of the present invention provides a lens focusing method based on a network camera, comprising: Step 1: Use the target camera to shoot the target area and obtain the original video stream of the target area; Step 2: pre-processing the original video stream to obtain a first video stream, processing the first video stream frame by frame to obtain a frame image sequence, sorting the frame image sequence according to time logic and configuring a sequence constant label for each frame; Step 3: Based on the standard extraction of numbers and sequential constant labels, multiple reference image frames of the frame image column are extracted for image processing, image parameters of each reference image frame are obtained, and key features are obtained; Step 4: Obtain the shooting focal length of the target camera of each reference image frame to the corresponding reference image frame according to the key features and using the image analysis algorithm; Step 5: Compare the shooting focal length with the standard focal length of the corresponding reference image frame to determine whether the focal length of the corresponding reference image frame is qualified, obtain the focal length of the target camera based on the qualified status of all reference image frames, and adjust the focus of the target camera based on the focal length status.

[0018] In this embodiment, the target camera refers to a camera device used to photograph the target area.

[0019] In this embodiment, the target area domain refers to a specific scene captured by the camera, and can be any area that needs to be observed, monitored or analyzed, such as a conference room, a factory workshop, a public place, etc.

[0020] In this embodiment, the original video stream is unprocessed continuous video data obtained from a video device.

[0021] In this embodiment, preprocessing refers to performing a series of operations on the original video stream, including: removing noise, adjusting image quality, image stabilization and other processes.

[0022] In this embodiment, the first video stream refers to an image sequence obtained by preprocessing the original video stream.

[0023] In this embodiment, frame-by-frame processing refers to extracting each frame in the video stream separately to obtain an image.

[0024] In this embodiment, the frame image list refers to a list consisting of a series of separate image frames obtained after the video stream is processed frame by frame.

[0025] In this embodiment, the time logic order refers to arranging the image frames according to their time sequence.

[0026] In this embodiment, the sequential constant label refers to a continuously increasing constant label assigned to each frame image, and is used to identify the temporal sequence of the frame images.

[0027] In this embodiment, the standard decimation number is used to select a specific number or rule of the reference image frame.

[0028] In this embodiment, key features refer to features used to describe and distinguish important information between images, including corner points, edges, textures, color distribution, etc.

[0029] In this embodiment, the image analysis algorithm includes: feature extraction and description, target detection and recognition, image segmentation, image classification and recognition, etc.

[0030] In this embodiment, the reference image frame refers to a specific frame image extracted from the original video stream for analysis and processing.

[0031] In this embodiment, the shooting focal length refers to the focal length used by the camera when shooting, and the focal length refers to the distance from the center of the lens to the focus.

[0032] In this embodiment, the standard focal length refers to the normal imaging focal length of the camera under specific circumstances. The standard focal length usually refers to the focal length near the viewing angle of the human eye, which is generally about 50 mm.

[0033] In this embodiment, the focus adjustment process refers to adjusting the focal length of the target camera according to the acquired shooting focal length of the target camera to meet the imaging requirement.

[0034] The working principle and beneficial effects of the above technical solution are: through image analysis and focal length comparison, automatic focusing is achieved, image quality is improved, misjudgment is reduced, and the efficiency and accuracy of focusing are enhanced.

[0035] Embodiment 2: On the basis of the above-mentioned embodiment 1, the target area is photographed by a target camera to obtain an original video stream of the target area, including: Determine the relative position of the target area to be photographed and the target camera, obtain relative configuration parameters, and complete the configuration of the target camera; After the configuration is completed, start the target camera and initialize the target camera according to the pre-focus parameters of the target camera; The target area is started to be photographed to obtain an original video stream of the target area.

[0036] In this embodiment, the relative configuration parameters are parameters for determining the relative position of the target area and the target camera, including: horizontal angle, vertical angle, distance, height difference and other parameters.

[0037] In this embodiment, the pre-focus parameters refer to parameters used to pre-adjust the focal length set when configuring the target camera, including: focal length setting, focus area, auto focus mode and other parameters.

[0038] In this embodiment, initialization includes: starting the camera, applying pre-focus parameters, calibrating the camera, testing and adjusting, and other operation processes.

[0039] The working principle and beneficial effects of the above technical solution are: determine the target area and camera position, configure parameters, initialize the camera, shoot the target area, and obtain the original video stream, thereby improving monitoring accuracy and data collection efficiency.

[0040] Embodiment 3: On the basis of the above-mentioned embodiment 1, preprocessing the original video stream to obtain the first video stream includes: Cut out the useless parts of the original video stream and convert it into a video stream according to a preset standard format; Processing the primary video stream according to a preset first resolution to obtain a secondary video stream; The secondary video stream is corrected and stabilized to obtain the first video stream.

[0041] In this embodiment, the useless part refers to the part of the video screen that does not contain target content or information, such as black edges, blank areas, noise points, etc.

[0042] In this embodiment, the preset first resolution refers to a video processing target resolution determined in advance.

[0043] In this embodiment, the secondary video stream refers to a video stream obtained by processing the primary video stream according to a preset first resolution, and the resolution processing process includes operations such as scaling, cropping, and adjusting the ratio.

[0044] In this embodiment, the correction stabilization processing refers to stabilization processing of the video stream, including: reducing shaking, jitter and other operation methods.

[0045] The working principle and beneficial effects of the above technical solution are: by eliminating useless parts, adjusting the video format and stabilizing the picture, the recognition accuracy of the video is improved, the compatibility is enhanced, and the storage space is saved.

[0046] Embodiment 4: On the basis of the above-mentioned embodiment 3, the first video stream is processed frame by frame to obtain a frame image sequence, including: Loading the first video stream into a preset video processing library, obtaining video parameters of the first video stream, determining a predetermined number of frames according to a frame number-video duration-video rate mapping table, and processing the first video stream frame by frame according to the predetermined number of frames to obtain a plurality of images; The multiple images are time-logically sorted according to the timestamp of each frame of the first video stream, and each frame is configured with a unique sequence constant label according to the sorted position; Gets a sequence of frame images consisting of frame images with sequential constant labels.

[0047] In this embodiment, the preset video processing library refers to a pre-designed and developed software library for video processing, including various functional modules, such as video decoding, frame processing, timestamp management, frame sorting, etc.

[0048] In this embodiment, the video parameters generally refer to various information describing video characteristics and attributes, including parameters such as resolution, frame rate, bit rate, color space, etc.

[0049] In this embodiment, the frame number-video duration-video rate mapping table is a table that maps the relationship between video duration, frame number and video rate.

[0050] In this embodiment, the predetermined number of frames is an ideal number of frames obtained according to a video duration and a video rate mapping table, and represents the total number of frames that should exist according to video parameters.

[0051] In this embodiment, the timestamp refers to the specific time at which an event occurs, and is used to mark the sample of each frame in the video.

[0052] The working principle and beneficial effects of the above technical solution are: loading the video through a preset processing library, processing frame by frame to obtain multiple images, and sorting them by timestamp, configuring unique tags, realizing time logic sorting and frame image processing of the video, providing convenience for subsequent analysis and application.

[0053] Embodiment 5: On the basis of the above-mentioned embodiment 1, multiple reference image frames of the frame image sequence are extracted based on the standard extraction number and the sequential constant label, including: Processing all original frame images in the frame image sequence to enhance contrast and brightness according to standard light parameters to obtain a brightness contrast image; Get the color parameters of any brightness contrast image and get the luminous flux: ;in, Indicates the luminous flux of the current brightness contrast image, K represents the proportional constant of the luminous flux, Represents the total spectral radiation intensity function of the current brightness contrast image, n means that the current brightness contrast image has n spectral colors, represents the color temperature function, represents the i-th spectral color, represents the light intensity coefficient of the i-th spectral color, represents the initial light intensity coefficient, e represents the preset lens sensitivity, Indicates the preset initial spectrum color; According to the standard classification range of luminous flux, the original frame image corresponding to the brightness contrast image is classified into the light perception category of the corresponding interval; Based on the standard extraction number and the sequential constant label and in combination with the number of images in each light sensitivity category, the extraction amount based on each light sensitivity category is determined, and a corresponding number of reference image frames are extracted in the corresponding light sensitivity category.

[0054] In this embodiment, the standard light parameters refer to parameters used to describe characteristics such as light source intensity, color, and distribution, including spectral distribution, luminous flux, light color temperature, and the like.

[0055] In this embodiment, contrast is a measure of brightness difference in an image, and is used to describe the degree of brightness difference between adjacent regions in an image.

[0056] In this embodiment, the brightness contrast image is an image obtained after contrast and brightness enhancement processing is performed on the original frame image. The processing method is to adjust the brightness range of the image to enhance the brightness difference in the image, and the contrast is also adjusted to enhance the brightness difference between adjacent areas in the image.

[0057] In this embodiment, the color parameters are parameters that describe the color characteristics of an image, and generally include hue, saturation, brightness, and the like.

[0058] In this embodiment, the luminous flux refers to the total light power emitted by the light source. Under the condition of a given light source, the luminous flux is a measure of the total amount of radiation radiated by the light source, and is usually expressed in the photometric unit lumen (lm).

[0059] In this embodiment, the total spectral radiation intensity function refers to a function that describes the variation of the radiation intensity of the light source with the wavelength in the entire wavelength range, and represents the radiation intensity of the light source at different wavelengths.

[0060] In this embodiment, the proportionality constant represents the proportionality constant of the luminous flux, and the value is 683 lm / W.

[0061] In this embodiment, spectral color refers to various colors with different wavelengths that are decomposed after light passes through a spectroscopic device. It is described by the wavelength of light, and light of different wavelengths corresponds to different colors.

[0062] In this embodiment, the color temperature function is used to describe the color temperature characteristics of the light source, the intensity distribution of light of different wavelengths in the spectrum, This refers specifically to the intensity of red light.

[0063] In this embodiment, the light intensity coefficient refers to a parameter describing the light intensity of various spectral colors in the image.

[0064] In this embodiment, the preset lens sensitivity refers to the sensitivity setting of a camera or camcorder, also known as an ISO (International Organization for Standardization) value.

[0065] In this embodiment, the preset initial spectrum color refers to the initial color distribution or reference color assumed when processing an image.

[0066] In this embodiment, the standard classification range refers to the range for classifying the original frame image according to the luminous flux of the brightness contrast image, for example: three classifications of low luminous flux, medium luminous flux, and high luminous flux.

[0067] In this embodiment, the light sensitivity category refers to different light sensitivity levels determined according to the standard classification range of the light flux of the original frame image, for example, three classifications of low light flux, medium light flux, and high light flux.

[0068] In this embodiment, the extraction amount refers to the number of reference image frames that should be extracted in each light sensitivity category, determined according to the light sensitivity category classification.

[0069] The working principle and beneficial effects of the above technical solution are: by enhancing the contrast and brightness of the original frame image, extracting color parameters to calculate the luminous flux, and grouping the images according to the classification criteria, and determining the number of reference images in each group, so as to improve the image quality and the representativeness of the light perception category.

[0070] Embodiment 6: On the basis of the above-mentioned embodiment 1, the reference image frame is processed to obtain key features and image parameters of each reference image frame, including: Extracting image parameters of any reference image frame, and performing grayscale conversion processing on the reference image frame to obtain a first grayscale image, iterating the Gaussian blur operation m times on the first grayscale image to generate a set of Gaussian image pyramids with a dimension of m; According to the Gaussian scale space algorithm, the Gaussian difference of the Gaussian images of two adjacent layers is calculated. According to the number of layers where the maximum Gaussian difference occurs, the pixel point with the maximum absolute value of the gradient deviation of the corresponding layer is found by grayscale gradient processing, and it is determined as the feature key point. The feature key points and the surrounding pixel points are compared with each other in different directions to obtain feature points of the feature key points and the surrounding pixel points, and the key features of the reference image frame are jointly constructed based on the feature points.

[0071] In this embodiment, image parameters refer to numerical values ​​that describe image features and attributes, including color information (such as RGB channel values), brightness, contrast, color distribution, texture, etc.

[0072] In this embodiment, the grayscale conversion process is the process of converting a color image into a grayscale image, including: obtaining a single-channel pixel point by performing a weighted average calculation on the RGB value of each pixel of the reference image frame, obtaining the grayscale value of the current pixel point based on the weight calculation of the brightness parameter of the pixel point and the RGB color single channel parameter, and obtaining a grayscale image after processing each pixel point of the reference image frame.

[0073] In this embodiment, the first grayscale image is an image obtained by converting the original color image into a grayscale image, in which each pixel has only one value, indicating the brightness information of the pixel, and no longer contains color information.

[0074] In this embodiment, the Gaussian blur operation is performed by replacing the grayscale value of each pixel with the weighted average value of surrounding pixels, and the weight used is determined by a Gaussian function.

[0075] In this embodiment, the Gaussian image pyramid is composed of a series of images constructed by applying different degrees of Gaussian blur to the first grayscale image, and each layer of images is obtained by performing a Gaussian blur operation on the previous layer of images.

[0076] In this embodiment, the Gaussian scale space algorithm is an algorithm for calculating the local Gaussian eigenvalues ​​of all images in each layer of the Gaussian image pyramid. The local Gaussian eigenvalues ​​refer to the values ​​of the Gaussian features of the feature key points.

[0077] In this embodiment, the Gaussian difference refers to the result obtained by performing a subtraction operation on local Gaussian eigenvalues ​​of images of two adjacent layers in the Gaussian pyramid.

[0078] In this embodiment, grayscale gradient processing refers to a method for calculating the grayscale gradient value of each pixel in an image. The grayscale gradient refers to the direction and rate of change of the fastest changing grayscale value of a pixel in an image.

[0079] In this embodiment, the absolute value of the gradient deviation refers to the absolute value of the gradient deviation of each pixel when calculating the Gaussian difference image.

[0080] In this embodiment, the key feature points include pixel points of significant structures or local features such as corner points, edges, and textures in the image.

[0081] In this embodiment, different directions refer to calculating the gradient directions of pixels around a certain pixel point, usually horizontal and vertical directions.

[0082] The working principle and beneficial effect of the above technical solution are: using Gaussian pyramid establishment, Gaussian difference calculation and key point detection to extract image features. Its advantages such as scale and rotation invariance and local feature description greatly improve the accuracy of image processing results.

[0083] Embodiment 7: On the basis of the above-mentioned embodiment 6, the shooting focal length of the target camera of each reference image frame to the corresponding reference image frame is obtained according to the key features and by using the image analysis algorithm, including: Map any reference image frame to the camera coordinate system, and calculate the image distance based on the key features of the reference image frame: ;in, represents the image distance of the reference image frame, represents the image distance conversion function, represents the feature point resolution of all camera coordinate systems of the reference image frame, represents the horizontal translation function, represents the translation function in the vertical direction, represents the preset translation vector of the jth feature point, represents the horizontal coordinate of the jth feature point, represents the ordinate of the jth feature point, Indicates that there are q feature points in total; Constructing a real coordinate system according to an image analysis algorithm to obtain the object distance of the reference image frame; The shooting focal length corresponding to the reference image frame is calculated according to the relationship between the object distance and the image distance.

[0084] In this embodiment, the camera coordinate system refers to the coordinate system inside the camera, which is used to describe the pixel position on the camera sensor and the direction of the camera optical axis, with the camera optical axis as the origin and the horizontal and vertical directions parallel to the sensor as the X-axis and Y-axis.

[0085] In this embodiment, the image distance refers to the distance between the image and the center origin of the camera.

[0086] In this embodiment, the image distance conversion function is a function that converts a feature point in the camera coordinate system of a feature point into an image distance. Any feature point of the image forms a basic matrix, and then the grayscale vector formed by the grayscale value of the feature point and the basic matrix are transposed and multiplied to obtain an image distance matrix, and the image separation distance of the feature point is obtained according to the image distance matrix.

[0087] In this embodiment, the image separation distance of the feature point refers to the image separation distance value of the feature point obtained based on the image separation distance conversion function.

[0088] In this embodiment, the translation function refers to a comprehensive representation function of the translation in the horizontal axis direction and the translation in the vertical axis direction, and describes the translation vectors of the feature points in the camera coordinate system in two preset directions.

[0089] In this embodiment, the preset translation vector refers to a preset translation vector of the feature point in the camera coordinate system, and the translation vector includes a translation distance and a translation direction.

[0090] In this embodiment, the object distance refers to the actual distance from the object to the camera.

[0091] In this embodiment, according to the object distance and the image distance, the calculation formula of the focal length is: ; Among them, r represents the focal length, f represents the object distance, and u represents the image distance.

[0092] The working principle and beneficial effects of the above technical solution are: using image feature points to calculate the camera image distance, combining the real coordinate system to obtain the object distance, and then deriving the camera shooting focal length, which can be used for accurate camera calibration and three-dimensional reconstruction, and improve the accuracy and efficiency of image processing.

[0093] Embodiment 8: On the basis of the above-mentioned embodiment 4, focusing processing is performed on the target camera according to the focal length, including: Compare the shooting focal length with the standard focal length of any reference image frame, and if the deviation from the standard focal length is greater than a preset deviation, determine that the focal length of the corresponding reference image frame is unqualified, otherwise determine that it is qualified; Obtaining a ratio of the qualified number of all reference image frames to the frame image column dimension, and if the ratio is greater than a preset qualified ratio, determining that the reference image frame is qualified, otherwise determining that the reference image frame is unqualified; A deviation translation function is constructed according to the standard focal length and the mean deviation of any reference image frame, and the focus translation range of the target camera is obtained in combination with the standard focal length imaging requirements, and the target camera is controlled to adjust according to the focus translation range.

[0094] In this embodiment, the preset deviation refers to a threshold value preset when evaluating the focal length.

[0095] In this embodiment, the ratio of column dimensions refers to the ratio between the number of qualified reference image frames and the number of columns of the image frame in image processing.

[0096] In this embodiment, the preset qualified ratio refers to a set threshold of the ratio between the qualified number of the reference image frame and the number of columns of the image frame.

[0097] In this embodiment, the deviation translation function is a function for calculating the deviation translation range. ; Where E represents the deviation range threshold, D0 represents the standard focal length, represents the focal length deviation of the reference image frame, It is a scaling factor of the focus translation range, used to control the size of the focus range.

[0098] In this embodiment, the focus translation range refers to the allowable range when the target camera adjusts the focal length. For example, if the deviation range threshold of the deviation translation function is 5%, the focus translation range can be set to within plus or minus 5% of the standard focal length.

[0099] The working principle and beneficial effects of the above technical solution are: improving the camera imaging quality and effect by evaluating the focal length quality, determining the qualified rate, calculating the focusing range and controlling the focal length adjustment.

[0100] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A lens focusing method based on a network camera, characterized in that: include: Step 1: Use the target camera to shoot the target area and obtain the original video stream of the target area; Step 2: pre-processing the original video stream to obtain a first video stream, processing the first video stream frame by frame to obtain a frame image sequence, sorting the frame image sequence according to time logic and configuring a sequence constant label for each frame; Step 3: Based on the standard extraction of numbers and sequential constant labels, multiple reference image frames of the frame image column are extracted for image processing, image parameters of each reference image frame are obtained, and key features are obtained; Step 4: Obtain the shooting focal length of the target camera of each reference image frame to the corresponding reference image frame according to the key features and using the image analysis algorithm; Step 5: Compare the shooting focal length with the standard focal length of the corresponding reference image frame to determine whether the focal length of the corresponding reference image frame is qualified, obtain the focal length of the target camera based on the qualified status of all reference image frames, and adjust the focus of the target camera based on the focal length status.

2. A lens focusing method based on a network camera according to claim 1, It is characterized in that The target area is photographed by the target camera to obtain the original video stream of the target area, including: Determine the relative position of the target area to be photographed and the target camera, obtain relative configuration parameters, and complete the configuration of the target camera; After the configuration is completed, start the target camera and initialize the target camera according to the pre-focus parameters of the target camera; The target area is started to be photographed to obtain an original video stream of the target area.

3. The lens focusing method based on a network camera according to claim 1, It is characterized in that Preprocessing the original video stream to obtain a first video stream includes: Cut out the useless parts of the original video stream and convert it into a video stream according to a preset standard format; Processing the primary video stream according to a preset first resolution to obtain a secondary video stream; The secondary video stream is corrected and stabilized to obtain the first video stream.

4. The lens focusing method based on a network camera according to claim 3, It is characterized in that The first video stream is processed frame by frame to obtain a frame image sequence, including: Loading the first video stream into a preset video processing library, obtaining video parameters of the first video stream, determining a predetermined number of frames according to a frame number-video duration-video rate mapping table, and processing the first video stream frame by frame according to the predetermined number of frames to obtain a plurality of images; The multiple images are time-logically sorted according to the timestamp of each frame of the first video stream, and each frame is configured with a unique sequence constant label according to the sorted position; Gets a sequence of frame images consisting of frame images with sequential constant labels.

5. The lens focusing method based on a network camera according to claim 1, It is characterized in that Based on the standard decimation number and the sequential constant label, multiple reference image frames of the frame image sequence are extracted, including: Processing all original frame images in the frame image sequence to enhance contrast and brightness according to standard light parameters to obtain a brightness contrast image; Get the color parameters of any brightness contrast image and get the luminous flux: ;in, Indicates the luminous flux of the current brightness contrast image, K represents the proportional constant of the luminous flux, Represents the total spectral radiation intensity function of the current brightness contrast image, n means that the current brightness contrast image has n spectral colors, represents the color temperature function, represents the i-th spectral color, represents the light intensity coefficient of the i-th spectral color, represents the initial light intensity coefficient, e represents the preset lens sensitivity, Indicates the preset initial spectrum color; According to the standard classification range of luminous flux, the original frame image corresponding to the brightness contrast image is classified into the light perception category of the corresponding interval; Based on the standard extraction number and the sequential constant label and in combination with the number of images in each light sensitivity category, the extraction amount based on each light sensitivity category is determined, and a corresponding number of reference image frames are extracted in the corresponding light sensitivity category.

6. The lens focusing method based on a network camera according to claim 1, It is characterized in that Perform image processing on the reference image frames to obtain key features and image parameters of each reference image frame, including: Extracting image parameters of any reference image frame, and performing grayscale conversion processing on the reference image frame to obtain a first grayscale image, iterating the Gaussian blur operation m times on the first grayscale image to generate a set of Gaussian image pyramids with a dimension of m; According to the Gaussian scale space algorithm, the Gaussian difference of the Gaussian images of two adjacent layers is calculated. According to the number of layers where the maximum Gaussian difference occurs, the pixel point with the maximum absolute value of the gradient deviation of the corresponding layer is found by grayscale gradient processing, and it is determined as the feature key point. The feature key points and the surrounding pixel points are compared with each other in different directions to obtain feature points of the feature key points and the surrounding pixel points, and the key features of the reference image frame are jointly constructed based on the feature points.

7. A lens focusing method based on a network camera according to claim 6, It is characterized in that The focal length of the target camera of each reference image frame for the corresponding reference image frame is obtained according to the key features and by using the image analysis algorithm, including: Map any reference image frame to the camera coordinate system, and calculate the image distance based on the key features of the reference image frame: ;in, represents the image distance of the reference image frame, represents the image distance conversion function, represents the feature point resolution of all camera coordinate systems of the reference image frame, represents the horizontal translation function, represents the translation function in the vertical direction, represents the preset translation vector of the jth feature point, represents the horizontal coordinate of the jth feature point, represents the ordinate of the jth feature point, Indicates that there are q feature points in total; Constructing a real coordinate system according to an image analysis algorithm to obtain the object distance of the reference image frame; The shooting focal length corresponding to the reference image frame is calculated according to the relationship between the object distance and the image distance.

8. The lens focusing method based on a network camera according to claim 4, It is characterized in that The target camera is focused according to the focal length, including: Compare the shooting focal length with the standard focal length of any reference image frame, and if the deviation from the standard focal length is greater than a preset deviation, determine that the focal length of the corresponding reference image frame is unqualified, otherwise determine that it is qualified; Obtaining a ratio of the qualified number of all reference image frames to the frame image column dimension, and if the ratio is greater than a preset qualified ratio, determining that the reference image frame is qualified, otherwise determining that the reference image frame is unqualified; A deviation translation function is constructed according to the standard focal length and the mean deviation of any reference image frame, and the focus translation range of the target camera is obtained in combination with the standard focal length imaging requirements, and the target camera is controlled to adjust according to the focus translation range.

Citation Information

Patent Citations

  • Automatic focusing system and method and projection equipment

    CN109752909A

  • Automatic focusing method and device, camera equipment and storage medium

    CN114244999A

  • Focusing method and device of camera module, electronic equipment and storage medium

    CN117336613A

  • Camera system and focal length adjusting method of zoom lens optical system of camera system

    JP2007086269A

Cited By

  • Image capturing device and autofocus method thereof

    TWI946353B