CN117252897B - Method, device, equipment and storage medium for extracting scratch foreground image of shaping mirror - Google Patents

Method, device, equipment and storage medium for extracting scratch foreground image of shaping mirror Download PDF

Info

Publication number
CN117252897B
CN117252897B CN202311534370.9A CN202311534370A CN117252897B CN 117252897 B CN117252897 B CN 117252897B CN 202311534370 A CN202311534370 A CN 202311534370A CN 117252897 B CN117252897 B CN 117252897B
Authority
CN
China
Prior art keywords
scratch
line segment
image
value
smaller
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202311534370.9A
Other languages
Chinese (zh)
Other versions
CN117252897A (en
Inventor
陈晓琴
杨晓艳
叶青
刘寅
李丽华
李树茂
张海彤
张传丽
郭星艺
丁飞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tianjin Eye Hospital Optometry Center Co ltd
Original Assignee
Tianjin Eye Hospital Optometry Center Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tianjin Eye Hospital Optometry Center Co ltd filed Critical Tianjin Eye Hospital Optometry Center Co ltd
Priority to CN202311534370.9A priority Critical patent/CN117252897B/en
Publication of CN117252897A publication Critical patent/CN117252897A/en
Application granted granted Critical
Publication of CN117252897B publication Critical patent/CN117252897B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/194Segmentation; Edge detection involving foreground-background segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/22Image preprocessing by selection of a specific region containing or referencing a pattern; Locating or processing of specific regions to guide the detection or recognition
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/46Descriptors for shape, contour or point-related descriptors, e.g. scale invariant feature transform [SIFT] or bags of words [BoW]; Salient regional features
    • G06V10/462Salient features, e.g. scale invariant feature transforms [SIFT]

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Multimedia (AREA)
  • Image Analysis (AREA)

Abstract

The embodiment of the invention discloses a method, a device, equipment and a storage medium for extracting a scratch foreground image of a shaping mirror, wherein the method comprises the following steps: obtaining a multi-exposure scratch image of the shaping mirror; selecting a pixel point, generating a reference line segment for the pixel point according to a neighborhood of a set angle, respectively establishing a parallel auxiliary judgment line segment at preset distances of the left side and the right side of the reference line segment when the gray value average value of at least one reference line segment is not smaller than a set first reference threshold value, and respectively calculating to obtain the gray value average value of each auxiliary judgment line segment; when the difference value of the gray value mean value of the two auxiliary judging line segments is not smaller than a preset third reference threshold value, and when the difference value of the gray value mean value of the reference line segments and each auxiliary judging line segment is smaller than a preset fourth reference threshold value, determining the pixel point as a scratch point; and returning to the step of selecting the pixel points until all the pixel points are traversed, and generating a scratch foreground image according to the scratch points.

Description

Method, device, equipment and storage medium for extracting scratch foreground image of shaping mirror
Technical Field
The invention relates to the technical field of foreground image extraction, in particular to a method, a device, equipment and a storage medium for extracting a scratch foreground image of a shaping mirror.
Background
The foreground image is typically the region of interest in the image, which together with the background forms a complete image. In the image processing and recognition, the accurate foreground image is obtained, so that the accurate recognition of the target can be realized, and the subsequent processing is convenient. At present, a watershed method is generally adopted to extract the foreground in the image. The core idea is to distinguish the foreground image and the background image by using the difference of pixel gray values of the foreground image and the background image through a set reasonable threshold value.
In the process of realizing the invention, the inventor finds the following technical problems: although the watershed method can obtain good foreground extraction effect on the conventional image, the watershed method cannot be applied to the scratch extraction of some special images, such as a shaping mirror. Because scratches of the shaping mirror are difficult to show under conventional light, the scratches can be visually displayed by irradiation of an external strong light source. However, because the cornea shaping lens has small area and large curvature, and has different curvatures at different arc sections, under the irradiation of strong light source, light reflection and refraction with different degrees are easy to generate, and the gray value of the area is changed. And because the cornea shaping lens is directly contacted with human eyes, organic substances such as proteins and the like can be inevitably accumulated on the surface of the cornea shaping lens. The gray value of the area is easy to change due to the irradiation of the organic substances by a strong light source, so that the foreground images of scratches cannot be accurately extracted by the watershed method.
Disclosure of Invention
The embodiment of the invention provides a method, a device, equipment and a storage medium for extracting a scratch foreground image of a shaping mirror, which are used for solving the technical problem that the scratch foreground image cannot be accurately extracted in the prior art.
In a first aspect, an embodiment of the present invention provides a method for extracting a scratch foreground image of a shaping lens, including:
obtaining a multi-exposure scratch image of the shaping mirror;
selecting a pixel point in the multi-exposure scratch image of the shaping mirror, generating reference line segments for the pixel point according to a neighborhood of a set angle, and calculating the gray value average value of each reference line segment;
when the gray value average value of at least one reference line segment is not smaller than a set first reference threshold value, respectively establishing a parallel auxiliary judgment line segment for the preset distance of the left side and the right side of the at least one existing reference line segment, wherein the length of the parallel auxiliary judgment line segment is the same as that of the corresponding reference line segment;
respectively calculating to obtain the gray value average value of each auxiliary judging line segment, and judging whether the gray value average value of each auxiliary judging line segment is not smaller than a set second reference threshold value;
when the gray value average value difference value of the two auxiliary judging line segments is not smaller than the set second reference threshold value, calculating the gray value average value difference value of the two auxiliary judging line segments and the gray value average value difference value of the at least one reference line segment and each auxiliary judging line segment;
When the difference value of the gray value mean values of the two auxiliary judging line segments is smaller than a preset third reference threshold value, and the difference value of the gray value mean value of each auxiliary judging line segment and the at least one reference line segment is smaller than a preset fourth reference threshold value, determining the pixel point as a scratch point;
and returning to the step of selecting one pixel point in the multi-exposure scratch image of the shaping mirror until all pixel points are traversed, and generating a scratch foreground image according to the determination result of the scratch points.
In a second aspect, an embodiment of the present invention further provides a device for extracting a scratch foreground image of a shaping mirror, including:
the acquisition module is used for acquiring the multi-exposure scratch image of the shaping mirror;
the selecting module is used for selecting one pixel point in the multi-exposure scratch image of the shaping mirror, generating reference line segments for the pixel point according to a preset angle neighborhood, and calculating the gray value average value of each reference line segment;
the establishing module is used for respectively establishing a parallel auxiliary judging line segment for the preset distance of the left side and the right side of the existing at least one reference line segment when the gray value average value of the at least one reference line segment is not smaller than a set first reference threshold value, and the length of the parallel auxiliary judging line segment is the same as that of the corresponding reference line segment;
The judging module is used for respectively calculating and obtaining the gray value average value of each auxiliary judging line segment and judging whether the gray value average value of each auxiliary judging line segment is not smaller than a set second reference threshold value;
the calculation module is used for calculating the difference value of the gray value mean value of the two auxiliary judgment line segments and the difference value of the gray value mean value of the at least one reference line segment and each auxiliary judgment line segment when the difference value is not smaller than the set second reference threshold value;
the determining module is used for determining the pixel point as a scratch point when the difference value of the gray value average value of the two auxiliary judging line segments is smaller than a preset third reference threshold value and the difference value of the gray value average value of the at least one reference line segment and each auxiliary judging line segment is smaller than a preset fourth reference threshold value;
and the generating module is used for returning to the step of selecting one pixel point in the multi-exposure scratch image of the shaping mirror until all the pixel points are traversed, and generating a scratch foreground image according to the determined result of the scratch points.
In a third aspect, an embodiment of the present invention further provides an apparatus, including:
one or more processors;
storage means for storing one or more programs,
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method for extracting a shaped mirror scratch foreground image as provided in the above embodiments.
In a fourth aspect, embodiments of the present invention also provide a storage medium containing computer-executable instructions, which when executed by a computer processor, are configured to perform the method for extracting a shaped mirror scratch foreground image as provided in the above embodiments.
The embodiment of the invention provides a method, a device, equipment and a storage medium for extracting a scratch foreground image of a shaping lens, which are used for acquiring a multi-exposure scratch image of the shaping lens; selecting a pixel point in the multi-exposure scratch image of the shaping mirror, generating reference line segments for the pixel point according to a neighborhood of a set angle, and calculating the gray value average value of each reference line segment; when the gray value average value of at least one reference line segment is not smaller than a set first reference threshold value, respectively establishing a parallel auxiliary judgment line segment for the preset distance of the left side and the right side of the at least one existing reference line segment, wherein the length of the parallel auxiliary judgment line segment is the same as that of the corresponding reference line segment; respectively calculating to obtain the gray value average value of each auxiliary judging line segment, and judging whether the gray value average value of each auxiliary judging line segment is not smaller than a set second reference threshold value; when the gray value average value difference value of the two auxiliary judging line segments is not smaller than the set second reference threshold value, calculating the gray value average value difference value of the two auxiliary judging line segments and the gray value average value difference value of the at least one reference line segment and each auxiliary judging line segment; when the difference value of the gray value mean values of the two auxiliary judging line segments is smaller than a preset third reference threshold value, and the difference value of the gray value mean value of each auxiliary judging line segment and the at least one reference line segment is smaller than a preset fourth reference threshold value, determining the pixel point as a scratch point; and returning to the step of selecting one pixel point in the multi-exposure scratch image of the shaping mirror until all pixel points are traversed, and generating a scratch foreground image according to the determination result of the scratch points. By utilizing the characteristics of the scratch image, whether the pixel point is a scratch can be accurately determined by setting the reference line and the auxiliary line and comprehensively judging the pixel gray values on the reference line and the auxiliary line. By using the method, the scratch foreground image can be accurately extracted from the shaping mirror image.
Drawings
Other features, objects and advantages of the present invention will become more apparent upon reading of the detailed description of non-limiting embodiments, made with reference to the accompanying drawings in which:
fig. 1 is a schematic flow chart of a method for extracting a scratch foreground image of a shaping lens according to an embodiment of the present invention;
fig. 2 is a schematic flow chart of a method for extracting a scratch foreground image of a shaping lens according to a second embodiment of the present invention;
fig. 3 is a schematic flow chart of a method for extracting a scratch foreground image of a shaping lens according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of a device for extracting a scratch foreground image of a shaping lens according to a fourth embodiment of the present invention;
fig. 5 is a block diagram of an apparatus according to a fifth embodiment of the present invention.
Detailed Description
The invention is described in further detail below with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting thereof. It should be further noted that, for convenience of description, only some, but not all of the structures related to the present invention are shown in the drawings.
Example 1
Fig. 1 is a flowchart of a method for extracting a scratch foreground image of a shaping lens according to an embodiment of the present invention, where the method may be performed by a device for extracting a scratch foreground image of a shaping lens, and specifically includes the following steps:
Step 110, a multi-exposure scratch image of the shaping lens is obtained, a pixel point in the multi-exposure scratch image of the shaping lens is selected, a reference line segment is generated for the pixel point according to a preset angle neighborhood, and the gray value average value of each reference line segment is calculated.
In this embodiment, one pixel point may be selected from the multi-exposure scratch image of the shaping lens, or an area where scratches occur most often in the shaping lens may be selected empirically, for example, a preset range corresponding to a position with the highest curvature, and one pixel point may be selected in this range. Starting from the pixel point, generating a reference line segment according to the neighborhood of the set angle. For each pixel point, consider 8 directionsThe angles are 0 degrees, 45 degrees, 90 degrees and 135 degrees respectively, and each straight line represents two directions. Calculating the sum of adjacent line segments with preset lengths in each directionThe average value of gray scale of each pixel point is recorded as I 0 . Alternatively, the angle of the direction may be selected according to different situations, and the angle is not limited herein.
And 120, when the gray value average value of at least one reference line segment is not smaller than the set first reference threshold value, respectively establishing a parallel auxiliary judgment line segment for the preset distance of the left side and the right side of the at least one existing reference line segment, wherein the length of the parallel auxiliary judgment line segment is the same as that of the corresponding reference line segment.
In this embodiment, since the scratch gradation value is different from the non-scratch gradation value, the scratch gradation value is larger than the non-scratch gradation value. And the gray values are different due to the different shaping mirrors. Therefore, the set first reference threshold value can be used for referencing the whole gray value setting of the shaping mirror. For example, the set first reference threshold value may be set to be increased by a preset value on the basis of the overall gray value of the shaping mirror as the first reference threshold value.
Since the scratch has a certain width, the error judgment caused by the overlarge difference between some single points and the surrounding gray values can be avoided, and the scratch can be considered to be parallel to and spaced from the surrounding gray valuesThe line segments of the pixels are all +.>And each pixel point is formed. Two groups of such line segments are arranged in each direction, and the gray average value is respectively recorded as +.>And->
And 130, respectively calculating the gray value average value of each auxiliary judgment line segment, and judging whether the gray value average value of each auxiliary judgment line segment is not smaller than a set second reference threshold value.
Two groups of auxiliary line segments in each direction are arranged, the number of pixels is consistent, and the average gray level is respectively recorded as I 1 And I 2 . And judging whether the gray value mean value of each auxiliary judging line segment is not smaller than a set second reference threshold value or not.
In consideration of the distribution of the scratches around the surface of the plastic mirror, the second reference threshold may be increased by a predetermined value based on the overall gray value of the plastic mirror, the increased value being smaller than the predetermined value corresponding to the first reference threshold.
And 140, calculating the difference value of the gray value mean value of the two auxiliary judging line segments and the difference value of the gray value mean value of the at least one reference line segment and each auxiliary judging line segment when the gray value mean value is not smaller than the set second reference threshold value.
Considering the image characteristics of the scratch, the scratch should have a gradient in a normal line perpendicular to the scratch direction. The selected pixel point is assumed to be a point on the scratch.And->Or->There should be a certain difference. While taking into account that the scratch is not too wide in the normal to the perpendicular scratch direction. If the center pixel point is the point on the scratch, < >>And->The difference between them should not be too large. I.e. the scratch cannot be too wide in the normal to the perpendicular scratch direction.
And step 150, determining the pixel point as a scratch point when the difference value of the gray value mean value of the two auxiliary judging line segments is smaller than a preset third reference threshold value and the difference value of the gray value mean value of the at least one reference line segment and each auxiliary judging line segment is smaller than a preset fourth reference threshold value.
Judging whether the difference value of the gray value mean values of the two auxiliary judging line segments is smaller than a preset third reference threshold value, namelyAnd (3) withWhether the difference between them is smaller than a preset third reference threshold value, and +.>And->Or->And determining whether the difference value is smaller than a fourth reference threshold value or not, and determining that the selected pixel point is a scratch point when the condition is met. The third and fourth reference thresholds may be empirically set.
And 160, returning to the step of selecting one pixel point in the multi-exposure scratch image of the shaping mirror until all pixel points are traversed, and generating a scratch foreground image according to the determined result of the scratch points.
By adopting the method, each pixel point of the multi-exposure scratch image of the shaping lens is sequentially traversed and selected, and the pixel points meeting the conditions are set as foreground pixel points, so that the pixel points are considered to be potential scratches; the rest of the pixels are set as the background. And the foreground and background separation of scratch images is realized.
The embodiment obtains the multi-exposure scratch image of the shaping mirror; selecting a pixel point in the multi-exposure scratch image of the shaping mirror, generating reference line segments for the pixel point according to a neighborhood of a set angle, and calculating the gray value average value of each reference line segment; when the gray value average value of at least one reference line segment is not smaller than a set first reference threshold value, respectively establishing a parallel auxiliary judgment line segment for the preset distance of the left side and the right side of the at least one existing reference line segment, wherein the length of the parallel auxiliary judgment line segment is the same as that of the corresponding reference line segment; respectively calculating to obtain the gray value average value of each auxiliary judging line segment, and judging whether the gray value average value of each auxiliary judging line segment is not smaller than a set second reference threshold value; when the gray value average value difference value of the two auxiliary judging line segments is not smaller than the set second reference threshold value, calculating the gray value average value difference value of the two auxiliary judging line segments and the gray value average value difference value of the at least one reference line segment and each auxiliary judging line segment; when the difference value of the gray value mean values of the two auxiliary judging line segments is smaller than a preset third reference threshold value, and the difference value of the gray value mean value of each auxiliary judging line segment and the at least one reference line segment is smaller than a preset fourth reference threshold value, determining the pixel point as a scratch point; and returning to the step of selecting one pixel point in the multi-exposure scratch image of the shaping mirror until all pixel points are traversed, and generating a scratch foreground image according to the determination result of the scratch points. By utilizing the characteristics of the scratch image, whether the pixel point is a scratch can be accurately determined by setting the reference line and the auxiliary line and comprehensively judging the pixel gray values on the reference line and the auxiliary line. By using the method, the scratch foreground image can be accurately extracted from the shaping mirror image.
Example two
Fig. 2 is a schematic flow chart of a method for extracting a scratch foreground image of a shaping lens according to a second embodiment of the present invention, where the method is optimized based on the foregoing embodiment, and the method for obtaining a multi-exposure scratch image of a shaping lens is specifically optimized as follows: performing feature detection on the images of the plurality of exposure scratches to obtain feature descriptors of each multi-focus image; obtaining a definition descriptor of each scratch image according to the feature descriptor of each multi-focus image; using an s multiplied by s sliding window to traverse the same area of each scratch image at the same time, and when the sum of definition descriptors in the sliding window of one scratch image is larger than the sum of definition descriptors of any other scratch image, adjusting up the weight values of all pixel points in the sliding window; according to the adjusted pixel point weight value, determining clear points, fuzzy points and uncertain points in the image; and splicing the plurality of scratch images according to the preset proportion of the clear point, the fuzzy point and the uncertain point to obtain the multi-exposure scratch image of the shaping mirror. Referring to fig. 2, the method for extracting the scratch foreground image of the shaping mirror comprises the following steps:
and 210, performing feature detection on the images of the plurality of exposure scratches to obtain feature descriptors of each multi-focus image, and obtaining definition descriptors of each scratch image according to the feature descriptors of each multi-focus image.
In the present embodiment, the curved surface characteristics of the shaping mirror are taken into consideration, and therefore, a plurality of images need to be acquired. After a plurality of images with different angles are acquired, the images are spliced, in this embodiment, a characteristic descriptor of each multi-focus image of the same cornea shaping mirror is obtained by adopting Dense SIFT characteristic detection, and the multidimensional characteristic around each pixel point in the image can be reflected by using the descriptor.
After the feature descriptors are obtained, the definition descriptors of each scratch image can be obtained by calculation by using the feature descriptors. Illustratively, a window size may be selected asDividing the window into +.>Units each having k gradient directions, thus generating +.>Feature descriptors of dimensions. />The sum and average of the dimensions of the feature descriptors of the dimensions can be used as a description of the definition of the image.
And 220, traversing the same area of each scratch image simultaneously by using an s multiplied by s sliding window, and when the sum of definition descriptors in the sliding window of one scratch image is larger than the sum of definition descriptors of any other scratch image, adjusting up the weight values of all pixel points in the sliding window.
For example, two weight maps of all 0's can be generated first The size is the same as that of images a, B. The size is +.>The sum of all definition descriptors in the sliding window in A, B is respectively denoted as. If->Then at +.>All pixel point weights in the corresponding window of (1) are +1, otherwise +.>The corresponding pixel point weights in the window are +1. Finally obtaining two complete weight graphs, wherein the gray value of each pixel point is marked as +.>,/>And gives the images a, B final weights according to the following formula:
only the value in a pixelS is>If the value of (2) is 0, the pixel is considered to be completely clear in the graph A, and the point weight is given to the graph A as 1. Likewise, only->The value of (2) is 0, (-)>If the value of (a) is s, the pixel is considered to be completely blurred in the image A, and the point weight is 0 in the image A. In other cases, the point was considered to be in a clear and fuzzy transition, and was given a weight of 0.5. And for each pixel point, carrying out weighted average on the gray values of the pixel points at the corresponding positions of the scratch graphs according to the normalized weight, and taking the obtained result as the gray value of the pixel point after splicing. Therefore, fusion of the multi-focus scratch images is realized, and a globally clear scratch image is obtained.
And 230, determining clear points, fuzzy points and uncertain points in the image according to the adjusted pixel point weight values, and splicing a plurality of scratch images according to the preset proportion of the clear points, the fuzzy points and the uncertain points to obtain the multi-exposure scratch image of the shaping mirror.
And for each pixel point, carrying out weighted average on the gray values of the pixel points at the corresponding positions of the scratch graphs according to the normalized weight, and taking the obtained result as the gray value of the pixel point after splicing. Therefore, fusion of the multi-focus scratch images is realized, and a globally clear scratch image is obtained.
Step 240, selecting a pixel point in the multi-exposure scratch image of the shaping mirror, generating reference line segments for the pixel point according to a preset angle neighborhood, and calculating the gray value average value of each reference line segment.
Step 250, when the gray value average value of at least one reference line segment is not less than the set first reference threshold value, respectively establishing a parallel auxiliary judgment line segment for the preset distance of the left side and the right side of the at least one existing reference line segment, wherein the length of the parallel auxiliary judgment line segment is the same as that of the corresponding reference line segment.
Step 260, respectively calculating to obtain the gray value average value of each auxiliary judgment line segment, and judging whether the gray value average value of each auxiliary judgment line segment is not smaller than a set second reference threshold value;
step 270, calculating the difference value of the gray value mean value of the two auxiliary judgment line segments and the difference value of the gray value mean value of the at least one reference line segment and each auxiliary judgment line segment when the gray value mean value is not smaller than the set second reference threshold value;
Step 280, when the difference value of the gray value mean value of the two auxiliary judging line segments is smaller than a preset third reference threshold value, and the difference value of the gray value mean value of the at least one reference line segment and each auxiliary judging line segment is smaller than a preset fourth reference threshold value, determining the pixel point as a scratch point;
and step 290, returning to the step of selecting one pixel point in the multi-exposure scratch image of the shaping mirror until all pixel points are traversed, and generating a scratch foreground image according to the determined result of the scratch points.
The embodiment specifically optimizes the obtained multi-exposure scratch image of the shaping mirror: performing feature detection on the images of the plurality of exposure scratches to obtain feature descriptors of each multi-focus image; obtaining a definition descriptor of each scratch image according to the feature descriptor of each multi-focus image; using an s multiplied by s sliding window to traverse the same area of each scratch image at the same time, and when the sum of definition descriptors in the sliding window of one scratch image is larger than the sum of definition descriptors of any other scratch image, adjusting up the weight values of all pixel points in the sliding window; according to the adjusted pixel point weight value, determining clear points, fuzzy points and uncertain points in the image; and splicing the plurality of scratch images according to the preset proportion of the clear point, the fuzzy point and the uncertain point to obtain the multi-exposure scratch image of the shaping mirror. By means of the method, the fact that a plurality of scratch images can be fused under the condition that clear features are fully reserved can be guaranteed, and the features of scratches in the images under different irradiation angles are effectively improved. The accuracy of scratch foreground image extraction is further improved.
In a preferred implementation of this embodiment, the acquiring the multi-exposure scratch image of the shaping lens may further include:
the diaphragm is used as an objective table, the inner surface of the cornea shaping lens is upwards placed at the position of a diaphragm aperture, only a small hole with adjustable center size can transmit light beams, the rest positions are not light-transmitting, and the aperture diameter of the diaphragm aperture is slightly smaller than the diameter of the cornea shaping lens; the annular LED is used as a light source to illuminate in a transmission mode, the center of the diaphragm is a point O, a point M, N is an objective lens and any point on the edge of the annular LED respectively, and the angle between OM and the optical axis isThe included angle between ON and the optical axis is->,/>The method comprises the steps of carrying out a first treatment on the surface of the And controlling the diaphragm platform to move a preset distance by utilizing a motor to obtain a plurality of multi-focus scratch images with different clear areas. By using the mode, the multi-exposure scratch images of the shaping mirror which fully embody the scratch images can be obtained at different angles.
Example III
Fig. 3 is a schematic flow chart of a method for extracting a scratch foreground image of a shaping lens according to a third embodiment of the present invention, where the method is optimized based on the above embodiment, and specifically the method may further include the following steps: performing binarization conversion on the multi-exposure scratch image of the shaping lens for distinguishing the foreground and the background, and performing straight line segment detection on the image subjected to the binarization conversion by using an FLD algorithm to obtain a plurality of detected straight line segments; randomly selecting one of the straight line segments, and calculating an included angle theta between the straight line segment and the adjacent straight line segment, a distance d between the midpoint of the straight line segment and the adjacent straight line segment, and a minimum distance g between the end point of the straight line segment and the adjacent straight line segment; when the included angle theta is smaller than a preset angle threshold value, the distance d is smaller than a preset distance threshold value, and the minimum distance g is smaller than a preset minimum distance threshold value, the straight line segments and the adjacent straight line segments are set to be the same group of straight line segments; returning to the step of randomly selecting one of the straight line segments until all the straight line segments are traversed; the scratch area of interest is set according to the grouping.
Referring to fig. 3, the method for extracting the scratch foreground image of the shaping mirror comprises the following steps:
step 310, obtaining a multi-exposure scratch image of a shaping lens, selecting a pixel point in the multi-exposure scratch image of the shaping lens, generating reference line segments for the pixel point according to a preset angle neighborhood, and calculating the gray value average value of each reference line segment;
step 320, when the gray value average value of at least one reference line segment is not less than the set first reference threshold value, respectively establishing a parallel auxiliary judgment line segment for the preset distance of the left side and the right side of the at least one existing reference line segment, where the length of the parallel auxiliary judgment line segment is the same as the length of the corresponding reference line segment.
Step 330, respectively calculating the gray value average value of each auxiliary judgment line segment, and judging whether the gray value average value of each auxiliary judgment line segment is not smaller than a set second reference threshold value.
And 340, calculating the difference value of the gray value mean value of the two auxiliary judging line segments and the difference value of the gray value mean value of the at least one reference line segment and each auxiliary judging line segment when the gray value mean value is not smaller than the set second reference threshold value.
And 350, determining the pixel point as a scratch point when the difference value of the gray value mean value of the two auxiliary judging line segments is smaller than a preset third reference threshold value and the difference value of the gray value mean value of the at least one reference line segment and each auxiliary judging line segment is smaller than a preset fourth reference threshold value.
And 360, returning to the step of selecting one pixel point in the multi-exposure scratch image of the shaping mirror until all pixel points are traversed, and generating a scratch foreground image according to the determined result of the scratch points.
And 370, performing binarization conversion on the multi-exposure scratch image of the shaping lens for distinguishing the foreground and the background, and performing straight line segment detection on the image subjected to the binarization conversion by using an FLD algorithm to obtain a plurality of detected straight line segments.
After the scratch foreground image is obtained, the scratch image is also required to be processed so as to obtain a complete scratch for a doctor to refer to, and the usability of the shaping mirror is evaluated. Therefore, the multi-exposure scratch image of the shaping mirror for distinguishing the foreground and the background needs to be subjected to binarization conversion, so that the distinguishing characteristics of the foreground and the background are further enhanced. Because the extracted scratch foreground image still has the possibility of interruption, after the binarization detection is carried out, the FLD algorithm can be utilized to carry out straight line segment detection on the image after the binarization conversion, and a plurality of straight line segments after the detection are obtained.
Step 380, randomly selecting one of the straight line segments, and calculating an included angle theta between the straight line segment and the adjacent straight line segment, a distance d between the midpoint of the straight line segment and the adjacent straight line segment, and a minimum distance g between the end point of the straight line segment and the adjacent straight line segment; and when the included angle theta is smaller than a preset angle threshold value, the distance d is smaller than a preset distance threshold value, and the minimum distance g is smaller than a preset minimum distance threshold value, setting the straight line segment and the adjacent straight line segment as the same group of straight line segments.
The types of scratches on the cornea shaping lens are roughly classified as follows: ideally long scratches, long scratches broken into several sections of medium-length scratches, long scratches broken into many short scratches, impurities introduced around the long scratches as interference, and impurities introduced around the break points as interference. Impurities are introduced around the break point as a disturbance. Therefore, it is necessary to determine whether the straight line segment is caused by the same scratch.
Grouping the obtained straight line segments. Each group contains a plurality of straight line segments, representing a long scratch, which can be broken or continuous. The basis of the grouping is the following three points: the included angle theta between the line segments, the distance d from the midpoint of one line segment to the other line segment, and the minimum value g of the breakpoint distance of the two line segments. First randomly selecting a line segmentAs an initial line segment, reference group O. Traversing all ungrouped line segments, and constructing all line segments satisfying the following formula in the Nth traversal>Will->All line segments in the line are marked with the number group N and are respectively marked as +.>,
Step 390, returning to a step of randomly selecting one of the straight line segments until all the straight line segments are traversed, and setting a scratch interest area according to the grouping.
The above steps of traversing are repeated until all segments have unique labels. Note that the first Go through->Is only equal to ++of the just-advanced group>The conditions in the above equation are determined, not with all the line segments in the group. And sets the line segments of the same group as a scratch area of interest.
The embodiment adds the following steps: performing binarization conversion on the multi-exposure scratch image of the shaping lens for distinguishing the foreground and the background, and performing straight line segment detection on the image subjected to the binarization conversion by using an FLD algorithm to obtain a plurality of detected straight line segments; randomly selecting one of the straight line segments, and calculating an included angle theta between the straight line segment and the adjacent straight line segment, a distance d between the midpoint of the straight line segment and the adjacent straight line segment, and a minimum distance g between the end point of the straight line segment and the adjacent straight line segment; when the included angle theta is smaller than a preset angle threshold value, the distance d is smaller than a preset distance threshold value, and the minimum distance g is smaller than a preset minimum distance threshold value, the straight line segments and the adjacent straight line segments are set to be the same group of straight line segments; returning to the step of randomly selecting one of the straight line segments until all the straight line segments are traversed; the scratch area of interest is set according to the grouping. The scratch foreground image can be further processed, so that scratches can be divided, and more scratch information can be obtained.
In a preferred implementation of this embodiment, the method may further comprise the steps of: performing polynomial fitting on all straight line segments in each scratch interest area to obtain fitted scratches; and marking the scratch detection result of the fitted scratch image in the multi-exposure scratch image of the shaping mirror according to the gray value of the corresponding position in the original image. And the method may further comprise the steps of, prior to said obtaining the fitted score: performing preliminary fitting on line segments in the region by using an RANCAS algorithm to remove the influence of outer points; correspondingly, performing polynomial fitting on all straight line segments in the region in each scratch interest region, and specifically optimizing: polynomial fitting is performed on all straight line segments in each scratch interest region except for the outer points. And carrying out RANSAC scratch fitting on the scratch interest region. For a set of data points P, a subset S of n points is randomly selected 1 Instantiating model M 1 Model parameters are calculated. Then screening from P that the model M is satisfied within a certain error range e 1 Point set S of (2) * 1 . If point set S * 1 If the number of the elements is greater than the threshold t, S is used * 1 Calculating a new model M * 1 . Otherwise, the subset S of n points is reselected 2 The above steps are repeated. If after N cycles no suitable subset S and corresponding model M is found, the model fails. Polynomial fitting based on least square method is selected as an initial model to find the optimal subset S optimal And best model M optimal . Will S optimal Press M in (3) pt mal And (5) drawing to obtain a scratch fitting graph. After each red line of the scratch fitting image is obtainedNumber of pixel pointsThereafter, the relative length of the scratch is given according to the image resolution by>And coverage of scratches->. Wherein->Is the average width of the scratches.
And marking the fitted scratch as a final detection result in a globally clear scratch image according to the gray level of the original image, so as to realize result visualization. The brighter the scratch indicates the deeper the scratch. Through the mode, a visual scratch image can be obtained in the image, and information such as the depth and the width of the scratch can be determined, so that a doctor can evaluate the scratch influence conveniently.
Example IV
Fig. 4 is a schematic structural diagram of a device for extracting a scratch foreground image of a shaping lens according to a fourth embodiment of the present invention, referring to fig. 4, the device for extracting a scratch foreground image of a shaping lens includes:
An acquisition module 410, configured to acquire a multi-exposure scratch image of the shaping lens;
the selecting module 420 is configured to select one pixel point in the multi-exposure scratch image of the shaping lens, generate reference line segments for the pixel point according to a preset angle neighborhood, and calculate a gray value average value of each reference line segment;
the establishing module 430 is configured to establish a parallel auxiliary judging line segment for each of the left and right preset distances of the at least one existing reference line segment when the gray value average value of the at least one reference line segment is not less than the set first reference threshold, where the length of the parallel auxiliary judging line segment is the same as that of the corresponding reference line segment;
the judging module 440 is configured to calculate a gray value average value of each auxiliary judging line segment, and judge whether the gray value average value of each auxiliary judging line segment is not less than a set second reference threshold value;
the calculating module 450 is configured to calculate a difference value of the gray value average values of the two auxiliary judging line segments and a difference value of the gray value average value of the at least one reference line segment and each auxiliary judging line segment when the difference value is not smaller than the set second reference threshold value;
a determining module 460, configured to determine that the pixel point is a scratch point when a difference value of the gray value average values of the two auxiliary judging line segments is smaller than a preset third reference threshold value, and a difference value of the gray value average value of the at least one reference line segment and each auxiliary judging line segment is smaller than a preset fourth reference threshold value;
And the generating module 470 is configured to return to the step of selecting one pixel point in the multi-exposure scratch image of the shaping lens until all the pixel points are traversed, and generate a scratch foreground image according to the determination result of the scratch point.
The device for extracting the scratch foreground image of the shaping mirror provided by the embodiment obtains a multi-exposure scratch image of the shaping mirror; selecting a pixel point in the multi-exposure scratch image of the shaping mirror, generating reference line segments for the pixel point according to a neighborhood of a set angle, and calculating the gray value average value of each reference line segment; when the gray value average value of at least one reference line segment is not smaller than a set first reference threshold value, respectively establishing a parallel auxiliary judgment line segment for the preset distance of the left side and the right side of the at least one existing reference line segment, wherein the length of the parallel auxiliary judgment line segment is the same as that of the corresponding reference line segment; respectively calculating to obtain the gray value average value of each auxiliary judging line segment, and judging whether the gray value average value of each auxiliary judging line segment is not smaller than a set second reference threshold value; when the gray value average value difference value of the two auxiliary judging line segments is not smaller than the set second reference threshold value, calculating the gray value average value difference value of the two auxiliary judging line segments and the gray value average value difference value of the at least one reference line segment and each auxiliary judging line segment; when the difference value of the gray value mean values of the two auxiliary judging line segments is smaller than a preset third reference threshold value, and the difference value of the gray value mean value of each auxiliary judging line segment and the at least one reference line segment is smaller than a preset fourth reference threshold value, determining the pixel point as a scratch point; and returning to the step of selecting one pixel point in the multi-exposure scratch image of the shaping mirror until all pixel points are traversed, and generating a scratch foreground image according to the determination result of the scratch points. By utilizing the characteristics of the scratch image, whether the pixel point is a scratch can be accurately determined by setting the reference line and the auxiliary line and comprehensively judging the pixel gray values on the reference line and the auxiliary line. By using the method, the scratch foreground image can be accurately extracted from the shaping mirror image.
On the basis of the above embodiments, the device further includes:
the conversion module is used for carrying out binarization conversion on the multi-exposure scratch image of the shaping lens for distinguishing the foreground and the background, and carrying out straight line segment detection on the image after the binarization conversion by using an FLD algorithm to obtain a plurality of detected straight line segments;
the random selection module is used for randomly selecting one of the straight line segments, and calculating an included angle theta between the straight line segment and the adjacent straight line segment, a distance d from the midpoint of the straight line segment to the adjacent straight line segment and a minimum distance g between the end point of the straight line segment and the adjacent straight line segment;
the same group setting module is used for setting the straight line segment and the adjacent straight line segment into the same group of straight line segments when the included angle theta is smaller than a preset angle threshold value, the distance d is smaller than a preset distance threshold value and the minimum distance g is smaller than a preset minimum distance threshold value;
the traversing module is used for returning to the step of randomly selecting one of the straight line segments until all the straight line segments are traversed;
and the setting module is used for setting the scratch interest area according to the grouping.
On the basis of the above embodiments, the obtaining module includes:
the feature detection unit is used for carrying out feature detection on the images of the plurality of exposure scratches to obtain feature descriptors of each multi-focus image;
The obtaining unit is used for obtaining definition descriptors of each scratch image according to the feature descriptors of each multi-focus image;
an up-regulating unit, configured to traverse the same area of each scratch image simultaneously by using an s×s sliding window, and up-regulate weight values of all pixel points in the sliding window when the sum of definition descriptors in the sliding window of one scratch image is greater than the sum of definition descriptors of any other scratch image;
the determining unit is used for determining clear points, fuzzy points and uncertain points in the image according to the adjusted pixel point weight values;
and the splicing unit is used for splicing the plurality of scratch images according to the proportion of the preset clear point, the preset fuzzy point and the preset uncertain point to obtain the multi-exposure scratch image of the shaping mirror.
On the basis of the above embodiments, the obtaining module further includes:
the placing unit is used for taking the diaphragm as the objective table, placing the inner surface of the cornea shaping lens upwards at the position of the aperture of the diaphragm, wherein the diaphragm only has an aperture with adjustable center size and can transmit light beams, the rest positions are not light-transmitting, and the aperture diameter of the aperture of the diaphragm is slightly smaller than the diameter of the cornea shaping lens;
the illumination unit is used for using the annular LED as a light source to illuminate in a transmission mode, the center of the diaphragm is a point O, a point M, N is an objective lens and any point on the edge of the annular LED respectively, and the angle between OM and the optical axis is The included angle between ON and the optical axis is->
And the moving unit is used for controlling the diaphragm platform to move a preset distance by utilizing the motor to obtain a plurality of multi-focus scratch images with different clear areas.
On the basis of the above embodiments, the device further includes:
the fitting module is used for performing polynomial fitting on all straight line segments in the region in each scratch interest region to obtain fitted scratches;
the marking module is used for marking the scratch detection result of the fitted scratch image in the multi-exposure scratch image of the shaping mirror according to the gray value of the corresponding position in the original image.
On the basis of the above embodiments, the device further includes:
the primary fitting module is used for carrying out primary fitting on line segments in the region by utilizing the RANCAS algorithm so as to remove the influence of external points;
correspondingly, the fitting unit is used for performing polynomial fitting on all straight-line segments with the outer points removed in the region in each scratch interest region.
The device for extracting the scratch foreground image of the shaping mirror provided by the embodiment of the invention can execute the method for extracting the scratch foreground image of the shaping mirror provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
Example five
Fig. 5 is a schematic structural diagram of a device according to a fifth embodiment of the present invention. Fig. 3 illustrates a block diagram of an exemplary device 12 suitable for use in implementing embodiments of the present invention. The device 12 shown in fig. 3 is merely an example and should not be construed as limiting the functionality and scope of use of embodiments of the present invention.
As shown in fig. 3, the device 12 is in the form of a general purpose computing terminal. Components of device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, a bus 18 that connects the various system components, including the system memory 28 and the processing units 16.
Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, and a local bus using any of a variety of bus architectures. By way of example, and not limitation, such architectures include Industry Standard Architecture (ISA) bus, micro channel architecture (MAC) bus, enhanced ISA bus, video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Device 12 typically includes a variety of computer system readable media. Such media can be any available media that is accessible by device 12 and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory 28 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM) 30 and/or cache memory 32. Device 12 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 34 may be used to read from or write to non-removable, nonvolatile magnetic media (not shown in FIG. 5, commonly referred to as a "hard disk drive"). Although not shown in fig. 3, a magnetic disk drive for reading from and writing to a removable non-volatile magnetic disk (e.g., a "floppy disk"), and an optical disk drive for reading from or writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In such cases, each drive may be coupled to bus 18 through one or more data medium interfaces. The system memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to carry out the functions of the embodiments of the invention.
A program/utility 40 having a set (at least one) of program modules 42 may be stored in, for example, system memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each or some combination of which may include an implementation of a network environment. Program modules 42 generally perform the functions and/or methods of the embodiments described herein.
The device 12 may also communicate with one or more external terminals 14 (e.g., keyboard, pointing terminal, display 24, etc.), one or more terminals that enable a user to interact with the device 12, and/or any terminals (e.g., network card, modem, etc.) that enable the device 12 to communicate with one or more other computing terminals. Such communication may occur through an input/output (I/O) interface 22. Also, device 12 may communicate with one or more networks such as a Local Area Network (LAN), a Wide Area Network (WAN) and/or a public network, such as the Internet, via network adapter 20. As shown, network adapter 20 communicates with other modules of device 12 over bus 18. It should be appreciated that although not shown, other hardware and/or software modules may be used in connection with device 12, including, but not limited to: microcode, terminal drives, redundant processing units, external disk drive arrays, RAID systems, tape drives, data backup storage systems, and the like.
The processing unit 16 executes various functional applications and data processing by running a program stored in the system memory 28, for example, implementing the method for extracting a scratch foreground image of a shaping mirror provided by the embodiment of the present invention.
Example six
A sixth embodiment of the present invention further provides a storage medium containing computer-executable instructions, which when executed by a computer processor, are configured to perform the method for extracting a scratch foreground image of a shaping mirror according to any one of the above embodiments.
The computer storage media of embodiments of the invention may take the form of any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or device. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
Note that the above is only a preferred embodiment of the present invention and the technical principle applied. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, while the invention has been described in connection with the above embodiments, the invention is not limited to the embodiments, but may be embodied in many other equivalent forms without departing from the spirit or scope of the invention, which is set forth in the following claims.

