An auto-focusing method and device for a video measuring instrument

By using a patterned sheet designed with multiple alternating stripes of different colors in an image measuring instrument, and by using a beam splitter and grayscale values ​​to determine the appropriate focal length, the problem of inefficient focusing in existing technologies is solved, and a fast and accurate focusing effect is achieved.

CN121165282BActive Publication Date: 2026-04-28ANHUI XINHUA UNIV
View PDF 4 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ANHUI XINHUA UNIV
Filing Date
2025-08-15
Publication Date
2026-04-28

AI Technical Summary

Technical Problem

The focusing methods of existing image measuring instruments are not efficient enough due to the inefficient design of the pattern sheet and the lack of efficiency in sharpness judgment.

Method used

The design uses stripes of different colors arranged in an alternating pattern. A beam splitter projects light of the corresponding colors onto an image sensor. The distribution of grayscale values ​​is compared with the stripes to determine whether the focal length is appropriate, thus achieving automatic focusing.

Benefits of technology

It improves the focusing efficiency and accuracy of the image measuring instrument, reduces the amount of calculation, and enables the focusing process to be completed quickly and accurately.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121165282B_ABST
    Figure CN121165282B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of image measuring instrument, and discloses an automatic focusing method and device of image measuring instrument.The present application is invented from two angles of the special design of the projection pattern and the judgment of whether the pattern is clear, and is placed in the form of pattern piece on the mounting position of the object to be measured so as to be the same as the position of the measured object.In the judgment of the focusing result, when the distribution of the gray value corresponds to the stripe on the pattern piece, it is indicated that the focal length is appropriate, the focusing is completed, the stripe on the pattern piece is known in advance, in the focusing process, the light splitting device blocks or reflects one color in the stripe, and the light of another color is projected onto the sensor, so that the absolute gray value difference can be caused, and the subsequent recognition of the gray value distribution is more favorable.Because the stripe on the pattern piece is known in advance, the distribution of the gray value is also fixed, and only when the distribution of the gray value corresponds to the stripe, the focusing is determined to be successful.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image measuring instrument technology, and in particular to an automatic focusing method and apparatus for an image measuring instrument. Background Technology

[0002] Image measuring instruments, also known as optical image measuring instruments or video measuring instruments, use high-resolution CCD color cameras, continuous zoom lenses, and liquid crystal displays to capture images of the object being measured and display them on a computer screen. Measurement software is then used to precisely measure parameters such as geometric dimensions, shape, and position. In research institutions and universities, image measuring instruments are used in materials science, physics, engineering, and other disciplines to help researchers accurately measure the microstructure, crystal shape, surface morphology, and other characteristics of materials, providing data support for scientific research. They are also valuable tools for teaching and experimental research, helping students to more intuitively understand concepts such as geometric dimensions, shape, and position, as well as master measurement techniques and methods.

[0003] Due to their high precision requirements, image measuring instruments demand high focusing accuracy during use. Existing focusing methods for image measuring instruments include:

[0004] Chinese Patent Publication CN101782369A discloses a focusing device for an image measuring instrument, and Chinese Patent Publication CN115014521A discloses an automatic focusing pushbroom hyperspectral imaging method and device based on a beam splitter. In the prior art, projected patterns are used to assist focusing. For example, the pattern sheet is a glass plate with multiple transparent and opaque squares. The pattern on the pattern sheet can also be other patterns, such as clearly defined animal images, human figures, or landscapes. Moreover, in the prior art, how to determine the focus status or the sharpness of the pattern directly affects the focusing accuracy. For example, the image measurement focusing system and method in Chinese Patent Publication CN101782369A determines sharpness based on a sharpness formula. Practice shows that the prior art schemes using auxiliary patterns to achieve focusing in image measuring instruments are inefficient due to the inefficient design of the pattern sheet and the inefficient sharpness judgment method, resulting in an inefficient focusing process for the image measuring instrument. Summary of the Invention

[0005] This invention provides an automatic focusing method and apparatus for an image measuring instrument, which can efficiently realize the focusing process of the image measuring instrument.

[0006] The first aspect of this invention discloses an automatic focusing method for an image measuring instrument, the method comprising:

[0007] The image measuring instrument captures an image of a patterned sheet, which has multiple stripes of different colors arranged alternately, and the position of the patterned sheet is the same as the position of the object to be measured.

[0008] During the shooting process, the light emitted from the pattern sheet passes through a beam splitter so that only the light of the corresponding color on the pattern sheet is projected into the image sensor;

[0009] The image measuring instrument captures images of the pattern piece at different focal lengths. When the distribution of gray values ​​in the image of the pattern piece corresponds to the stripes on the pattern piece, it indicates that the focal length is appropriate and focusing is complete.

[0010] As an optional implementation, in a first aspect of the invention, the patterned sheet has a plurality of stripes of alternating first and second colors;

[0011] The beam splitter is used to separate light with wavelengths exceeding a wavelength threshold from light with wavelengths not exceeding a wavelength threshold.

[0012] The wavelength of the light corresponding to the first color exceeds the wavelength threshold, and the wavelength of the light corresponding to the second color does not exceed the wavelength threshold.

[0013] As an optional implementation, in a first aspect of the invention, the distribution of grayscale values ​​on the image of the pattern patch includes:

[0014] When the stripes on the pattern are non-horizontal stripes, it refers to the grayscale value change of any pixel row in the image of the pattern;

[0015] When the stripes on the pattern are non-vertical stripes, it represents the grayscale value change of any pixel column in the image of the pattern;

[0016] Wherein, the horizontal direction of the pattern patch corresponds to the pixel row on the image of the pattern patch, and the vertical direction of the pattern patch corresponds to the pixel column on the image of the pattern patch.

[0017] As an optional implementation, in a first aspect of the invention, the distribution of the grayscale values ​​corresponds to the stripes on the pattern piece, including:

[0018] The grayscale value distribution includes the periodic changes in the pixel value size in a row or column of pixels. When the focal length is appropriate, the period of the periodic change corresponds to the stripe distribution period on the pattern piece, and the gradient value of the change in the periodic change from small to large or from large to small is greater than a set threshold.

[0019] As an optional implementation, in a first aspect of the invention, the patterned sheet has a plurality of vertical stripes of alternating first and second colors;

[0020] The beam splitter is used to separate the light source of the first color and the light source of the second color, and to project the light source of the second color onto the image sensor.

[0021] The distribution of grayscale values ​​corresponds to the stripes on the pattern piece, including: calculating the gradient value of the grayscale values ​​in the horizontal direction of the image of the pattern piece as they change from small to large or from large to small; the gradient value of the change is greater than a set threshold, and the period of change of grayscale values ​​in the horizontal direction of the image of the pattern piece is the same as the period of change of the stripes on the pattern.

[0022] As an optional implementation, in a first aspect of the invention, the patterned sheet has a plurality of horizontal stripes of alternating first and second colors;

[0023] The beam splitter is used to separate the light source of the first color and the light source of the second color, and to project the light source of the second color onto the image sensor.

[0024] The distribution of grayscale values ​​corresponds to the stripes on the pattern piece, including: calculating the gradient value of the change in grayscale values ​​in the vertical direction of the image of the pattern piece as they change from small to large or from large to small; the gradient value of the change is greater than a set threshold, and the period of change of grayscale values ​​in the vertical direction of the image of the pattern piece is the same as the period of change of the stripes on the pattern.

[0025] As an optional implementation, in a first aspect of the invention, the patterned sheet has multiple vertical or horizontal stripes of equal width.

[0026] The beam splitter is used to separate the light source of the first color and the light source of the second color, and to project the light source of the second color onto the image sensor.

[0027] The distribution of gray values ​​corresponds to the stripes on the pattern piece, including: using an edge detection algorithm to extract the edge positions on the image of the pattern piece where the gray values ​​change, and the width between adjacent edge positions is the same.

[0028] As an optional implementation, in a first aspect of the invention, the patterned sheet has a plurality of vertical stripes of alternating first and second colors, the width of which is known;

[0029] The beam splitter is used to separate the light source of the first color and the light source of the second color, and to project the light source of the second color onto the image sensor.

[0030] Increase the sensor's exposure time until the stripes corresponding to the second color in the image acquired by the sensor are overexposed;

[0031] The distribution of the grayscale values ​​corresponds to the stripes on the pattern piece, including:

[0032] When the stripes corresponding to the second color are overexposed, the stripes corresponding to the second color are bright stripes, and the stripes corresponding to the first color are dark stripes.

[0033] A grayscale threshold is set, wherein the grayscale value of the pixels on the bright ridge is greater than the grayscale threshold, and the grayscale value of the pixels on the dark ridge is less than the grayscale threshold.

[0034] Calculate the length of dark strides for pixels with gray values ​​less than a gray value threshold and the length of bright strides for pixels with gray values ​​greater than a gray value threshold in the horizontal direction of the image of the pattern patch.

[0035] The lengths of the dark and light patterns correspond to the widths of the stripes on the pattern piece.

[0036] A second aspect of the present invention discloses an autofocus device for an image measuring instrument, the device comprising:

[0037] A beam splitter is installed between the lens and the image sensor of the image measuring instrument;

[0038] The patterned sheet is placed on the mounting position of the object to be measured during the focusing process of the image measuring instrument; the patterned sheet has multiple stripes of different colors arranged alternately.

[0039] The light emitted from the patterned sheet passes through a beam splitter and then reaches the image sensor. The beam splitter ensures that only light of the corresponding color passes through the patterned sheet.

[0040] The image measuring instrument captures images of the pattern piece at different focal lengths. When the distribution of gray values ​​in the image of the pattern piece corresponds to the stripes on the pattern piece, it indicates that the focal length is appropriate and focusing is complete.

[0041] As an optional implementation, in a second aspect of the invention, the patterned sheet has a plurality of vertical stripes of alternating first and second colors, the vertical stripes having equal widths.

[0042] The beam splitter is used to separate the light source of the first color and the light source of the second color, and to project the light source of the second color onto the image sensor.

[0043] The distribution of gray values ​​corresponds to the stripes on the pattern piece, including: using an edge detection algorithm to extract the edge positions on the pattern piece image where the gray values ​​change, and the width between adjacent edge positions is the same.

[0044] As an optional implementation, in a second aspect of the invention, the image measuring instrument is further provided with a beam splitter behind the lens for separating the light source entering from the lens into a first optical path and a second optical path.

[0045] The first optical path and the second optical path contain identical image information. The first optical path is directly projected onto the measuring image sensor of the image measuring instrument. The measuring image sensor is used to capture an image of the object to be measured after focusing.

[0046] The second optical path passes through the beam splitter and reaches the focusing image sensor; the focusing image sensor is used to acquire the image of the pattern piece.

[0047] Compared with the prior art, the present invention has the following beneficial effects:

[0048] This invention is conceived from two perspectives: the special design of the projected pattern and the judgment of the pattern's clarity. Existing technologies do not limit the projected pattern; it can be geometric or human figures. This invention, however, modifies it into a pattern with multiple alternating stripes of different colors, placed as a pattern piece on the installation position of the object to be measured, aligning it with the object's position. In judging the focusing result, when the distribution of grayscale values ​​corresponds to the stripes on the pattern piece, it indicates that the focal length is appropriate, and focusing is complete. The stripes on the pattern piece are known in advance. During focusing, a beam-splitting device blocks or reflects one color from the stripes, while the other color is projected onto the sensor. This creates an absolute difference in grayscale values, facilitating subsequent recognition of the grayscale distribution. Because the stripes on the pattern piece are known in advance, the grayscale distribution is fixed; only when the grayscale distribution corresponds to the stripes is focusing considered successful. Attached Figure Description

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

[0050] Figure 1 This is a schematic diagram of the structure of an automatic focusing device for an image measuring instrument disclosed in an embodiment of the present invention;

[0051] Figure 2 This is a schematic diagram of a pattern sheet including alternating red and green stripes, as disclosed in an embodiment of the present invention.

[0052] Figure 3 This is a graph showing the change in grayscale values ​​of a pixel row under a successfully focused state, as disclosed in an embodiment of the present invention.

[0053] Figure 4 This is a diagram showing the blurred edge state when focusing fails, as disclosed in an embodiment of the present invention.

[0054] Figure 5 This is a graph showing the change in grayscale values ​​of a pixel row when focusing fails, as disclosed in an embodiment of the present invention. Detailed Implementation

[0055] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0056] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, apparatus, product, or end that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or ends.

[0057] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0058] This invention provides an automatic focusing method and apparatus for an image measuring instrument, which can efficiently realize the focusing process of the image measuring instrument. Detailed descriptions follow.

[0059] This invention first discloses an autofocus device for an image measuring instrument. This autofocus device is applied to the image measuring instrument to assist it in quickly and accurately achieving focus. The image measuring instrument includes a lens, an image sensor, and a mounting device, etc. Figure 1 As shown, the autofocus device of the image measuring instrument includes:

[0060] A beam splitter is installed between the lens and the image sensor of the image measuring instrument; optionally, the beam splitter can be a dichroic filter or a beam splitter prism, which can separate light of different colors.

[0061] A patterned sheet is placed on the mounting position of the object to be measured during the focusing process of the image measuring instrument, such as on a carrier device; the patterned sheet has multiple stripes of different colors arranged alternately.

[0062] The light emitted from the pattern sheet reaches the image sensor after passing through a beam splitter. The beam splitter ensures that only light of the corresponding color passes through the pattern sheet. The light emitted by the pattern sheet can be either reflected light or light emitted by the pattern sheet itself.

[0063] The image measuring instrument captures images of the pattern piece at different focal lengths. When the distribution of gray values ​​in the image of the pattern piece corresponds to the stripes on the pattern piece, it indicates that the focal length is appropriate and focusing is complete.

[0064] In this invention, the inventive concept is based on two aspects: the special design of the projected pattern and the judgment of whether the pattern is clear. The projected pattern in the prior art is not limited and can be a geometric figure or a human figure. This invention changes it to a pattern with multiple stripes of alternating different colors, and places it as a pattern piece on the installation position of the object to be measured, aligning it with the object's position. Regarding the judgment of the focusing result, when the distribution of grayscale values ​​corresponds to the stripes on the pattern piece, it indicates that the focal length is appropriate, and focusing is complete. The stripes on the pattern piece are known in advance. During the focusing process, the beam splitting device blocks or reflects one color from the stripes, while the other color of light is projected onto the sensor. This creates an absolute difference in grayscale values, which is more conducive to the subsequent identification of the grayscale value distribution. Since the stripes on the pattern piece are known in advance, the grayscale value distribution is also fixed. Only when the grayscale value distribution corresponds to the stripes is focusing considered successful.

[0065] In an optional embodiment, for the patterned patch, optionally, the patterned patch has multiple vertical stripes of alternating first and second colors, the width of the vertical stripes being equal;

[0066] At this time, the beam splitter is used to separate the light source of the first color and the light source of the second color, so that the light source of the second color is projected onto the image sensor.

[0067] The distribution of gray values ​​corresponds to the stripes on the pattern, including: using an edge detection algorithm to extract the edge positions on the pattern image where the gray values ​​change, and the width between adjacent edge positions is the same.

[0068] Examples are given below:

[0069] The patterned pattern can be a red and green alternating stripe pattern, such as... Figure 2As shown, the fringe spacing of the above fringe pattern can be changed and is known, and the positions of the red and green stripes can be interchanged. The stripe colors are also not limited, as long as they can be separated by a dichroic sheet or a dichroic prism (which reflects long-wavelength light and transmits short-wavelength light, or vice versa). The greater the wavelength difference, the better the effect.

[0070] The beam splitter can be a dichroic plate or dichroic prism, used to reflect long-wavelength light and transmit short-wavelength light. This separates red and green light. The longer-wavelength red light is reflected, while the shorter-wavelength green light is projected and enters the imaging element. If the focal length is appropriate and the image is clear, a photograph with alternating green and black stripes can be obtained (red light is filtered and imaged as black stripes).

[0071] For grayscale distribution, the data is presented in rows. Figure 2 The corresponding grayscale value changes should be as follows: Figure 3 The image shown is a stepped distribution pattern. However, if the lens focal length is not matched, the image will be blurry, appearing as green stripes that are too wide or too narrow, and the edges will be indistinct. Figure 4 As shown. Similar to the above situation, the boundary is not clear and the width differs significantly from the ideal width. (Based on rows) Figure 4 The corresponding grayscale value change should be represented by a wavy curve, such as... Figure 5 As shown.

[0072] In another optional embodiment, a beam splitter may be provided behind the lens of the image measuring instrument to separate the light source entering from the lens into a first optical path and a second optical path; wherein the first optical path is the normal measuring optical path and the second optical path is a focusing assist optical path for assisting focusing.

[0073] The first optical path and the second optical path contain the same image information. The first optical path is directly projected onto the measuring image sensor of the image measuring instrument. The measuring image sensor is used to capture an image of the object to be measured after focusing.

[0074] The second optical path passes through a beam splitter and reaches the focusing image sensor; the focusing image sensor is used to acquire the image of the pattern piece.

[0075] Based on the aforementioned autofocus device of the image measuring instrument, this invention further discloses an autofocus method for the image measuring instrument, wherein a beam splitting device is provided between the lens and the image sensor of the image measuring instrument, and the method includes:

[0076] Step 101: The image measuring instrument captures an image of the pattern piece.

[0077] In this embodiment of the invention, the pattern sheet has multiple stripes of different colors arranged alternately, and the position of the pattern sheet is the same as the position of the object to be measured. Furthermore, during the imaging process, the light emitted from the pattern sheet passes through a beam splitter so that only light of the corresponding color from the pattern sheet is projected into the image sensor.

[0078] Step 102: The image measuring instrument takes images of the pattern piece at different focal lengths. When the distribution of gray values ​​on the pattern piece corresponds to the stripes on the pattern piece, it indicates that the focal length is appropriate and focusing is complete.

[0079] As can be seen, the automatic focusing method of the image measuring instrument in this embodiment of the invention uses a patterned sheet with multiple stripes of alternating different colors to assist focusing. When the light from the patterned sheet passes through the beam splitter, only the light of the corresponding color is projected into the image sensor, thus improving image contrast. This ensures that only one color of light enters the sensor, and subsequent grayscale value processing and analysis are sufficient to obtain the grayscale value distribution, eliminating the need for further color information processing and saving computational load. Finally, the focusing result is determined by comparing the grayscale value distribution with the stripes on the patterned sheet. When the grayscale value distribution corresponds to the stripes on the patterned sheet, the focal length is suitable, and focusing is complete. The patterned sheet designed in this embodiment of the invention can cooperate with the beam splitter, and the focus success is determined by comparing the grayscale value distribution with the stripes on the patterned sheet, as proposed in this embodiment of the invention, thereby efficiently realizing the focusing process of the image measuring instrument.

[0080] In this embodiment of the invention, optionally, the pattern piece is positioned at the same location as the object to be tested. The pattern piece can be placed on the mounting position of the object to be tested, and a following device is provided. The following device is used to adjust the height of the pattern piece so that it is always at the same height as the surface of the object to be tested. In actual operation, the pattern piece can be made very small and thin, and will not significantly affect the detection of the object to be tested.

[0081] In an optional embodiment, the patterned sheet has multiple stripes of alternating first and second colors; a beam splitter is used to separate light with wavelengths exceeding a wavelength threshold from light with wavelengths not exceeding the wavelength threshold; the wavelength of the light corresponding to the first color exceeds the wavelength threshold, and the wavelength of the light corresponding to the second color does not exceed the wavelength threshold. For example, the first color is red, and the second color is green.

[0082] In another optional embodiment, the distribution of grayscale values ​​on the pattern image includes:

[0083] When the stripes on the pattern are not horizontal stripes, it represents the change in grayscale value of any pixel row in the image of the pattern.

[0084] When the stripes on the pattern are not vertical stripes, it represents the grayscale value changes of any pixel column in the image of the pattern.

[0085] The horizontal direction of the pattern piece corresponds to the pixel row on the pattern piece image, and the vertical direction of the pattern piece corresponds to the pixel column on the pattern piece image.

[0086] In this optional embodiment, when performing focus calculations, a row or column of pixel values ​​can be directly selected from the image, greatly reducing the computational load. However, not all pixel distributions in a row or column correspond to the stripes, because in practice, the pattern used for focusing can be very small, occupying only a small portion of the entire image. Therefore, the correspondence between stripes and pixel changes can refer to the correspondence between stripes and a portion of pixel changes within a pixel row or column.

[0087] Existing focusing calculations often require the entire image to calculate sharpness or perform other operations to achieve focusing, which is computationally intensive and the focusing speed may not meet requirements under certain circumstances. This is especially true for objects whose positions are constantly changing, where real-time high-precision focus tracking places high demands on the efficiency of focusing calculations. The embodiments of this invention can select only one or several rows of pixels to perform focusing calculations, which is highly efficient and can meet the needs of fast real-time focusing.

[0088] In this optional embodiment, the distribution of grayscale values ​​further optionally corresponds to the stripes on the pattern piece, including:

[0089] The grayscale value distribution includes the periodic changes in the pixel values ​​of a row or column of pixels. When the focal length is appropriate, the period of the periodic change corresponds to the stripe distribution period on the pattern. Furthermore, during the periodic changes, the gradient value of the pixel value changes from small to large or from large to small, which is greater than a set threshold.

[0090] In this embodiment of the invention, a beam splitting device is creatively designed between the lens and the image sensor of the image measuring instrument. This beam splitting device can filter out a portion of the stripes in the patterned image, so that the obtained image of the patterned image forms a more vivid contrast. When the focus is successful, it is only necessary to focus on whether the change in gray value is "steep" enough, that is, the gradient of the change in gray value is greater than a preset threshold. The focus judgment result can be obtained without focusing on the color and sharpness calculation results.

[0091] In yet another alternative embodiment, the patterned sheet has multiple vertical stripes of alternating first and second colors;

[0092] The beam splitter is used to separate the light source of the first color and the light source of the second color, so that the light source of the second color is projected onto the image sensor.

[0093] The distribution of grayscale values ​​corresponds to the stripes on the pattern, including: calculating the gradient value of the grayscale value in the horizontal direction of the pattern image as it changes from small to large or from large to small; if the gradient value is greater than a set threshold, the period of grayscale value change in the horizontal direction of the pattern image is the same as the period of change of the stripes on the pattern.

[0094] Corresponding to this optional embodiment, the vertical stripes can also be horizontal stripes. Those skilled in the art will understand that horizontal and vertical are only relative directions. Therefore, in yet another optional embodiment, the patterned sheet has multiple horizontal stripes of alternating first and second colors.

[0095] The beam splitter is used to separate the light source of the first color and the light source of the second color, and to project the light source of the second color onto the image sensor.

[0096] The distribution of grayscale values ​​corresponds to the stripes on the pattern piece, including: calculating the gradient value of the change in grayscale values ​​in the vertical direction of the image of the pattern piece as they change from small to large or from large to small; the gradient value of the change is greater than a set threshold, and the period of change of grayscale values ​​in the vertical direction of the image of the pattern piece is the same as the period of change of the stripes on the pattern.

[0097] In another alternative embodiment, the patterned sheet has multiple vertical or horizontal stripes of alternating first and second colors, and the widths of the vertical or horizontal stripes are equal.

[0098] The beam splitter is used to separate the light source of the first color and the light source of the second color, so that the light source of the second color is projected onto the image sensor.

[0099] The distribution of gray values ​​corresponds to the stripes on the pattern, including: using an edge detection algorithm to extract the edge positions on the image of the pattern where the gray values ​​change, and the width between adjacent edge positions is the same.

[0100] In this optional embodiment, the stripes are set to have equal widths. This simplifies the diagonal calculation process: existing edge detection algorithms are used to extract the edge positions on the pattern piece, and the accuracy of the edge positions can be adjusted by setting the edge detection algorithm. When the focus is inaccurate, the widths between adjacent edge positions are not the same; when the focus is accurate, the widths between edge positions are the same. Optionally, in this embodiment, the accuracy of the edge detection algorithm can be initially set to a relatively low value, at which point the focal length changes more rapidly or more broadly, thereby achieving rapid focus determination. When the widths between adjacent edge positions are relatively close, the focal length changes more slowly or more finely, at which point the accuracy of the edge detection algorithm is increased, thereby achieving more precise focus.

[0101] In yet another alternative embodiment, the patterned sheet has multiple vertical stripes of alternating first and second colors, the width of which is known.

[0102] The beam splitter is used to separate the light source of the first color and the light source of the second color, so that the light source of the second color is projected onto the image sensor.

[0103] Increase the sensor's exposure time until the stripes corresponding to the second color in the image acquired by the sensor are overexposed;

[0104] The distribution of grayscale values ​​corresponds to the stripes on the pattern piece, including:

[0105] When the stripes corresponding to the second color are overexposed, the stripes corresponding to the second color are bright stripes, and the stripes corresponding to the first color are dark stripes.

[0106] Set a grayscale threshold: pixels on bright lines have grayscale values ​​greater than the grayscale threshold, while pixels on dark lines have grayscale values ​​less than the grayscale threshold.

[0107] Calculate the length of dark striates of pixels with gray values ​​less than a gray value threshold and the length of bright striates of pixels with gray values ​​greater than a gray value threshold in the horizontal direction of the pattern image.

[0108] The lengths of the dark and light stripes correspond to the widths of the stripes on the pattern piece.

[0109] In this optional embodiment, overexposure is used to create a greater difference in grayscale values ​​between bright and dark stripes on the pattern image. Under overexposure, if the focus is off, the bright stripes will be very wide, or even the entire image will appear as a white, overexposed pattern. When the focus is accurate, the contrast between the bright and dark stripes is very sharp—one is overexposed, and the other is a dark stripe, facilitating the calculation of grayscale distribution. Focus is successful when the lengths of the dark and bright stripes correspond to the width of the stripes on the pattern.

[0110] The device embodiments described above are merely illustrative. The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules; that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0111] Through the detailed description of the above embodiments, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product, which can be stored in a computer-readable storage medium.

[0112] Finally, it should be noted that the above embodiments are merely preferred embodiments of the present invention and are only used to illustrate the technical solutions of the present invention, not to limit them. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. An automatic focusing method for an image measuring instrument, characterized in that, The image measuring instrument has a beam splitting device between its lens and the image sensor. The method includes: The image measuring instrument captures an image of a patterned sheet, which has multiple stripes of alternating first and second colors, and the position of the patterned sheet is the same as the position of the object to be measured. During the process of the image measuring instrument capturing an image of a pattern piece, the light emitted from the pattern piece passes through a beam splitter so that only the light of the corresponding color on the pattern piece is projected into the image sensor; wherein, the beam splitter is used to separate light whose wavelength exceeds a wavelength threshold from light whose wavelength does not exceed a wavelength threshold; the wavelength of the light corresponding to the first color exceeds the wavelength threshold, and the wavelength of the light corresponding to the second color does not exceed the wavelength threshold; The image measuring instrument captures images of the pattern piece at different focal lengths. When the distribution of gray values ​​in the image of the pattern piece corresponds to the stripes on the pattern piece, it indicates that the focal length is appropriate and focusing is complete. The distribution of grayscale values ​​on the image of the pattern piece includes: when the stripes on the pattern piece are non-horizontal stripes, the grayscale value changes of any pixel row on the image of the pattern piece, wherein the horizontal direction of the pattern piece corresponds to the pixel row on the image of the pattern piece.

2. The automatic focusing method of the image measuring instrument according to claim 1, characterized in that, The distribution of grayscale values ​​on the image of the pattern patch also includes: When the stripes on the pattern are non-vertical stripes, it represents the grayscale value change of any pixel column in the image of the pattern; The vertical direction of the pattern piece corresponds to the pixel column on the image of the pattern piece.

3. The automatic focusing method of the image measuring instrument according to claim 2, characterized in that, The distribution of the grayscale values ​​corresponds to the stripes on the pattern piece, including: The grayscale value distribution includes the periodic changes in the pixel value size in a row or column of pixels. When the focal length is appropriate, the period of the periodic change corresponds to the stripe distribution period on the pattern piece, and the gradient value of the change in the periodic change from small to large or from large to small is greater than a set threshold.

4. The autofocus method of the image measuring instrument according to claim 3, characterized in that, The patterned piece has multiple vertical stripes of alternating first and second colors; The beam splitter is used to separate the light source of the first color and the light source of the second color, and to project the light source of the second color onto the image sensor. The distribution of grayscale values ​​corresponds to the stripes on the pattern piece, including: calculating the gradient value of the grayscale values ​​in the horizontal direction of the image of the pattern piece as they change from small to large or from large to small; the gradient value is greater than a set threshold, and the period of change of grayscale values ​​in the horizontal direction of the image of the pattern piece is the same as the period of change of the stripes on the pattern piece.

5. The autofocus method of the image measuring instrument according to claim 3, characterized in that, The patterned piece has multiple horizontal stripes of alternating first and second colors; The beam splitter is used to separate the light source of the first color and the light source of the second color, and to project the light source of the second color onto the image sensor. The distribution of grayscale values ​​corresponds to the stripes on the pattern piece, including: calculating the gradient value of the change in grayscale values ​​in the vertical direction of the image of the pattern piece as they change from small to large or from large to small; the gradient value of the change is greater than a set threshold, and the period of change of grayscale values ​​in the vertical direction of the image of the pattern piece is the same as the period of change of the stripes on the pattern piece.

6. The autofocus method of the image measuring instrument according to any one of claims 4 or 5, characterized in that, The patterned piece has multiple vertical or horizontal stripes of equal width; The distribution of gray values ​​corresponds to the stripes on the pattern piece, and the method further includes: using an edge detection algorithm to extract the edge positions on the image of the pattern piece where the gray values ​​change, and the width between adjacent edge positions is the same.

7. The automatic focusing method of the image measuring instrument according to claim 3, characterized in that, The patterned piece has multiple vertical stripes of alternating first and second colors, and the width of the vertical stripes is known. The beam splitter is used to separate the light source of the first color and the light source of the second color, and to project the light source of the second color onto the image sensor. Increase the sensor's exposure time until the stripes corresponding to the second color in the image acquired by the sensor are overexposed; The distribution of the grayscale values ​​corresponds to the stripes on the pattern piece, including: When the stripes corresponding to the second color are overexposed, the stripes corresponding to the second color are bright stripes, and the stripes corresponding to the first color are dark stripes. A grayscale threshold is set, wherein the grayscale value of the pixels on the bright ridge is greater than the grayscale threshold, and the grayscale value of the pixels on the dark ridge is less than the grayscale threshold. Calculate the length of dark strides for pixels with gray values ​​less than a gray value threshold and the length of bright strides for pixels with gray values ​​greater than a gray value threshold in the horizontal direction of the image of the pattern patch. The lengths of the dark and light patterns correspond to the widths of the stripes on the pattern piece.

8. An automatic focusing device for an image measuring instrument, characterized in that, include: A beam splitter is installed between the lens and the image sensor of the image measuring instrument; The patterned sheet is placed on the mounting position of the object to be measured during the focusing process of the image measuring instrument; the patterned sheet has multiple stripes of alternating first and second colors; The light emitted from the pattern piece reaches the image sensor after passing through a beam splitter. The beam splitter ensures that only light of the corresponding color passes through the pattern piece. Specifically, the beam splitter is used to separate light with wavelengths exceeding a wavelength threshold from light with wavelengths not exceeding a wavelength threshold. The wavelength of the light corresponding to the first color exceeds the wavelength threshold, while the wavelength of the light corresponding to the second color does not exceed the wavelength threshold. The image measuring instrument captures images of the pattern piece at different focal lengths. When the distribution of gray values ​​in the image of the pattern piece corresponds to the stripes on the pattern piece, it indicates that the focal length is appropriate and focusing is complete. The distribution of grayscale values ​​on the image of the pattern piece includes: when the stripes on the pattern piece are non-horizontal stripes, the grayscale value changes of any pixel row on the image of the pattern piece, wherein the horizontal direction of the pattern piece corresponds to the pixel row on the image of the pattern piece.

9. The autofocus device of the image measuring instrument according to claim 8, characterized in that, The patterned piece has multiple vertical stripes of alternating first and second colors, and the width of the vertical stripes is equal. The beam splitter is used to separate the light source of the first color and the light source of the second color, and to project the light source of the second color onto the image sensor. The distribution of gray values ​​corresponds to the stripes on the pattern piece, including: using an edge detection algorithm to extract the edge positions on the pattern piece image where the gray values ​​change, and the width between adjacent edge positions is the same.

Citation Information

Patent Citations

  • Image measurement focusing system and method

    CN101782369A

  • Automatic focusing push-broom hyperspectral imaging method and device based on spectroscope

    CN115014521A

  • Focusing method and system

    CN111665617A

  • Calibration method of image measuring instrument

    CN114909994A