Camera focusing auxiliary method, system and equipment and medium
Through corner point detection and modulation transfer analysis, the quality score of the camera image is calculated and the focal length is automatically adjusted, which solves the problem of low focus accuracy in the prior art and achieves high definition of the entire area of the image.
Patent Information
- Application Number
- CN202510053153.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-14
- Publication Date
- 2025-08-01
AI Technical Summary
Existing camera focus methods lack quantitative feedback on the quality changes in the edge area of the image, resulting in low manual focus accuracy and affecting image clarity.
The target corner point and central area of the image are obtained through corner point detection, and the mass score is calculated using modulation transfer analysis, and displayed on the image. The camera focal length is automatically adjusted until the mass score meets the target value.
Provides quantitative sharpness feedback, improves focus accuracy, ensures consistency in the sharpness of the four corners and central areas of the image, and obtains high-definition images.
Smart Images

Figure CN120416660A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of focal length adjustment, and particularly to a method, system, device, and medium for assisting camera focusing. Background Art
[0002] With the development of camera technology and its popularization in various applications, the focal length adjustment accuracy of cameras has become one of the important factors affecting image quality. Currently, most focusing methods still rely on the operator's manual visual observation, mainly focusing on the center of the image or easily observable areas, while paying less attention to the quality changes in the edge areas of the image. However, in practical applications, due to factors such as lens distortion and off-axis imaging, the image quality often deteriorates at the four corner points and edge areas of the camera's field of view. These problems not only affect the overall clarity of the image but also limit the use effect of the camera in application scenarios that require full-field clarity.
[0003] Currently, due to the lack of quantitative feedback on the quality changes in the edge areas of the image, the existing focusing methods have low manual focusing accuracy and it is difficult to ensure consistent clarity within the entire image range. Therefore, the existing focusing methods have the problems of low accuracy and affecting image clarity. Summary of the Invention
[0004] Embodiments of this application provide a method, system, device, and medium for assisting camera focusing to at least solve the problems of low accuracy and affecting image clarity in the related art focusing methods.
[0005] In a first aspect, embodiments of this application provide a method for assisting camera focusing, and the method includes:
[0006] Based on the preprocessed image, obtain the target corner points and the central area of the image through corner detection;
[0007] Based on modulation transfer analysis, obtain the quality score of the target corner points and the quality score of the central area;
[0008] Display the quality score of the target corner points and the quality score of the central area at the corresponding positions of the image;
[0009] Based on the quality score of the target corner points and the quality score of the central area, adjust the camera focal length until the quality score of the target corner points and the quality score of the central area meet the target quality score.
[0010] In an embodiment, before obtaining the target corner points and the central area of the image based on the preprocessed image through corner detection, the method further includes:
[0011] Obtain the initial target focusing distance of the camera according to the minimum working distance and the maximum working distance of the camera;
[0012] Based on the initial target focusing distance, obtain an image of the initial target focusing distance and preprocess the image.
[0013] In one embodiment, the preprocessing of the image includes:
[0014] Process the image according to the output format of the camera;
[0015] The processing includes converting the image with 16-bit pixels to 8-bit pixels and converting the image of the RGB camera to a grayscale image.
[0016] In one embodiment, the obtaining of the target corner points and the central region of the image by corner detection according to the preprocessed image includes:
[0017] Detect the preprocessed image through the checkerboard corner detection algorithm, determine multiple corner points in the image, and determine the four corner points and the center point of the image among the multiple corner points, where the four corner points are located at the four rectangular corners of the rectangular image.
[0018] In one embodiment, the obtaining of the second diagnosis result through the random forest algorithm according to the current protection action data includes:
[0019] Calculate the contrast of the four corner points and the center point at different spatial frequencies through the inclined edge method;
[0020] Based on the contrast at different spatial frequencies and the contrast at zero spatial frequency, obtain the quality scores of the four corner points and the quality score of the center point.
[0021] In one embodiment, the obtaining of the quality scores of the four corner points and the quality score of the center point based on the contrast at different spatial frequencies and the contrast at zero spatial frequency includes:
[0022] Based on the contrast at different spatial frequencies and the contrast at zero spatial frequency, through the formula:
[0023]
[0024] Obtain the quality scores of the four corner points and the quality score of the center point;
[0025] where C(f) represents the contrast at spatial frequency (f), and C(0) is the contrast at zero spatial frequency.
[0026] In one embodiment, after the mass fraction of the target corner point and the mass fraction of the central region meet the target mass fraction, the method further includes:
[0027] Storing an image that meets the target mass fraction, where the image of the target mass fraction includes the preprocessed image, the target corner point, the central region, the mass fraction corresponding to the target corner point, and the mass fraction corresponding to the central region.
[0028] In one embodiment, after obtaining the target corner point and the central region of the image, the method further includes:
[0029] Obtaining a first distance between the target corner point and the center of the image;
[0030] Obtaining a second distance between the central region and the center of the image;
[0031] Determining the degree of image distortion based on the first distance and the second distance.
[0032] In a second aspect, an embodiment of the present application provides a camera focusing assistance system, which includes a target corner point and central region module, a mass fraction module, a display module, and a focusing module, where:
[0033] The target corner point and central region module is configured to obtain the target corner point and the central region of the image through corner detection according to the preprocessed image;
[0034] The mass fraction module is configured to obtain the mass fraction of the target corner point and the mass fraction of the central region according to modulation transfer analysis;
[0035] The display module is configured to display the mass fraction of the target corner point and the mass fraction of the central region at corresponding positions of the image;
[0036] The focusing module is configured to adjust the camera focal length based on the mass fraction of the target corner point and the mass fraction of the central region until the mass fraction of the target corner point and the mass fraction of the central region meet the target mass fraction.
[0037] In a third aspect, an embodiment of the present application provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, it implements a camera focusing assistance method as described in the first aspect above.
[0038] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, it implements a camera focusing assistance method as described in the first aspect above.
[0039] The camera focusing assistance method, system, device, and medium provided by the embodiments of the present application at least have the following technical effects.
[0040] By performing corner detection on the preprocessed image, the target corners and the central region of the image are obtained. According to the modulation transfer analysis, the quality scores of the target corners and the central region are obtained. The quality scores of the target corners and the central region are displayed at the corresponding positions of the image. Based on the quality scores of the target corners and the central region, the camera focal length is adjusted until the quality scores of the target corners and the central region meet the target quality scores. By calculating the real-time MTF scores of the four corners and the central region of the image, quantitative clarity feedback is provided, and focusing is performed according to the clarity feedback to obtain a high-clarity image. This solves the problem of low accuracy in the focusing method in the related art, which affects the image clarity.
[0041] The details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more concise and understandable. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] The drawings described herein are used to provide a further understanding of the present application and form a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation of the present application. In the drawings:
[0043] Figure 1 is a flowchart of a camera focusing assistance method according to an embodiment of the present application;
[0044] Figure 2 is a flowchart of step S102 shown according to an exemplary embodiment;
[0045] Figure 3 is a block diagram of a camera focusing assistance system shown according to an exemplary embodiment;
[0046] Figure 4 is a block diagram of an electronic device shown according to an exemplary embodiment. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0047] In order to make the purpose, technical solutions, and advantages of the present application clearer, the present application will be described and explained below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application. Based on the embodiments provided by the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of the present application.
[0048] Obviously, the accompanying drawings in the following description are only some examples or embodiments of the present application. For those of ordinary skill in the art, without creative efforts, the present application can also be applied to other similar scenarios based on these drawings. In addition, it can also be understood that although the efforts made in such a development process may be complex and lengthy, for those of ordinary skill in the art related to the content disclosed in the present application, some design, manufacturing, or production changes based on the technical content disclosed in the present application are only conventional technical means and should not be understood as insufficient disclosure of the content of the present application.
[0049] In the present application, the mention of "embodiment" means that the specific features, structures, or characteristics described in connection with the embodiment can be included in at least one embodiment of the present application. The appearance of this phrase at various positions in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment mutually exclusive with other embodiments. Those of ordinary skill in the art explicitly and implicitly understand that the embodiments described in the present application can be combined with other embodiments without conflict.
[0050] Unless otherwise defined, the technical terms or scientific terms involved in the present application should have the ordinary meaning understood by those with ordinary skills in the technical field to which the present application belongs. The terms "a", "an", "one", "the", and similar words involved in the present application do not indicate a limitation in quantity and can represent a singular or plural number. The terms "comprising", "including", "having", and any variations thereof involved in the present application are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include unlisted steps or units, or may further include other steps or units inherent to these processes, methods, products, or devices. The terms "connected", "coupled", and similar words involved in the present application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The term "plurality" involved in the present application refers to two or more. "And / or" describes the association relationship of associated objects and indicates that three relationships may exist. For example, "A and / or B" may represent: A exists alone, A and B exist simultaneously, and B exists alone. The character " / " generally represents an "or" relationship between the associated objects before and after. The terms "first", "second", "third", etc. involved in the present application are only used to distinguish similar objects and do not represent a specific order for the objects.
[0051] In a first aspect, an embodiment of the present application provides a method for assisting camera focusing. Figure 1 It is a flowchart of assisting camera focusing, as Figure 1 shown, a method for assisting camera focusing includes:
[0052] Step S101: Based on the preprocessed image, obtain the target corner points and the central region of the image through corner detection.
[0053] Step S102: Based on the modulation transfer analysis, obtain the quality scores of the target corner points and the central region.
[0054] Step S103: Display the quality scores of the target corner points and the central region at the corresponding positions on the image.
[0055] Step S104: Based on the quality scores of the target corner points and the central region, adjust the camera focus until the quality scores of the target corner points and the central region meet the target quality score.
[0056] In summary, the embodiment of the present application provides a camera focusing assistance method. By performing corner detection on the preprocessed image, the target corner points and the central region of the image are obtained. Based on the modulation transfer analysis, the quality scores of the target corner points and the central region are obtained. The quality scores of the target corner points and the central region are displayed at the corresponding positions on the image. Based on the quality scores of the target corner points and the central region, the camera focus is adjusted until the quality scores of the target corner points and the central region meet the target quality score. By calculating the real-time MTF scores of the four corner points and the central region of the image, quantitative clarity feedback is provided, and focusing is performed according to the clarity feedback to obtain high-clarity images. This solves the problems of low accuracy and affecting image clarity in the related art focusing methods.
[0057] In one embodiment, before obtaining the target corner points and the central region of the image through corner detection based on the preprocessed image, the camera focusing assistance method further includes:
[0058] Obtain the initial target focusing distance of the camera according to the minimum working distance and the maximum working distance of the camera;
[0059] Based on the initial target focusing distance, obtain an image of the initial target focusing distance and preprocess the image.
[0060] Optionally, through the formula
[0061]
[0062] Obtain the initial target focusing distance. In the formula, h1 represents the lowest working distance of the camera, h2 represents the highest working distance of the camera, and s is the initial target focusing distance of the camera. The initial target focusing distance refers to the initially set target focal length of the camera during the focusing process. This initial value is to quickly approach the optimal focal length and reduce the time and complexity of manual focusing. Based on the initial target focusing distance of the camera, obtain the image of the initial target focusing distance and preprocess the image. The initial target focusing distance shows the numerical value of the focal length, and focusing is performed through this numerical value.
[0063] By calculating the initial target focusing distance, the camera can be quickly adjusted to a reasonable initial position, reducing the time and complexity of manual focusing. The initial target focusing distance provides a good starting point for the focusing process, making subsequent fine-tuning more accurate and improving the focusing accuracy.
[0064] In one embodiment, preprocessing the image includes:
[0065] Process the image according to the output format of the camera;
[0066] The processing includes converting the image from 16-bit pixels to 8-bit pixels and converting the image of the RGB camera to a grayscale image.
[0067] Optionally, image preprocessing is to improve the efficiency and accuracy of subsequent image processing and analysis. Specifically, the preprocessing steps include converting the image from 16-bit to 8-bit and converting the RGB image to a grayscale image. Converting a 16-bit image to an 8-bit image can significantly reduce the data volume and speed up the processing speed. Converting an RGB image to a grayscale image can reduce the processing complexity and improve the processing efficiency. The preprocessing steps can remove noise, enhance the contrast of the image, and improve the accuracy of subsequent detection and analysis.
[0068] In one embodiment, in step S101, based on the preprocessed image, obtain the target corner points and the central region of the image through corner detection. Specifically, it includes:
[0069] Detect the preprocessed image through the checkerboard corner detection algorithm, determine multiple corner points in the image, and determine the four corner points and the center point of the image among the multiple corner points, where the four corner points are located at the four rectangular corners of the rectangular image.
[0070] Optionally, after image acquisition and preprocessing, four corner points and a center point in the image are detected by a checkerboard corner detection algorithm. To improve the detection accuracy, a corner detection algorithm based on OpenCV is adopted to detect the checkerboard corner points in the image through the geometric structure of the image. This step not only detects multiple corner points of the checkerboard, but also further identifies four corner points and a center point for focusing. Specifically, a corner detection algorithm based on OpenCV is used to detect multiple corner points in the preprocessed image. The checkerboard corner points in the image are detected through the geometric structure of the image. Among the detected multiple corner points, four corner points located at the four corners of the rectangular image are selected, and the center point of the image is determined.
[0071] Figure 2 is a flowchart of step S102 shown according to an exemplary embodiment, as Figure 2 shown, step S102, according to modulation transfer analysis, obtains the quality score of the target corner points and the quality score of the central region, specifically including the following steps:
[0072] Step S1021, calculate the contrast of the four corner points and the center point at different spatial frequencies by the slanted edge method.
[0073] Step S1022, based on the contrast at different spatial frequencies and the contrast at zero spatial frequency, obtain the quality scores of the four corner points and the quality score of the center point.
[0074] Optionally, the slanted edge method is a method for measuring the modulation transfer function (MTF). By detecting the contrast change of the slanted edge in the image, the MTF value at different spatial frequencies is calculated. Among the four corner points and the center point, the slanted edge is detected. A line is extracted along the direction of the slanted edge, and the brightness value of each pixel on this line is recorded. The contrast is determined according to the brightness value, and the contrast C(f) at different spatial frequencies is calculated. The following formula is used to calculate the MTF value at different spatial frequencies:
[0075]
[0076] where C(f) represents the contrast at spatial frequency f, and C(0) is the contrast at zero spatial frequency.
[0077] The quality scores include but are not limited to MTF10 and MTF50. The MTF values are calculated at multiple frequencies. MTF10 represents the frequency at 10% contrast, while MTF50 represents the frequency at 50% contrast. These metrics directly reflect the sharpness of the image region. Specifically, MTF is used to measure the ability to maintain this contrast at different levels of detail (spatial frequencies). MTF10 is to find the level of detail when "the contrast drops to only 10%", and MTF50 is to find the level of detail when "the contrast drops to only 50%".
[0078] Step S102 can more accurately evaluate the sharpness of the image region by calculating the contrast and MTF values at different spatial frequencies, thereby improving the accuracy of focusing. The quality scores (such as MTF10 and MTF50) provide metrics for quantitatively evaluating image quality, facilitating users to adjust the focal length of the camera according to these scores. Through objective numerical evaluation, subjective judgment in the focusing process is reduced, improving the consistency and reliability of focusing.
[0079] In one example, in step S103, the quality scores of the target corner points and the central region are displayed at the corresponding positions in the image. Specifically, it includes:
[0080] Obtain the quality scores of the target corner points and the central region from step S102. Determine the positions in the image where the quality scores are to be displayed, near the corresponding corner points and the central region. Superimpose and display the quality scores on the image in text form.
[0081] Step S103, displaying the quality scores on the image, provides intuitive feedback to help users quickly understand the image quality of each region. Users can adjust the focal length of the camera according to the displayed quality scores until the scores of all regions reach the target quality score. Through intuitive visual feedback, the user's operation experience and focusing efficiency are improved.
[0082] In one example, in step S104, based on the quality scores of the target corner points and the central region, adjust the focal length of the camera until the quality scores of the target corner points and the central region meet the target quality score. Specifically, it includes:
[0083] Obtain the quality scores of the target corner points and the central region from step S102. Compare the current quality scores with the target quality score to determine if they meet the requirements. If they do not meet the target quality score, adjust the focal length of the camera, re-acquire the image, and repeat steps S102 and S103 until the quality scores of all regions meet the target quality score.
[0084] For example,
[0085] Quality score of the center point: MTF10 = 0.1, MTF50 = 0.5
[0086] The mass fractions of the four corner points (assumed to be the upper left, upper right, lower left, and lower right respectively):
[0087] Upper left corner point: MTF10 = 0.1, MTF50 = 0.4;
[0088] Upper right corner point: MTF10 = 0.1, MTF50 = 0.45;
[0089] Lower left corner point: MTF10 = 0.1, MTF50 = 0.42;
[0090] Lower right corner point: MTF10 = 0.1, MTF50 = 0.48;
[0091] Assume the target mass fraction is: MTF10 ≥ 0.1, MTF50 ≥ 0.5
[0092] Among the current mass fractions, the MTF50 of the center point is 0.5, which meets the target mass fraction; however, the MTF50 of the four corner points are 0.4, 0.45, 0.42, and 0.48 respectively, all of which do not meet the target mass fraction.
[0093] Step S104 ensures that the image quality reaches a predetermined standard by automatically adjusting the camera focal length, improving the accuracy and efficiency of focusing. Reducing the number of times the user manually adjusts the focal length, enhancing the user experience. Ensuring that the image quality of the four corner points and the center point meets the requirements, improving the overall image quality.
[0094] In one example, after the mass fraction of the target corner point and the mass fraction of the central region meet the target mass fraction, the method further includes:
[0095] Storing the image that meets the target mass fraction, where the image of the target mass fraction includes the preprocessed image, the target corner point, the central region, as well as the corresponding mass fraction of the target corner point and the corresponding mass fraction of the central region.
[0096] Optionally, store the image that meets the target mass fraction. Storage content: The stored content includes the preprocessed image, the target corner point, the central region, as well as the corresponding mass fraction of the target corner point and the corresponding mass fraction of the central region.
[0097] Storing the image that meets the target mass fraction and its related information is convenient for subsequent analysis and verification. Ensuring that the image quality after each focusing meets the predetermined standard, improving the reliability and consistency of the system. The stored image and mass fraction can be used for subsequent quality inspection and problem troubleshooting.
[0098] In a second aspect, the embodiments of the present application provide a system for assisting camera focusing. Figure 3It is a block diagram of a camera focusing assistance system shown according to an exemplary embodiment. As Figure 3 shown, the system includes a target corner and center region module 310, a quality score module 320, a display module 330, and a focusing module 340, where:
[0099] The target corner and center region module 310 is configured to obtain the target corners and the center region of the image through corner detection based on the preprocessed image;
[0100] The quality score module 320 is configured to obtain the quality score of the target corners and the quality score of the center region according to modulation transfer analysis;
[0101] The display module 330 is configured to display the quality score of the target corners and the quality score of the center region at the corresponding positions of the image;
[0102] The focusing module 340 is configured to adjust the camera focal length based on the quality score of the target corners and the quality score of the center region until the quality score of the target corners and the quality score of the center region meet the target quality score.
[0103] In summary, the embodiment of the present application provides a camera focusing assistance system. Through the target corner and center region module 310, the quality score module 320, the display module 330, and the focusing module 340, the problem that the focusing method in the related art has low accuracy and affects image clarity is solved. Specifically, the target corners and the center region of the image are obtained through corner detection based on the preprocessed image. The quality score of the target corners and the quality score of the center region are obtained according to modulation transfer analysis. The quality score of the target corners and the quality score of the center region are displayed at the corresponding positions of the image. The camera focal length is adjusted based on the quality score of the target corners and the quality score of the center region until the quality score of the target corners and the quality score of the center region meet the target quality score. By performing real-time MTF score calculation on the four corners and the center region of the image, quantitative clarity feedback is provided, and focusing is performed according to the clarity feedback to obtain high-clarity images. The problem that the focusing method in the related art has low accuracy and affects image clarity is solved.
[0104] It should be noted that the camera focusing assistance system provided in this embodiment is used to implement the above implementation manners, and those that have been described will not be repeated. As used above, terms such as "module", "unit", "sub-unit", etc. can be a combination of software and / or hardware that can implement a predetermined function. Although the devices described in the above embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware is also possible and contemplated.
[0105] In a third aspect, the embodiment of the present application provides an electronic device,Figure 4 is a block diagram of an electronic device shown according to an exemplary embodiment. As Figure 4 shown, the electronic device may include a processor 41 and a memory 42 storing computer program instructions.
[0106] Specifically, the above-mentioned processor 41 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application.
[0107] Among them, the memory 42 may include a mass storage for data or instructions. By way of example and not limitation, the memory 42 may include a hard disk drive (HDD), a floppy disk drive, a solid state drive (SSD), a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive, or a combination of two or more of these. Where appropriate, the memory 42 may include removable or non-removable (or fixed) media. Where appropriate, the memory 42 may be internal or external to the data processing device. In a particular embodiment, the memory 42 is a non-volatile memory. In a particular embodiment, the memory 42 includes a read-only memory (ROM) and a random access memory (RAM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically alterable ROM (EAROM), or a flash memory, or a combination of two or more of these. Where appropriate, the RAM may be a static random access memory (SRAM) or a dynamic random access memory (DRAM), where the DRAM may be a fast page mode dynamic random access memory (FPMDRAM), an extended date out dynamic random access memory (EDODRAM), a synchronous dynamic random access memory (SDRAM), etc.
[0108] The memory 42 can be used to store or cache various data files required for processing and / or communication, as well as possible computer program instructions executed by the processor 41.
[0109] The processor 41 reads and executes the computer program instructions stored in the memory 42 to implement any one of the camera focusing assistance methods in the above embodiments.
[0110] In one embodiment, a device for camera focusing assistance may further include a communication interface 43 and a bus 40. Among them, as Figure 4 shown, the processor 41, the memory 42, and the communication interface 43 are connected through the bus 40 and complete communication with each other.
[0111] The communication interface 43 is used to implement communication between the modules, devices, units, and / or devices in the embodiments of the present application. The communication port 43 can also implement data communication with other components such as external devices, image / data acquisition devices, databases, external storage, and image / data processing workstations.
[0112] The bus 40 includes hardware, software, or both, and couples components of a device for camera focus assistance to each other. The bus 40 includes at least one of the following, including but not limited to: Data Bus, Address Bus, Control Bus, Expansion Bus, Local Bus. By way of example and not limitation, the bus 40 may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an InfiniBand interconnect, a Low Pin Count (LPC) bus, a memory bus, a MicroChannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Bus (VLB) bus, or other suitable buses, or a combination of two or more of these. Where appropriate, the bus 40 may include one or more buses. Although the embodiments of the present application describe and illustrate specific buses, the present application contemplates any suitable bus or interconnect.
[0113] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a program is stored. When the program is executed by a processor, it implements a method for camera focus assistance provided in the first aspect.
[0114] Among them, the readable storage medium may more specifically include, but is not limited to: portable disks, hard disks, random access memories, read-only memories, erasable programmable read-only memories, optical storage devices, magnetic storage devices, or any suitable combination of the above.
[0115] In a possible implementation manner, the present invention can also be implemented in the form of a program product, which includes program code. When the program product runs on a terminal device, the program code is used to cause the terminal device to execute the steps of implementing a camera focusing assistance method provided in the first aspect.
[0116] Among them, the program code for executing the present invention can be written in any combination of one or more programming languages. The program code can be executed entirely on the user device, partially on the user device, executed as an independent software package, partially on the user device and partially on a remote device, or entirely on a remote device.
[0117] The technical features of the above embodiments can be combined arbitrarily. For the sake of concise description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope described in this specification.
[0118] The above embodiments only represent several implementation manners of the present application. The description is relatively specific and detailed, but it should not be construed as a limitation on the scope of the invention patent. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application should be subject to the appended claims.
Claims
1. A camera focusing assistance method, characterized in that, The method includes: Based on the preprocessed image, through corner detection, obtaining the target corners and the central region of the image; Based on modulation transfer analysis, obtaining the quality scores of the target corners and the quality score of the central region; Displaying the quality scores of the target corners and the quality score of the central region at corresponding positions of the image; Based on the quality scores of the target corners and the quality score of the central region, adjusting the camera focal length until the quality scores of the target corners and the quality score of the central region meet the target quality scores.
2. The method according to claim 1, wherein Before obtaining the target corners and the central region of the image based on the preprocessed image through corner detection, the method further includes: Based on the minimum working distance and the maximum working distance of the camera, obtaining the initial target focusing distance of the camera; Based on the initial target focusing distance, obtaining an image of the initial target focusing distance and preprocessing the image.
3. The method according to claim 2, wherein The preprocessing of the image includes: Processing the image according to the output format of the camera; The processing includes converting the image from 16-bit pixels to 8-bit pixels and converting the image of an RGB camera to a grayscale image.
4. The method according to claim 1, wherein The obtaining of the target corners and the central region of the image based on the preprocessed image through corner detection includes: Detecting the preprocessed image through a checkerboard corner detection algorithm, determining multiple corners in the image, and determining four corners and the center point of the image among the multiple corners, where the four corners are located at the four rectangular corners of a rectangular image.
5. The method according to claim 1, wherein Based on modulation transfer analysis, obtaining the quality scores of the target corners and the quality score of the central region includes: Calculating the contrast of the four corners and the center point at different spatial frequencies through the tilted edge method; Based on the contrast at different spatial frequencies and the contrast at zero spatial frequency, obtaining the quality scores of the four corners and the quality score of the center point.
6. The method according to claim 5, characterized in that The obtaining of the quality scores of the four corners and the quality score of the center point based on the contrast at different spatial frequencies and the contrast at zero spatial frequency includes: Based on the contrast at different spatial frequencies and the contrast at zero spatial frequency, through the formula: Obtaining the quality scores of the four corners and the quality score of the center point; where C(f) represents the contrast at spatial frequency (f), and C(0) is the contrast at zero spatial frequency.
7. The method according to claim 1, characterized in that After the quality scores of the target corners and the quality score of the central region meet the target quality scores, the method further includes: Storing the image that meets the target quality scores, where the image of the target quality scores includes the preprocessed image, the target corners, the central region, and the quality scores corresponding to the target corners and the quality score corresponding to the central region.
8. The method according to claim 1, characterized in that, After obtaining the target corners and the central region of the image, the method further includes: Obtaining a first distance between the target corners and the center of the image; Obtaining a second distance between the central region and the center of the image; Determine the degree of image distortion based on the first distance and the second distance.
9. A camera focusing assistance system, characterized in that, The system includes a target corner and central region module, a quality score module, a display module, and a focusing module, where: The target corner and central region module is configured to obtain the target corners and the central region of the image through corner detection based on the preprocessed image; The quality score module is configured to obtain the quality score of the target corner and the quality score of the central region according to modulation transfer analysis; The display module is configured to display the quality score of the target corner and the quality score of the central region at corresponding positions of the image; The focusing module is configured to adjust the camera focal length based on the quality score of the target corner and the quality score of the central region until the quality score of the target corner and the quality score of the central region meet the target quality score.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by a processor, it implements a camera focusing assistance method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Automatic focusing method applied to camera module
CN103809348A
MTF-based camera focusing method, device and system
CN109361854A
Chessboard corner capturing method, device and system and readable storage medium
CN110264531A
Definition measuring method and device and computer readable storage medium
CN113935954A
Focusing method and device of camera module, electronic equipment and storage medium
CN117336613A