Claims (8)

1. The method for extracting the scratch foreground image of the shaping mirror is characterized by comprising the following steps of:
obtaining a multi-exposure scratch image of the shaping mirror;
selecting a pixel point in the multi-exposure scratch image of the shaping mirror, generating reference line segments for the pixel point according to a neighborhood of a set angle, and calculating the gray value average value of each reference line segment;
when the gray value average value of at least one reference line segment is not smaller than a set first reference threshold value, respectively establishing a parallel auxiliary judgment line segment for the preset distance of the left side and the right side of the at least one existing reference line segment, wherein the length of the parallel auxiliary judgment line segment is the same as that of the corresponding reference line segment;
Respectively calculating to obtain the gray value average value of each auxiliary judging line segment, and judging whether the gray value average value of each auxiliary judging line segment is not smaller than a set second reference threshold value;
when the gray value average value difference value of the two auxiliary judging line segments is not smaller than the set second reference threshold value, calculating the gray value average value difference value of the two auxiliary judging line segments and the gray value average value difference value of the at least one reference line segment and each auxiliary judging line segment;
when the difference value of the gray value mean values of the two auxiliary judging line segments is smaller than a preset third reference threshold value, and the difference value of the gray value mean value of each auxiliary judging line segment and the at least one reference line segment is smaller than a preset fourth reference threshold value, determining the pixel point as a scratch point;
returning to the step of selecting one pixel point in the multi-exposure scratch image of the shaping lens until all pixel points are traversed, and generating a scratch foreground image according to the determination result of the scratch points;
the obtaining the multi-exposure scratch image of the shaping mirror comprises the following steps:
performing feature detection on the images of the plurality of exposure scratches to obtain feature descriptors of each multi-focus image;
obtaining a definition descriptor of each scratch image according to the feature descriptor of each multi-focus image;
Using an s multiplied by s sliding window to traverse the same area of each scratch image at the same time, and when the sum of definition descriptors in the sliding window of one scratch image is larger than the sum of definition descriptors of any other scratch image, adjusting up the weight values of all pixel points in the sliding window;
according to the adjusted pixel point weight value, determining clear points, fuzzy points and uncertain points in the image;
and splicing the plurality of scratch images according to the preset proportion of the clear point, the fuzzy point and the uncertain point to obtain the multi-exposure scratch image of the shaping mirror.
2. The method according to claim 1, wherein the method further comprises:
performing binarization conversion on the multi-exposure scratch image of the shaping lens for distinguishing the foreground and the background, and performing straight line segment detection on the image subjected to the binarization conversion by using an FLD algorithm to obtain a plurality of detected straight line segments;
randomly selecting one of the straight line segments, and calculating an included angle theta between the straight line segment and the adjacent straight line segment, a distance d between the midpoint of the straight line segment and the adjacent straight line segment, and a minimum distance g between the end point of the straight line segment and the adjacent straight line segment;
when the included angle theta is smaller than a preset angle threshold value, the distance d is smaller than a preset distance threshold value, and the minimum distance g is smaller than a preset minimum distance threshold value, the straight line segments and the adjacent straight line segments are set to be the same group of straight line segments;
Returning to the step of randomly selecting one of the straight line segments until all the straight line segments are traversed;
the scratch area of interest is set according to the grouping.
3. The method of claim 1, wherein the acquiring the shaping mirror multi-exposure scratch image further comprises:
the diaphragm is used as an objective table, the inner surface of the cornea shaping lens is upwards placed at the position of a diaphragm aperture, only a small hole with adjustable center size can transmit light beams, the rest positions are not light-transmitting, and the aperture diameter of the diaphragm aperture is slightly smaller than the diameter of the cornea shaping lens;
the annular LED is used as a light source to illuminate in a transmission mode, the center of the diaphragm is a point O, a point M, N is an objective lens and any point on the edge of the annular LED respectively, and the angle between OM and the optical axis isThe included angle between ON and the optical axis is->,/>
And controlling the diaphragm platform to move a preset distance by utilizing a motor to obtain a plurality of multi-focus scratch images with different clear areas.
4. The method according to claim 2, wherein the method further comprises:
performing polynomial fitting on all straight line segments in each scratch interest area to obtain fitted scratches;
and marking the scratch detection result of the fitted scratch image in the multi-exposure scratch image of the shaping mirror according to the gray value of the corresponding position in the original image.
5. The method according to claim 4, wherein prior to said obtaining the fitted scratch, the method further comprises:
performing preliminary fitting on line segments in the region by using an RANCAS algorithm to remove the influence of outer points;
correspondingly, the polynomial fitting is performed on all straight line segments in the region in each scratch interest region, including:
polynomial fitting is performed on all straight line segments in each scratch interest region except for the outer points.
6. The utility model provides a shaping mirror scratch prospect image extraction element which characterized in that includes:
the acquisition module is used for acquiring the multi-exposure scratch image of the shaping mirror;
the selecting module is used for selecting one pixel point in the multi-exposure scratch image of the shaping mirror, generating reference line segments for the pixel point according to a preset angle neighborhood, and calculating the gray value average value of each reference line segment;
the establishing module is used for respectively establishing a parallel auxiliary judging line segment for the preset distance of the left side and the right side of the existing at least one reference line segment when the gray value average value of the at least one reference line segment is not smaller than a set first reference threshold value, and the length of the parallel auxiliary judging line segment is the same as that of the corresponding reference line segment;
The judging module is used for respectively calculating and obtaining the gray value average value of each auxiliary judging line segment and judging whether the gray value average value of each auxiliary judging line segment is not smaller than a set second reference threshold value;
the calculation module is used for calculating the difference value of the gray value mean value of the two auxiliary judgment line segments and the difference value of the gray value mean value of the at least one reference line segment and each auxiliary judgment line segment when the difference value is not smaller than the set second reference threshold value;
the determining module is used for determining the pixel point as a scratch point when the difference value of the gray value average value of the two auxiliary judging line segments is smaller than a preset third reference threshold value and the difference value of the gray value average value of the at least one reference line segment and each auxiliary judging line segment is smaller than a preset fourth reference threshold value;
the generating module is used for returning to the step of selecting one pixel point in the multi-exposure scratch image of the shaping lens until all pixel points are traversed, and generating a scratch foreground image according to the determination result of the scratch points;
the acquisition module comprises:
the feature detection unit is used for carrying out feature detection on the images of the plurality of exposure scratches to obtain feature descriptors of each multi-focus image;
The obtaining unit is used for obtaining definition descriptors of each scratch image according to the feature descriptors of each multi-focus image;
an up-regulating unit, configured to traverse the same area of each scratch image simultaneously by using an s×s sliding window, and up-regulate weight values of all pixel points in the sliding window when the sum of definition descriptors in the sliding window of one scratch image is greater than the sum of definition descriptors of any other scratch image;
the determining unit is used for determining clear points, fuzzy points and uncertain points in the image according to the adjusted pixel point weight values;
and the splicing unit is used for splicing the plurality of scratch images according to the proportion of the preset clear point, the preset fuzzy point and the preset uncertain point to obtain the multi-exposure scratch image of the shaping mirror.
7. An apparatus, the apparatus comprising:
one or more processors;
storage means for storing one or more programs,
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the shaping mirror scratch foreground image extraction method of any one of claims 1-5.
8. A storage medium containing computer executable instructions, which when executed by a computer processor are for performing the method of shaped mirror scratch foreground image extraction according to any of claims 1-5.
CN202311534370.9A 2023-11-17 2023-11-17 Method, device, equipment and storage medium for extracting scratch foreground image of shaping mirror Active CN117252897B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311534370.9A CN117252897B (en) 2023-11-17 2023-11-17 Method, device, equipment and storage medium for extracting scratch foreground image of shaping mirror

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311534370.9A CN117252897B (en) 2023-11-17 2023-11-17 Method, device, equipment and storage medium for extracting scratch foreground image of shaping mirror

