Street lamp working condition discrimination method

By comparing the grayscale values ​​of video images in preset positions of the camera, the street lamp status can be simply and quickly judged, and the problems of heavy data labeling and high hardware cost in the prior art are solved, and low-cost and efficient street lamp working conditions are achieved.

CN120236115APending Publication Date: 2025-07-01SHANGHAI QIANLONG ENERGY-SAVING TECH CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311871099.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-31
Publication Date
2025-07-01

AI Technical Summary

Technical Problem

In actual applications, existing street light detection algorithms face the problems of heavy workload of data labeling, difficult identification, and high hardware cost, and it is difficult to effectively determine the working conditions of street lights.

Method used

By obtaining the video image of the camera in the preset position, selecting a fixed area for grayscale comparison, using the grayscale average value to judge the status of the street light, combining the condition coefficient and absolute difference value to judge the day or night, reducing data annotation and hardware requirements.

Benefits of technology

It realizes rapid and low-cost identification of street light status, reduces labor and hardware costs, and has good robustness to adapt to changes in street light shape.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120236115A_ABST
    Figure CN120236115A_ABST
Patent Text Reader

Abstract

The invention provides a method for judging the working condition of a street lamp. The method comprises the following steps: acquiring a video image containing the street lamp of a camera at any moment of a preset position as a first sampling video image; selecting a fixed area containing a street lamp in the first sampling video image as a first sampling area; all the pixels with the gray values larger than a first threshold value in the first sampling area are obtained to serve as first-class pixels; calculating an average value of the gray values of the first type of pixels, and defining the average value of the gray values of the first type of pixels as a first gray average value; judging the first gray average value and a second threshold value; if the first gray average value is greater than a second threshold value, judging that the state of the street lamp is on; if the first gray average value is smaller than or equal to the second threshold value, the state of the street lamp is judged to be off. The working condition of the street lamp can be simply and conveniently judged.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a method for judging the working condition of street lamps, belonging to the field of lighting technology. Background Art

[0002] At present, in the field of street lamp detection, deep learning object detection technology has been widely used. However, the application of this technology requires a large amount of labeled data as the training basis, which is often difficult to meet in practical applications. At the same time, due to problems such as the diversity of street lamp shapes, the heavy workload of annotation, and the difficulty of small target recognition caused by the far shooting distance, the existing street lamp detection algorithms face many challenges in practical applications.

[0003] In view of this, it is necessary to propose a method for judging the working condition of street lamps to solve the above problems. Summary of the Invention

[0004] The purpose of the present invention is to provide a method for simply and quickly judging the working condition of street lamps.

[0005] To achieve the above purpose, the present invention provides a method for judging the working condition of street lamps, including:

[0006] Obtain a video image containing street lamps at any moment in a preset position of a camera as a first sampled video image;

[0007] Select a fixed area containing street lamps in the first sampled video image as a first sampled area;

[0008] Obtain all pixels in the first sampled area whose gray values of pixels are greater than a first threshold as first-class pixels;

[0009] Calculate the average value of the gray values of the first-class pixels, and define the average value of the gray values of the first-class pixels as the first gray average value;

[0010] Judge the magnitude relationship between the first gray average value and a second threshold;

[0011] If the first gray average value is greater than the second threshold, judge that the state of the street lamp is on;

[0012] If the first gray average value is less than or equal to the second threshold, judge that the state of the street lamp is off.

[0013] As a further improvement of the present invention, the method for obtaining the second threshold includes:

[0014] Select several frames of night images of the camera in the preset position, and the night images contain street lamps;

[0015] Select a fixed area at the same position as the first sampling area in each frame of the night image as the first sample area, and the first sample area contains street lights;

[0016] Compare the gray values of the pixels in the first sample area of each frame of the night image with the first threshold, and obtain all the pixels in the first sample area of each frame of the night image whose gray values are greater than the first threshold as the second type of pixels;

[0017] Calculate the average value of the gray values of the second type of pixels in each frame of the night image, and define the average value of the gray values of the second type of pixels as the second gray average value;

[0018] Based on the second gray average value of each frame of the night image, calculate the average of the second gray average values of the several frames of the night image;

[0019] Multiply the average by a conditional coefficient to obtain the second threshold.

[0020] As a further improvement of the present invention, the conditional coefficient is greater than 0.7 and less than 1.

[0021] As a further improvement of the present invention, the state of the street lights in the night image is the lit state.

[0022] As a further improvement of the present invention, the range of the first threshold is 170-210.

[0023] As a further improvement of the present invention, the method further includes:

[0024] Obtain the video image of the camera at any moment in the preset position as the sampling video image;

[0025] Select a no-light background area in the sampling video image as the second sampling area;

[0026] Retrieve the daytime image obtained by the camera at the preset position;

[0027] Select the no-light background area at the same position as the second sampling area in the daytime image as the second sample area;

[0028] Calculate the first absolute difference between the number of characteristic pixels in the second sampling area and the second sample area;

[0029] Retrieve the night image obtained by the camera at the preset position;

[0030] Select the no-light background area at the same position as the second sampling area in the night image as the third sample area;

[0031] Calculate a second absolute difference in the number of characteristic pixels in the second sampling area and the third sample area;

[0032] Compare the magnitudes of the first absolute difference and the second absolute difference. If the first absolute difference is less than the second absolute difference, it is determined that the street lamp in the sampled video image is in the daytime; if the first absolute difference is greater than the second absolute difference, it is determined that the street lamp in the sampled video image is in the nighttime.

[0033] As a further improvement of the present invention, the method further includes: if the first absolute difference is equal to the second absolute difference, obtain a video image at the next moment of the camera at the preset position as the sampled video image, and recalculate the first absolute difference and the second absolute difference until the first absolute difference is not equal to the second absolute difference.

[0034] As a further improvement of the present invention, the number of characteristic pixels is the number of pixels in the same lamp-free background area of the video image whose gray value is less than a third threshold. The video image can be a daytime image, a nighttime image, or a sampled video image at any moment; the range of the third threshold is: 60 - 120.

[0035] As a further improvement of the present invention, retrieve a plurality of frames of pre-stored daytime images obtained by the camera at the preset position, calculate the average value of the number of characteristic pixels in the second sample area in the plurality of frames of daytime images, and the first absolute difference is the absolute difference between this average value and the number of characteristic pixels in the second sampling area in the sampled video image;

[0036] Retrieve a plurality of frames of pre-stored nighttime images obtained by the camera at the preset position, calculate the average value of the number of characteristic pixels in the third sample area in the plurality of frames of nighttime images, and the second absolute difference is the absolute difference between this average value and the number of characteristic pixels in the second sampling area in the sampled video image.

[0037] As a further improvement of the present invention, select a fixed area containing a street lamp in the first sampled video image as the first sampling area according to a configuration file, and select a lamp-free background area in the sampled video image as the second sampling area according to the configuration file, where the configuration file includes the name and IP address of the camera, the coordinates of the first sampling area, and the coordinates of the second sampling area; when the camera is moved, it is necessary to call the preset position to make the camera automatically return to the monitoring screen of the preset position to obtain the video image of the preset position.

[0038] The beneficial effects of the present invention are:

[0039] The method for judging the working condition of street lamps according to the present invention can compare the gray values of pixels in the first sampling area with a first threshold, obtain all pixels in the first sampling area whose gray values are greater than the first threshold as the first type of pixels, and calculate the average value of the gray values of the first type of pixels, that is, the first gray average value. By judging the magnitude relationship between the first gray average value and a second threshold, it can simply and conveniently judge whether the street lamp is on or off, without the need for a large amount of manual data annotation, without collecting a large number of materials in different scenarios, and without the training and inference of a GPU server. Moreover, the method of the present invention is based on the video images of a selected camera at a preset position for discrimination, and has good robustness to changes in the geometric shape of street lamps. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 It is a schematic flowchart of the method for discriminating whether a lamp is on or off according to the present invention.

[0041] Figure 2 It is a schematic flowchart of the method for discriminating day and night according to the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0042] In order to make the objectives, technical solutions and advantages of the present invention clearer, the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments.

[0043] Here, it should be noted that in order to avoid obscuring the present invention due to unnecessary details, only the structures and / or processing steps closely related to the solution of the present invention are shown in the drawings, and other details less related to the present invention are omitted.

