Measuring microscope rapid automatic focusing method based on ISP chip

Through the block processing based on ISP chip and the method of adjusting the lens position, the problem of low autofocus efficiency of industrial microscopes is solved, and the fast and accurate focus effect is achieved, which is suitable for efficient measurement of industrial microscopes.

CN119200195AActive Publication Date: 2024-12-27NANJING MUMUSILI TECH CO LTD +2
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411380855.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-30
Publication Date
2024-12-27
Estimated Expiration
2044-09-30

AI Technical Summary

Technical Problem

During the automatic focusing process, existing industrial microscopes have problems such as large amount of image data, low transmission efficiency, low communication efficiency and low computing efficiency, resulting in insufficient focus speed and accuracy.

Method used

The fast autofocus method based on the ISP chip is adopted to process the image by blocking, calculate the sharpness value of each block and perform weighting. Combined with the mountain climbing method, the lens position is gradually adjusted to find the best focus point of the image.

Benefits of technology

It achieves fast and accurate autofocus, shortens image processing time, improves focus speed and accuracy, and is suitable for the large-scale measurement needs of industrial microscopes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119200195A_ABST
    Figure CN119200195A_ABST
Patent Text Reader

Abstract

The invention discloses a measuring microscope rapid automatic focusing method based on an ISP chip, and the method comprises the steps: obtaining an image from a microscope camera, inputting the image into the ISP chip, carrying out the blocking processing of the image, calculating the definition value of each block, and aiming at the definition value of each block, combining with the center bias correction and the compensation processing of the adjacent blocks, thereby achieving the rapid automatic focusing of a measuring microscope. And obtaining a corrected definition value, selecting a block area with the maximum definition value, gradually adjusting the position of a microscope lens by using a hill climbing method, dynamically adjusting the focal length, and finally determining an optimal focusing point and completing automatic focusing. According to the method, the ISP chip is used for hardware acceleration processing, the focusing speed and precision are greatly improved, and the method is suitable for complex measurement environments under different illumination conditions and has wide application prospects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of industrial microscope measurement, and in particular to a fast automatic focusing method of a measuring microscope based on an ISP chip. Background Art

[0002] Microscope image processing has some characteristics: (1) The depth of field of the microscope is small; (2) The illumination of the pupil is small under high magnification; (3) The field of view of the microscope is small, and the image feature points are not obvious when focusing; (4) The illumination of the microscope light source is large, and the maximum illumination of the ring light source, coaxial light source, and bottom light source can reach 100,000 lux. Due to the influence of the light source, the camera is prone to overexposure, resulting in loss of image texture. Based on the traditional method of using industrial cameras to collect microscope images, the image clarity is judged on the Windows side, and the focus is performed by controlling the working distance between the optical lens and the object being measured. There are several disadvantages: (1) The image data volume is large, and the image is uploaded to Windows, which occupies a large bandwidth and has low transmission efficiency; (2) The communication between the camera (real-time system), the single-chip microcomputer (real-time system), and the Windows system (non-real-time system) is the communication between the real-time operating system and the non-real-time operating system, and the communication efficiency is low; (3) The image clarity judgment on the Windows side is performed by software algorithm (without hardware acceleration), and the calculation efficiency is low. Summary of the invention

[0003] Technical purpose: In view of the shortcomings of existing autofocus, the present invention discloses a fast autofocus method for a measuring microscope based on an ISP chip. Through hardware-accelerated image processing and the hill climbing method, the lens position is gradually adjusted to quickly find the best focus point of the image, thereby improving the focusing speed and accuracy.

[0004] Technical solution: To achieve the above technical objectives, the present invention adopts the following technical solution:

[0005] A fast autofocus method for a measuring microscope based on an ISP chip specifically comprises the following steps:

[0006] Acquire an image from the measuring microscope camera, input it into the ISP chip, start the focus function, and determine whether to set the focus area. If the focus area is not set, manually select the focus area.

[0007] The ISP chip processes the received image in blocks according to the set focus area. Each block consists of several pixels, representing different areas in the image.

[0008] Calculate the clarity value of each block respectively, and perform weighted processing on the clarity value of each block, perform center bias correction according to the distance of the block from the center of the image, and perform weighted average compensation processing on the clarity values ​​of adjacent blocks to obtain the clarity value of each block after center bias correction and compensation processing;

[0009] The block area with the largest clarity value is selected and the position of the measuring microscope lens is gradually adjusted using the hill climbing method to find the best focus point of the image and complete automatic focusing.

[0010] Preferably, the specific steps of calculating the clarity value of each block are as follows:

[0011] The ISP chip performs high-pass filtering on each block to extract the high-frequency components in the horizontal and vertical directions of each block;

[0012] Calculate the maximum horizontal definition value and the maximum vertical definition value according to the high-frequency components in the horizontal and vertical directions of the block, and sum the two maximum definition values ​​to set the definition value of the current block;

[0013] Output the clarity value information and complete the clarity value calculation for each block.

[0014] Preferably, the calculation formula of the center bias correction weight is as follows:

[0015]

[0016] Among them, W c represents the center bias correction weight, n represents the d x and d y Regularization coefficient, d x Indicates the distance from the center of the block to the center of the image in the x-axis direction, d y Indicates the distance from the block center to the image center in the y-axis direction.

[0017] Preferably, the definition value of each block is calculated as follows:

[0018] C=βH2+(1-β)*V2

[0019] Among them, C represents the clarity of the block, β is a constant used to adjust the image clarity threshold, H2 represents the horizontal filtering output value, and V2 represents the vertical filtering output value.

[0020] Preferably, the specific steps of performing weighted averaging of the clarity values ​​of adjacent blocks to complete the compensation process are as follows:

[0021] Obtaining a definition value of a current block, and determining adjacent blocks of the current block, wherein the adjacent blocks include four, three or two;

[0022] The clarity value of the adjacent block is divided by the total number of adjacent blocks and then added to the current block to obtain a new clarity value for the current block.

[0023] Preferably, the block area with the largest clarity value is selected to gradually adjust the position of the measuring microscope lens using the hill climbing method to find the best focus point of the image. The specific steps for completing the automatic focusing are as follows:

[0024] Select the block area with the largest clarity value, determine the initial focal length position of the measuring microscope lens, and set an initial step length for lens adjustment;

[0025] Gradually adjust the lens focal length, starting from the current focal length position, increase or decrease the focal length in sequence, update the lens position, and recalculate the clarity value of the selected block area after each adjustment;

[0026] Compare the clarity values ​​before and after adjustment to determine the change trend of the clarity values. If the clarity value after adjusting the focal length increases compared to the clarity value at the previous position, continue to adjust the focal length and continue searching in the direction where the eye clarity value increases. If the clarity value starts to decrease, it indicates that the best focus point has been exceeded, and readjust the step size and direction.

[0027] When the clarity value approaches the maximum value, the lens adjustment step is gradually reduced, and the clarity values ​​of two consecutive adjustments are compared. If the difference between the clarity values ​​of two consecutive adjustment positions and the clarity value of the previous position is within the set threshold range, the current position is the best focus point. If the clarity value decreases, it indicates that the best focus point has been exceeded and the camera returns to the position of the previous maximum value.

[0028] The measuring microscope lens position is fixed at the best focus point, completes automatic focus, and outputs the clearest image at the moment.

[0029] Preferably, the hill climbing method is also provided with a back-off mechanism. Specifically, if the clarity value starts to decrease and has passed a maximum value, the back-off mechanism returns to the maximum value position of the clarity value and performs fine-tuning at that position to ensure that the best focus point is found.

[0030] Beneficial effects: The fast autofocus method for a measuring microscope based on an ISP chip provided by the present invention has the following beneficial effects:

[0031] 1. The present invention uses an ISP chip for hardware acceleration processing, which can greatly shorten the time of image processing and calculation and achieve fast autofocus. Compared with the traditional autofocus method that relies on software algorithms, the present invention has obvious speed advantages and is particularly suitable for microscope measurement scenes that require fast focusing. At the same time, by processing the image in blocks, calculating the clarity value of each block respectively, and performing weighted processing according to the distance of the block from the image center, the focusing accuracy is further improved. In addition, the clarity compensation mechanism between adjacent blocks makes the focusing result more stable, avoiding the local blurred area from affecting the overall focusing effect.

[0032] 2. The present invention uses the hill climbing method to gradually adjust the focal length of the microscope lens. The system can automatically search for the best focus point in the image without excessive manual intervention. It is easy to operate and has a high degree of automation, which is suitable for large-scale measurement needs in industrial microscopes. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.

[0034] Figure 1 It is the overall flow chart of the method of the present invention;

[0035] Figure 2 A flowchart of the focus area selection process of the present invention;

[0036] Figure 3 A flowchart of selecting a block area with maximum clarity in a focus area according to the present invention;

[0037] Figure 4 It is a flowchart of the block definition calculation of the present invention;

[0038] Figure 5 A flowchart of the hill climbing method for finding the best focus point. DETAILED DESCRIPTION

[0039] The present invention will be described more clearly and completely below by way of a preferred embodiment in conjunction with the accompanying drawings, but the present invention is not limited to the scope of the embodiment.

[0040] like Figure 1 As shown, the present invention provides a fast automatic focusing method for a measuring microscope based on an ISP chip, which specifically includes the following steps:

[0041] S101, such as Figure 2 As shown, an image is acquired from a measuring microscope camera, input into the ISP chip, the focus function is started, and it is determined whether a focus area is set. If the focus area is not set, the focus area is manually selected.

[0042] S102, the ISP chip divides the received image into blocks according to the set focus area, each block is composed of a number of pixels, representing a different area in the image. The purpose of the block processing is to locally analyze the clarity of the image to facilitate subsequent autofocus calculations.

[0043] S103, such as Figure 3 As shown, the clarity value of each block is calculated respectively, and the clarity value of each block is weighted, and the center bias correction is performed according to the distance of the block from the image center, and the clarity values ​​of adjacent blocks are weighted averaged to complete the compensation processing, so as to obtain the clarity value of each block after the center bias correction and compensation processing.

[0044] In one embodiment, Figure 4 As shown, the specific steps for calculating the clarity value of each block are as follows:

[0045] The ISP chip performs high-pass filtering on each block to extract the high-frequency components in the horizontal and vertical directions of each block;

[0046] Calculate the maximum horizontal definition value and the maximum vertical definition value according to the high-frequency components in the horizontal and vertical directions of the block, and sum the two maximum definition values ​​to set the definition value of the current block;

[0047] Output the clarity value information and complete the clarity value calculation for each block.

[0048] The high-frequency component method is used to calculate the clarity value C based on the ISP chip, that is, the clearer the image, the larger the amplitude of the high-frequency part. The high-frequency component can be obtained by passing the image through a high-pass filter. Four filters and brightness information are provided, horizontal filter output values ​​H1 and H2, vertical filter output values ​​V1 and V2, and brightness Y and high brightness counter Hicnt. The original image is filtered horizontally by IIR filtering and vertically by FIR filtering. The clarity value calculation formula for each block is as follows:

[0049] C=βH i +(1-β)*V i

[0050] Among them, C represents the clarity of the block, β is a constant used to adjust the image clarity threshold, and H i Represents the horizontal filtering output value, V i Represents the vertical filter output value, and i represents the filter output value index.

[0051] In the present invention, the parameter β in formula C is set to 0.75, H i With V i They are the filter output values ​​in the horizontal and vertical directions respectively.

[0052] Preferably, the calculation formula of the center bias correction weight is as follows:

[0053]

[0054] Among them, W c represents the center bias correction weight, n represents the d x and d y Regularization coefficient, d x Indicates the distance from the center of the block to the center of the image in the x-axis direction, d y Indicates the distance from the block center to the image center in the y-axis direction.

[0055] In one embodiment, the specific steps of performing weighted averaging of the definition values ​​of adjacent blocks to complete compensation processing are as follows:

[0056] Obtaining a definition value of a current block, and determining adjacent blocks of the current block, wherein the adjacent blocks include four, three or two;

[0057] The clarity value of the adjacent block is divided by the total number of adjacent blocks and then added to the current block to obtain a new clarity value for the current block.

[0058] Finally, the image clarity value C1 is weighted to obtain the distance-weighted image clarity value C2 = C1 × W C The area with the largest clarity value is selected as the focus area, and after the focus area is obtained, the hill climbing method is used to search for the best focus position. S104, the block area with the largest clarity value is selected, and the position of the measuring microscope lens is gradually adjusted by the hill climbing method to find the best focus point of the image and complete the automatic focus.

[0059] In one embodiment, Figure 5 As shown in the figure, the block area with the largest clarity value is selected and the position of the measuring microscope lens is gradually adjusted using the hill climbing method to find the best focus point of the image. The specific steps to complete the autofocus are as follows:

[0060] Select the block area with the largest clarity value, determine the initial focal length position of the measuring microscope lens, and set an initial step length for lens adjustment;

[0061] Gradually adjust the lens focal length, starting from the current focal length position, increase or decrease the focal length in sequence, update the lens position, and recalculate the clarity value of the selected block area after each adjustment;

[0062] Compare the clarity values ​​before and after adjustment to determine the change trend of the clarity values. If the clarity value after adjusting the focal length increases compared to the clarity value at the previous position, continue to adjust the focal length and continue searching in the direction where the eye clarity value increases. If the clarity value starts to decrease, it indicates that the best focus point has been exceeded, and readjust the step size and direction.

[0063] When the clarity value approaches the maximum value, the lens adjustment step is gradually reduced, and the clarity values ​​of two consecutive adjustments are compared. If the difference between the clarity values ​​of two consecutive adjustment positions and the clarity value of the previous position is within the set threshold range, the current position is the best focus point. If the clarity value decreases, it indicates that the best focus point has been exceeded and the camera returns to the position of the previous maximum value.

[0064] The measuring microscope lens position is fixed at the best focus point, completes automatic focus, and outputs the clearest image at the moment.