Publications (2)

Publication Number Publication Date
CN117252897A CN117252897A (en) 2023-12-19
CN117252897B true CN117252897B (en) 2024-02-02

Family

ID=89128024

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311534370.9A Active CN117252897B (en) 2023-11-17 2023-11-17 Method, device, equipment and storage medium for extracting scratch foreground image of shaping mirror

Country Status (1)

Country Link
CN (1) CN117252897B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108280822A (en) * 2017-12-20 2018-07-13 歌尔科技有限公司 The detection method and device of screen cut
CN112258448A (en) * 2020-09-15 2021-01-22 郑州金惠计算机系统工程有限公司 Fine scratch detection method, fine scratch detection device, electronic equipment and computer-readable storage medium
WO2023005123A1 (en) * 2021-07-30 2023-02-02 浙江宇视科技有限公司 Optical center determination method and apparatus, electronic device, and medium
CN116993682A (en) * 2023-07-10 2023-11-03 欧几里德(苏州)医疗科技有限公司 Cornea shaping mirror flaw area extraction method based on image data analysis

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108280822A (en) * 2017-12-20 2018-07-13 歌尔科技有限公司 The detection method and device of screen cut
CN112258448A (en) * 2020-09-15 2021-01-22 郑州金惠计算机系统工程有限公司 Fine scratch detection method, fine scratch detection device, electronic equipment and computer-readable storage medium
WO2023005123A1 (en) * 2021-07-30 2023-02-02 浙江宇视科技有限公司 Optical center determination method and apparatus, electronic device, and medium
CN116993682A (en) * 2023-07-10 2023-11-03 欧几里德(苏州)医疗科技有限公司 Cornea shaping mirror flaw area extraction method based on image data analysis

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
"Automatic scratch detector for optical surface";Hong-Yan Zhang etc.;《Optics Express》;第27卷(第15期);第20910-20927页 *
"光学元件表面划痕的可视化检测";潘永强等;《西安工业大学学报》;第32卷(第6期);全文 *
"基于灰度差值的均值滤波算法机器在AXI中的应用";王朋等;《电子工艺技术》(第3期);全文 *