[0044] In addition, it should also be noted that the term "comprising", "including" or any other variant thereof is intended to cover a non-exclusive inclusion, such that a process, method, article or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or also includes elements inherent to such process, method, article or device.

[0045] The present invention provides a simple and rapid method for discriminating the working condition of street lamps. This method does not require a large amount of labeled data and GPU server drivers. By simply obtaining a small amount of sampled video images / sampled video images of a camera at a preset position and retrieving several daytime images and nighttime images of the same camera at the preset position, and comparing the gray values of the sampled video images / sampled video images with those of the daytime and nighttime images, it can be known whether the street lamp at the preset position of the camera is on or off, and whether it is in the daytime or nighttime state, greatly reducing the labor cost of annotation and the time and hardware cost of training.

[0046] Please refer to Figure 1As shown, in the method for judging the working condition of the street lamp of the present invention, it is a schematic flowchart for judging whether the street lamp is in the lit state or the extinguished state for the street lamp at night.

[0047] The method includes the following steps:

[0048] Obtain a video image containing a street lamp at any moment in the preset position in the dark state by a camera as the first sampled video image. Preferably, the video image is a frame of color video image, and the color video image can be a color 8-bit JPG image or a color 8-bit BMP image, etc.

[0049] Select a fixed area containing the street lamp in the first sampled video image as the first sampled area. Among them, according to the configuration file, a rectangular fixed area containing the street lamp in the first sampled video image is selected as the first sampled area. The configuration file includes information such as the name and IP address of the camera, and the coordinates of the first sampled area.

[0050] That is, when the first sampled video image is fixed, the first sampled area is fixed, and the first sampled area contains a street lamp.

[0051] Compare the gray value of the pixels in the first sampled area with the first threshold, and obtain all the pixels in the first sampled area whose gray value is greater than the first threshold as the first type of pixels. Among them, the pixel value range of an 8-bit JPG video image is 0 - 255, and the range of the first threshold is 170 - 210. By setting the size of the first threshold, some pixels that do not meet the conditions are removed to reduce the error of the judgment method of the present invention.

[0052] Calculate the average value of the gray values of the first type of pixels, and define the average value of the gray values of the first type of pixels as the first gray average value. Since the first gray average value is the average value of the gray values of all pixels greater than the first threshold, the calculation error can be reduced.

[0053] Judge the size of the first gray average value and the second threshold;

[0054] If the first gray average value is greater than the second threshold, judge that the state of the street lamp is lit;

[0055] If the first gray average value is less than or equal to the second threshold, judge that the state of the street lamp is extinguished.

[0056] Furthermore, the method for obtaining the second threshold includes;

[0057] Select several frames of dark images of the camera in the preset position, and the dark images contain street lamps. Among them, the dark images can be pre-stored images obtained by the camera in the preset position. And the state of the street lamp in the dark image is the lit state.

[0058] Select a rectangular fixed area at the same position as the first sampling area in each frame of night image as the first sample area, and the first sample area contains street lights.

[0059] Compare the gray values of the pixels in the first sample area of each frame of night image with the first threshold, and obtain all the pixels in the first sample area of each frame of night image whose gray values are greater than the first threshold as the second type of pixels.

[0060] Calculate the average value of the gray values of the second type of pixels in each frame of night image, and define the average value of the gray values of the second type of pixels as the second gray average value.

[0061] Based on the second gray average value of each frame of night image, calculate the average of the second gray average values of several frames of night images.

[0062] That is, by retrieving the second gray average values in the state where the street lights are on in several frames of pre-stored night images and calculating the average of the second gray average values, the gray value of the camera at the preset position in the night state when the street lights are on can be obtained.

[0063] Multiply the average by a condition coefficient to obtain the second threshold. By multiplying the condition coefficient, the error of manually specifying parameters can be minimized as much as possible.

[0064] Furthermore, the condition coefficient is greater than 0.7 and less than 1. Preferably, the condition coefficient is 0.8 or 0.9. By setting the condition coefficient to be greater than 0.7 and less than 1, while making the second threshold significant with the average of the second gray average values, the result of the second threshold can be made as reliable as possible.

[0065] Please refer to Figure 2 As shown, the present invention also provides a method for judging day or night. The method includes:

[0066] Obtain a video image at any moment of a camera at a preset position as a sampled video image; wherein, the camera is the same camera as the camera for judging whether the street light is on or off, and the preset position of the camera is also the same preset position. Preferably, the video image is a frame of color video image, and the color video image can be a color 8-bit JPG image or a color 8-bit BMP image, etc.

[0067] Select a rectangular lamp-free background area in the sampled video image as the second sampling area. That is, select a rectangular lamp-free background area in the sampled video image according to the configuration file. The configuration file includes the name and IP address of the camera and the coordinates of the second sampling area.

[0068] Retrieve the pre-stored daytime image obtained by the camera at the preset position;

[0069] Select the rectangle's lamp-free background area at the same position as the second sampling area in the daytime image as the second sample area;

[0070] Calculate the first absolute difference in the number of feature pixels between the second sampling area and the second sample area;

[0071] Retrieve the pre-stored nighttime image obtained by the camera at the preset position;

[0072] Select the rectangle's lamp-free background area at the same position as the second sampling area in the nighttime image as the third sample area;

[0073] Calculate the second absolute difference in the number of feature pixels between the second sampling area and the third sample area;

[0074] Compare the magnitudes of the first absolute difference and the second absolute difference. If the first absolute difference is less than the second absolute difference, it is determined that the street lamp in the sampled video image is in the daytime; if the first absolute difference is greater than the second absolute difference, it is determined that the street lamp in the sampled video image is in the nighttime.

[0075] If the first absolute difference is equal to the second absolute difference, obtain one frame of color video image at the next moment of the camera at the preset position as the sampled video image, and recalculate the first absolute difference and the second absolute difference according to the above judgment method until the first absolute difference is not equal to the second absolute difference.

[0076] Among them, the number of feature pixels is the number of pixels in the same lamp-free background area in one frame of video image whose gray value is less than the third threshold. One frame of video image can be a daytime image, a nighttime image, or a sampled video image at any moment. Further, the range of the third threshold is: 60 - 120.

[0077] Among them, the source of the daytime image is: retrieve several frames of pre-stored daytime images obtained by the camera at the preset position. The source of the nighttime image is: retrieve several frames of pre-stored nighttime images obtained by the camera at the preset position.

[0078] By calculating the average number of characteristic pixels in the second sample area of several frames of daytime images, the first absolute difference is the absolute difference between this average and the number of characteristic pixels in the second sampling area of the sampled video image, and by calculating the average number of characteristic pixels in the third sample area of several frames of nighttime images, the second absolute difference is the absolute difference between this average and the number of characteristic pixels in the second sampling area of the sampled video image. By using the same method to calculate the average number of characteristic pixels in the daytime and nighttime images of the same lamp-free background area selected by the same camera at the same preset position, the error can be minimized as much as possible.

[0079] It should be noted that in the present invention, the name and IP address of the camera are fixed, and the preset position is also fixed. The daytime image, nighttime image, sampled video image, and sampled video image are all obtained at this preset position to reduce errors. When the camera is moved, the preset position needs to be called to make the camera automatically return to the monitoring screen of the preset position to obtain the color video image of the preset position.

[0080] In summary, the method for discriminating the working condition of street lamps according to the present invention only needs to compare the number of pixels or the gray value of a small number of pre-stored images at a fixed preset position of a determined camera with any frame of the sampled video image and the sampled video image, which greatly reduces the labor cost of annotation, the training time, and the hardware cost. Moreover, the method of the present invention is based on the images at the selected preset position of the camera for discrimination, and has good robustness to the change of the geometric shape of the street lamp.

[0081] The above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present invention can be modified or equivalently replaced without departing from the spirit and scope of the technical solutions of the present invention.

Claims

1. A method for discriminating the working conditions of street lamps, characterized in that, Including: Obtaining a video image containing street lights at any moment of a camera at a preset position as a first sampled video image; Selecting a fixed area containing street lights in the first sampled video image as a first sampled area; Obtaining all pixels in the first sampled area whose gray values of pixels are greater than a first threshold as first-class pixels; Calculating the average value of the gray values of the first-class pixels, and defining the average value of the gray values of the first-class pixels as a first gray average value; Judging the magnitude relationship between the first gray average value and a second threshold; If the first gray average value is greater than the second threshold, judging that the state of the street light is on; If the first gray average value is less than or equal to the second threshold, judging that the state of the street light is off.

2. The discriminant method for the working conditions of street lamps according to claim 1, wherein: The method for obtaining the second threshold includes: Selecting several frames of night images of the camera at the preset position, where the night images contain street lights; Selecting a fixed area at the same position as the first sampled area in each frame of night image as a first sample area, and the first sample area contains street lights; Comparing the gray values of pixels in the first sample area of each frame of night image with the first threshold, and obtaining all pixels in the first sample area of each frame of night image whose gray values of pixels are greater than the first threshold as second-class pixels; Calculating the average value of the gray values of the second-class pixels in each frame of night image, and defining the average value of the gray values of the second-class pixels as a second gray average value; Based on the second gray average value of each frame of night image, calculating the average of the second gray average values of the several frames of night images; Multiplying the average by a condition coefficient to obtain the second threshold.

3. The discriminant method for the working conditions of street lamps according to claim 2, wherein: The condition coefficient is greater than 0.7 and less than 1.

4. The discriminant method for the working conditions of street lamps according to claim 2, characterized in that: The state of the street light in the night image is an on state.

5. The discriminant method for the working conditions of street lamps according to claim 1, characterized in that: The range of the first threshold is 170 - 210.

6. The discriminant method for the working conditions of street lamps according to claim 1, wherein The method further includes: Obtaining a video image of the camera at any moment at the preset position as a sampled video image; Selecting a no-light background area in the sampled video image as a second sampled area; Retrieving a daytime image obtained by the camera at the preset position; Selecting a no-light background area at the same position as the second sampled area in the daytime image as a second sample area; Calculating a first absolute difference in the number of characteristic pixels between the second sampled area and the second sample area; Retrieving a night image obtained by the camera at the preset position; Selecting a no-light background area at the same position as the second sampled area in the night image as a third sample area; Calculating a second absolute difference in the number of characteristic pixels between the second sampled area and the third sample area; Comparing the magnitudes of the first absolute difference and the second absolute difference. If the first absolute difference is less than the second absolute difference, it is judged that the street light in the sampled video image is in the daytime; if the first absolute difference is greater than the second absolute difference, it is judged that the street light in the sampled video image is in the night.

7. The discriminant method for the working conditions of street lamps according to claim 6, characterized in that: The method further includes: if the first absolute difference is equal to the second absolute difference, obtaining a video image of the next moment of the camera at the preset position as a sampled video image, and recalculating the first absolute difference and the second absolute difference until the first absolute difference is not equal to the second absolute difference.

8. The discriminant method for the working conditions of street lamps according to claim 6, characterized in that: The number of characteristic pixels is the number of pixels in the same lamp-free background area of the video image whose gray value is less than a third threshold. The video image can be a daytime image, a nighttime image, or a sampled video image at any moment. The range of the third threshold is 60-120.

9. The method for discriminating the working condition of a street lamp according to claim 6, wherein: Retrieving a plurality of pre-stored daytime images obtained by the camera at the preset position, calculating the average value of the number of characteristic pixels in the second sample area in the plurality of daytime images, and the first absolute difference is the absolute difference between the average value and the number of characteristic pixels in the second sampling area in the sampled video image; Retrieving a plurality of pre-stored nighttime images obtained by the camera at the preset position, calculating the average value of the number of characteristic pixels in the third sample area in the plurality of nighttime images, and the second absolute difference is the absolute difference between the average value and the number of characteristic pixels in the second sampling area in the sampled video image.

10. The discriminant method for the working conditions of street lamps according to any one of claims 1 to 9, characterized in that: Selecting a fixed area containing street lamps in the first sampled video image as the first sampling area according to the configuration file, and selecting a lamp-free background area in the sampled video image as the second sampling area according to the configuration file. The configuration file includes the name and IP address of the camera, the coordinates of the first sampling area, and the coordinates of the second sampling area; when the camera is moved, the preset position needs to be called to make the camera automatically return to the monitoring screen of the preset position to obtain the video image of the preset position.