CN111738973B - Stain test method, device and system for quality inspection of camera module and storage medium - Google Patents

Stain test method, device and system for quality inspection of camera module and storage medium Download PDF

Info

Publication number
CN111738973B
CN111738973B CN201910222883.3A CN201910222883A CN111738973B CN 111738973 B CN111738973 B CN 111738973B CN 201910222883 A CN201910222883 A CN 201910222883A CN 111738973 B CN111738973 B CN 111738973B
Authority
CN
China
Prior art keywords
stain
image
test image
value
adaptive
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
CN201910222883.3A
Other languages
Chinese (zh)
Other versions
CN111738973A (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.)
Ningbo Sunny Opotech Co Ltd
Original Assignee
Ningbo Sunny Opotech 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 Ningbo Sunny Opotech Co Ltd filed Critical Ningbo Sunny Opotech Co Ltd
Priority to CN201910222883.3A priority Critical patent/CN111738973B/en
Publication of CN111738973A publication Critical patent/CN111738973A/en
Application granted granted Critical
Publication of CN111738973B publication Critical patent/CN111738973B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • G06T7/0004Industrial image inspection
    • G06T7/0008Industrial image inspection checking presence/absence
    • 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
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/136Segmentation; Edge detection involving thresholding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/194Segmentation; Edge detection involving foreground-background segmentation
    • 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
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20004Adaptive image processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20212Image combination
    • G06T2207/20224Image subtraction
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02EREDUCTION OF GREENHOUSE GAS [GHG] EMISSIONS, RELATED TO ENERGY GENERATION, TRANSMISSION OR DISTRIBUTION
    • Y02E10/00Energy generation through renewable energy sources
    • Y02E10/50Photovoltaic [PV] energy

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Quality & Reliability (AREA)
  • Biomedical Technology (AREA)
  • General Health & Medical Sciences (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Image Analysis (AREA)
  • Studio Devices (AREA)

Abstract

The application provides a stain test method, a device, a system and a storage medium for quality inspection of a camera module, wherein the method comprises the following steps: dividing the test image into a plurality of initial partitions, each initial partition having a different stain identification threshold; for each initial partition, obtaining a binary image containing a stain based on an adaptive stain splitting method, wherein the adaptive stain splitting method comprises: for the current subarea, performing self-adaptive surface fitting on the test image to obtain a fitting image; subtracting the test image from the fitted image to obtain a foreground image; and determining whether to adaptively divide the current partition according to whether the difference between the brightness maximum value and the brightness minimum value of the foreground image is greater than a preset threshold value.

Description

Stain test method, device and system for quality inspection of camera module and storage medium
Technical Field
The application relates to a quality inspection technology of a camera module and a computer vision technology, in particular to a stain test method, a stain test device, a stain test system and a storage medium for quality inspection of the camera module.
Background
The camera module is also called a camera module, and currently, the camera module has become an indispensable built-in component in consumer electronic terminal products such as smart phones. The development trend of the mobile phone market requires that the camera module has a plurality of characteristics such as large pixels, large apertures, miniaturization and the like, which brings difficulty to the assembly and quality inspection of the camera module. The application mainly relates to quality inspection of a camera module.
Stain detection is a particularly important feature in the quality inspection of camera modules. The camera module belongs to a high-precision optical device, and is usually assembled in a dust-free environment with extremely high cleanliness. However, any dust-free environment is relative and may require the use of glue or other additives during assembly, such as handling where chipping or impurities are unlikely to occur accidentally. If the scraps or impurities are attached to the photosensitive chip or the lens inside the lens, the always existing stain appears in the image shot by the shooting module, and serious quality problems are caused. Therefore, each camera module must be subjected to stain detection before shipping to ensure that no defective products with stain problems flow into the market.
In the prior art, a smear detection algorithm (which is sometimes referred to herein as a conventional smear detection algorithm for convenience of description) is to determine whether a smear exists in an image and to determine a smear position based on a luminance and an area threshold of the smear. Specifically, an image is first divided into a plurality of blocks (e.g., 20×20 pixel blocks), and for each block, an average luminance value thereof is calculated; then, for each pixel in the current block, calculating the difference between the pixel and the average brightness value of the current block; comparing the difference with a preset stain brightness threshold to determine whether the current pixel belongs to a stain (the meaning of the stain is that the pixel is covered by the stain and is a part of the stain); after all pixels of all blocks are judged, a binary image containing stain information can be obtained, then a stain position is obtained, and the area of the stain can be calculated according to the number of continuous pixels belonging to the stain. In the conventional stain detection algorithm, the calculated stain area is sometimes compared with a preset stain area threshold, and only when the calculated stain area exceeds the preset stain area threshold, the establishment of the stain is finally determined.
The traditional stain detection algorithm can automatically detect stains on the traditional camera module. However, with the improvement of the resolution of the camera module, the size of the image is larger and larger, and the traditional stain detection algorithm cannot meet the increasing demand of goods output in efficiency. In addition, when detecting image stains, the traditional stain detection algorithm is easily influenced by factors such as image noise, ambient brightness and the like, so that erroneous judgment of stain test results occurs, and batch use of manufacturers on a production line is not facilitated.
In view of the foregoing, there is a great need for a solution for testing the quality of camera modules with high detection efficiency and stable performance.
Disclosure of Invention
The present application provides a solution that overcomes or partially overcomes at least one of the drawbacks of the prior art.
According to one aspect of the present application, there is provided a stain test method for quality inspection of camera modules, the method comprising: 1) Dividing the test image into a plurality of initial partitions, each initial partition having a different stain identification threshold; 2) For each initial partition, obtaining a binary image containing a stain based on an adaptive stain segmentation method; and 3) after all areas of the test image are binarized, obtaining a stain position in the binarized foreground image, and judging whether a stain exists at a suspected stain position corresponding to the stain position in the test image according to a stain identification threshold value of an initial partition corresponding to the stain position, wherein the self-adaptive stain segmentation method comprises the following steps: 21 For the current subarea, performing self-adaptive surface fitting on the test image to obtain a fitting image; 22 Subtracting the test image from the fitted image to obtain a foreground image; and 23) determining whether the difference between the brightness maximum value and the brightness minimum value of the foreground image is larger than a preset threshold value, if so, performing adaptive segmentation on the current partition, and repeatedly performing an adaptive stain segmentation method on the adaptively segmented partition, otherwise, not performing adaptive segmentation on the current partition and binarizing the foreground image of the current partition.
According to another aspect of the present application, there is provided a stain testing device for quality inspection of camera modules, the device comprising a partitioner, a binary image acquirer and a stain determiner, wherein the partitioner is configured to divide a test image into a plurality of initial partitions, each of the initial partitions having a different stain identification threshold; the binary image acquirer is used for acquiring a binary image containing the stain based on the adaptive stain segmentation method for each initial partition; the self-adaptive stain segmentation method comprises the following steps: 1) For the current subarea, performing self-adaptive surface fitting on the test image to obtain a fitting image; 2) Subtracting the test image from the fitting image to obtain a foreground image; 3) Determining whether the difference between the brightness maximum value and the brightness minimum value of the foreground image is larger than a preset threshold value, if so, carrying out self-adaptive segmentation on the current partition, and repeatedly executing a self-adaptive stain segmentation method on the partition after self-adaptive segmentation, otherwise, not carrying out self-adaptive segmentation on the current partition and binarizing the foreground image of the current partition; the stain determiner is used for acquiring stain positions in the binarized foreground image after all areas of the test image are binarized, and judging whether stains exist in suspected stain positions corresponding to the stain positions in the test image according to stain identification threshold values of the initial partitions corresponding to the stain positions.
According to yet another aspect of the present application, there is provided a spot testing system for camera module quality inspection, the system comprising a processor; and a memory coupled to the processor and storing machine-readable instructions executable by the processor to perform operations comprising:
1) Dividing the test image into a plurality of initial partitions, each initial partition having a different stain identification threshold;
2) For each initial partition, obtaining a binary image containing a stain based on an adaptive stain segmentation method; and
3) After all areas of the test image are binarized, obtaining a stain position in the binarized foreground image, judging whether a stain exists in a suspected stain position corresponding to the stain position in the test image according to a stain identification threshold value of an initial partition corresponding to the stain position,
the self-adaptive stain segmentation method comprises the following steps:
21 For the current subarea, performing self-adaptive surface fitting on the test image to obtain a fitting image;
22 Subtracting the test image from the fitted image to obtain a foreground image; and
23 Determining whether the difference between the brightness maximum value and the brightness minimum value of the foreground image is larger than a preset threshold value, if so, carrying out self-adaptive segmentation on the current partition, and repeatedly executing a self-adaptive stain segmentation method on the partition after self-adaptive segmentation, otherwise, not carrying out self-adaptive segmentation on the current partition and binarizing the foreground image of the current partition.
According to yet another aspect of the present application, there is provided a non-transitory machine-readable storage medium storing machine-readable instructions, characterized in that the machine-readable instructions are executable by a processor to:
1) Dividing the test image into a plurality of initial partitions, each initial partition having a different stain identification threshold;
2) For each initial partition, obtaining a binary image containing a stain based on an adaptive stain segmentation method; and
3) After all areas of the test image are binarized, obtaining a stain position in the binarized foreground image, judging whether a stain exists in a suspected stain position corresponding to the stain position in the test image according to a stain identification threshold value of an initial partition corresponding to the stain position,
the self-adaptive stain segmentation method comprises the following steps:
21 For the current subarea, performing self-adaptive surface fitting on the test image to obtain a fitting image;
22 Subtracting the test image from the fitted image to obtain a foreground image; and
23 Determining whether the difference between the brightness maximum value and the brightness minimum value of the foreground image is larger than a preset threshold value, if so, carrying out self-adaptive segmentation on the current partition, and repeatedly executing a self-adaptive stain segmentation method on the partition after self-adaptive segmentation, otherwise, not carrying out self-adaptive segmentation on the current partition and binarizing the foreground image of the current partition.
Compared with the prior art, the application has at least one of the following technical effects:
1. the application can well improve the stability, operability and efficiency of the stain test on the production line of the camera module.
2. The application can effectively reduce the omission ratio and the misjudgment ratio of the stain detection of the camera module.
3. The present application can effectively improve the efficiency of stain detection (e.g., detect stains more quickly).
Drawings
Exemplary embodiments are illustrated in referenced figures. The embodiments and figures disclosed herein are to be regarded as illustrative rather than restrictive.
FIG. 1 illustrates a flow chart of a spot testing method for camera module quality inspection according to one embodiment of the present application;
FIG. 2 illustrates an example of an original test image and an example of an enhanced test image in one embodiment of the application;
FIG. 3 illustrates partitioning of a test image according to an embodiment of the present application;
FIG. 4 illustrates a flowchart of obtaining a binary image containing a blur based on an adaptive blur segmentation method according to an embodiment of the present application;
FIG. 5 illustrates a schematic diagram of determining spot merging based on the overlapping area of spot marking areas; and
fig. 6 shows a schematic diagram of a computer system suitable for use in implementing the terminal device or server of the present application.
Detailed Description
For a better understanding of the application, various aspects of the application will be described in more detail with reference to the accompanying drawings. It should be understood that the detailed description is merely illustrative of exemplary embodiments of the application and is not intended to limit the scope of the application in any way. Like reference numerals refer to like elements throughout the specification. The expression "and/or" includes any and all combinations of one or more of the associated listed items.
It should be noted that in this specification, the expressions first, second, etc. are only used to distinguish one feature from another feature, and do not represent any limitation of the feature. Accordingly, a first body discussed below may also be referred to as a second body without departing from the teachings of the present application.
In the drawings, the thickness, size and shape of the object have been slightly exaggerated for convenience of explanation. The figures are merely examples and are not drawn to scale.
It will be further understood that the terms "comprises," "comprising," "includes," "including," "having," "containing," and/or "including," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. Furthermore, when a statement such as "at least one of the following" appears after a list of features that are listed, the entire listed feature is modified instead of modifying a separate element in the list. Furthermore, when describing embodiments of the present application, the use of "may" means "one or more embodiments of the present application. Also, the term "exemplary" is intended to refer to an example or illustration.
As used herein, the terms "substantially," "about," and the like are used as terms of a table approximation, not as terms of a table level, and are intended to illustrate inherent deviations in measured or calculated values that would be recognized by one of ordinary skill in the art.
Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. It will be further understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the relevant art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein.
It should be noted that, without conflict, the embodiments of the present application and features of the embodiments may be combined with each other. The application will be described in detail below with reference to the drawings in connection with embodiments.
FIG. 1 illustrates a flow chart of a spot testing method for camera module quality inspection according to one embodiment of the present application. Referring to fig. 1, in the present embodiment, the stain testing method 1000 includes steps S100 to S400. These steps are described separately below.
In step S100, a test image captured by the camera module to be tested may be obtained, and the image enhancement processing may be performed on the test image. In this embodiment, the image enhancement processing may be implemented by a Retinex-based image enhancement method. In particular, the image enhancement processing step may comprise the sub-steps of: extracting brightness data (sometimes also called Y component of the image) of the test image, and performing filtering processing to remove noise; removing the background in the image to highlight features of foreground blemishes; and linearly stretching the image. Although the image enhancement is described first in the embodiments of the present application, it will be understood by those skilled in the art that the present application is not limited thereto, and in some embodiments, the step of enhancing the image may be omitted, and when the enhancing step is omitted, the enhanced test image described below may be replaced with the test image. In one embodiment, the captured test image may be scaled down (e.g., by downsampling) to reduce its size prior to the enhancement process, thereby reducing the computational effort of subsequent processing.
Specifically, when detecting a smear image, the influence of factors such as image noise may cause erroneous judgment of a smear test result. Therefore, in one embodiment, the extracted image luminance data (image luminance component is generally denoted as Y component of the image) is first subjected to a filter process to eliminate the influence of noise or the like on the positioning stain. The filtering process can be represented by formula (1).
filterImg=filter(Y_Img) (1)
Where filter () represents a filter function, which can be understood as a method of implementing the filter function in a computer. Y_img represents the luminance Y component of the original image. The filterImg represents the filtered image. Since the shape characteristics of the stain are mostly circular or nearly circular, in this embodiment, a circular filter function may be selected as the filter function.
Further, due to different production line environments and different causes of the stains, the types of the stains can be classified into deep stains, shallow stains, ultra-shallow stains, the positions of the stains can be also classified into four corner positions, center positions and the like, and because the characteristic of the stains is influenced by the brightness of the light source, when the brightness of the light source is brighter, the characteristic of the stains is more obvious, and the stains can be more revealed from the background image. Therefore, in one embodiment, a modified Retinex image enhancement method is used to remove some of the background brightness to highlight the features of the foreground blemish. Specifically, a method of removing a part of background luminance may be expressed as formula (2).
logImg=log(Y_Img)–log(filterImg) (2)
Where log () represents a logarithmic function, which can be understood as a method of implementing an image enhancement function in a computer. In this embodiment, image enhancement is performed based on a logarithmic method. log img represents an image from which a part of the background luminance is removed.
Finally, the background-removed luminance image may be linearly stretched so that the pixel value of the image is in the range of 0 to 255. The linear stretching can be achieved by the formula (3).
Where poulimg represents the image obtained after the execution of step S100, which may be referred to as an enhanced test image for convenience of description. Enhancement of the test image helps to quickly and accurately detect and locate stains. FIG. 2 illustrates an example of an original test image and an example of an enhanced test image, where the left side is the original test image and the right side is the enhanced test image, in one embodiment of the application. Referring to fig. 2, in the original test image on the left side, the light source brightness is low, the stain hardly appears, and the stain becomes more noticeable when the original image is enhanced.
After the enhanced test image is obtained, the enhanced test image may be divided into a plurality of initial partitions in step S200. Since the types and characteristics of the stains at different positions of the image are different, each manufacturer has different requirements for the stains in different areas of the module image, different detection criteria may be adopted at different positions of the test image when performing the stain detection, for example, different stain identification thresholds may be adopted as described below. Fig. 3 illustrates division of a test image according to an embodiment of the present application, and as shown in fig. 3, the enhanced test image may be divided into a center region 301, four-side regions 302, and four-side regions 303 in step S200.
After the enhanced test image is divided, a binary image containing a stain may be obtained based on an adaptive stain segmentation method for each initial partition in step S300. Fig. 4 shows a flowchart of obtaining a binary image containing a blur based on an adaptive blur segmentation method according to an embodiment of the present application, as shown in fig. 4, the adaptive blur segmentation method may include the steps of: step S301, for the current subarea, performing self-adaptive surface fitting on the enhanced test image to obtain a fitting image; step S302, subtracting the enhanced test image from the fitting image to obtain a foreground image; and step S303, determining whether to adaptively divide the current partition according to whether the difference between the brightness maximum value and the brightness minimum value of the foreground image is larger than a preset threshold value.
In step S301, adaptive surface fitting may be achieved by formula (4).
surfImg=surfacefit(scrImg) (4)
Wherein surfImg represents a fitted image, scrImg represents an enhanced test image in the current partition, surfacefit () is a surface fitting function, which can be understood as a method for realizing surface fitting in a computer, and the function is used for fitting out smoother background features in the image.
Since the original test image contains both background and stain features, it is preferable to remove the background features from the enhanced test image first to obtain stain features. Since the stain in the image has low brightness, in order to make the value at the stain in the background-removed image positive, the background-removed image, i.e., the foreground image, may be obtained by subtracting the enhanced test image from the fitted image in step S302. The operation in step S302 can be expressed by formula (5).
subImg=surfImg-scrImg (5)
Where subImg represents the foreground image, surfImg represents the fitted image, and scrImg represents the enhanced test image in the current partition.
It should be noted that while in the embodiment of the present application, the fitted image is subtracted from the enhanced test image, the present application is not limited thereto, and the fitted image may be subtracted from the enhanced test image.
After the foreground image is obtained, it may be determined whether to adaptively divide the current partition according to whether the difference between the maximum brightness value and the minimum brightness value of the foreground image is greater than a preset threshold value in step S303. When the difference between the maximum brightness value and the minimum brightness value is greater than the preset threshold, it may be considered that the current partition may be continuously divided, and at this time, the current partition may be adaptively divided into a plurality of (e.g., four) next-level partitions, and the above-described steps S301 to S303 may be performed for each next-level partition. When the difference between the maximum brightness value and the minimum brightness value is smaller than or equal to a preset threshold value, the current partition can be considered to be unable to be continuously segmented, and binarization processing is carried out on the foreground image in the current partition. The preset threshold may have different values in different initial partitions. It should be noted that the adaptive segmentation described herein differs from the segmentation of the test image described above. Specifically, the test image is divided into a central area, four-side areas and four-corner areas, so that stains in different areas can be managed and controlled through different detection thresholds; the adaptive segmentation adaptively judges whether to perform integral fitting on the current region or to divide the current region into several blocks for fitting respectively, so as to improve the accuracy of surface fitting, wherein whether to perform further segmentation is determined according to a comparison result with a set threshold value, which is different from fixedly dividing the test image into a center region, four-side regions and four-side regions in the step of dividing the test image.
Through the self-adaptive fitting process, the fitting precision can be improved, and the fitting black edge can be reduced.
In embodiments of the present disclosure, the binarization process for the foreground image may be implemented by resetting pixel values in the foreground image according to a binarization threshold. Specifically, first, whether the value of each pixel in the foreground image is greater than a binarization threshold value is determined, if the value of the pixel is greater than the binarization threshold value, the pixel can be considered as a stain pixel, and the pixel value thereof can be adjusted to a stain value, for example, to 0; if the pixel's value is less than the binarization threshold, which may be determined experimentally and have different values in different initial partitions, the pixel may be considered a normal pixel, and its pixel value may be adjusted to a non-stain value, e.g., to 1. After binarization, the stained pixels and normal pixels are further distinguished, which makes the stained pixels more noticeable.
After all the areas of the test image are binarized through step S300, a binary image (i.e., a binarized foreground image) may be scanned in step S400 to obtain a stain position, and whether a suspected stain position corresponding to the stain position exists in the test image may be judged according to a stain recognition threshold value of an initial partition corresponding to the stain position, wherein the stain recognition threshold value may include a brightness threshold value and an area threshold value.
In the embodiment of the application, the corresponding suspected stain position can be found in the original test image according to the stain position obtained from the binary image, and the brightness data of the suspected stain position can be extracted. The luminance data may then be curve fitted to obtain a background image corresponding thereto. Thereafter, this background image may be subtracted from the luminance data to obtain a difference image, which will become more apparent in the difference image if there is a stain in this area. After the difference image is obtained, it may be determined whether the brightness at each pixel point in the difference image is greater than a brightness threshold, and if the brightness at the pixel point is greater than the brightness threshold, the pixel point may be determined as a stain pixel, at which time, the stain area value at the suspected stain location is increased by a corresponding value, for example, 1 for each stain pixel found. Conversely, if the brightness at the pixel is less than or equal to the brightness threshold, the pixel may be determined as a normal pixel, at which time the stain area value at the suspected stain location is not increased. The luminance threshold may have different values in different initial partitions. After all pixels in the difference image are determined, whether a stain is actually present at the suspected stain location may be determined based on whether the stain area value is greater than an area threshold. Specifically, when the previously accumulated stain area value is greater than the area threshold, it may be determined that a stain is present at the suspected stain location, whereas if the stain area value is less than or equal to the area threshold, it may be determined that no stain is present at the suspected stain location. The area threshold may have different values in different initial partitions.
Since the aforementioned binary image is obtained by performing the operations of adaptive fitting, binarization, etc. in a large area region (i.e., different initial partitions), from which the spot position can be roughly located, but there may be erroneous judgment in the obtained spot position, the present application further eliminates the spot erroneous judgment by performing finer judgment on the suspected spot position corresponding to the roughly located spot position in the original test image. The actual stain position can be more accurately positioned through the steps.
In addition, since the brightness of each pixel included in one complete stain region may be different, one stain region may be divided into a plurality of stain regions due to the difference of the binarization threshold values at the time of binarization. When the original one spot area is divided into a plurality of spot areas, the spot detection efficiency will be reduced, and the workload of the production line personnel for the subsequent processing of the spot module will be increased. Thus, in one embodiment of the present application, the stain testing method may further comprise the step of merging stains.
Specifically, in the step of merging the spots, when a plurality of spots are obtained for the same test image, the spots may be merged according to the distance between centers of the plurality of spots. For example, when the distance between the centers of two spots is smaller than a predetermined threshold, the two spots may be considered to belong to the same spot area, and at this time, the two spots may be merged into the same spot area, and when the distance between the centers of two spots is greater than or equal to the predetermined threshold, the two spots may be considered not to belong to the same spot area, and at this time, the two spots may not be merged.
In another embodiment of the application, the incorporation of the spot may also be determined based on the area of overlap of the spot marking areas. Fig. 5 shows a schematic diagram of determining spot merging according to the overlapping area of spot mark areas, wherein the left side is the spot schematic diagram before merging and the right side is the spot schematic diagram after merging. Referring to fig. 5, the suspected stain positions in the original test image may be marked with rectangular frames (i.e., stain mark areas), when the overlapping areas of the stain mark areas of the two stains exceed a predetermined threshold, the two stains may be considered to belong to the same stain area, at this time, the two stains may be merged into the same stain area, and when the overlapping areas of the stain mark areas of the two stains are less than or equal to the predetermined threshold, the two stains may be considered not to belong to the same stain area, at this time, the two stains may not be merged. In still another embodiment of the present application, the above-described method of merging spots according to the distance between spot centers and the method of merging spots according to the overlapping area of spot mark areas may be used simultaneously.
In actual test, compared with the traditional stain detection algorithm, the stain detection is carried out based on the stain detection method (the stain detection method based on the adaptive partition), the omission factor is reduced from the traditional 1.52% to 1.0%, and the misjudgment rate is reduced from 32.26% to 11.5%. These data indicate that the stain detection algorithm of the present application can significantly improve the accuracy of the stain detection.
The application also provides a stain testing device for quality inspection of the camera module, which comprises a partitioner, a binary image acquirer and a stain determiner, wherein the partitioner is used for dividing a test image into a plurality of initial partitions, and each initial partition is provided with a different stain identification threshold; the binary image acquirer is used for acquiring a binary image containing the stain based on the adaptive stain segmentation method for each initial partition; the self-adaptive stain segmentation method comprises the following steps: 1) For the current subarea, performing self-adaptive surface fitting on the test image to obtain a fitting image; 2) Subtracting the test image from the fitting image to obtain a foreground image; and 3) determining whether the difference between the brightness maximum value and the brightness minimum value of the foreground image is larger than a preset threshold value, if so, carrying out self-adaptive segmentation on the current partition, and repeatedly executing a self-adaptive stain segmentation method on the partition after self-adaptive segmentation, otherwise, not carrying out self-adaptive segmentation on the current partition and binarizing the foreground image of the current partition; the stain determiner is used for acquiring stain positions in the binarized foreground image after all areas of the test image are binarized, and judging whether stains exist in suspected stain positions corresponding to the stain positions in the test image according to stain identification threshold values of the initial partitions corresponding to the stain positions.
In one embodiment, the spot testing apparatus further comprises a test image enhancer for enhancing the test image prior to dividing the test image into the plurality of initial partitions.
In one embodiment, the test image enhancer is to: extracting brightness data of the test image and filtering to remove noise; removing the background in the brightness data; and linearly stretching the background-removed luminance data to obtain an enhanced test image.
In one embodiment, the initial zone includes a central zone, four side zones, and four corner zones.
In one embodiment, in step 3), the adaptive partitioning of the current partition is to partition the current partition into four next-level partitions.
In one embodiment, the stain identification threshold includes an area threshold and a brightness threshold.
In one embodiment, determining whether a suspected stain location corresponding to the stain location in the test image has a stain according to a stain identification threshold of an initial zone corresponding to the stain location further comprises: extracting brightness data at the suspected stain position from the test image; performing surface fitting on the brightness data to obtain a background image; subtracting the background image from the luminance data to obtain a difference image; judging whether the brightness of each pixel point in the difference image is greater than a brightness threshold value, if so, judging the pixel point as a stain pixel and increasing the stain area value at the suspected stain position by a corresponding value, otherwise, judging the pixel point as a normal pixel and not increasing the stain area value at the suspected stain position; judging whether the stain area value of the suspected stain position is larger than an area threshold value, if so, determining that the suspected stain position has stains, otherwise, determining that the suspected stain position has no stains.
In one embodiment, in step 3), binarizing the foreground image of the current partition comprises: judging whether the value of each pixel in the foreground image is larger than a binarization threshold value, if so, setting the value of the pixel as a stain value, and otherwise, setting the value of the pixel as a non-stain value, wherein the binarization threshold value has different values in different initial partitions.
In one embodiment, the test image enhancer is further to: the photographed test image is reduced to reduce the image size, and then subjected to image enhancement processing.
In one embodiment, the spot testing apparatus further comprises a spot combiner for: for the same test image, when the stain determiner obtains a plurality of stains, part or all of the plurality of stains are combined into one stain according to an overlapping area of a stain marking area, wherein the stain marking area is a rectangular frame for marking a stain position.
In one embodiment, the spot testing apparatus further comprises a spot combiner for: for the same test image, when the stain determiner obtains a plurality of stains, part or all of the plurality of stains are combined into one stain according to a distance between centers of the plurality of stains.
In one embodiment, the spot testing apparatus further comprises a spot combiner for: when the stain determiner obtains a plurality of stains for the same test image, combining part or all of the plurality of stains into one stain according to the area of the overlapping region of the output result; and combining part or all of the plurality of spots into one spot according to a distance between centers of the plurality of spots.
The application also provides a computer system, which can be a mobile terminal, a Personal Computer (PC), a tablet computer, a server and the like. Referring now to FIG. 6, there is illustrated a schematic diagram of a computer system 600 suitable for use in implementing a terminal device or server of the present application: as shown in fig. 6, computer system 600 includes one or more processors, communications, etc., such as: one or more Central Processing Units (CPUs) 601, and/or one or more image processors (GPUs) 613, etc., the processors may perform various suitable actions and processes according to executable instructions stored in a read-only memory (ROM) 602 or executable instructions loaded from a storage portion 608 into a Random Access Memory (RAM) 603. The communication portion 612 may include, but is not limited to, a network card, which may include, but is not limited to, a IB (Infiniband) network card.
The processor may be in communication with the rom 602 and/or the ram 603 to execute executable instructions, and is connected to the communication unit 612 through the bus 604, and is in communication with other target devices through the communication unit 612, so as to perform operations corresponding to any of the methods provided in the embodiments of the present application, for example: 1) Dividing the test image into a plurality of initial partitions, each initial partition having a different stain identification threshold; 2) For each initial partition, obtaining a binary image containing a stain based on an adaptive stain segmentation method; and 3) after all areas of the test image are binarized, obtaining a stain position in the binarized foreground image, and judging whether a stain exists at a suspected stain position corresponding to the stain position in the test image according to a stain identification threshold value of an initial partition corresponding to the stain position, wherein the self-adaptive stain segmentation method comprises the following steps: 21 For the current subarea, performing self-adaptive surface fitting on the test image to obtain a fitting image; 22 Subtracting the test image from the fitted image to obtain a foreground image; and 23) determining whether the difference between the brightness maximum value and the brightness minimum value of the foreground image is larger than a preset threshold value, if so, performing adaptive segmentation on the current partition, and repeatedly performing an adaptive stain segmentation method on the adaptively segmented partition, otherwise, not performing adaptive segmentation on the current partition and binarizing the foreground image of the current partition.
In addition, in the RAM 603, various programs and data necessary for device operation can also be stored. The CPU 601, ROM 602, and RAM 603 are connected to each other through a bus 604. In the case of RAM 603, ROM 602 is an optional module. The RAM 603 stores executable instructions that cause the processor 601 to execute operations corresponding to the communication methods described above, or write executable instructions to the ROM 602 at the time of execution. An input/output (I/O) interface 605 is also connected to bus 604. The communication unit 612 may be integrally provided or may be provided with a plurality of sub-modules (e.g., a plurality of IB network cards) and be connected to a bus link.
The following components are connected to the I/O interface 605: an input portion 606 including a keyboard, mouse, etc.; an output portion 607 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, a speaker, and the like; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The drive 610 is also connected to the I/O interface 605 as needed. Removable media 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is installed as needed on drive 610 so that a computer program read therefrom is installed as needed into storage section 608.
It should be noted that the architecture shown in fig. 6 is only an alternative implementation, and in a specific practical process, the number and types of components in fig. 6 may be selected, deleted, added or replaced according to actual needs; in the setting of different functional components, implementation manners such as separation setting or integration setting can also be adopted, for example, the GPU and the CPU can be separated or the GPU can be integrated on the CPU, the communication part can be separated or the communication part can be integrated on the CPU or the GPU, and the like. Such alternative embodiments fall within the scope of the present disclosure.
In addition, according to embodiments of the present application, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, the present application provides a non-transitory machine-readable storage medium storing machine-readable instructions executable by a processor to perform instructions corresponding to the method steps provided by the present application, such as: 1) Dividing the test image into a plurality of initial partitions, each initial partition having a different stain identification threshold; 2) For each initial partition, obtaining a binary image containing a stain based on an adaptive stain segmentation method; and 3) after all areas of the test image are binarized, obtaining a stain position in the binarized foreground image, and judging whether a stain exists at a suspected stain position corresponding to the stain position in the test image according to a stain identification threshold value of an initial partition corresponding to the stain position, wherein the self-adaptive stain segmentation method comprises the following steps: 21 For the current subarea, performing self-adaptive surface fitting on the test image to obtain a fitting image; 22 Subtracting the test image from the fitted image to obtain a foreground image; and 23) determining whether the difference between the brightness maximum value and the brightness minimum value of the foreground image is larger than a preset threshold value, if so, continuing to divide the current partition, and repeatedly executing the self-adaptive stain dividing method on the divided partition, otherwise, not executing the self-adaptive division on the current partition and binarizing the foreground image of the current partition.
In such an embodiment, the computer program can be downloaded and installed from a network through the communication portion 609, and/or installed from the removable medium 611. The above-described functions defined in the method of the present application are performed when the computer program is executed by a Central Processing Unit (CPU) 601.
The methods and apparatus, devices of the present application may be implemented in numerous ways. For example, the methods and apparatus, devices of the present application may be implemented by software, hardware, firmware, or any combination of software, hardware, firmware. The above-described sequence of steps for the method is for illustration only, and the steps of the method of the present application are not limited to the sequence specifically described above unless specifically stated otherwise. Furthermore, in some embodiments, the present application may also be embodied as programs recorded in a recording medium, the programs including machine-readable instructions for implementing the methods according to the present application. Thus, the present application also covers a recording medium storing a program for executing the method according to the present application.
The above description is only illustrative of the preferred embodiments of the present application and of the principles of the technology employed. It will be appreciated by persons skilled in the art that the scope of the application referred to in the present application is not limited to the specific combinations of the technical features described above, but also covers other technical features formed by any combination of the technical features described above or their equivalents without departing from the inventive concept. Such as the above-mentioned features and the technical features disclosed in the present application (but not limited to) having similar functions are replaced with each other.

Claims (31)

1. A stain test method for quality inspection of a camera module is characterized by comprising the following steps:
1) Dividing the test image into a plurality of initial partitions, each initial partition having a different stain identification threshold, wherein the stain identification threshold comprises an area threshold and a brightness threshold;
2) For each initial partition, obtaining a binary image containing a stain based on an adaptive stain segmentation method; the self-adaptive stain segmentation method comprises the following steps:
21 For the current subarea, performing self-adaptive surface fitting on the test image to obtain a fitting image;
22 Subtracting the test image from the fitted image to obtain a foreground image; and
23 Determining whether the difference between the brightness maximum value and the brightness minimum value of the foreground image is larger than a preset threshold value, if so, carrying out self-adaptive segmentation on the current partition, and repeatedly executing the self-adaptive stain segmentation method on the partition after self-adaptive segmentation, otherwise, not carrying out self-adaptive segmentation on the current partition and binarizing the foreground image of the current partition; and
3) After all the areas of the test image are binarized, obtaining a stain position in the binarized foreground image, judging whether a stain exists in a suspected stain position corresponding to the stain position in the test image according to a stain identification threshold value of an initial partition corresponding to the stain position, wherein judging whether the suspected stain position corresponding to the stain position in the test image exists according to the stain identification threshold value of the initial partition corresponding to the stain position further comprises:
Extracting brightness data at the suspected stain position from the test image;
performing surface fitting on the brightness data to obtain a background image;
subtracting the background image from the luminance data to obtain a difference image;
judging whether the brightness of each pixel point in the difference image is larger than the brightness threshold value, if so, judging the pixel point as a stain pixel and enabling the stain area value at the suspected stain position to be increased by a corresponding value, otherwise, judging the pixel point as a normal pixel and not increasing the stain area value at the suspected stain position;
judging whether the stain area value of the suspected stain position is larger than the area threshold value, if so, determining that the stain exists in the suspected stain position, otherwise, determining that the stain does not exist in the suspected stain position.
2. The spot testing method for camera module quality inspection of claim 1, further comprising the step of enhancing the test image prior to dividing the test image into a plurality of initial partitions.
3. The method for spot testing for camera module quality inspection of claim 2, wherein the step of enhancing the test image comprises:
Extracting brightness data of the test image to perform filtering treatment so as to filter noise;
removing the background in the brightness data; and
the background-removed luminance data is linearly stretched to obtain an enhanced test image.
4. The spot testing method for camera module quality inspection of claim 1, wherein the initial zone comprises a central zone, four side zones, and four corner zones.
5. The method according to claim 1, wherein in the step 23), the adaptive segmentation of the current partition is performed by dividing the current partition into four next-level partitions.
6. The method according to claim 1, wherein in the step 23), the binarizing the foreground image of the current partition comprises:
judging whether the value of each pixel in the foreground image is larger than a binarization threshold value, if so, setting the value of the pixel as a stain value, otherwise, setting the value of the pixel as a non-stain value,
wherein the binarization threshold has different values in different initial partitions.
7. The method for spot testing for camera module quality inspection of claim 2, wherein the step of enhancing the test image further comprises: the photographed test image is reduced to reduce the image size, and then subjected to image enhancement processing.
8. The spot testing method for quality inspection of camera modules of claim 1, further comprising the steps of:
4) For the same test image, when a plurality of stains are obtained after step 3) is performed, part or all of the plurality of stains are combined into one stain according to the overlapping area of the stain marking area, wherein the stain marking area is a rectangular frame for marking the positions of the stains.
9. The spot testing method for quality inspection of camera modules of claim 1, further comprising the steps of:
4a) For the same test image, when a plurality of spots are obtained after step 3) is performed, part or all of the plurality of spots are combined into one spot according to the distance between centers of the plurality of spots.
10. The spot testing method for quality inspection of camera modules of claim 1, further comprising the steps of:
4b) When a plurality of stains are obtained after the step 3) is executed for the same test image, combining part or all of the plurality of stains into one stain according to the area of the overlapped area of the output result; and combining part or all of the plurality of spots into one spot according to the distance between centers of the plurality of spots.
11. A stain testing arrangement for making a video recording module quality inspection, its characterized in that includes:
a partitioner for partitioning a test image into a plurality of initial partitions, each initial partition having a different stain identification threshold, wherein the stain identification threshold comprises an area threshold and a brightness threshold;
a binary image acquirer for acquiring a binary image containing a stain based on an adaptive stain segmentation method for each initial partition; the self-adaptive stain segmentation method comprises the following steps:
1) For the current subarea, performing self-adaptive surface fitting on the test image to obtain a fitting image;
2) Subtracting the test image from the fitted image to obtain a foreground image; and
3) Determining whether the difference between the brightness maximum value and the brightness minimum value of the foreground image is larger than a preset threshold value, if so, carrying out self-adaptive segmentation on the current partition, and repeatedly executing the self-adaptive stain segmentation method on the partition after self-adaptive segmentation, otherwise, not carrying out self-adaptive segmentation on the current partition and binarizing the foreground image of the current partition; and
The stain determiner is configured to obtain a stain position from the binarized foreground image after all areas of the test image are binarized, determine whether a stain exists at a suspected stain position corresponding to the stain position in the test image according to a stain identification threshold of an initial partition corresponding to the stain position, wherein determining whether a stain exists at a suspected stain position corresponding to the stain position in the test image according to a stain identification threshold of an initial partition corresponding to the stain position further includes:
extracting brightness data at the suspected stain position from the test image;
performing surface fitting on the brightness data to obtain a background image;
subtracting the background image from the luminance data to obtain a difference image;
judging whether the brightness of each pixel point in the difference image is larger than the brightness threshold value, if so, judging the pixel point as a stain pixel and enabling the stain area value at the suspected stain position to be increased by a corresponding value, otherwise, judging the pixel point as a normal pixel and not increasing the stain area value at the suspected stain position;
judging whether the stain area value of the suspected stain position is larger than the area threshold value, if so, determining that the stain exists in the suspected stain position, otherwise, determining that the stain does not exist in the suspected stain position.
12. The spot testing apparatus for camera module quality inspection of claim 11, further comprising a test image enhancer for enhancing the test image prior to dividing the test image into the plurality of initial partitions.
13. The spot testing apparatus for camera module quality inspection of claim 12, wherein the test image intensifier is configured to:
extracting brightness data of the test image to perform filtering treatment so as to filter noise;
removing the background in the brightness data; and
the background-removed luminance data is linearly stretched to obtain an enhanced test image.
14. The spot testing apparatus for camera module quality inspection of claim 11, wherein the initial zone comprises a central zone, four side zones, and four corner zones.
15. The spot testing apparatus for quality inspection of camera modules of claim 11, wherein in the step 3), the adaptive segmentation of the current partition is to divide the current partition into four next-level partitions.
16. The spot testing apparatus for camera module quality inspection of claim 11, wherein in the step 3), binarizing the foreground image of the current partition comprises:
Judging whether the value of each pixel in the foreground image is larger than a binarization threshold value, if so, setting the value of the pixel as a stain value, otherwise, setting the value of the pixel as a non-stain value,
wherein the binarization threshold has different values in different initial partitions.
17. The spot testing apparatus for camera module quality inspection of claim 12, wherein the test image intensifier is further configured to: the photographed test image is reduced to reduce the image size, and then subjected to image enhancement processing.
18. The spot testing apparatus for quality inspection of camera modules of claim 11, further comprising:
spot combiner for: for the same test image, when the spot determiner obtains a plurality of spots, a part or all of the plurality of spots are combined into one spot according to an overlapping area of a spot marking area, wherein the spot marking area is a rectangular frame for marking a spot position.
19. The spot testing apparatus for quality inspection of camera modules of claim 11, further comprising:
spot combiner for: for the same test image, when the stain determiner obtains a plurality of stains, part or all of the plurality of stains are combined into one stain according to a distance between centers of the plurality of stains.
20. The spot testing apparatus for quality inspection of camera modules of claim 11, further comprising the steps of:
spot combiner for: when the stain determiner obtains a plurality of stains for the same test image, combining part or all of the plurality of stains into one stain according to the area of the overlapping area of the output result; and combining part or all of the plurality of spots into one spot according to the distance between centers of the plurality of spots.
21. A spot testing system for quality inspection of camera modules, the system comprising:
a processor; and
a memory coupled to the processor and storing machine-readable instructions executable by the processor to perform operations comprising:
1) Dividing the test image into a plurality of initial partitions, each initial partition having a different stain identification threshold, wherein the stain identification threshold comprises an area threshold and a brightness threshold;
2) For each initial partition, obtaining a binary image containing a stain based on an adaptive stain segmentation method; the self-adaptive stain segmentation method comprises the following steps:
21 For the current subarea, performing self-adaptive surface fitting on the test image to obtain a fitting image;
22 Subtracting the test image from the fitted image to obtain a foreground image; and
23 Determining whether the difference between the brightness maximum value and the brightness minimum value of the foreground image is larger than a preset threshold value, if so, carrying out self-adaptive segmentation on the current partition, and repeatedly executing the self-adaptive stain segmentation method on the partition after self-adaptive segmentation, otherwise, not carrying out self-adaptive segmentation on the current partition and binarizing the foreground image of the current partition; and
3) After all the areas of the test image are binarized, obtaining a stain position in the binarized foreground image, judging whether a stain exists in a suspected stain position corresponding to the stain position in the test image according to a stain identification threshold value of an initial partition corresponding to the stain position, wherein judging whether the suspected stain position corresponding to the stain position in the test image exists according to the stain identification threshold value of the initial partition corresponding to the stain position further comprises:
extracting brightness data at the suspected stain position from the test image;
Performing surface fitting on the brightness data to obtain a background image;
subtracting the background image from the luminance data to obtain a difference image;
judging whether the brightness of each pixel point in the difference image is larger than the brightness threshold value, if so, judging the pixel point as a stain pixel and enabling the stain area value at the suspected stain position to be increased by a corresponding value, otherwise, judging the pixel point as a normal pixel and not increasing the stain area value at the suspected stain position;
judging whether the stain area value of the suspected stain position is larger than the area threshold value, if so, determining that the stain exists in the suspected stain position, otherwise, determining that the stain does not exist in the suspected stain position.
22. The spot testing system for camera module quality inspection of claim 21, further comprising the step of enhancing the test image prior to dividing the test image into the plurality of initial partitions.
23. The spot testing system for camera module quality inspection of claim 22, wherein the step of enhancing the test image comprises:
extracting brightness data of the test image to perform filtering treatment so as to filter noise;
Removing the background in the brightness data; and
the background-removed luminance data is linearly stretched to obtain an enhanced test image.
24. The spot testing system for camera module quality inspection of claim 21, wherein the initial zone includes a central zone, four side zones, and four corner zones.
25. The spot testing system for camera module quality inspection of claim 21, wherein in step 23), the adaptive segmentation of the current partition is to divide the current partition into four next-level partitions.
26. The spot testing system for camera module quality inspection of claim 21, wherein in step 23), binarizing the foreground image of the current partition comprises:
judging whether the value of each pixel in the foreground image is larger than a binarization threshold value, if so, setting the value of the pixel as a stain value, otherwise, setting the value of the pixel as a non-stain value,
wherein the binarization threshold has different values in different initial partitions.
27. The spot testing system for quality inspection of camera modules of claim 22, wherein the step of enhancing the test image further comprises: the photographed test image is reduced to reduce the image size, and then subjected to image enhancement processing.
28. The spot testing system for quality inspection of camera modules of claim 21, wherein the spot testing method further comprises the steps of:
4) For the same test image, when a plurality of stains are obtained after step 3) is performed, part or all of the plurality of stains are combined into one stain according to the overlapping area of the stain marking area, wherein the stain marking area is a rectangular frame for marking the positions of the stains.
29. The spot testing system for quality inspection of camera modules of claim 21, wherein the spot testing method further comprises the steps of:
4a) For the same test image, when a plurality of spots are obtained after step 3) is performed, part or all of the plurality of spots are combined into one spot according to the distance between centers of the plurality of spots.
30. The spot testing system for quality inspection of camera modules of claim 21, wherein the spot testing method further comprises the steps of:
4b) When a plurality of stains are obtained after the step 3) is executed for the same test image, combining part or all of the plurality of stains into one stain according to the area of the overlapped area of the output result; and combining part or all of the plurality of spots into one spot according to the distance between centers of the plurality of spots.
31. A non-transitory machine-readable storage medium storing machine-readable instructions executable by a processor to perform operations comprising:
1) Dividing the test image into a plurality of initial partitions, each initial partition having a different stain identification threshold, wherein the stain identification threshold comprises an area threshold and a brightness threshold;
2) For each initial partition, obtaining a binary image containing a stain based on an adaptive stain segmentation method; the self-adaptive stain segmentation method comprises the following steps:
21 For the current subarea, performing self-adaptive surface fitting on the test image to obtain a fitting image;
22 Subtracting the test image from the fitted image to obtain a foreground image; and
23 Determining whether the difference between the brightness maximum value and the brightness minimum value of the foreground image is larger than a preset threshold value, if so, carrying out self-adaptive segmentation on the current partition, and repeatedly executing the self-adaptive stain segmentation method on the partition after self-adaptive segmentation, otherwise, not carrying out self-adaptive segmentation on the current partition and binarizing the foreground image of the current partition; and
3) After all the areas of the test image are binarized, obtaining a stain position in the binarized foreground image, judging whether a stain exists in a suspected stain position corresponding to the stain position in the test image according to a stain identification threshold value of an initial partition corresponding to the stain position, wherein judging whether the suspected stain position corresponding to the stain position in the test image exists according to the stain identification threshold value of the initial partition corresponding to the stain position further comprises:
extracting brightness data at the suspected stain position from the test image;
performing surface fitting on the brightness data to obtain a background image;
subtracting the background image from the luminance data to obtain a difference image;
judging whether the brightness of each pixel point in the difference image is larger than the brightness threshold value, if so, judging the pixel point as a stain pixel and enabling the stain area value at the suspected stain position to be increased by a corresponding value, otherwise, judging the pixel point as a normal pixel and not increasing the stain area value at the suspected stain position;
judging whether the stain area value of the suspected stain position is larger than the area threshold value, if so, determining that the stain exists in the suspected stain position, otherwise, determining that the stain does not exist in the suspected stain position.
CN201910222883.3A 2019-03-22 2019-03-22 Stain test method, device and system for quality inspection of camera module and storage medium Active CN111738973B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910222883.3A CN111738973B (en) 2019-03-22 2019-03-22 Stain test method, device and system for quality inspection of camera module and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910222883.3A CN111738973B (en) 2019-03-22 2019-03-22 Stain test method, device and system for quality inspection of camera module and storage medium

Publications (2)

Publication Number Publication Date
CN111738973A CN111738973A (en) 2020-10-02
CN111738973B true CN111738973B (en) 2023-08-15

Family

ID=72645617

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910222883.3A Active CN111738973B (en) 2019-03-22 2019-03-22 Stain test method, device and system for quality inspection of camera module and storage medium

Country Status (1)

Country Link
CN (1) CN111738973B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104867159A (en) * 2015-06-05 2015-08-26 北京大恒图像视觉有限公司 Stain detection and classification method and device for sensor of digital camera
CN106791804A (en) * 2016-11-23 2017-05-31 歌尔股份有限公司 For the smear detecting method and device of camera module
CN108765424A (en) * 2018-04-03 2018-11-06 迈克医疗电子有限公司 Stain method for detecting area and device, analytical instrument and storage medium
CN109102466A (en) * 2017-06-20 2018-12-28 杭州海康威视数字技术股份有限公司 Image smear determination method and device
CN109118498A (en) * 2018-08-22 2019-01-01 科大讯飞股份有限公司 A kind of camera head stain detection method, device, equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104867159A (en) * 2015-06-05 2015-08-26 北京大恒图像视觉有限公司 Stain detection and classification method and device for sensor of digital camera
CN106791804A (en) * 2016-11-23 2017-05-31 歌尔股份有限公司 For the smear detecting method and device of camera module
CN109102466A (en) * 2017-06-20 2018-12-28 杭州海康威视数字技术股份有限公司 Image smear determination method and device
CN108765424A (en) * 2018-04-03 2018-11-06 迈克医疗电子有限公司 Stain method for detecting area and device, analytical instrument and storage medium
CN109118498A (en) * 2018-08-22 2019-01-01 科大讯飞股份有限公司 A kind of camera head stain detection method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN111738973A (en) 2020-10-02

Similar Documents

Publication Publication Date Title
EP3614334B1 (en) Method for image processing and electronic device
CN110766679B (en) Lens contamination detection method and device and terminal equipment
US9811899B2 (en) Method, image processing system and computer-readable recording medium for item defect inspection
US10438361B2 (en) Image processing apparatus and image processing method for finding background regions in an image
KR102214876B1 (en) System and method of correcting image artifacts
JP4657869B2 (en) Defect detection apparatus, image sensor device, image sensor module, image processing apparatus, digital image quality tester, defect detection method, defect detection program, and computer-readable recording medium
US20190266706A1 (en) Removal of shadows from document images while preserving fidelity of image contents
CN115631117B (en) Image enhancement method, device, detection system and storage medium for defect detection
CN108918093B (en) Optical filter mirror surface defect detection method and device and terminal equipment
CN115205223B (en) Visual inspection method and device for transparent object, computer equipment and medium
US20230011569A1 (en) Method and apparatus for detecting defect, device, and storage medium
CN117115130A (en) Wafer edge defect detection method and device
CN113781396A (en) Screen defect detection method, device, equipment and storage medium
CN114298985B (en) Defect detection method, device, equipment and storage medium
US20240086661A1 (en) Method and apparatus for processing graphic symbol and computer-readable storage medium
CN114007013A (en) Fuzzy region determination and anti-shake performance detection method and system, and anti-shake performance detection equipment
CN111415365B (en) Image detection method and device
CN111738973B (en) Stain test method, device and system for quality inspection of camera module and storage medium
CN111563869B (en) Stain test method for quality inspection of camera module
WO2024016715A1 (en) Method and apparatus for testing imaging consistency of system, and computer storage medium
CN112329572B (en) Rapid static living body detection method and device based on frame and flash point
KR20190109242A (en) Image-processing apparatus to reduce staircase artifacts from an image signal
CN113628192B (en) Image blur detection method, apparatus, device, storage medium, and program product
CN117501326A (en) Image processing method and device, electronic equipment and computer readable storage medium
CN114937003A (en) Multi-type defect detection system and method for glass panel

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