Also Published As

Publication number Publication date
CN117252897A (en) 2023-12-19

Similar Documents

Publication Publication Date Title
US10885352B2 (en) Method, apparatus, and device for determining lane line on road
JP2020042816A (en) Object detection method, device, apparatus, storage media, and vehicle
JP4741704B2 (en) Device, method and computer program for confirming road signs in images
JP5775225B2 (en) Text detection using multi-layer connected components with histograms
CN110379020B (en) Laser point cloud coloring method and device based on generation countermeasure network
CN110796018B (en) Hand motion recognition method based on depth image and color image
CN109583345B (en) Road recognition method, device, computer device and computer readable storage medium
US20200175673A1 (en) Method and device for detecting defect of meal box, server, and storage medium
WO2019240900A1 (en) Attention loss based deep neural network training
EP3617938B1 (en) Lane line processing method and device
CN110189336A (en) Image generating method, system, server and storage medium
CN110956137A (en) Point cloud data target detection method, system and medium
CN115861601B (en) Multi-sensor fusion sensing method and device
CN116453029B (en) Building fire environment detection method based on image data
Huang et al. Automatic identification and location technology of glass insulator self-shattering
Muddu Study of Image Transmission Through a Fiber-Optic Conduit and Its Enhancement Using Digital Image Processing Techniques
CN113409271B (en) Method, device and equipment for detecting oil stain on lens
CN116071294A (en) Optical fiber surface defect detection method and device
CN109740526B (en) Signal lamp identification method, device, equipment and medium
CN113281780B (en) Method and device for marking image data and electronic equipment
KR101557271B1 (en) Method for detecting a circle-type object and approximating a substitute circle based on Image processing
CN117252897B (en) Method, device, equipment and storage medium for extracting scratch foreground image of shaping mirror
CN116930192B (en) High-precision copper pipe defect detection method and system
CN112949451A (en) Cross-modal target tracking method and system through modal perception feature learning
CN114155179A (en) Light source defect detection method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant