CN111970506B - Lens dirt detection method, device and equipment - Google Patents

Lens dirt detection method, device and equipment Download PDF

Info

Publication number
CN111970506B
CN111970506B CN202011122158.8A CN202011122158A CN111970506B CN 111970506 B CN111970506 B CN 111970506B CN 202011122158 A CN202011122158 A CN 202011122158A CN 111970506 B CN111970506 B CN 111970506B
Authority
CN
China
Prior art keywords
detection
lens
total
area
contamination
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
CN202011122158.8A
Other languages
Chinese (zh)
Other versions
CN111970506A (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.)
Changzhou Ruitai Photoelectric Co Ltd
Original Assignee
Changzhou Ruitai Photoelectric 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 Changzhou Ruitai Photoelectric Co Ltd filed Critical Changzhou Ruitai Photoelectric Co Ltd
Priority to CN202011122158.8A priority Critical patent/CN111970506B/en
Priority to PCT/CN2020/128608 priority patent/WO2022082904A1/en
Publication of CN111970506A publication Critical patent/CN111970506A/en
Application granted granted Critical
Publication of CN111970506B publication Critical patent/CN111970506B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N17/00Diagnosis, testing or measuring for television systems or their details
    • H04N17/002Diagnosis, testing or measuring for television systems or their details for television cameras
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Quality & Reliability (AREA)
  • Biomedical Technology (AREA)
  • General Health & Medical Sciences (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Studio Devices (AREA)
  • Investigating Materials By The Use Of Optical Means Adapted For Particular Applications (AREA)

Abstract

The invention relates to a method, a device and equipment for detecting lens dirtiness, wherein the method comprises the following steps: acquiring a lens image shot by a lens to be detected; dividing the image into two subareas and a total area by combining the coordinates of the central point of the lens image, carrying out subarea detection by combining the gray values of different areas, and carrying out comprehensive detection according to the gray value of the total detection area. Corresponding dirt detection is carried out on the subareas and the total detection area containing the subareas, and detection data of the subareas and detection data of the total area are summarized and serve as an integral detection result of the lens to be detected. Whether there is dirt through image subregion detection camera lens, realize the dirty automated inspection of camera lens, avoid the detection error that artifical discernment leads to, and detect more comprehensively, can improve the dirty reliability that detects of camera lens.

Description

Lens dirt detection method, device and equipment
Technical Field
The invention relates to the technical field of lens detection, in particular to a method, a device and equipment for detecting lens contamination.
Background
With the development of science and technology and the continuous progress of society, the use of the mobile phone in daily work and life of people is more and more common, and the mobile phone with the lens can also meet the requirements of photographing and shooting of users. The lens of the mobile phone is composed of lenses and is an optical device for forming images on a negative film. During the lens production and lens assembly processes, direct or indirect contact causes dust fall, dirt and other defects on the lens.
The traditional lens smudging detection method mainly relies on manual identification under a high-power microscope, has large workload and subjective consciousness, and influences the reliability of product detection.
Disclosure of Invention
Accordingly, it is necessary to overcome the defects of the prior art and provide a method, an apparatus and a device for detecting lens contamination, which can improve the reliability of lens contamination detection.
A lens contamination detection method includes: acquiring a lens image shot by a lens to be detected; dividing the lens image to obtain detection areas, and extracting gray data of each detection area; performing contamination detection on each detection area according to the gray data of each detection area;
the dividing the lens image to obtain a detection area includes: acquiring a central point coordinate obtained by measuring the lens image; performing image division on the lens image according to the central point coordinate and a preset radius value to obtain a first detection partition containing a central point, a second detection partition surrounding the first detection partition, and a total detection area containing the first detection partition and the second detection partition;
the performing contamination detection on each of the detection regions according to the gray data of each of the detection regions includes: detecting whether the first detection subarea and the second detection subarea are polluted or not through a dynamic threshold value according to the gray data of the first detection subarea and the second detection subarea respectively to obtain the pollution detection results of the first detection subarea and the second detection subarea; dividing the total detection area according to the gray data of the total detection area to obtain particles to be dirtied; and analyzing the particles to be detected to obtain a dirt detection result of the total detection area.
According to the lens contamination detection method, the lens image shot by the lens to be detected is obtained, the image is divided into two subareas and a total area by combining the central point coordinates of the lens image, the subarea detection is conveniently carried out by subsequently combining the gray values of different areas, and the comprehensive detection is carried out according to the gray value of the total detection area. Corresponding dirt detection is carried out on the subareas and the total detection area containing the subareas, and detection data of the subareas and detection data of the total area are summarized and serve as an integral detection result of the lens to be detected. Whether there is dirt through image subregion detection camera lens, realize the dirty automated inspection of camera lens, avoid the detection error that artifical discernment leads to, and detect more comprehensively, can improve the dirty reliability that detects of camera lens.
In one embodiment, the dividing the total detection area according to the gray data of the total detection area to obtain the particles to be stained includes: calculating the gray average value and the variance of the total detection area according to the gray data of the total detection area; determining a reference threshold value according to the gray level average value and the variance of the total detection area; and carrying out global threshold segmentation according to the reference threshold to obtain the particles to be smudged.
In one embodiment, the analyzing the particles to be contaminated to obtain the contamination detection result of the total detection area includes: and performing aggregated dirt judgment on the particles to be detected through closed operation to obtain a dirt detection result of the total detection area.
In one embodiment, the analyzing the particles to be contaminated to obtain the contamination detection result of the total detection area includes: and sequentially taking each dirt particle to be detected as a center, and analyzing the number or the area of the dirt particles to be detected in a set range to obtain a dirt detection result of the total detection area.
In one embodiment, the analyzing the particles to be contaminated to obtain the contamination detection result of the total detection area includes: and analyzing the size or area of the particles to be soiled to obtain a soiling detection result of the total detection area.
In one embodiment, after performing contamination detection on each of the detection regions according to the gray scale data of each of the detection regions, the method further includes displaying a contamination detection result.
A lens contamination detection apparatus comprising: the image acquisition module is used for acquiring a lens image obtained by shooting a lens to be detected; the data processing module is used for acquiring a central point coordinate obtained by measuring the lens image; performing image division on the lens image according to the central point coordinate and a preset radius value to obtain a first detection partition containing a central point, a second detection partition surrounding the first detection partition, and a total detection area containing the first detection partition and the second detection partition; the contamination detection module is used for detecting whether contamination exists in the first detection subarea and the second detection subarea through dynamic thresholds according to the gray data of the first detection subarea and the second detection subarea respectively to obtain contamination detection results of the first detection subarea and the second detection subarea; dividing the total detection area according to the gray data of the total detection area to obtain particles to be dirtied; and analyzing the particles to be detected to obtain a dirt detection result of the total detection area.
The lens contamination detection device divides the image into two subareas and a total area by combining the coordinates of the central point of the lens image, so that the subsequent subarea detection is conveniently carried out by combining the gray values of different areas, and the comprehensive detection is carried out according to the gray value of the total detection area. Corresponding dirt detection is carried out on the subareas and the total detection area containing the subareas, and detection data of the subareas and detection data of the total area are summarized and serve as an integral detection result of the lens to be detected. Whether there is dirt through image subregion detection camera lens, realize the dirty automated inspection of camera lens, avoid the detection error that artifical discernment leads to, and detect more comprehensively, can improve the dirty reliability that detects of camera lens.
In one embodiment, the dirt detection module calculates the gray level average value and the variance of the total detection area according to the gray level data; determining a reference threshold value according to the gray level average value and the variance of the total detection area; and carrying out global threshold segmentation according to the reference threshold to obtain the particles to be smudged.
The device for detecting the dirt of the lens comprises a camera and a product jig, wherein the product jig is used for placing the lens to be detected, the camera is used for shooting a lens image obtained by the lens to be detected, and the dirt of the lens is detected according to the method.
According to the lens contamination detection device, the image is divided into two subareas and a total area by combining the coordinate of the central point of the lens image, so that the subsequent subarea detection is conveniently carried out by combining the gray values of different areas, and the comprehensive detection is carried out according to the gray value of the total detection area. Corresponding dirt detection is carried out on the subareas and the total detection area containing the subareas, and detection data of the subareas and detection data of the total area are summarized and serve as an integral detection result of the lens to be detected. Whether there is dirt through image subregion detection camera lens, realize the dirty automated inspection of camera lens, avoid the detection error that artifical discernment leads to, and detect more comprehensively, can improve the dirty reliability that detects of camera lens.
In one embodiment, the lens contamination detection apparatus further includes a light source for providing background light for the lens to be detected.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this application, illustrate embodiments of the invention and, together with the description, serve to explain the invention and not to limit the invention.
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a flowchart illustrating a lens contamination detection method according to an embodiment of the invention;
FIG. 2 is a flowchart illustrating dividing a lens image into detection regions according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating a contamination detection process performed on each detection area according to gray data of each detection area according to an embodiment of the present invention;
fig. 4 is a block diagram of a lens contamination detection apparatus according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a lens contamination detection apparatus according to an embodiment of the present invention;
FIG. 6 is a schematic view of a lens detection area according to an embodiment of the present invention;
fig. 7 is a flow chart of contamination detection of the lens contamination detection apparatus according to an embodiment of the invention.
210. A camera; 220. a camera lens; 230. a product jig; 240. a light source.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in detail below. In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention. This invention may, however, be embodied in many different forms and should not be construed as limited to the embodiments set forth herein.
In one embodiment, a method for detecting lens contamination is provided, which is suitable for performing contamination detection on lenses of electronic products such as mobile phones and computers. As shown in fig. 1, the method includes:
step S110: and acquiring a lens image shot by the lens to be detected.
The camera can be used for shooting the lens to be detected to obtain a lens image. Specifically, the lens to be detected can be placed on a product jig, background light is provided by the light source, dirt on the lens to be detected and the background have good contrast, the camera is fixed on the support, the structural part is adjusted, the camera can collect images of the lens in the middle, and then the camera is adjusted, so that the camera can collect clear images.
After the camera is used for shooting to obtain a clear image of the lens to be detected, the main control board of the camera can be used for obtaining the lens image and carrying out subsequent image contamination detection, or the camera can be used for sending the lens image to an external controller and carrying out subsequent image analysis detection. For convenience of understanding, the following description will take the main control board inside the camera to perform image contamination detection as an example.
Step S120: and dividing the shot image to obtain detection areas, and extracting gray data of each detection area.
After the main control board obtains the lens image shot by the lens to be detected, the lens image can be divided according to the preset dividing line, and the lens image can also be divided according to different radiuses of the lens. Considering the shape characteristics that the thickness of the lens is gradually changed from the geometric center to the edge and the thickness on the same radius is consistent, the color depth of different radius areas on the lens image can be different. In this embodiment, the central coordinates of the lens image are used as reference points, the lens image is divided according to a set radius size to obtain different detection areas, and the gray scale data of the detection areas is obtained through image analysis. The lens image is divided according to the radius size, so that parts with obvious color difference can be well distinguished, and image analysis is conveniently carried out by combining with gray data.
In one embodiment, as shown in fig. 2, the step S120 of dividing the lens image into detection regions includes steps S122 and S124.
Step S122: and acquiring the coordinates of the central point obtained by measuring the lens image. Specifically, the image analysis may be performed on the lens image through the main control board, the lens profile in the image is extracted, and the coordinate of the central point of the lens is calculated, or the central point of the lens is measured through an external device and then transmitted to the main control board. In this embodiment, the coordinates of the center point of the entire detection area in the image are obtained through caliper measurement. For example, a lens image may be displayed on a display screen, a tester measures the displayed image with a caliper, calculates a center point position of a lens in the image, then selects a lens center point in the image by clicking a touch display screen or moving a display cursor with a key, and the main control board determines a center point coordinate in the image according to an operation of the tester.
Step S124: and carrying out image division on the lens image according to the central point coordinate and the preset radius value to obtain a first detection partition containing the central point, a second detection partition surrounding the first detection partition, and a total detection area containing the first detection partition and the second detection partition.
Because the gray values of the images shot by the different radius areas of the lens are different, the radius sizes of the different areas of the lens can be preset, and the first detection subarea, the second detection subarea and the total detection area can be obtained by dividing according to the obtained center point coordinate and the fixed radius size. The first detection subarea comprises a central point of the lens, the second detection subarea surrounds the first detection subarea, and the first detection subarea and the second detection subarea form a total detection area.
In the embodiment, the image is divided into two partitions and a total area by combining the coordinates of the central point of the lens image, so that partition detection can be conveniently performed by subsequently combining the gray values of different areas, and comprehensive detection can be performed according to the gray value of the total detection area. It is understood that in other embodiments, the image may be divided into more detection areas for detection according to the coordinates of the center point.
Step S130: and performing contamination detection on each detection area according to the gray data of each detection area.
The main control board can analyze whether the pixels in the detection areas have differences according to the gray data of the detection areas, and the main control board analyzes whether the detection areas are dirty or not by comparing the data such as the number and the aggregation degree of the pixels with the differences with the pre-stored judgment parameters. The judgment parameters can be obtained through sample training and learning, specifically, the distance between the camera and the sample is kept, the shooting parameters of the camera are unchanged, the camera is used for shooting different types of dirty samples to obtain images for detection, the judgment parameters are adjusted according to the detection result and the actual condition of the dirty samples, and the accuracy of the detection result is improved. In addition, new samples with dirt and samples without dirt can be added for verification, and parameters with accuracy meeting requirements (such as the accuracy is more than 98%) are selected as the judgment parameters of final application through multiple iterative adjustments. In the actual detection process, the position of the camera and the shooting parameters are kept unchanged, so that accurate and reliable dirt detection can be carried out on the lens to be detected through the stored judgment parameters.
In one embodiment, as shown in fig. 3, step S130 includes step S132, step S134, and step S136.
Step S132: and detecting whether the first detection subarea and the second detection subarea are polluted or not through a dynamic threshold value according to the gray data of the first detection subarea and the second detection subarea respectively to obtain the pollution detection results of the first detection subarea and the second detection subarea.
The dynamic threshold is based on a local threshold, a local area is divided in the whole detection area, and each pixel point in the local area is compared with surrounding pixel points, so that whether the point belongs to dirt or not is determined. Specifically, after the main control board divides the first detection partition into a plurality of local areas, the gray value of each pixel point in the local area is compared with the gray values of the peripheral pixel points, which may be calculating the average gray value of the peripheral pixel points as a local threshold, and then comparing the gray value of the pixel point with the local threshold, if the difference between the gray value of the pixel point and the local threshold exceeds a set threshold, the pixel point may be considered to be dirty.
After the existence of the dirt is determined, the dirt information of the first detection subarea, such as the dirt position, the dirt area and the like, can be obtained by combining the dirt pixel points determined by all the local areas in the first detection subarea. When the dirty area is calculated, the ratio of the image size to the real object size can be predetermined and stored, and after the dirty area in the image is obtained according to the number of the pixel points determined to be dirty in the image and the size of each pixel point, the actual dirty area of the lens to be detected is calculated by combining the stored ratio. In addition, the camera can be focused and adjusted to enable the image size to be the same as the real size, so that the calculated image dirt area can be directly used as the actual dirt area of the lens to be detected.
It can be understood that the manner of detecting whether the second detection partition is dirty or not by the dynamic threshold value according to the gray data of the second detection partition is similar to that of the first detection partition, and is not described herein again.
Step S134: and according to the gray data of the total detection area, dividing the total detection area to obtain particles to be smudged. The main control board can calculate to obtain reference comparison data according to the gray data of the total detection area, compare the gray value of each pixel point in the total detection area with the reference comparison data, and extract the pixel points meeting the requirements as possible dirty spots, namely particles to be dirty.
Step S136: and analyzing the dirt particles to be determined to obtain a dirt detection result of the total detection area.
After the main control board cuts and extracts the particles to be detected, further analyzing and judging whether each particle to be detected belongs to the dirt, and obtaining a dirt detection result of the total detection area. Similarly, if the total detection area is dirty, the main control panel can count dirty information such as dirty position, dirty area and the like, so that the main control panel can be conveniently checked by a tester.
In this embodiment, all carry out corresponding dirty detection through the total detection area to subregion and contain the subregion, will divide the detection data collection of subregion detection data and total region, as the whole testing result who waits to detect the camera lens, detect more comprehensively, improved the reliability that carries out dirty detection to the camera lens.
In addition, after the step S130, the method may further include a step of displaying a contamination detection result. Specifically, after the existence of the dirt is detected, the dirt detection result can be stored in the memory card, and the dirt detection result can be displayed on the display screen of the camera, or the dirt detection result can be sent to the display screen of the mobile terminal in a wired or wireless mode for displaying, so that the tester can check the dirt. The method for displaying the dirty detection result is not unique, and information such as dirty point positions and areas of different detection areas can be displayed on a display screen; or the dirty spots in the upper ring of the shot lens image can be annotated with information such as position coordinates, area and the like, and the image marked with the information can be displayed on a display screen.
According to the lens contamination detection method, the image is divided into two subareas and a total area by combining the coordinates of the central point of the lens image, so that the subarea detection can be conveniently carried out by combining the gray values of different areas subsequently, and the comprehensive detection can be carried out according to the gray value of the total detection area. Corresponding dirt detection is carried out on the subareas and the total detection area containing the subareas, and detection data of the subareas and detection data of the total area are summarized and serve as an integral detection result of the lens to be detected. Whether there is dirt through image subregion detection camera lens, realize the dirty automated inspection of camera lens, accurate discernment is dirty, improves the dirty stability that detects of camera lens, and detects more comprehensively, avoids the detection error that artifical discernment leads to, can improve the dirty reliability that detects of camera lens.
In one embodiment, step S134 includes: calculating the gray average value and the variance of the total detection area according to the gray data of the total detection area; determining a reference threshold value according to the gray level average value and the variance of the total detection area; and carrying out global threshold segmentation according to the reference threshold to obtain the particles to be smudged. Specifically, after the main control board calculates the gray average value and the variance of the whole area according to the gray value of each pixel point in the total detection area, the gray average value can be adjusted by combining the variance to determine a reference threshold, then the gray value of each pixel point in the total detection area is compared with the reference threshold, and the pixel points with the gray values larger than the reference threshold are divided to serve as particles to be smudged.
The specific manner of analyzing the soil particles to be determined is not exclusive, and in one embodiment, step S136 includes: and (4) carrying out aggregated dirt judgment on the dirt particles to be determined through closed operation to obtain a dirt detection result of the total detection area.
The closed operation principle is that firstly expansion is carried out and then corrosion is carried out, and then corrosion is carried out after expansion operation is carried out on a detected point. After the main control board carries out expansion and corrosion operations on dirt particles to be determined, the area and the longest dimension of the treated dirt particle points to be determined are compared with set parameters, if the area and the longest dimension of the treated dirt particle points to be determined are larger than the corresponding set parameters, the requirement of the aggregative dirt can be considered to be met, the aggregative dirt is judged, and the actual size and the area of the aggregative dirt can be recorded for viewing.
In one embodiment, step S136 includes: and sequentially taking each dirt particle to be detected as a center, and analyzing the number or the area of the dirt particles to be detected in a set range to obtain a dirt detection result of the total detection area.
The specific setting mode of the set range is not unique, the main control board can determine the range by taking the undetermined dirt particles as the center and taking a preset value stored in advance as the radius, the number or the area of the undetermined dirt particles in the range is compared with the preset parameters stored in advance, and if the number or the area of the undetermined dirt particles is larger than the corresponding set parameters, the number or the area of the undetermined dirt particles in the range where the undetermined dirt particles are located can be considered to meet the dirt characteristics. And respectively detecting the range of each dirt particle to be detected to judge whether the dirt characteristics are met, so as to obtain the dirt detection result of the whole total detection area.
In one embodiment, step S136 includes: and analyzing the size or area of the dirt particles to be determined to obtain a dirt detection result of the total detection area.
Specifically, the main control board compares the size or area of each particle to be soiled with the stored set parameters, and if the size or area of the particle to be soiled is larger than the corresponding set parameters, the particle to be soiled can be considered to meet the characteristics of soiling. And finally, obtaining a dirt detection result of the whole total detection area by respectively analyzing the size or the area of each dirt particle to be detected.
The three modes for analyzing the particles to be contaminated are provided, and the tester can select a specific analysis mode according to actual requirements. It can be understood that, in an embodiment, the step S136 may also include the above three manners of analyzing the to-be-determined dirt particles, analyze the to-be-determined dirt particles in the total detection area in different manners, and integrate the detection data of the various manners as the dirt detection result of the total detection area, so that the detection is more comprehensive.
It should be understood that although the various steps in the flow charts of fig. 1-3 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 1-3 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performance of the sub-steps or stages is not necessarily sequential, but may be performed in turn or alternating with other steps or at least some of the sub-steps or stages of other steps.
In one embodiment, a device for detecting contamination on a lens is provided, which is suitable for performing contamination detection on a lens of an electronic product such as a mobile phone and a computer. As shown in fig. 4, the apparatus includes an image acquisition module 110, a data processing module 120, and a contamination detection module 130. The image obtaining module 110 is configured to obtain a lens image obtained by shooting a lens to be detected; the data processing module 120 is configured to obtain a coordinate of a central point obtained by measuring the lens image; carrying out image division on the lens image according to the coordinate of the central point and a preset radius value to obtain a first detection partition containing the central point, a second detection partition surrounding the first detection partition and a total detection area containing the first detection partition and the second detection partition; the contamination detection module 130 is configured to detect whether contamination exists in the first detection partition and the second detection partition by using a dynamic threshold according to the gray data of the first detection partition and the gray data of the second detection partition, respectively, to obtain contamination detection results of the first detection partition and the second detection partition; dividing the total detection area according to the gray data of the total detection area to obtain particles to be smudged; and analyzing the dirt particles to be determined to obtain a dirt detection result of the total detection area.
In addition, the contamination detection module 130 is further configured to display a contamination detection result. Specifically, after the existence of the dirt is detected, the dirt detection result can be stored in the memory card, and the dirt detection result can be displayed on the display screen of the camera, or the dirt detection result can be sent to the display screen of the mobile terminal in a wired or wireless mode for displaying, so that the tester can check the dirt.
In one embodiment, the contamination detection module 130 calculates a gray average and a variance of the total detection area from the gray data; determining a reference threshold value according to the gray level average value and the variance of the total detection area; and carrying out global threshold segmentation according to the reference threshold to obtain the particles to be smudged.
In one embodiment, the contamination detection module 130 performs an aggregate contamination judgment on the to-be-determined contamination particles through a closed operation to obtain a contamination detection result of the total detection area.
In one embodiment, the contamination detection module 130 sequentially uses each particle to be contaminated as a center, and analyzes the number or area of the particles to be contaminated within a set range to obtain a contamination detection result of the total detection area.
In one embodiment, the contamination detection module 130 analyzes the size or area of the contamination particles to be determined to obtain the contamination detection result of the total detection area.
The three modes for analyzing the particles to be contaminated are provided, and the tester can select a specific analysis mode according to actual requirements. It can be understood that, in an embodiment, the contamination detection module 130 may also include the above three ways of analyzing the to-be-determined contamination particles, analyze the to-be-determined contamination particles in the total detection area by using different ways, and integrate the detection data of the various ways as the contamination detection result of the total detection area, so that the detection is more comprehensive.
For specific limitations of the lens contamination detection apparatus, reference may be made to the above limitations of the lens contamination detection method, and details thereof are not repeated here. All or part of the modules in the lens contamination detection device can be realized by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
The lens contamination detection device divides the image into two subareas and a total area by combining the coordinates of the central point of the lens image, so that the subsequent subarea detection is conveniently carried out by combining the gray values of different areas, and the comprehensive detection is carried out according to the gray value of the total detection area. Corresponding dirt detection is carried out on the subareas and the total detection area containing the subareas, and detection data of the subareas and detection data of the total area are summarized and serve as an integral detection result of the lens to be detected. Whether there is dirt through image subregion detection camera lens, realize the dirty automated inspection of camera lens, accurate discernment is dirty, improves the dirty stability that detects of camera lens, and detects more comprehensively, avoids the detection error that artifical discernment leads to, can improve the dirty reliability that detects of camera lens.
In one embodiment, the invention further provides a lens contamination detection device, which is suitable for performing contamination detection on lenses of electronic products such as mobile phones and computers. The equipment comprises a camera and a product jig, wherein the product jig is used for placing the lens to be detected, the camera is used for shooting a lens image obtained by the lens to be detected, and the dirt detection of the lens is carried out according to the method. In one embodiment, the lens contamination detection apparatus further includes a light source for providing background light for the lens to be detected.
Specifically, as shown in fig. 5, the camera 210 may be fixed on a stand, and a lens image may be centrally captured by adjusting a fastening screw of a structural member with reference to an axis of the camera lens 220. The product jig 230 is used for placing a lens to be detected, and ensures that the surface of the product can be axially vertical to the lens during detection. The camera 210 is a CMOS (Complementary Metal Oxide Semiconductor) global exposure camera, which ensures fast and stable image acquisition. The camera is used for installing the workpiece, so that the moving space of the camera in the three dimensions of XYZ can be guaranteed, and the camera can be conveniently debugged and adapted to different products. The camera lens 220 adopts a double telecentric lens with low depth of field and high resolution, so that the dirt can be imaged clearly. The light source 240 specifically adopts an annular light source with a lamp bead installation angle of 70 degrees, irradiates the back of the lens to be detected along the axial direction of the lens, and meets the requirement that the dirt and the background have clear contrast in imaging.
Firstly, a batch of various types of dirty samples are prepared, and the height and the brightness of a light source are adjusted, so that all dirty samples can be imaged clearly and have good contrast with the background. The dirty samples are detected, the judgment parameters of the algorithm in the main control board of the camera 210 are adjusted, and the accuracy of the detection result is improved. And then, adding a new sample with dirt and a sample without dirt for algorithm verification, and selecting a judgment parameter with the accuracy rate of more than 98% as a judgment parameter for final application through multiple iterative adjustment.
And after the judgment parameters are determined, carrying out actual dirt detection on the lens to be detected. The shot image shot by the shot to be detected is acquired, fig. 6 is a schematic view of a shot detection area, it can be seen that different area gray values are different, and the size of each area of the same product can be determined according to a fixed value. As shown in fig. 7, the central coordinate of the entire detection area is obtained by a caliper measurement method, and the detection area is divided according to the obtained central coordinate and a fixed radius size to obtain a first detection sub-area 1, a second detection sub-area 2, and a total detection area 3, where the first detection sub-area 1 is a circle with a darker center color, the second detection sub-area 2 is a ring with a lighter color, and the total detection area 3 is a union of the first detection sub-area 1 and the second detection sub-area 2. After different detection areas are obtained through division, whether contamination exists or not is detected for the first detection partition 1 and the second detection partition 2 by using a dynamic threshold method. The dynamic threshold is a dividing method for distinguishing the fixed threshold, a local area is divided in the whole detection area based on the local threshold, and each pixel point in the local area is compared with the surrounding pixel points, so that whether the point belongs to dirt or not is determined.
For the total detection area 3, firstly, the gray level average value and the variance of the area are calculated, the gray level average value and the variance are used for calculating to obtain a fixed threshold, the particles which are possibly dirty are segmented by combining the fixed threshold through a global threshold segmentation method, and the particles which are possibly dirty can be judged by different methods: judging the accumulated dirt by using closed operation; sequentially taking the particles to be detected as a center, and judging whether the number or the area of the particles in a certain range meets the characteristics of dirt; whether the characteristic of the contamination is satisfied is judged by the size or the area of the single particle. The global threshold segmentation adopts a fixed threshold, and the point in the detection area is compared with the threshold to determine whether the point belongs to the dirt. The closed operation principle is that firstly expansion is carried out and then corrosion is carried out, and then the corrosion is carried out after the expansion operation is carried out on the detected point. If the point after the closing operation satisfies the requirement of the aggregating contamination in the area and the longest dimension, it is judged as the aggregating contamination.
According to the lens contamination detection device, the image is divided into two subareas and a total area by combining the coordinate of the central point of the lens image, so that the subsequent subarea detection is conveniently carried out by combining the gray values of different areas, and the comprehensive detection is carried out according to the gray value of the total detection area. Corresponding dirt detection is carried out on the subareas and the total detection area containing the subareas, and detection data of the subareas and detection data of the total area are summarized and serve as an integral detection result of the lens to be detected. Whether there is dirt through image subregion detection camera lens, realize the dirty automated inspection of camera lens, accurate discernment is dirty, improves the dirty stability that detects of camera lens, and detects more comprehensively, avoids the detection error that artifical discernment leads to, can improve the dirty reliability that detects of camera lens.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above examples only show some embodiments of the present invention, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A lens contamination detection method is characterized by comprising the following steps:
acquiring a lens image shot by a lens to be detected;
dividing the lens image to obtain detection areas, and extracting gray data of each detection area;
performing contamination detection on each detection area according to the gray data of each detection area;
the dividing the lens image to obtain a detection area includes: acquiring a central point coordinate obtained by measuring the lens image; performing image division on the lens image according to the central point coordinate and a preset radius value to obtain a first detection partition containing a central point, a second detection partition surrounding the first detection partition, and a total detection area containing the first detection partition and the second detection partition;
the performing contamination detection on each of the detection regions according to the gray data of each of the detection regions includes: detecting whether the first detection subarea and the second detection subarea are polluted or not through a dynamic threshold value according to the gray data of the first detection subarea and the second detection subarea respectively to obtain the pollution detection results of the first detection subarea and the second detection subarea; dividing the total detection area according to the gray data of the total detection area to obtain particles to be dirtied; analyzing the particles to be detected to obtain a dirt detection result of the total detection area; and the particles to be smudged are obtained by comparing and dividing the gray value of each pixel point in the total detection area with a reference threshold value obtained by calculation according to the gray data of the total detection area.
2. The lens contamination detection method according to claim 1, wherein the dividing the total detection area into particles to be contaminated according to the gray data of the total detection area comprises:
calculating the gray average value and the variance of the total detection area according to the gray data of the total detection area;
determining a reference threshold value according to the gray level average value and the variance of the total detection area;
and carrying out global threshold segmentation according to the reference threshold to obtain the particles to be smudged.
3. The lens contamination detection method according to claim 1, wherein the analyzing the particles to be contaminated to obtain the contamination detection result of the total detection area comprises:
and performing aggregated dirt judgment on the particles to be detected through closed operation to obtain a dirt detection result of the total detection area.
4. The lens contamination detection method according to claim 1, wherein the analyzing the particles to be contaminated to obtain the contamination detection result of the total detection area comprises:
and sequentially taking each dirt particle to be detected as a center, and analyzing the number or the area of the dirt particles to be detected in a set range to obtain a dirt detection result of the total detection area.
5. The lens contamination detection method according to claim 1, wherein the analyzing the particles to be contaminated to obtain the contamination detection result of the total detection area comprises:
and analyzing the size or area of the particles to be soiled to obtain a soiling detection result of the total detection area.
6. The method according to claim 1, further comprising a step of displaying a contamination detection result after the contamination detection is performed on each of the detection regions based on the gray data of each of the detection regions.
7. A lens contamination detection apparatus, comprising:
the image acquisition module is used for acquiring a lens image obtained by shooting a lens to be detected;
the data processing module is used for acquiring a central point coordinate obtained by measuring the lens image; performing image division on the lens image according to the central point coordinate and a preset radius value to obtain a first detection partition containing a central point, a second detection partition surrounding the first detection partition, and a total detection area containing the first detection partition and the second detection partition;
the contamination detection module is used for detecting whether contamination exists in the first detection subarea and the second detection subarea through dynamic thresholds according to the gray data of the first detection subarea and the second detection subarea respectively to obtain contamination detection results of the first detection subarea and the second detection subarea; dividing the total detection area according to the gray data of the total detection area to obtain particles to be dirtied; analyzing the particles to be detected to obtain a dirt detection result of the total detection area; and the particles to be smudged are obtained by comparing and dividing the gray value of each pixel point in the total detection area with a reference threshold value obtained by calculation according to the gray data of the total detection area.
8. The lens contamination detection apparatus according to claim 7, wherein the contamination detection module calculates a mean value and a variance of a gray level of a total detection area from the gray level data; determining a reference threshold value according to the gray level average value and the variance of the total detection area; and carrying out global threshold segmentation according to the reference threshold to obtain the particles to be smudged.
9. A lens contamination detection device, comprising a camera and a product jig, wherein the product jig is used for placing a lens to be detected, the camera is used for shooting a lens image obtained by the lens to be detected, and the lens contamination detection is performed according to the method of any one of claims 1 to 6.
10. The lens contamination detection apparatus according to claim 9, further comprising a light source for providing a background light to the lens to be detected.
CN202011122158.8A 2020-10-20 2020-10-20 Lens dirt detection method, device and equipment Active CN111970506B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202011122158.8A CN111970506B (en) 2020-10-20 2020-10-20 Lens dirt detection method, device and equipment
PCT/CN2020/128608 WO2022082904A1 (en) 2020-10-20 2020-11-13 Lens smudge detection method, apparatus and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011122158.8A CN111970506B (en) 2020-10-20 2020-10-20 Lens dirt detection method, device and equipment

Publications (2)

Publication Number Publication Date
CN111970506A CN111970506A (en) 2020-11-20
CN111970506B true CN111970506B (en) 2020-12-29

Family

ID=73387394

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011122158.8A Active CN111970506B (en) 2020-10-20 2020-10-20 Lens dirt detection method, device and equipment

Country Status (2)

Country Link
CN (1) CN111970506B (en)
WO (1) WO2022082904A1 (en)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113240672A (en) * 2021-06-21 2021-08-10 广州文远知行科技有限公司 Lens pollutant detection method, device, equipment and storage medium
CN113554637B (en) * 2021-07-30 2022-06-07 上海集成电路制造创新中心有限公司 Method and device for detecting dirt on camera cover plate
CN113570582B (en) * 2021-07-30 2022-07-29 上海集成电路制造创新中心有限公司 Camera cover plate cleanliness detection method and detection device
CN113834823B (en) * 2021-11-29 2022-04-08 浙江华诺康科技有限公司 Endoscope contamination detection device and contamination detection method
CN114589160B (en) * 2022-01-25 2023-05-16 深圳大方智能科技有限公司 Camera protection method for indoor construction
CN114882265B (en) * 2022-07-12 2022-09-06 济宁昆仑石油化工有限公司 Method for detecting quality of finished oil
CN115880238B (en) * 2022-12-01 2023-08-15 华瑞研能科技(深圳)有限公司 Artificial intelligence picture stain processing method and device
CN115953322B (en) * 2023-01-15 2023-07-14 山东产研卫星信息技术产业研究院有限公司 Stain removing method for satellite remote sensing image
CN116012386A (en) * 2023-03-28 2023-04-25 超音速人工智能科技股份有限公司 Diaphragm coverage detection method, system, equipment and storage medium
CN117191809B (en) * 2023-08-30 2024-03-22 宿州绍宸智能科技有限公司 Glass detection equipment fault monitoring and early warning system based on data analysis

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10191356B2 (en) * 2014-07-04 2019-01-29 Light Labs Inc. Methods and apparatus relating to detection and/or indicating a dirty lens condition
CN104539937B (en) * 2014-11-24 2017-03-29 歌尔科技有限公司 A kind of method and apparatus of camera module dust detection
CN104867159B (en) * 2015-06-05 2018-04-10 北京大恒图像视觉有限公司 A kind of digital camera sensor dust detection and stage division and device
CN105516694B (en) * 2015-12-08 2018-01-02 上海集成电路研发中心有限公司 Avoid producing the method and system at the dark angle of camera lens
CN106412573B (en) * 2016-10-26 2019-02-15 歌尔科技有限公司 A kind of method and apparatus of detector lens stain
JP6731645B2 (en) * 2017-08-03 2020-07-29 パナソニックIpマネジメント株式会社 Image monitoring device, image monitoring method, and image monitoring program
EP3489892B1 (en) * 2017-11-24 2022-01-05 Ficosa Adas, S.L.U. Determining clean or dirty captured images
CN108780050B (en) * 2018-03-29 2020-10-09 深圳达闼科技控股有限公司 Method and device for detecting lens, electronic equipment and computer readable storage medium
CN110021012B (en) * 2019-03-27 2023-09-26 安徽皓视光电科技有限公司 Mobile phone lens window glass defect detection method based on machine vision technology
CN110446025B (en) * 2019-06-25 2020-08-07 盐城华昱光电技术有限公司 Camera module detection system and method applied to electronic equipment

Also Published As

Publication number Publication date
WO2022082904A1 (en) 2022-04-28
CN111970506A (en) 2020-11-20

Similar Documents

Publication Publication Date Title
CN111970506B (en) Lens dirt detection method, device and equipment
WO2021000524A1 (en) Hole protection cap detection method and apparatus, computer device and storage medium
JP6619194B2 (en) Touch panel inspection apparatus and method
CN100565630C (en) Display multiangle measurement system and method
US10157457B2 (en) Optical measurement of opening dimensions in a wafer
CN103196918A (en) Key assembling detection method for vehicle air conditioner control panel
CN113155839A (en) Steel plate outer surface defect online detection method based on machine vision
CN113554582A (en) Defect detection method, device and system for functional hole in cover plate of electronic equipment
TW201516397A (en) Bubble inspection system for glass
WO2020137121A1 (en) Image processing device, image processing method, and image processing program
CN109622404B (en) Automatic sorting system and method for micro-workpieces based on machine vision
KR20160054150A (en) System and Method for Automatically Detecting a Mura Defect using Morphological Image Processing and Labeling
CN112102319B (en) Dirty image detection method, dirty image detection device, and dirty image detection mechanism
CN112070762A (en) Mura defect detection method and device for liquid crystal panel, storage medium and terminal
KR101712489B1 (en) Method for measuring a pollution level of spot welding electrode tip using images
CN110602299A (en) Appearance defect detection method based on different inclination angles
CN112802018B (en) Integrity detection method, device and equipment for segmented circular workpiece and storage medium
CN111504608B (en) Brightness uniformity detection system and brightness uniformity detection method
CN111524107B (en) Defect detection method, defect detection apparatus, and computer-readable storage medium
CN111062887B (en) Image definition judging method based on improved Retinex algorithm
JP6182024B2 (en) Unevenness measuring method and unevenness measuring apparatus
TWI493177B (en) Method of detecting defect on optical film with periodic structure and device thereof
TW202209173A (en) Method for defect detection, method for defect classification and system thereof
JP2006292500A (en) Surface inspection method and surface inspection device
CN107389677B (en) Method and device for detecting quality of flannelette fluff

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