Low-contrast image enhancement method and device

By adaptively adjusting the image brightness and optimizing image quality with deep learning models, the problem of low-contrast image enhancement is solved, the image contrast and clarity are improved, and the robustness of the deep learning model is improved.

CN119417735APending Publication Date: 2025-02-11YUYAO SUNNY OPTICAL INTELLIGENCE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310914194.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-07-25
Publication Date
2025-02-11

AI Technical Summary

Technical Problem

The prior art is difficult to effectively enhance low-contrast images, especially in images with different color depths. It is difficult to adaptively adjust the brightness of the image, resulting in poor image clarity and color brightness, which is difficult to use in computer recognition and analysis.

Method used

By obtaining the brightness value of the image, adaptively enhance the light and dark relationship between each pixel and its neighboring pixels, the brightness value is adjusted using convolutional operations to achieve the improvement of contrast, and further optimize image quality through deep learning models.

Benefits of technology

Adaptive adjustment of images of different colors is achieved, the contrast and clarity of images are improved, and high-quality image data is provided for use by deep learning models, thereby improving the robustness of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119417735A_ABST
    Figure CN119417735A_ABST
Patent Text Reader

Abstract

The invention relates to a low-contrast image enhancement method and device. The method comprises the following steps: acquiring a feature image of a to-be-detected object; acquiring a brightness value of the feature image; based on the brightness value, comparing a brightness relation between each pixel in the feature image and a neighborhood pixel of the pixel, and adaptively enhancing the brightness of the feature image based on a comparison result to obtain an enhanced image; and performing deep learning based on the enhanced image to obtain a target deep learning model. By adopting the method, the brightness of pixels with different brightness degrees can be adjusted, the contrast is improved, the quality of feature images with different colors is improved, and a high-quality image is provided for deep learning, so that the robustness of a target deep learning model is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a method and device for low-contrast image enhancement. Background Art

[0002] Contrast refers to the difference in brightness between the brightest white and the darkest black in the light and dark areas of an image. The larger the difference range, the greater the contrast, and the smaller the difference range, the smaller the contrast. Generally speaking, the greater the contrast, the clearer and more eye-catching the image, and the brighter the color; while a small contrast will make the entire picture blurry. In the process of taking pictures, due to the fact that the grayscale values ​​of the objects in the scene are very close, the contrast of the obtained image is very low and the focus is not prominent, which not only makes the subjective observation of the human eye poor, but also makes it difficult to use for computer recognition and analysis.

[0003] Common contrast enhancement methods include gamma correction, which can improve image contrast by using the gamma function as a mapping function. However, when using this method to enhance the contrast of images, it is difficult to set a gamma value suitable for each image. When the wrong gamma value is set, the original color may change, making it difficult to accurately adjust images with different color depths. Summary of the invention

[0004] Based on this, it is necessary to provide a low-contrast image enhancement method and device that can adaptively adjust images of different color depths in order to address the above technical problems.

[0005] In a first aspect, the present application proposes a low-contrast image enhancement method, the method comprising:

[0006] Acquire a characteristic image of the object to be tested;

[0007] Obtaining a brightness value of the feature image;

[0008] Based on the brightness value, compare the brightness relationship between each pixel in the feature image and the neighboring pixels of the pixel, and adaptively enhance the brightness of the feature image based on the comparison result to obtain an enhanced image;

[0009] Deep learning is performed based on the enhanced image to obtain a target deep learning model.

[0010] In one embodiment, the step of obtaining a characteristic image of the object to be measured includes:

[0011] Acquire a target image of the object to be measured, and identify the position of the target object from the target image; locate the area where the object to be measured is located based on the position of the target object;

[0012] Based on the area where the object to be measured is located, the object to be measured is intercepted from the target image to obtain a feature image of the object to be measured.

[0013] In one embodiment, acquiring a target image and identifying a target object from the target image; and locating an area where the object to be measured is located based on the position of the target object, comprises:

[0014] Acquire a lens module image, and identify a circular end surface area of ​​the lens module from the lens module image;

[0015] Based on the circular end surface area, the center position of the circle is calculated; based on the center position of the circle, the area where the annular rubber line is located is obtained.

[0016] In one embodiment, acquiring a target image and identifying a target object from the target image; and locating an area where the object to be measured is located based on the position of the target object, comprises:

[0017] Acquire a lens module image and extract feature points of the lens module;

[0018] Based on the relative position between the special-shaped glue line and the feature point, the area where the special-shaped glue line is located is obtained.

[0019] In one embodiment, obtaining the brightness value of the feature image includes:

[0020] Extracting original brightness values ​​from the feature image;

[0021] The original brightness value is linearly enhanced to obtain a brightness value.

[0022] In one embodiment, comparing the brightness relationship between each pixel in the feature image and the neighboring pixels of the pixel based on the brightness value, and adaptively enhancing the brightness of the feature image based on the comparison result to obtain an enhanced image includes:

[0023] Based on the brightness value, performing a convolution operation on the brightness value of each pixel;

[0024] Comparing the convolution operation result with the current brightness value of the pixel;

[0025] The brightness of the feature image is adaptively enhanced based on the comparison result to obtain an enhanced image.

[0026] In one embodiment, the brightness of the feature image is adaptively enhanced based on the comparison result to obtain an enhanced image, including:

[0027] If the convolution operation result is greater than the current brightness value of the pixel, then reduce the current brightness value of the pixel;

[0028] If the convolution operation result is less than the current brightness value of the pixel, increase the current brightness value of the pixel;

[0029] Based on the changes to the brightness values ​​of all the pixels, an enhanced image is obtained.

[0030] In one embodiment, performing deep learning based on the enhanced image to obtain a target deep learning model includes:

[0031] Annotating the enhanced image using an annotation tool to generate a training data set;

[0032] The deep learning model is trained using the training data set to obtain a target deep learning model.

[0033] In one embodiment, the method further comprises:

[0034] The target deep learning model is used to infer the target enhanced image, determine whether there is a defective area in the target enhanced image, and obtain the defective area in the target enhanced image.

[0035] In a second aspect, the present application further provides a low-contrast image enhancement device, the device comprising:

[0036] A feature module is used to obtain a feature image of the object to be tested;

[0037] A brightness module, used to obtain the brightness value of the feature image;

[0038] An enhancement module, used for comparing the brightness relationship between each pixel in the feature image and the neighboring pixels of the pixel based on the brightness value, and adaptively enhancing the brightness of the feature image based on the comparison result to obtain an enhanced image;

[0039] A deep learning module performs deep learning based on the enhanced image to obtain a target deep learning model.

[0040] The above-mentioned low-contrast image enhancement method and device calculate the brightness value of the feature image and compare the brightness relationship between each pixel and its neighboring pixels, and adaptively enhance the brightness of the feature image based on the comparison result to obtain an enhanced image. It can adjust the brightness of pixels of different brightness levels for feature images of different colors to achieve contrast improvement, provide high-quality images for deep learning, and thus improve the robustness of the target deep learning model. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0042] Figure 1 is a hardware structure block diagram of a low-contrast image enhancement method in one embodiment;

[0043] Figure 2 is a schematic flow chart of a low-contrast image enhancement method in one embodiment;

[0044] Figure 3 A schematic diagram of a ring-shaped glue line area according to an embodiment;

[0045] Figure 4 A schematic diagram of a shaped glue line area according to an embodiment;

[0046] Figure 5 A schematic diagram of a process of a low-contrast image enhancement method in a preferred embodiment;

[0047] Figure 6 FIG. 4 is a structural block diagram of a low-contrast image enhancement device in an embodiment. DETAILED DESCRIPTION

[0048] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments provided in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.

[0049] Obviously, the drawings described below are only some examples or embodiments of the present application. For ordinary technicians in this field, the present application can also be applied to other similar scenarios based on these drawings without creative work. In addition, it can also be understood that although the efforts made in this development process may be complicated and lengthy, for ordinary technicians in this field related to the content disclosed in this application, some changes in design, manufacturing or production based on the technical content disclosed in this application are just conventional technical means, and should not be understood as the content disclosed in this application is insufficient.

[0050] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those of ordinary skill in the art that the embodiments described in this application may be combined with other embodiments without conflict.

[0051] Unless otherwise defined, the technical terms or scientific terms involved in this application should be understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a", "the" and the like involved in this application do not indicate a quantitative limitation, and may represent the singular or plural. The terms "include", "comprise", "have" and any of their variations involved in this application are intended to cover non-exclusive inclusions; for example, a process, method, system, product or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units that are not listed, or may also include other steps or units inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "multiple" involved in this application refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there may be three relationships, for example, "A and / or B" can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects before and after are in an "or" relationship. The terms "first", "second", "third", etc. involved in this application are only used to distinguish similar objects and do not represent a specific ordering of the objects.

[0052] The method embodiment provided in this embodiment can be executed in a terminal, a computer or a similar computing device. For example, running on a terminal, Figure 1 : is a hardware structure block diagram of the low-contrast image enhancement method of this embodiment. Figure 1 As shown, the terminal may include one or more ( Figure 1 Only one is shown in the figure) processor 102 and memory 104 for storing data, wherein processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA. The above terminal may also include a transmission device 106 and an input and output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above terminal. Figure 1More or fewer components as shown, or with Figure 1 Different configurations shown.

[0053] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the low-contrast image enhancement method in this embodiment. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0054] The transmission device 106 is used to receive or send data via a network. The above network includes a wireless network provided by the communication provider of the terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (Radio Frequency, referred to as RF) module, which is used to communicate with the Internet wirelessly.

[0055] In this embodiment, a low-contrast image enhancement method is provided. Figure 2 FIG. 4 is a flow chart of the low-contrast image enhancement method of this embodiment. Figure 2 As shown, the process includes the following steps:

[0056] Step S210, obtaining a characteristic image of the object to be tested.

[0057] Specifically, the characteristic image of the object to be tested is a low-contrast image. For example, in optical equipment, there is often a glue line area in the lens module. The glue line area is used as the object to be tested to obtain the glue line characteristic image. In the glue line characteristic image, the grayscale value of the glue depression area is very close to that of the normal area. It is difficult for the computer to accurately identify the characteristics of the glue depression, which affects the quality of the lens module. In addition, the object to be tested can also be other areas such as the lens or the gold finger. The object to be tested may usually have target features such as scratch features or stain features.

[0058] Step S220, obtaining the brightness value of the feature image.

[0059] Specifically, the brightness value of the feature image can be obtained by image processing algorithms, deep learning models, etc., or the original brightness value of each pixel in the feature image and the brightness value after linear enhancement can be extracted. The original brightness value of each pixel in the feature image can be calculated using the L component of the HSL space, and the formula is as follows:

[0060]

[0061] Among them, L R , L G , L B They are the brightness components of the R, G, and B channels of the current pixel respectively.

[0062] The L component is normalized and calculated to obtain the original brightness value Ln of the feature image. The calculation formula is as follows:

[0063]

[0064] The original brightness value Ln of the feature image can also be obtained by the brightness calculation method of the Y channel of the YUV space. The calculation formula is as follows:

[0065] Ln=0.299×L R (x,y)+0.587×L G (x,y)+0.114×L B (x,y);

[0066] Among them, L R , L G , L B They are the brightness components of the R, G, and B channels of the current pixel respectively.

[0067] After obtaining the original brightness value, the original brightness value is linearly enhanced using the mapping function to obtain the brightness value L of the feature image. t :

[0068]

[0069] The value of z is:

[0070]

[0071] Among them, at least 90% of the original brightness values ​​L in the feature image n > b, z = 1, the current pixel of the feature image does not need to be linearly enhanced; at least 10% of the original brightness value L in the feature image n When <a, z=0, the current pixel of the feature image needs to be linearly enhanced; a≤L n When ≤b, the current pixel of the feature image also needs to be linearly enhanced.n The values ​​of a and b are linearly interpolated. For different images to be tested, different values ​​of a and b can be obtained for calculation, so as to adjust the linear enhancement effect more specifically, 0<a<1, 0<b<1.

[0072] Step S230 , based on the brightness value, compare the brightness relationship between each pixel in the feature image and the neighboring pixels of the pixel, and adaptively enhance the brightness of the feature image based on the comparison result to obtain an enhanced image.

[0073] Specifically, taking the defect features in the lens module as an example, different calculation methods are selected according to the different defect features in the object to be tested to calculate the brightness of a certain pixel and the brightness of the surrounding pixels. For example, the mean is more general and can be applied to any defect feature, but it works better only on low-contrast images with relatively high contrast. The median and convolution are more suitable for scenes with relatively lower contrast. The median is suitable for small granular defects: cracks, small holes, foreign matter, etc. Convolution is suitable for dirt, bulging, dents, etc.

[0074] This embodiment takes convolution as an example, obtains the original brightness value of the current pixel, sets a convolution kernel, and performs a convolution operation on the pixel. When the convolution value is greater than the current value, it means that the current original brightness value is darker than the adjacent area. In order to improve the contrast, the brightness value should be set smaller. Similarly, when the convolution value is less than the current value, it means that the current brightness value is brighter than the neighborhood. In order to improve the contrast, the brightness value should be set larger.

[0075] Specifically, this function can be implemented through the following algorithm: process the neighborhood pixels through the Gaussian blur algorithm framework, add a convolution kernel to the Gaussian blur framework, perform convolution operations, calculate the size relationship between the current brightness value and the neighborhood brightness, and calculate the enhanced image based on the brightness size relationship. The specific formula is as follows:

[0076] G(x,y)=L t (x,y) E(x,y) ;

[0077] Among them, G(x,y) is the brightness value after adaptive image enhancement; L t (x, y) is the brightness value obtained in step S220 above; E(x, y) is the brightness enhancement index, which is obtained by the following algorithm:

[0078]

[0079] Among them, L conv (x, y) is the result of convolution of the brightness value of the feature image; L t (x, y) is the brightness value of the feature image; the value range of p is:

[0080]

[0081] Among them, σ is the size of the convolution kernel, that is, the global mean square error. When σ≤c, it means that most parts of the image are basically the same color and the contrast is very poor. At this time, p takes the maximum value. When σ>, it means that the contrast of the original image meets the requirements and the degree of enhancement can be reduced. If the mean square error is between c and d, it is appropriately linearly enhanced. The value range of d and c is a positive integer greater than 2.

[0082] Step S240: performing deep learning based on the enhanced image to obtain a target deep learning model.

[0083] Specifically, the enhanced image is annotated using an annotation tool to generate a training data set; the deep learning model is trained using the training data set to obtain a target deep learning model. By improving the image quality of the data set and improving the model training effect, a target deep learning model with higher prediction accuracy is obtained.

[0084] In the above-mentioned low-contrast image enhancement method, by calculating the brightness value of the feature image and comparing the brightness relationship between each pixel and its neighboring pixels, the brightness of the feature image is adaptively enhanced based on the comparison result to obtain an enhanced image. For feature images of different colors, the brightness of pixels of different brightness levels can be adjusted to achieve contrast improvement, thereby improving the training effect of the model.

[0085] In one embodiment, based on the above step S210, obtaining a characteristic image of the object to be measured may specifically include the following steps:

[0086] Step S211, obtaining a target image of the object to be measured, and identifying the position of the target object from the target image; based on the position of the target object, locating the area where the object to be measured is located.

[0087] Specifically, taking the target image as a lens module image as an example, the object to be measured may be a glue line area, and the glue line area has different shapes, including ring-shaped and irregular shapes.

[0088] Among them, the method for dynamic positioning of the annular rubber line area includes:

[0089] See also Figure 3 , obtain a lens module image, the lens module image includes a lens area, an end face area and a glue line area, identify the circular end face area of ​​the lens module from the lens module image; calculate the center position based on the circular end face area; based on the center position, obtain the area where the annular glue line is located.

[0090] Preferably, in the above method, based on the circular end face area, the center position of the circle is calculated by a circle fitting algorithm; based on the center position of the circle, the circular area is expanded to obtain the area where the annular rubber line is located.

[0091] Methods for dynamic positioning of the shaped glue line area include:

[0092] The lens module image is acquired and the feature points of the lens module are extracted; based on the relative position between the special-shaped glue line and the feature points, the area where the special-shaped glue line is located is obtained.

[0093] Preferably, in the above method, the characteristic points of the lens module include holes, printed characters, components, etc. Figure 4 ,The lens module image includes the CMOS chip area and the glue line area, and the chip position is extracted. ,Since the glue line area and the chip position are relatively fixed, the relative position of the glue line in the ,module can be obtained based on the positioning coordinates of the chip, thus the glue line area can be ,obtained.

[0094] Step S212: based on the area where the object to be measured is located, the object to be measured is intercepted from the target image to obtain a feature image of the object to be measured.

[0095] This embodiment dynamically locates the object to be measured in the target image to obtain the area where the object to be measured is located, thereby accurately capturing the feature image for contrast enhancement.

[0096] In one embodiment, based on the above step S220, obtaining the brightness value of the feature image may specifically include the following steps:

[0097] Step S221, extracting the original brightness value from the feature image.

[0098] Specifically, the original brightness value of each pixel in the extracted feature image can be calculated using the L component of the HSL space, or the brightness calculation method of the Y channel of the YUV space can be used.

[0099] Step S222: linearly enhance the original brightness value to obtain a brightness value.

[0100] Specifically, the degree of linear enhancement is determined according to the size of the original brightness value, thereby obtaining the brightness value of the feature image.

[0101] Specifically, after obtaining the original brightness value, the original brightness value is adaptively linearly enhanced using the mapping function to obtain the brightness value L of the feature image. t :

[0102]

[0103] The value of z is:

[0104]

[0105] Among them, L nWhen >b, z=1, the current pixel of the feature image does not need to be linearly enhanced; L n When <a, z=0, the current pixel of the feature image needs to be linearly enhanced; a≤L n When ≤b, the current pixel of the feature image also needs to be linearly enhanced. n The values ​​of a and b are linearly interpolated. For different images to be tested, different values ​​of a and b can be obtained for calculation, so as to adjust the linear enhancement effect more specifically, 0<a<1, 0<b<1.

[0106] This embodiment can adaptively change the brightness of the feature image by linearly enhancing the original brightness, thereby preliminarily improving the image quality so as to facilitate subsequent enhancement processing.

[0107] In one embodiment, based on the above step S230, based on the brightness value, the brightness relationship between each pixel in the feature image and the neighboring pixels of the pixel is compared, and the brightness of the feature image is adaptively enhanced based on the comparison result to obtain an enhanced image, which may specifically include the following steps:

[0108] Step S231, based on the brightness value, performing a convolution operation on the brightness value of each pixel.

[0109] Specifically, based on the original brightness value obtained in step S221 above, a convolution operation is performed on the original brightness value of each pixel.

[0110] Step S232, comparing the convolution operation result with the brightness value of the current pixel.

[0111] Step S233: adaptively enhance the brightness of the feature image based on the comparison result to obtain an enhanced image.

[0112] The brightness is the brightness after linear enhancement, which can be the brightness after linear enhancement in the above step S222.

[0113] Specifically, if the convolution operation result is greater than the brightness value of the current pixel, the brightness value of the current pixel is reduced; if the convolution operation result is less than the brightness value of the current pixel, the brightness value of the current pixel is increased; based on the change in the brightness values ​​of all pixels, an enhanced image is obtained.

[0114] This embodiment obtains the brightness relationship between the current pixel and its neighboring pixels through convolution calculation, thereby adjusting the image brightness to make the bright ones brighter and the dark ones darker, thereby greatly improving the image contrast.

[0115] In one embodiment, based on the above step S240, deep learning is performed based on the enhanced image to obtain a target deep learning model, which may specifically include the following steps:

[0116] Step S241: annotate the enhanced image using an annotation tool to generate a training data set.

[0117] Specifically, the enhanced image can be used for deep learning. In order to improve the training effect of the deep learning model, when constructing the training data set, the above steps S210 to S230 are used to perform contrast enhancement processing on the acquired image to obtain an enhanced image, and a high-quality, high-definition training data set is obtained based on the enhanced image.

[0118] Step S242: Use the training data set to train the deep learning model to obtain a target deep learning model.

[0119] In this embodiment, by annotating the enhanced images, the problem of being unable to accurately annotate extremely low contrast images, resulting in excessively high model training loss, is solved, thereby improving the reliability of the target deep learning model.

[0120] In one embodiment, the low-contrast image enhancement method further includes:

[0121] Step S250, use the target deep learning model to infer the target enhanced image, determine whether there is a defect area in the target enhanced image, and obtain the defect area in the target enhanced image.

[0122] Specifically, the target deep learning model can be trained through the above steps S241 to S242. In the field of intelligent manufacturing industry, deep learning as a high-tech is playing an increasingly important role, involving many branch applications such as visual inspection, trajectory planning, workpiece positioning, fuzzy control, etc. When using the target deep model for reasoning, the low contrast of the target image will also affect the reasoning effect. Therefore, referring to the above steps S210 to S230, the feature image of the target object to be tested is obtained; the brightness value of the feature image is calculated; based on the brightness value, the light and dark relationship between each pixel in the feature image and the neighboring pixels of the pixel is compared, and the brightness of the feature image is adaptively enhanced based on the comparison result to obtain a target enhanced image; the target strong image is input into the target deep model to obtain accurate reasoning results and reduce the false detection rate of defective areas.

[0123] In this embodiment, by inputting the enhanced image into the target deep learning model, more accurate inference results can be obtained and the false detection rate can be reduced.

[0124] The present embodiment is described and illustrated below through preferred embodiments.

[0125] Figure 5 4 is a flow chart of the low-contrast image enhancement method of the preferred embodiment.

[0126] Step S510, acquiring a lens module image.

[0127] Step S520: identifying the circular end surface area of ​​the lens module from the lens module image.

[0128] Step S530, calculating the center position of the circle based on the circular end surface area; and obtaining the area where the annular rubber line is located based on the center position of the circle.

[0129] Step S540 , based on the area where the annular glue line is located, intercept the annular glue line from the lens module image to obtain a feature image of the annular glue line.

[0130] Step S550, extracting the original brightness value from the feature image; performing linear enhancement on the original brightness value to obtain a brightness value.

[0131] Step S560 , based on the brightness value, compare the brightness relationship between each pixel in the feature image and the neighboring pixels of the pixel, and adaptively enhance the brightness of the feature image based on the comparison result to obtain an enhanced image.

[0132] Step S570: annotate the enhanced image using an annotation tool to generate a training data set.

[0133] Step S580, train the deep learning model using the training data set to obtain a target deep learning model.

[0134] Step S590, use the target deep learning model to infer the target enhanced image to obtain the defect area.

[0135] In this preferred embodiment, by obtaining the glue line feature image of the lens module and calculating the brightness of each pixel in the glue line feature image and the brightness of the surrounding pixels, the brightness of the glue line feature image is adaptively adjusted based on the brightness-darkness contrast relationship to obtain an enhanced image, which effectively improves the contrast of the glue line feature image and highlights the defect area. In addition, the enhanced image is used to annotate the defect map, generate a data set, and perform deep learning, and can also be directly used for defect reasoning, so that defects in low-contrast feature images can be more accurately identified, thereby improving the reliability of lens module defect detection.

[0136] By applying this preferred embodiment to the glue line defect detection project, compared with not using the method in this preferred embodiment, the false detection rate is significantly reduced and the recall rate is improved, thereby achieving strict control of the quality of the lens module.

[0137] This method can be applied to the detection of defects on the adhesive surface of the lens module, and is also applicable to other defect detection, including but not limited to the detection of dirty gold fingers, dust inside the lens, lens scratches and the like.

[0138] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0139] Based on the same inventive concept, a low-contrast image enhancement device is also provided in this embodiment. The system is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. The terms "module", "unit", "subunit", etc. used below can implement a combination of software and / or hardware for a predetermined function. Although the system described in the following embodiments is preferably implemented in software, the implementation in hardware, or a combination of software and hardware, is also possible and conceivable.

[0140] In one embodiment, if Figure 6 As shown, a low-contrast image enhancement device is provided, comprising: a feature module 61, a brightness module 62, an enhancement module 63 and a deep learning module 64, wherein:

[0141] A feature module 61 is used to obtain a feature image of the object to be tested;

[0142] A brightness module 62, used to obtain the brightness value of the feature image;

[0143] An enhancement module 63 is used to compare the brightness relationship between each pixel in the feature image and the neighboring pixels of the pixel based on the brightness value, and adaptively enhance the brightness of the feature image based on the comparison result to obtain an enhanced image;

[0144] The deep learning module 64 performs deep learning based on the enhanced image to obtain a target deep learning model.

[0145] In one embodiment, the feature module 61 is also used to obtain a target image of the object to be tested and identify the position of the target object from the target image; locate the area where the object to be tested is located based on the position of the target object; and capture the object to be tested from the target image based on the area where the object to be tested is located to obtain a feature image of the object to be tested.

[0146] In one embodiment, the feature module 61 is also used to obtain a lens module image, identify a circular end face area of ​​the lens module from the lens module image; calculate the center position of the circle based on the circular end face area; and obtain the area where the annular glue line is located based on the center position of the circle.

[0147] In one of the embodiments, the feature module 61 is further used to obtain the lens module image and extract the feature points of the lens module; based on the relative position between the shaped glue line and the feature points, the area where the shaped glue line is located is obtained.

[0148] In one embodiment, the brightness module 62 is further used to extract original brightness values ​​from the feature image; and perform linear enhancement on the original brightness values ​​to obtain brightness values.

[0149] In one embodiment, the enhancement module 63 is further used to perform a convolution operation on the brightness value of each pixel based on the brightness value; compare the convolution operation result with the brightness value of the current pixel; and adaptively enhance the brightness of the feature image based on the comparison result to obtain an enhanced image.

[0150] In one embodiment, the enhancement module 63 is also used to reduce the brightness value of the current pixel if the convolution operation result is greater than the brightness value of the current pixel; if the convolution operation result is less than the brightness value of the current pixel, then increase the brightness value of the current pixel; based on the change in the brightness values ​​of all pixels, an enhanced image is obtained.

[0151] In one embodiment, the deep learning module 64 is further used to annotate the enhanced image using an annotation tool to generate a training data set; and to train the deep learning model using the training data set to obtain a target deep learning model.

[0152] In one of the embodiments, the low-contrast image enhancement device also includes an inference module, which is used to use a preset target deep learning model to infer the enhanced image to obtain a defect area in the object to be tested.

[0153] Each module in the low-contrast image enhancement device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.

[0154] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, any of the above-mentioned low-contrast image enhancement methods is implemented.

[0155] In one embodiment, a computer-readable storage medium is provided on which a computer program is stored. When the computer program is executed by a processor, any of the above-mentioned low-contrast image enhancement methods is implemented.

[0156] In one embodiment, a computer program product is provided, including a computer program, which, when executed by a processor, implements any of the above-mentioned low-contrast image enhancement methods.

[0157] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.

[0158] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0159] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0160] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A low-contrast image enhancement method, characterized in that: The method comprises: Acquire a characteristic image of the object to be tested; Obtaining a brightness value of the feature image; Based on the brightness value, compare the brightness relationship between each pixel in the feature image and the neighboring pixels of the pixel, and adaptively enhance the brightness of the feature image based on the comparison result to obtain an enhanced image; Deep learning is performed based on the enhanced image to obtain a target deep learning model.

2. The low-contrast image enhancement method according to claim 1, characterized in that: The step of obtaining a characteristic image of the object to be measured comprises: Acquire a target image of the object to be measured, and identify the position of the target object from the target image; locate the area where the object to be measured is located based on the position of the target object; Based on the area where the object to be measured is located, the object to be measured is intercepted from the target image to obtain a feature image of the object to be measured.

3. The low-contrast image enhancement method according to claim 2, characterized in that: The step of acquiring a target image and identifying a target object from the target image; Based on the position of the target object, locating the area where the object to be measured is located includes: Acquire a lens module image, and identify a circular end surface area of ​​the lens module from the lens module image; Based on the circular end surface area, the center position of the circle is calculated; based on the center position of the circle, the area where the annular rubber line is located is obtained.

4. The low-contrast image enhancement method according to claim 2, characterized in that: The step of acquiring a target image and identifying a target object from the target image; Based on the position of the target object, locating the area where the object to be measured is located includes: Acquire a lens module image and extract feature points of the lens module; Based on the relative position between the special-shaped glue line and the feature point, the area where the special-shaped glue line is located is obtained.

5. The low-contrast image enhancement method according to claim 1, characterized in that: The obtaining of the brightness value of the feature image comprises: Extracting original brightness values ​​from the feature image; The original brightness value is linearly enhanced to obtain a brightness value.

6. The low-contrast image enhancement method according to claim 1, characterized in that: The step of comparing the brightness relationship between each pixel in the feature image and the neighboring pixels of the pixel based on the brightness value, and adaptively enhancing the brightness of the feature image based on the comparison result to obtain an enhanced image includes: Based on the brightness value, performing a convolution operation on the brightness value of each pixel; Comparing the convolution operation result with the current brightness value of the pixel; The brightness of the feature image is adaptively enhanced based on the comparison result to obtain an enhanced image.

7. The low-contrast image enhancement method according to claim 6, characterized in that: Adaptively enhancing the brightness of the feature image based on the comparison result to obtain an enhanced image, including: If the convolution operation result is greater than the current brightness value of the pixel, then reduce the current brightness value of the pixel; If the convolution operation result is less than the current brightness value of the pixel, increase the current brightness value of the pixel; Based on the changes to the brightness values ​​of all the pixels, an enhanced image is obtained.

8. The low-contrast image enhancement method according to claim 1, characterized in that: The performing deep learning based on the enhanced image to obtain a target deep learning model comprises: Annotating the enhanced image using an annotation tool to generate a training data set; The deep learning model is trained using the training data set to obtain a target deep learning model.

9. The low-contrast image enhancement method according to claim 1, characterized in that: The method further comprises: The target deep learning model is used to infer the target enhanced image, determine whether there is a defective area in the target enhanced image, and obtain the defective area in the target enhanced image.

10. A low-contrast image enhancement device, characterized in that: The device comprises: A feature module is used to obtain a feature image of the object to be tested; A brightness module, used to obtain the brightness value of the feature image; An enhancement module, used for comparing the brightness relationship between each pixel in the feature image and the neighboring pixels of the pixel based on the brightness value, and adaptively enhancing the brightness of the feature image based on the comparison result to obtain an enhanced image; A deep learning module performs deep learning based on the enhanced image to obtain a target deep learning model.