CN111882540A - Method, device and equipment for detecting stains on camera protective cover - Google Patents

Method, device and equipment for detecting stains on camera protective cover Download PDF

Info

Publication number
CN111882540A
CN111882540A CN202010740286.2A CN202010740286A CN111882540A CN 111882540 A CN111882540 A CN 111882540A CN 202010740286 A CN202010740286 A CN 202010740286A CN 111882540 A CN111882540 A CN 111882540A
Authority
CN
China
Prior art keywords
stain
gray
pixel points
protective cover
camera
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.)
Granted
Application number
CN202010740286.2A
Other languages
Chinese (zh)
Other versions
CN111882540B (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.)
Goertek Techology Co Ltd
Original Assignee
Goertek Techology 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 Goertek Techology Co Ltd filed Critical Goertek Techology Co Ltd
Priority to CN202010740286.2A priority Critical patent/CN111882540B/en
Publication of CN111882540A publication Critical patent/CN111882540A/en
Application granted granted Critical
Publication of CN111882540B publication Critical patent/CN111882540B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/62Analysis of geometric attributes of area, perimeter, diameter or volume
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/67Focus control based on electronic image sensor signals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30108Industrial image inspection
    • G06T2207/30164Workpiece; Machine component

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Geometry (AREA)
  • Quality & Reliability (AREA)
  • Studio Devices (AREA)

Abstract

The invention discloses a stain detection method of a camera protective cover, which comprises the steps of adjusting the focal length and the aperture of a camera, so that the distance from the focal point of the camera to the protective cover is not more than a preset distance, and the aperture is not less than the size of the preset aperture; acquiring a gray image of the protective cover by using a camera; and identifying stain pixel points in the gray level image to obtain stain distribution data on the protective cover. The camera is modulated to have a focus positioned near the protective cover, and the protective cover image shot by the large aperture is adopted, so that the problem of interference caused by clear imaging of a background object in the shot protective cover image due to the fact that the protective cover is transparent is solved to a great extent, the accuracy of stain identification in the protective cover image is guaranteed, and the accuracy of a stain detection result of the protective cover is improved. The application also provides a stain detection device and equipment of the camera protection cover, and the beneficial effects are achieved.

Description

Method, device and equipment for detecting stains on camera protective cover
Technical Field
The invention relates to the technical field of images, in particular to a method, a device and equipment for detecting stains on a camera protective cover.
Background
The video monitoring technology is a monitoring technology which is widely applied at present, can be used for traffic violation monitoring, important financial safety monitoring, safety operation monitoring of construction sites and the like. In the video detection equipment to which the video monitoring technology is applied, a camera is one of key equipment, and the accuracy of a monitoring result is related to the definition of an image shot by the camera.
However, the video detection equipment is applied in various environments, and if the working environment is severe, the problems of moisture and heavy pollution exist, the service life of the camera can be influenced to a certain extent. Therefore, a transparent waterproof shell can be arranged on the camera in a severe working environment, and the camera is protected. But along with camera operating time's extension, the inevitable stain that can be stained with on this protective housing, if not clear for a long time, the stain spot can be more and more bigger and bigger, influences the normal work of camera.
Disclosure of Invention
The invention aims to provide a method, a device and equipment for detecting stains on a protective cover of a camera, and solves the technical problem that stains on the protective cover of the camera affect the normal work of the camera.
In order to solve the above technical problem, the present invention provides a method for detecting stains on a camera protection cover, comprising:
adjusting the focal length and the aperture of the camera to ensure that the distance from the focal point of the camera to the protective cover is not more than a preset distance, and the aperture is not less than the size of the preset aperture;
acquiring a gray image of the protective cover by using the camera;
and identifying stain pixel points in the gray level image to obtain stain distribution data on the protective cover.
Optionally, identifying a stain pixel point in the grayscale image, and obtaining stain distribution data on the protective cover, includes:
identifying the stain pixel points according to the gray value of the pixel points in the gray image;
and judging whether the proportion of the stain pixel points to the total pixel points of the gray image is greater than a preset proportion, if so, determining that the stains on the protective cover exceed the standard.
Optionally, determining whether a ratio of the stain pixels to total pixels of the grayscale image is greater than a preset ratio includes:
determining the total number of all stain pixel points in the gray level image according to the identified stain pixel points;
and judging whether the ratio of the total number of the stain pixels to the total number of the pixels of the gray-scale image is larger than a first preset proportion.
Optionally, determining whether a ratio of the stain pixels to total pixels of the grayscale image is greater than a preset ratio includes:
determining the number of pixel points contained in each stain imaging area according to the coordinate values of the stain pixel points;
and judging whether the ratio of the number of the pixel points in the stain imaging area with the largest area to the total number of the pixel points of the gray level image is larger than a second preset proportion.
Optionally, determining the number of pixels included in each stain imaging area according to the coordinate value of each stain pixel includes:
obtaining the maximum abscissa, the minimum abscissa, the maximum ordinate and the minimum ordinate of each pixel point in the same stain imaging area formed by a plurality of stain pixel points;
according to the estimation formula of the number of pixel points in the stain imaging area: and estimating the number of pixels in each stain imaging area, wherein S is the number of pixels, X1, X2, Y1 and Y2 are respectively a maximum abscissa, a minimum abscissa, a maximum ordinate and a minimum ordinate of the stain imaging area, and K is an estimation proportionality coefficient.
Optionally, determining whether a ratio of the stain pixels to total pixels of the grayscale image is greater than a preset ratio includes:
judging whether the ratio of the total number of all the stain pixels to the total number of the pixels of the gray-scale image is larger than a first preset proportion, and/or the ratio of the number of the pixels of the stain imaging area with the largest area to the total number of the pixels of the gray-scale image is larger than a second preset proportion; wherein the first preset proportion is greater than the second preset proportion.
Optionally, identifying a stain pixel in the grayscale image includes:
obtaining the gray difference absolute value between adjacent pixel points according to the gray value of each pixel point in the gray image;
marking the pixel point with the maximum gray value in the two adjacent pixel points with the gray difference absolute value larger than a preset difference threshold value as a stain edge pixel point in the stain pixel points;
identifying expected stain pixel points with gray values larger than a preset gray value in all pixel points of the gray image;
marking expected stain pixel points communicated with the stain edge pixel points as stain internal pixel points in the stain pixel points; the expected stain pixel points communicated with the stain edge pixel points are the expected stain pixel points directly adjacent to the stain edge pixel points or the expected stain pixel points adjacent to the stain edge pixel points through the same expected stain pixel point area; the expected stain pixel point region is a pixel region formed by one or more adjacent expected stain pixel points in sequence.
Optionally, identifying a stain pixel in the grayscale image includes:
taking any pixel point in the gray image as a current pixel point, judging whether the gray value of the current pixel point is larger than a preset gray value or not, and if so, marking the current pixel point as an expected stain pixel point;
obtaining the gray difference absolute value of the current pixel point and each adjacent pixel point;
judging whether a gray difference absolute value larger than a preset difference threshold exists in each gray difference absolute value, if so, selecting an adjacent pixel point corresponding to the gray difference absolute value larger than the preset difference threshold and a pixel point with the largest gray value in the current pixel points as a stain edge pixel point;
sequentially taking each adjacent pixel point of the current pixel point as a new current pixel point, and repeatedly executing the operation step of judging whether the gray value of the current pixel point is greater than a preset gray value until all pixel points in the gray image are subjected to the identification completion of the expected stain pixel points and the stain edge pixel points;
and identifying and marking the stain internal pixel points in the expected stain pixel points one by taking any expected stain pixel point adjacent to the stain edge pixel point in the gray image as a starting point pixel point.
The application also provides a stain detection device of camera safety cover, includes:
the adjusting module is used for adjusting the focal length and the aperture of the camera, so that the distance between the focal point of the camera and the protective cover is not more than a preset distance, and the aperture is not less than the size of the preset aperture;
the acquisition module is used for acquiring a gray level image of the protective cover by using the camera;
the identification module is used for identifying stain pixel points in the gray level image;
and the judging module is used for judging whether the proportion of the stain pixel points to the total pixel points of the gray level image is greater than a preset proportion or not, and if so, sending an alarm prompt.
The application also provides a stain check out test set of camera safety cover, includes:
a memory for storing a computer program;
a processor for implementing the steps of the method for detecting stains in a protective cover of a camera as described in any one of the above when the computer program is executed.
According to the stain detection method for the camera protection cover, the image shooting is carried out on the protection cover by utilizing the camera shooting function of the camera, and the stains on the image corresponding to the protection cover are identified in an image identification mode, so that the data of the stain distribution condition on the protection cover are determined, and an effective theoretical basis is provided for workers to determine whether the protection cover needs to be cleaned or not; meanwhile, when the camera is used for shooting the image of the protective cover, in order to overcome the problem that the background object generates interference due to the fact that the protective cover is transparent, the camera is modulated to have a focus located near the protective cover, and the aperture of the camera is adjusted to be a large aperture, so that a fuzzy picture is formed on the background object in the shot image of the protective cover, interference caused by the fact that the protective cover is transparent is avoided to a great extent, accuracy of identification of stains in the image of the protective cover is guaranteed, and accuracy of a stain detection result of the protective cover is improved.
The application also provides a stain detection device and equipment of the camera protection cover, and the beneficial effects are achieved.
Drawings
In order to more clearly illustrate the embodiments or technical solutions of the present invention, the drawings used in the description of the embodiments or the prior art will be briefly described 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 that other drawings can be obtained based on these drawings without creative efforts.
Fig. 1 is a schematic flowchart of a method for detecting stains in a protective cover of a camera according to an embodiment of the present disclosure;
fig. 2 is a schematic flow chart illustrating a process of identifying a stain pixel in a gray-scale image according to an embodiment of the present disclosure;
fig. 3 is a partial schematic view of a gray scale image of a protective cover according to an embodiment of the present disclosure;
fig. 4 is a schematic flow chart illustrating a process of identifying a stain pixel in a gray-scale image according to another embodiment of the present application;
FIG. 5 is a partial schematic view of a gray scale image of a protective cover according to another embodiment of the present disclosure;
fig. 6 is a block diagram of a stain detection apparatus of a camera protection cover according to an embodiment of the present invention;
fig. 7 is a block diagram of a stain detection apparatus of a camera protection cover according to an embodiment of the present invention.
Detailed Description
The safety cover of camera can protect the camera to a certain extent not disturbed and caused the damage by rainwater, moisture, pollutant etc. in the external environment. The protective cover is inevitably contaminated with stains and needs to be cleaned frequently. However, whether the surface of the protective cover is seriously stained with stains has randomness to a certain degree, if a cleaning period is set for periodic cleaning, the cleaning period needs to be set shorter to ensure the timeliness of cleaning, and the workload of cleaning the protective cover is increased to a certain degree.
Therefore, the technical scheme for carrying out stain detection on the protective cover of the camera is provided, when the protective cover is detected to be required to clean stains, the camera can send out an alarm in time, the cleanliness of the protective cover can be guaranteed, the situation that the protective cover is frequently cleaned in an useless mode is avoided, and on the basis that the camera can work normally, the workload for cleaning the protective cover is reduced.
In order that those skilled in the art will better understand the disclosure, the invention will be described in further detail with reference to the accompanying drawings and specific embodiments. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
As shown in fig. 1, fig. 1 is a schematic flowchart of a method for detecting stains in a protective cover of a camera according to an embodiment of the present application, where the method for detecting stains may include:
s11: the focal length and the aperture of the camera are adjusted, so that the distance from the focal point of the camera to the protective cover is not greater than a preset distance, and the aperture is not smaller than the size of the preset aperture.
During the monitoring process of the camera, the focal length of the camera is generally set to be relatively large so as to clearly shoot the picture of an object to be monitored at a distance; the size of the aperture is also selected according to the captured environment picture.
In this embodiment, an image of the protective cover is captured by using the camera function of the camera, and the stain condition on the protective cover is determined based on the image recognition technology. However, when the camera is used for monitoring, the camera needs to shoot a monitoring image through the protective cover, so the protective cover is transparent and colorless in normal times. If the camera directly shoots the image of the protective cover, even if the image formed by the stains on the protective cover can be shot, the stains in the image and the background object are difficult to distinguish due to the interference of the image formed by the background object outside the protective cover, so that the stains cannot be accurately identified from the image.
Therefore, when the camera is used for shooting the image of the protective cover, the camera is controlled to focus firstly, and the focus of the camera is adjusted to a position near the protective cover; meanwhile, the aperture of the camera is adjusted to be not smaller than the preset aperture size, so that the large aperture shooting of the camera is guaranteed to a certain extent, and the maximum aperture of the camera can be directly adopted for shooting.
When the camera shoots the image of the protective cover, the background object outside the protective cover can be fuzzified and imaged to a certain extent, so that the scene outside the protective cover in the shot image is a blurred shadow image, the problem that the identification of the stain in the image of the protective cover is interfered by imaging of the background object is avoided, and the accuracy of identifying the stain in the protective cover is ensured.
S12: and acquiring a gray image of the protective cover by using the camera.
S13: and identifying stain pixel points in the gray level image to obtain stain distribution data on the protective cover.
It will be appreciated that the smudges on the protective cover are generally black or slightly darker in color, and therefore the gray level values of the pixels in the gray level image of the protective cover are relatively large. Therefore, when the stain pixel points are actually identified, whether the stain pixel points are the stain pixel points or not can be determined according to the gray value of the pixel points.
After the stain pixel points are determined, the distribution positions of the stains on the protective cover can be determined, and then whether the stains on the protective cover are serious or not is determined. For example, after the stain pixels are identified, whether the proportion of the stain pixels to the total pixels of the gray-scale image is greater than a preset proportion or not can be judged, and if yes, the stain on the protective cover is determined to be out of standard.
The proportion of the stain pixel points in the total pixel points of the gray level image is consistent with the proportion of the stain shielding camera shooting the monitoring image, and whether the condition of the stain on the protective cover is serious can be judged according to the proportion.
After confirming that the stain condition on the protective cover is serious or not, the staff can confirm whether the protective cover needs to be cleaned according to the stain distribution condition data, if the stain on the protective cover is determined to be too much, namely the stain exceeds the standard, a cleaning alarm prompt can be automatically sent out so as to confirm that the stain on the protective cover is cleaned in time and ensure the cleaning degree of the protective cover.
When the stain detection is actually performed on the protective cover of the camera, the image of the protective cover is shot by directly using the shooting function of the camera. Obviously, the focal length and aperture size of the camera in the working state are different from those of the camera in the state of detecting the dirt on the protective cover. In order to ensure that the camera can work normally, the camera cannot keep a state of shooting images of the protective cover for a long time.
Therefore, in the practical application process, the working state of the camera can be set to be periodically switched to the state of detecting the stains on the protection cover, and the camera can be normally monitored while periodically detecting the stains on the protection cover after the image of the protection cover is shot.
In summary, when the stain condition of the protective cover is detected, the camera shooting function of the camera is fully utilized to shoot the image of the protective cover, and the shot image is used as a basis for determining the stain condition of the protective cover, so that the function of the camera is expanded to a certain extent; meanwhile, the focus of the camera when shooting the image of the protective cover is adjusted to be close to the protective cover and a large aperture is arranged, so that the image of an object outside the protective cover is blurred, the problem that the image of the protective cover cannot be accurately identified due to the fact that the protective cover is transparent and the image of a background object is interfered is avoided, the accuracy of identifying the stains in the image of the protective cover is guaranteed, the accuracy of a detection result of the stain condition of the protective cover is further guaranteed, timely alarming is carried out when the stain condition is serious, the problem of frequently cleaning the stains of the protective cover is avoided on the basis of guaranteeing the timeliness of cleaning the stains, and the workload of cleaning the protective cover is reduced.
Based on the above embodiment, after each pixel point in the grayscale image of the protection cover is identified and determined whether to be a stain pixel point, the process of determining whether the proportion of the stain pixel point to the total pixel points of the grayscale image is greater than the preset proportion based on the identification and determination result may include:
determining the total number of all stain pixel points in the gray level image according to the identified stain pixel points;
and judging whether the ratio of the total number of all the stain pixel points to the total number of the pixel points of the gray-scale image is larger than a first preset proportion.
In consideration of the fact that in the practical application process, if the area covered by the stain pixel points on the gray-scale image is too large, the image definition of the camera for video monitoring shooting is inevitably reduced, and therefore the proportion of the total number of all the stain pixel points to the total number of the pixel points of the whole gray-scale image can be used as the basis for judging whether the protective cover needs to be cleaned.
The size of the preset proportion can be determined according to the requirement of the camera on definition in the video monitoring working process, and the preset proportion can be set to be smaller correspondingly if the definition requirement is high.
Further, considering that in practical applications, some fine stain spots may exist on the protective cover, because the area of the stain imaging area is small, which may not affect the definition of the monitoring image shot by the camera too seriously, and if only one or two relatively large stain spots appear on the protective cover, the proportion of the stain imaging area of the large stain spot in the gray scale image to the whole area of the gray scale image is not too large, but the proportion has an influence on the monitoring work of the camera, and therefore, it should also be regarded as a situation that the stain cleaning is needed.
Therefore, in another embodiment of the present application, the determining whether the ratio of the stain pixels to the total pixels of the gray-scale image is greater than the preset ratio may specifically include:
determining the number of pixel points contained in each stain imaging area according to the coordinate values of the stain pixel points;
and judging whether the ratio of the number of the pixel points in the stain imaging area with the largest area to the total number of the pixel points in the gray level image is larger than a second preset proportion.
Further, in determining the largest stain imaging area, the statistical derivation may be performed in an estimation manner, and the process may include:
obtaining the maximum abscissa, the minimum abscissa, the maximum ordinate and the minimum ordinate of each pixel point in the same stain imaging area formed by a plurality of stain pixel points;
according to the estimation formula of the number of pixel points in the stain imaging area: and estimating the number of pixel points of each stain imaging area, wherein S is the number of pixel points, X1, X2, Y1 and Y2 are respectively the maximum abscissa, the minimum abscissa, the maximum ordinate and the minimum ordinate of the stain imaging area, and K is an estimation proportionality coefficient.
It can be understood that one stain imaging area is also an imaging area of a stain spot in a gray level image, and the same stain imaging area is an area covered by sequentially adjacent stain pixel points.
In addition, the estimated proportionality coefficient may be 0.85, or may be other values, and may be comprehensively set through multiple measurements in practical applications, which is not limited in this application.
In summary, in the process of determining the proportion of the stain pixels to the pixels of the entire gray scale image, the alarm prompt of cleaning the protective cover may be performed on the condition that the proportion of the total number of the stain pixels to the total number of the pixels of the gray scale image exceeds a first preset proportion, or the alarm prompt of cleaning the protective cover may be performed on the condition that the proportion of the number of the pixels of the largest stain imaging area to the total number of the pixels of the entire gray scale image exceeds a second preset proportion. Other judgment conditions can be adopted as long as the judgment conditions can reflect the area size of the stain pixel points covering the gray level image.
Certainly, in order to improve the performance of the monitoring work of the camera, after each stain pixel point is identified, two conditions that the ratio of the total number of all the stain pixel points to the total number of the pixel points of the gray-scale image is greater than a first preset proportion, and the ratio of the number of the pixel points of the stain imaging area with the largest area to the total number of the pixel points of the gray-scale image is greater than a second preset proportion can be judged. As long as the stain pixel points in the gray level image meet any one of the two conditions, an alarm can be sent out, so that more comprehensive detection of the stains of the protective cover is realized. In addition, the first preset ratio in this embodiment should be larger than the second preset ratio.
Based on the foregoing embodiment, in another specific embodiment of the present application, as shown in fig. 2, a process of identifying a stain pixel point in a gray scale image of a protection cover acquired by a camera may include:
s21: and obtaining the gray difference absolute value between adjacent pixel points according to the gray value of each pixel point in the gray image.
S22: and marking the pixel point with the maximum gray value in the two adjacent pixel points with the gray difference absolute value larger than the preset difference threshold as a stain edge pixel point in the stain pixel points.
After acquiring the image of the protective cover, to facilitate subsequent identification and determination, the image may be adjusted to an image with a predetermined pixel size, for example, the image may be adjusted to a 640 × 480 image; and converting the adjusted image into a gray image, and searching the pixel points with jump gray values according to the gray values of all the pixel points in the gray image.
When the camera shoots the image of the protective cover, the camera adopts the small focal length and the large aperture, the imaging edge of the background object in the image can be blurred, after the image of the protective cover is converted into the gray image, the gray change of the imaging edge of the background object on the gray image is gradually changed, and the jump of the gray value is relatively small.
The imaging edge of the stain on the protective cover in the gray level image becomes sharp, that is, the gray level of the imaging edge of the stain on the gray level image is changed rapidly, so that the gray level value of the pixel point of the imaging edge of the stain also has large jump. Therefore, in the embodiment, the identification of the stain edge can be performed according to the gray value jump of the pixel points, so as to avoid the interference caused by the imaging of the background object in the gray image. According to the experimental determination, the edge gray level variation value of the normal stain is greater than 150, and accordingly the preset difference threshold should be set to be greater than 150, and the specific value may be adjusted according to the actual situation, which is not limited in this embodiment.
S23: and identifying expected stain pixel points with the gray values larger than the preset gray value in all the pixel points of the gray image.
It should be noted that there is no inevitable order for the identification of the expected stain pixel points and the stain edge pixel points, and the identification of the expected stain pixel points may be performed first or the identification of the stain edge pixel points may be performed first, which is not specifically limited in this application.
Certainly, if the gray value of a certain pixel point is greater than the preset gray value and the absolute value of the gray difference between the certain pixel point and the adjacent pixel point is greater than the preset difference threshold, the certain pixel point is a stain edge pixel point; that is to say, when a pixel simultaneously satisfies the condition that the gray value is greater than the preset gray value and the absolute value of the gray difference between the pixel and the adjacent pixel is greater than the preset difference threshold, the pixel is a stain edge pixel.
S24: and marking the expected stain pixel points communicated with the stain edge pixel points as stain internal pixel points in the stain pixel points.
The expected stain pixel points communicated with the stain edge pixel points are expected stain pixel points directly adjacent to the stain edge pixel points or expected stain pixel points adjacent to the stain edge pixel points through the same expected stain pixel point area; the expected stain pixel point region is a pixel region formed by one or more sequentially adjacent expected stain pixel points.
In this embodiment, the stain pixels are divided into two types, one type is a pixel located at the edge of the stain imaging area, that is, a stain edge pixel, and the other type is a pixel located at the middle position inside the stain imaging area, that is, a stain internal pixel. After all the stain edge pixel points and the stain internal pixel points in the gray image are identified, all the stain pixel points are identified equivalently.
It can be understood that the stain imaging area is formed by connecting stain internal pixel points and stain edge pixel points in a sheet-like manner, so that the stain internal pixel points are inevitably adjacent to the stain edge pixel points, or are indirectly adjacent to each other through the sequentially adjacent stain internal pixel points, namely the stain internal pixel points are communicated with the stain edge pixel points.
As shown in fig. 3, fig. 3 is a partial schematic view of a gray scale image of a protective cover provided in this embodiment of the present application, in fig. 3, a pixel point a, a pixel point B, a pixel point C, and a pixel point D all belong to an expected stain internal pixel point whose gray scale value is greater than a preset gray scale value, and a pixel point E is a stain edge pixel point; and the pixel point D is adjacent to the pixel point E, so that the pixel point D is a stain internal pixel point, and the pixel point A is communicated with the pixel point E through the pixel point B, the pixel point C, the pixel point D and the pixel point E which are sequentially adjacent, so that the pixel point A belongs to the stain internal pixel point.
However, in the gray-scale image, there may be some pixels in the area where the background object is imaged, because the corresponding object is darker in color, the gray-scale value of the pixel is larger, but there is no connected stain pixel around the pixel, and the pixel does not belong to a stain pixel, such as pixel F and pixel G in fig. 2, although the gray-scale values of pixel F and pixel G are both larger than the preset gray-scale value, they are not connected to pixel E and other stain edge pixels, so that it can be determined that pixel F and pixel G are not stain internal pixels. And because the gray values of the pixels adjacent to the pixel point F and the pixel point G are gradually changed, the gray difference values of the pixel point F and the pixel point G and the adjacent pixels around the pixel point G cannot reach the preset difference threshold value, so that the possibility that the pixel point F and the pixel point G are stain edge pixel points can be eliminated, and the interference of background object imaging on the identification of the stain pixel points can be eliminated.
According to the embodiment, the characteristics that the gray value of the imaging edge of the background object in the gray image of the protective cover changes bluntly and the gray value of the imaging edge of the stain changes sharply are utilized, the stain pixel points in the gray image and the pixel points imaged by the background object with a darker color are distinguished, the interference of the background object on the stain detection of the protective cover is further eliminated, and the accuracy of the stain detection result of the protective cover is improved.
The identification sequence for identifying the stain pixel points of each pixel point in the gray level image of the protective cover can be various. In an optional embodiment of the present application, as shown in fig. 4, fig. 4 is a schematic flowchart of a process for identifying a stain pixel point in a gray-scale image according to another embodiment of the present application, where the identification process may include:
s31: and selecting any pixel point in the gray level image as a current pixel point.
S32: and judging whether the gray value of the current pixel point is larger than a preset gray value, if so, entering S33, and if not, entering S34.
S33: and marking the current pixel points as expected stain pixel points.
S34: and calculating the gray difference absolute values of the current pixel point and each adjacent pixel point one by one.
S35: and judging whether the gray scale difference absolute values are larger than a preset difference threshold value or not, if so, entering S36, and if not, entering S37.
S36: and selecting the adjacent pixel point corresponding to the gray difference absolute value larger than the preset difference threshold value and the pixel point with the maximum gray value in the current pixel points as the stain edge pixel point.
S37: and judging whether all the pixels in the gray-scale image are subjected to the identification completion of the expected stain pixels and the stain edge pixels, if so, entering S39, and if not, entering S38.
S38: and (4) sequentially taking each adjacent pixel point of the current pixel point as a new current pixel point, and entering S32.
S39: and taking any expected stain pixel point adjacent to the stain edge pixel point in the gray image as a starting point pixel point, and identifying and marking stain internal pixel points in each expected stain pixel point one by one.
Certainly, in practical application, it is not necessary to perform the identification and determination of the stain internal pixels on the expected stain pixels after all the expected stain pixels and the stain edge pixels are identified. For example, after a certain stain edge pixel is identified, if an expected stain pixel is identified in the adjacent pixels, the expected stain pixel can be marked as a stain interior pixel in the stain pixels.
As shown in fig. 5, the initially selected current pixel point is set as the pixel point a0, and after determining whether the pixel point a0 is a stain edge pixel point, the identification determination of whether the current pixel point is a stain edge pixel point is performed sequentially by using the pixel point a1 and the pixel point a2 until the pixel point a8 is the current pixel point. After the judgment of the stain pixel point is completed from the pixel point a1 to the pixel point a8, the pixel points adjacent to the pixel point a1 to the pixel point a8 are further used as the current pixel point to perform the judgment of whether each pixel point is the stain pixel point, and so on.
It can be understood that, for example, when the pixel a2 is the current pixel, although the pixel a0 and the pixel a1 are both adjacent to the pixel a2, when the pixel a0 and the pixel a1 are the current pixels, the pixel a2 has already been subjected to the gray scale absolute value calculation, and therefore, when the pixel a2 is the current pixel, the pixel a0 and the pixel a1 do not need to be subjected to the gray scale absolute value calculation again. Similarly, when the stain pixel points are judged by taking all the pixel points as the current pixel points in sequence, the absolute value operation of the gray difference value is not required to be carried out on the adjacent pixel points which are judged by the stain pixel points.
In addition, the first selected pixel point for determining the stain pixel point can be selected at will from the gray-scale image, the center point in the gray-scale image can be selected, and the vertex pixel point in the gray-scale image can also be selected, which does not have specific limitations in the present application.
Further, the identification determination as to whether each pixel is a stain pixel is not necessarily the identification determination order as described above. For example, whether the pixels are the stain pixels or not can be sequentially determined one by one in the rows/columns of the gray-scale image of the protective cover, the technical scheme of the application can also be implemented, and the determination mode of whether each pixel is the stain pixel is similar to that in the embodiment, and is not repeated here. In the application, other modes of scanning and judging whether each pixel point is a stain pixel point can be adopted, and the method is not particularly limited.
In the following, the stain detection device of the camera protection cover according to the embodiment of the present invention is introduced, and the stain detection device of the camera protection cover described below and the stain detection method of the camera protection cover described above may be referred to in correspondence with each other.
Fig. 6 is a block diagram of a stain detection device of a camera protection cover according to an embodiment of the present invention, and the stain detection device of the camera protection cover according to fig. 6 may include:
the adjusting module 100 is used for adjusting the focal length and the aperture of the camera, so that the distance from the focal point of the camera to the protective cover is not more than a preset distance, and the aperture is not less than the size of the preset aperture;
the acquisition module 200 is used for acquiring a gray level image of the protective cover by using the camera;
and the identification module 300 is configured to identify a stain pixel point in the grayscale image, and obtain stain distribution data on the protective cover.
The stain detection device of the camera protection cover of the present embodiment is used for implementing the stain detection method of the camera protection cover, and therefore, the specific implementation manner of the stain detection device of the camera protection cover can be seen in the foregoing embodiments of the stain detection method of the camera protection cover, for example, the adjusting module 100, the collecting module 200, and the identifying module 300 are respectively used for implementing steps S11 to S13 in the stain detection method of the camera protection cover, so that the specific implementation manner thereof can refer to the description of the corresponding embodiments of each part, and will not be described again here.
The present application further provides an embodiment of a stain detection apparatus for a camera protection cover, as shown in fig. 7, fig. 7 is a block diagram of a structure of the stain detection apparatus for a camera protection cover provided in the embodiment of the present application, and the apparatus may include:
a memory 1 for storing a computer program;
the processor 2 is configured to implement the steps of the method for detecting stains in a camera protection cover according to any of the above embodiments when executing the computer program.
The processor in this embodiment can execute the computer program stored in the memory, can realize accurate detection of stains on the camera protection cover, provide theoretical basis for workers to clean the protection cover in time, expand the function of the camera on the basis of not influencing the normal monitoring work of the camera, and avoid frequently cleaning the protection cover on the basis of ensuring good working performance of the camera.
In addition, the memory 1 may be a Random Access Memory (RAM), a memory, a Read Only Memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Furthermore, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include elements inherent in the list. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element. In addition, parts of the above technical solutions provided in the embodiments of the present application, which are consistent with the implementation principles of corresponding technical solutions in the prior art, are not described in detail so as to avoid redundant description.

Claims (10)

1. A method for detecting stains on a camera protection cover is characterized by comprising the following steps:
adjusting the focal length and the aperture of the camera to ensure that the distance from the focal point of the camera to the protective cover is not more than a preset distance, and the aperture is not less than the size of the preset aperture;
acquiring a gray image of the protective cover by using the camera;
and identifying stain pixel points in the gray level image to obtain stain distribution data on the protective cover.
2. The method for detecting stains in a protective cover of a camera according to claim 1, wherein identifying stain pixels in the gray-scale image to obtain stain distribution data on the protective cover comprises:
identifying the stain pixel points according to the gray value of the pixel points in the gray image;
and judging whether the proportion of the stain pixel points to the total pixel points of the gray image is greater than a preset proportion, if so, determining that the stains on the protective cover exceed the standard.
3. The method for detecting stains in a protective cover of a camera according to claim 2, wherein the step of determining whether the proportion of the stain pixels to the total pixels of the gray image is greater than a preset proportion comprises:
determining the total number of all stain pixel points in the gray level image according to the identified stain pixel points;
and judging whether the ratio of the total number of the stain pixels to the total number of the pixels of the gray-scale image is larger than a first preset proportion.
4. The method for detecting stains in a protective cover of a camera according to claim 2, wherein the step of determining whether the proportion of the stain pixels to the total pixels of the gray image is greater than a preset proportion comprises:
determining the number of pixel points contained in each stain imaging area according to the coordinate values of the stain pixel points;
and judging whether the ratio of the number of the pixel points in the stain imaging area with the largest area to the total number of the pixel points of the gray level image is larger than a second preset proportion.
5. The method for detecting stains in a protective cover of a camera according to claim 4, wherein the step of determining the number of pixels included in each stain imaging area based on the coordinate values of the stain pixels comprises:
obtaining the maximum abscissa, the minimum abscissa, the maximum ordinate and the minimum ordinate of each pixel point in the same stain imaging area formed by a plurality of stain pixel points;
according to the estimation formula of the number of pixel points in the stain imaging area: and estimating the number of pixels in each stain imaging area, wherein S is the number of pixels, X1, X2, Y1 and Y2 are respectively a maximum abscissa, a minimum abscissa, a maximum ordinate and a minimum ordinate of the stain imaging area, and K is an estimation proportionality coefficient.
6. The method for detecting stains in a protective cover of a camera according to claim 2, wherein the step of determining whether the proportion of the stain pixels to the total pixels of the gray image is greater than a preset proportion comprises:
judging whether the ratio of the total number of all the stain pixels to the total number of the pixels of the gray-scale image is larger than a first preset proportion, and/or the ratio of the number of the pixels of the stain imaging area with the largest area to the total number of the pixels of the gray-scale image is larger than a second preset proportion; wherein the first preset proportion is greater than the second preset proportion.
7. The method of any one of claims 1 to 6, wherein identifying a stain pixel in the gray scale image comprises:
obtaining the gray difference absolute value between adjacent pixel points according to the gray value of each pixel point in the gray image;
marking the pixel point with the maximum gray value in the two adjacent pixel points with the gray difference absolute value larger than a preset difference threshold value as a stain edge pixel point in the stain pixel points;
identifying expected stain pixel points with gray values larger than a preset gray value in all pixel points of the gray image;
marking expected stain pixel points communicated with the stain edge pixel points as stain internal pixel points in the stain pixel points; the expected stain pixel points communicated with the stain edge pixel points are the expected stain pixel points directly adjacent to the stain edge pixel points or the expected stain pixel points adjacent to the stain edge pixel points through the same expected stain pixel point area; the expected stain pixel point region is a pixel region formed by one or more adjacent expected stain pixel points in sequence.
8. The method of detecting smudges in a camera protective cover of claim 7, wherein identifying smudged pixels in the gray scale image comprises:
taking any pixel point in the gray image as a current pixel point, judging whether the gray value of the current pixel point is larger than a preset gray value or not, and if so, marking the current pixel point as an expected stain pixel point;
obtaining the gray difference absolute value of the current pixel point and each adjacent pixel point;
judging whether a gray difference absolute value larger than a preset difference threshold exists in each gray difference absolute value, if so, selecting an adjacent pixel point corresponding to the gray difference absolute value larger than the preset difference threshold and a pixel point with the largest gray value in the current pixel points as a stain edge pixel point;
sequentially taking each adjacent pixel point of the current pixel point as a new current pixel point, and repeatedly executing the operation step of judging whether the gray value of the current pixel point is greater than a preset gray value until all pixel points in the gray image are subjected to the identification completion of the expected stain pixel points and the stain edge pixel points;
and identifying and marking the stain internal pixel points in the expected stain pixel points one by taking any expected stain pixel point adjacent to the stain edge pixel point in the gray image as a starting point pixel point.
9. A stain detection device of a camera protection cover, comprising:
the adjusting module is used for adjusting the focal length and the aperture of the camera, so that the distance between the focal point of the camera and the protective cover is not more than a preset distance, and the aperture is not less than the size of the preset aperture;
the acquisition module is used for acquiring a gray level image of the protective cover by using the camera;
and the identification module is used for identifying stain pixel points in the gray level image and acquiring stain distribution data on the protective cover.
10. The utility model provides a smudge check out test set of camera safety cover which characterized in that includes:
a memory for storing a computer program;
a processor for implementing the steps of the method for detecting smudges of a protective cover for a camera according to any one of claims 1 to 8 when executing said computer program.
CN202010740286.2A 2020-07-28 2020-07-28 Stain detection method, device and equipment for camera protection cover Active CN111882540B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010740286.2A CN111882540B (en) 2020-07-28 2020-07-28 Stain detection method, device and equipment for camera protection cover

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010740286.2A CN111882540B (en) 2020-07-28 2020-07-28 Stain detection method, device and equipment for camera protection cover

Publications (2)

Publication Number Publication Date
CN111882540A true CN111882540A (en) 2020-11-03
CN111882540B CN111882540B (en) 2024-06-21

Family

ID=73201409

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010740286.2A Active CN111882540B (en) 2020-07-28 2020-07-28 Stain detection method, device and equipment for camera protection cover

Country Status (1)

Country Link
CN (1) CN111882540B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114260259A (en) * 2021-12-22 2022-04-01 深圳泰德激光技术股份有限公司 Method and device for cleaning battery by laser and computer readable storage medium
CN114326422A (en) * 2021-12-14 2022-04-12 深圳市时誉高精科技有限公司 ZigBee remote controller for smart home
CN115661208A (en) * 2022-12-26 2023-01-31 合肥疆程技术有限公司 Camera posture and stain detection method and device and automobile
CN115846306A (en) * 2022-12-29 2023-03-28 河北中瓷电子科技股份有限公司 Automatic cleaning system, method and device for green ceramic chips and terminal equipment

Citations (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1606758A (en) * 2000-08-31 2005-04-13 雷泰克公司 Sensor and imaging system
JP2007318355A (en) * 2006-05-24 2007-12-06 Matsushita Electric Ind Co Ltd Imaging device and lens stain detecting method
CN105872464A (en) * 2016-04-11 2016-08-17 三峡大学 System for automatically monitoring factory smoke emission based on video signal
KR101778561B1 (en) * 2016-04-20 2017-09-14 주식회사 아이엠에스일렉트로닉스 Pollution detect and inform apparatus of camera, and control method thereof
CN107333048A (en) * 2017-08-28 2017-11-07 湖州靖源信息技术有限公司 A kind of automatically cleaning monitoring camera
CN109472772A (en) * 2018-09-29 2019-03-15 歌尔股份有限公司 Image smear detection method, device and equipment
CN109587392A (en) * 2018-10-18 2019-04-05 北京集光通达科技股份有限公司 The method of adjustment and device of monitoring device, storage medium, electronic device
CN110532876A (en) * 2019-07-26 2019-12-03 纵目科技(上海)股份有限公司 Night mode camera lens pays detection method, system, terminal and the storage medium of object
US20190369031A1 (en) * 2018-06-01 2019-12-05 Fanuc Corporation Visual sensor lens or lens cover abnormality detection system
CN110738629A (en) * 2018-07-02 2020-01-31 中兴通讯股份有限公司 lens contamination detection method, terminal and computer readable storage medium
CN110766679A (en) * 2019-10-25 2020-02-07 普联技术有限公司 Lens contamination detection method and device and terminal equipment
CN110800294A (en) * 2018-07-27 2020-02-14 深圳市大疆创新科技有限公司 Method, equipment and system for detecting camera module and machine-readable storage medium
CN110889801A (en) * 2018-08-16 2020-03-17 九阳股份有限公司 Decontamination optimization method for camera of smoke stove system and smoke stove system
CN111380873A (en) * 2018-12-29 2020-07-07 尚科宁家(中国)科技有限公司 Dirt detection method, device, equipment and medium for lens of sweeping robot
CN111405177A (en) * 2020-03-09 2020-07-10 Oppo广东移动通信有限公司 Image processing method, terminal and computer readable storage medium

Patent Citations (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1606758A (en) * 2000-08-31 2005-04-13 雷泰克公司 Sensor and imaging system
JP2007318355A (en) * 2006-05-24 2007-12-06 Matsushita Electric Ind Co Ltd Imaging device and lens stain detecting method
CN105872464A (en) * 2016-04-11 2016-08-17 三峡大学 System for automatically monitoring factory smoke emission based on video signal
KR101778561B1 (en) * 2016-04-20 2017-09-14 주식회사 아이엠에스일렉트로닉스 Pollution detect and inform apparatus of camera, and control method thereof
CN107333048A (en) * 2017-08-28 2017-11-07 湖州靖源信息技术有限公司 A kind of automatically cleaning monitoring camera
US20190369031A1 (en) * 2018-06-01 2019-12-05 Fanuc Corporation Visual sensor lens or lens cover abnormality detection system
CN110738629A (en) * 2018-07-02 2020-01-31 中兴通讯股份有限公司 lens contamination detection method, terminal and computer readable storage medium
CN110800294A (en) * 2018-07-27 2020-02-14 深圳市大疆创新科技有限公司 Method, equipment and system for detecting camera module and machine-readable storage medium
CN110889801A (en) * 2018-08-16 2020-03-17 九阳股份有限公司 Decontamination optimization method for camera of smoke stove system and smoke stove system
CN109472772A (en) * 2018-09-29 2019-03-15 歌尔股份有限公司 Image smear detection method, device and equipment
CN109587392A (en) * 2018-10-18 2019-04-05 北京集光通达科技股份有限公司 The method of adjustment and device of monitoring device, storage medium, electronic device
CN111380873A (en) * 2018-12-29 2020-07-07 尚科宁家(中国)科技有限公司 Dirt detection method, device, equipment and medium for lens of sweeping robot
CN110532876A (en) * 2019-07-26 2019-12-03 纵目科技(上海)股份有限公司 Night mode camera lens pays detection method, system, terminal and the storage medium of object
CN110766679A (en) * 2019-10-25 2020-02-07 普联技术有限公司 Lens contamination detection method and device and terminal equipment
CN111405177A (en) * 2020-03-09 2020-07-10 Oppo广东移动通信有限公司 Image processing method, terminal and computer readable storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
王葭;孟一飞;虎民飞;: "基于视频图像的光伏板污渍点两阶段检测技术", 机械工程与自动化, no. 02, 15 April 2020 (2020-04-15) *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114326422A (en) * 2021-12-14 2022-04-12 深圳市时誉高精科技有限公司 ZigBee remote controller for smart home
CN114260259A (en) * 2021-12-22 2022-04-01 深圳泰德激光技术股份有限公司 Method and device for cleaning battery by laser and computer readable storage medium
CN115661208A (en) * 2022-12-26 2023-01-31 合肥疆程技术有限公司 Camera posture and stain detection method and device and automobile
CN115846306A (en) * 2022-12-29 2023-03-28 河北中瓷电子科技股份有限公司 Automatic cleaning system, method and device for green ceramic chips and terminal equipment

Also Published As

Publication number Publication date
CN111882540B (en) 2024-06-21

Similar Documents

Publication Publication Date Title
CN111882540B (en) Stain detection method, device and equipment for camera protection cover
CN110930353B (en) Method and device for detecting state of hole site protection door, computer equipment and storage medium
CN110766679B (en) Lens contamination detection method and device and terminal equipment
CN109523527B (en) Method and device for detecting dirty area in image and electronic equipment
US7280141B1 (en) Fixed pattern noise subtraction in a digital image sensor
CN110197180B (en) Character defect detection method, device and equipment
CN113379680B (en) Defect detection method, defect detection device, electronic device and computer readable storage medium
JPWO2007141858A1 (en) Dirt detection method
JP2009064175A (en) Object detection device and object detection method
CN108513075B (en) Image processing method, device, equipment, medium and infrared imaging device
CN109685794B (en) Camera self-adaptive step length DPC algorithm and device for mobile phone screen defect detection
CN112926483A (en) Standard cabinet state indicator lamp identification monitoring method, device and system
WO2019146097A1 (en) Sensing device and sensing system for defective photographic data
JP2021052238A (en) Deposit detection device and deposit detection method
US5805728A (en) Edge line measuring method
CN116600210B (en) Image acquisition optimizing system based on robot vision
CN117788394A (en) State detection method, device, equipment and storage medium of power equipment
CN112017163A (en) Image blur degree detection method and device, electronic equipment and storage medium
CN111435080B (en) Water level measuring method, device and system
CN107194923B (en) Ultraviolet image diagnosis method for defect inspection of contact network power equipment
CN115546736A (en) River channel sand collection monitoring processing method and system based on image collection
CN111213372B (en) Evaluation of dynamic range of imaging device
CN111649804A (en) Oil level monitoring method and device with storage function
CN111524102A (en) Method and device for detecting screen contamination of liquid crystal display
CN117173185B (en) Method and device for detecting area of rolled plate, storage medium and computer equipment

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