[0065] In one embodiment, the hill climbing method is also provided with a back-off mechanism. Specifically, if the clarity value starts to decrease and has passed a maximum value, the back-off mechanism returns to the maximum clarity value position and performs fine-tuning at that position to ensure that the best focus point is found.

[0066] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A fast autofocus method for a measuring microscope based on an ISP chip, characterized in that: The specific steps include: Acquire an image from the measuring microscope camera, input it into the ISP chip, start the focus function, and determine whether to set the focus area. If the focus area is not set, manually select the focus area. The ISP chip processes the received image in blocks according to the set focus area. Each block consists of several pixels, representing different areas in the image. Calculate the clarity value of each block respectively, and perform weighted processing on the clarity value of each block, perform center bias correction according to the distance of the block from the center of the image, and perform weighted average compensation processing on the clarity values ​​of adjacent blocks to obtain the clarity value of each block after center bias correction and compensation processing; The block area with the largest clarity value is selected and the position of the measuring microscope lens is gradually adjusted using the hill climbing method to find the best focus point of the image and complete automatic focusing.

2. The method for rapid automatic focusing of a measuring microscope based on an ISP chip according to claim 1, characterized in that: The specific steps for calculating the clarity value of each block are as follows: The ISP chip performs high-pass filtering on each block to extract the high-frequency components in the horizontal and vertical directions of each block; Calculate the maximum horizontal definition value and the maximum vertical definition value according to the high-frequency components in the horizontal and vertical directions of the block, and sum the two maximum definition values ​​to set the definition value of the current block; Output the clarity value information and complete the clarity value calculation for each block.

3. The fast automatic focusing method of a measuring microscope based on an ISP chip according to claim 1, characterized in that: The calculation formula of the center bias correction weight is as follows: Among them, W c represents the center bias correction weight, n represents the d x and d y Regularization coefficient, d x Indicates the distance from the center of the block to the center of the image in the x-axis direction, d y Indicates the distance from the block center to the image center in the y-axis direction.

4. The method for rapid automatic focusing of a measuring microscope based on an ISP chip according to claim 2, characterized in that: The calculation formula of the clarity value of each block is as follows: C=βH2+(1-β)*V2 Among them, C represents the clarity of the block, β is a constant used to adjust the image clarity threshold, H2 represents the horizontal filtering output value, and V2 represents the vertical filtering output value.

5. The method for rapid automatic focusing of a measuring microscope based on an ISP chip according to claim 1, characterized in that: The specific steps of performing weighted average compensation on the clarity values ​​of adjacent blocks are as follows: Obtaining a definition value of a current block, and determining adjacent blocks of the current block, wherein the adjacent blocks include four, three or two; The clarity value of the adjacent block is divided by the total number of adjacent blocks and then added to the current block to obtain a new clarity value for the current block.

6. The method for rapid automatic focusing of a measuring microscope based on an ISP chip according to claim 1, characterized in that: Select the block area with the largest clarity value and use the hill climbing method to gradually adjust the position of the measuring microscope lens to find the best focus point of the image. The specific steps to complete the autofocus are as follows: Select the block area with the largest clarity value, determine the initial focal length position of the measuring microscope lens, and set an initial step length for lens adjustment; Gradually adjust the lens focal length, starting from the current focal length position, increase or decrease the focal length in sequence, update the lens position, and recalculate the clarity value of the selected block area after each adjustment; Compare the clarity values ​​before and after adjustment to determine the change trend of the clarity values. If the clarity value after adjusting the focal length increases compared to the clarity value at the previous position, continue to adjust the focal length and continue searching in the direction where the eye clarity value increases. If the clarity value starts to decrease, it indicates that the best focus point has been exceeded, and readjust the step size and direction. When the clarity value approaches the maximum value, the lens adjustment step is gradually reduced, and the clarity values ​​of two consecutive adjustments are compared. If the difference between the clarity values ​​of two consecutive adjustment positions and the clarity value of the previous position is within the set threshold range, the current position is the best focus point. If the clarity value decreases, it indicates that the best focus point has been exceeded and the camera returns to the position of the previous maximum value. The measuring microscope lens position is fixed at the best focus point, completes automatic focus, and outputs the clearest image at the moment.

7. The method for rapid automatic focusing of a measuring microscope based on an ISP chip according to claim 6, characterized in that: The hill climbing method is also provided with a back-off mechanism. Specifically, if the clarity value starts to decrease and has passed a maximum value, the back-off mechanism returns to the maximum value position of the clarity value and performs fine-tuning at this position to ensure that the best focus point is found.

Citation Information

Patent Citations

  • Microscope image automatic acquisition apparatus

    CN105022156A

  • Automatic focusing method for intelligent digital microscope

    CN113852761A

  • Digital microscope apparatus, focusing position searching method therefor, and program

    JP2014178474A