A brightness measurement system based on digital images

By designing a brightness measurement system based on digital images, the shortcomings of digital image brightness measurement in the prior art are solved, and the rapid and accurate measurement of brightness and the identification and positioning of light-polluted areas are achieved, and the measurement efficiency and accuracy are improved.

CN118365601BActive Publication Date: 2025-03-21TIANJIN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410451382.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-16
Publication Date
2025-03-21
Estimated Expiration
2044-04-16

AI Technical Summary

Technical Problem

The prior art lacks systematic brightness measurement tools, especially when the photoelectric conversion function of imaging sensors changes, it is difficult to accurately measure the brightness of digital images, and it is difficult to quickly identify and locate light-contaminated areas.

Method used

A brightness measurement system based on digital images is designed, including an identification layer, an analysis layer, a processing layer, a determination layer and an output layer. By reading digital images, analyzing photoelectric conversion functions or functional relationships, measuring and analyzing brightness information, determining the location of the light pollution zone and outputting the results.

Benefits of technology

It realizes rapid and accurate measurement of the brightness of digital images, can identify and locate light-polluted areas, improves the efficiency and accuracy of brightness measurement, and supports the measurement of high dynamic range and low dynamic range images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118365601B_ABST
    Figure CN118365601B_ABST
Patent Text Reader

Abstract

The present invention belongs to the technical field of image processing, and discloses a brightness measurement system based on digital images, comprising: an identification layer, used for reading a digital image acquired by an imaging sensor carried by a relevant instrument, and outputting a reading result; an analysis layer, based on the reading result output by the identification layer; the system can obtain the brightness value of any position of the digital image through a photoelectric conversion function and a functional relationship, and can calculate the brightness of a selected area in the digital image through functions of point arrangement at any position, point arrangement according to a margin, point arrangement in an array, and intelligently dividing an area to calculate the brightness, and can avoid the time-consuming and labor-intensive problems of traditional measurement methods, and improve the efficiency of brightness measurement; through matching the digital image with a night city image in a database, the determination layer can quickly identify a light pollution area in the digital image and obtain the actual position of the light pollution area.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and more specifically, to a brightness measurement system based on digital images. Background Art

[0002] With the rapid development of digital technology, digital imaging has been widely used in various fields, such as medical imaging, aerospace, industrial production and daily life. In these applications, it is particularly important to accurately measure the brightness of digital images, because brightness information is not only related to the visual quality of the image, but also directly related to the accuracy and reliability of the image data; at present, there is no systematic tool for brightness measurement of imaging sensors. Since the photoelectric conversion function of imaging sensors changes with the change of camera lenses, there is no widely used brightness measurement system based on digital images;

[0003] In the existing brightness measurement specifications, the traditional brightness measurement method usually requires setting up a brightness meter at a fixed point for observation and obtaining the average brightness value by setting up points. The measurement method is labor-intensive, time-consuming and labor-intensive, and has a small range. In addition, when studying large-scale urban light pollution, it is inconvenient to quickly find the threshold range that light pollution exceeds by measuring the brightness of digital images, and it is also inconvenient to locate the actual location of light pollution. Summary of the invention

[0004] In order to overcome the problem that the prior art requires users to spend extra time and energy, the present invention proposes a brightness measurement system based on digital images to solve the above problem.

[0005] The present invention provides the following technical solution: A brightness measurement system based on digital images, comprising: a recognition layer, used to read a digital image acquired by an imaging sensor carried by a related instrument, and output the reading result;

[0006] The analysis layer selects a photoelectric conversion function or a functional relationship to analyze the digital image according to the reading result output by the recognition layer, and generates an analyzed digital image;

[0007] The processing layer includes a measuring module and an analyzing module. The measuring module measures the analyzed digital image to obtain the brightness information of the pixels in the analyzed digital image. The analyzing module generates an analysis diagram based on the brightness information of the pixels in the analyzed digital image.

[0008] The determination layer is used to determine the analyzed digital image and obtain the actual position of the light pollution area in the analyzed digital image;

[0009] The output layer will export the brightness information of the pixels in the analyzed digital image, the analysis diagram, and the actual location of the light pollution area and save them to the directory specified by the user.

[0010] Furthermore, in the recognition layer, the digital image obtained by the imaging sensor carried by the relevant instrument is input into the recognition layer, and the recognition layer reads the digital image through the TKinter interface library. If the TKinter interface library can read the digital image, the digital image is an 8-bit image. If the TKinter interface library cannot read the digital image, the digital image is a 32-bit image.

[0011] Furthermore, the method of selecting a photoelectric conversion function or a functional relationship to analyze the digital image according to the reading result output by the recognition layer to generate the analyzed digital image is:

[0012] Convert the digital image into a grayscale image. If the digital image is an 8-bit image, the digital image is a low dynamic range image. Convert the grayscale image through a photoelectric conversion function to obtain a resolved digital image.

[0013] The photoelectric conversion function is:

[0014]

[0015] Wherein, L(x,y) is the brightness value of the grayscale image at (x,y), T is the exposure time, k is the first proportional coefficient, a is the slope parameter of the linear relationship between the grayscale value and the camera lens exposure, b is the offset parameter of the linear relationship between the grayscale value and the camera lens exposure, and D(x,y) is the grayscale value of the grayscale image at (x,y).

[0016] Furthermore, if the digital image is a 32-bit image, the digital image is a high dynamic range image, and the grayscale image is converted through a functional relationship to obtain a resolved digital image;

[0017] The functional relationship is:

[0018] L`(x`,y`)=k`×[ω1R`(x`,y`)+ω2G`(x`,y`)+ω3B`(x`,y`)]

[0019] Where L`(x`,y`) is the brightness value of the grayscale image at (x`,y`), R`(x`,y`), G`(x`,y`) and B`(x`,y`) are the relationship between the grayscale values ​​of the RGB channels and the actual stimulus values, ω1, ω2 and ω3 are the contribution coefficients corresponding to the RGB channels, and k1 is the second proportional coefficient.

[0020] Furthermore, the measuring module measures the resolved digital image to obtain the brightness information of the pixels in the resolved digital image in the following manner:

[0021] Arrange measurement grids equidistantly on the analyzed digital image, customize the margins of the measurement grid in the four directions of up, down, left, and right, as well as the required number of rows and columns of points, intelligently generate equidistantly distributed measurement grids, and output the brightness information of each point;

[0022] The measurement grid is arranged as follows:

[0023] L1=L p -(L left +L right ),

[0024] H1=H p -(H up +H down ),

[0025] Where L1 is the length of the entire measurement grid, H1 is the height of the entire measurement grid, and L p To resolve the length of the digital image, H p To resolve the height of the digital image, L left is the left margin, L right is the right margin, H up is the top margin, H down For the bottom margin, enter the number of vertical points and the number of horizontal points in the prompt box on the measurement module;

[0026]

[0027]

[0028] In the formula, S1 is the horizontal distance between adjacent points, S h is the vertical distance between adjacent points, P h and P1 are the number of vertical points and the number of horizontal points respectively;

[0029] Using nested loops, all points in the measurement grid are traversed, and the corresponding brightness information is marked and output in the analyzed digital image.

[0030] Further, the analysis module includes a first analysis module, a second analysis module and a third analysis module;

[0031] The first analysis module is used to convert a single-band grayscale image into a color image and export a pseudo-color image; the second analysis module, based on the brightness information of the digital image obtained at the analysis layer, traverses each pixel of the digital image one by one and calculates the brightness value of each pixel according to a specific threshold input by the user. If the brightness value of a pixel exceeds the specific threshold set by the user, the pixel will be highlighted by the system; the third analysis module is for exporting a statistical histogram. Based on reading and classifying the digital image, it traverses each pixel in the digital image, substitutes the RGB value of the digital image into the photoelectric conversion function, collects the generated brightness information, and selects the corresponding chart.

[0032] Furthermore, the method for determining the analyzed digital image and obtaining the actual position of the light pollution area in the analyzed digital image is:

[0033] The analyzed digital image is input into the discrimination layer, and the discrimination layer discriminates the analyzed digital image with the night city image in the database to obtain the first night city image;

[0034] The analyzed digital image is adjusted to correspond to the first night city image, and an evaluation frame is set. The evaluation frames are sequentially arranged on the analyzed digital image to obtain an arrangement result. The analyzed digital image is divided into regions according to the arrangement result to obtain z evaluation regions. The z evaluation regions are evaluated by a light pollution evaluation formula to obtain z evaluation values. A light pollution evaluation threshold is preset, and the evaluation region above the light pollution evaluation threshold is defined as a light pollution region.

[0035] Projecting the analyzed digital image, the first night city image and its corresponding day city image into the virtual space in parallel;

[0036] Click on the light pollution area on the analyzed digital image, and a virtual alignment line is generated at the clicked position. The virtual alignment line runs through the night city image and the day city image to obtain the penetration position of the virtual alignment line and the day city image. Among them, the day city image is associated with the geographic information system to obtain the coordinates of the penetration position, which is the actual position of the light pollution area.

[0037] Furthermore, the light pollution assessment formula is:

[0038]

[0039] Where Pgz is the light pollution assessment value of the assessment area, Tz is the adjustment ratio of the analytical digital image adjusted to correspond to the first night city image, Fb is the ratio of the dark area to the bright area in the assessment area, and δ is the influence coefficient.

[0040] Furthermore, the method of obtaining the first night city image is:

[0041] Collect images of n cities at night and during the day to obtain night city images and day city images corresponding to the night city images, and the n night city images and day city images corresponding to the night city images constitute a database;

[0042] Preset the segmentation threshold, perform grayscale processing on the analyzed digital image and n night city images in the database, and save the grayscale values ​​above the segmentation threshold to obtain the analyzed contour image and n night contour images;

[0043] The similarity value between the analytical contour image and the n night contour images in the database is obtained by simplifying the SSIM formula, and the night city image corresponding to the night contour image with the highest similarity value is taken as the first night city image;

[0044] The simplified SSIM formula is:

[0045]

[0046] In the formula, SSIM(J x ,Y w ) is the similarity value between the analytical contour image and the night contour image, To analyze the pixel variance of the contour map, is the pixel variance of the analytical contour map, σJ x Y w To resolve the pixel covariance between the contour image and the night contour image, c1 and c2 are the first constant and the second constant, respectively;

[0047] The method of adjusting the analyzed digital image to correspond to the first night city image is:

[0048] Calculate all the intersection points of each line in the first night contour image corresponding to the analytical contour image and the first night city image by using a line segment intersection detection algorithm, and take the angles of all the intersection points on each line as an angle sequence;

[0049] The lines corresponding to the angle sequences with the most overlap are selected as the registration lines between the first night city image and the analyzed digital image, and the analyzed digital image is adjusted to correspond to the first night city image according to the registration lines and the angles on the registration lines.

[0050] Furthermore, in the output layer, the brightness information of the pixel points in the analyzed digital image and the actual location of the light pollution area are exported in text form, and the analysis diagram is exported in image form. The brightness information of the pixel points, the analysis diagram and the actual location of the light pollution area exported from the analyzed digital image are all saved in a directory specified by the user.

[0051] The present invention provides a brightness measurement system based on digital images, which has the following beneficial effects:

[0052] 1. This system has the advantages of expanding application and improving applicability. It is adapted to the brightness algorithms for high dynamic range images and low dynamic range images respectively. The brightness value of any position of the digital image can be obtained through the photoelectric conversion function and the functional relationship. The brightness of the selected area in the digital image can be calculated through the functions of point arrangement at any position, point arrangement according to the margin, point arrangement in an array, and intelligent segmentation of the area to calculate the brightness, thus avoiding the time-consuming and labor-intensive problems of traditional measurement methods and improving the efficiency of brightness measurement.

[0053] 2. By matching the digital image with the night city image in the database, the decision layer can quickly identify the light pollution area in the digital image, and use the light pollution assessment formula and the preset light pollution assessment threshold to objectively and accurately assess the degree of light pollution; by analyzing the parallel projection of the digital image, the night city image and the daytime city image in the virtual space, and clicking on the light pollution area, a virtual alignment line can be generated to determine the penetration position of the light pollution area in the daytime city image, and the actual position of the light pollution area can be obtained, providing strong data support for the subsequent governance and management of light pollution. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] Figure 1 A module schematic diagram of a brightness measurement system based on digital images of the present invention;

[0055] Figure 2 The present invention is a specific flow chart for obtaining the actual position of the light pollution area in the digital image. DETAILED DESCRIPTION

[0056] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0057] Example 1

[0058] See also Figure 1 In this embodiment, a brightness measurement system based on digital images includes:

[0059] The recognition layer is used to read the digital image acquired by the imaging sensor carried by the relevant instrument and output the reading result;

[0060] The digital image obtained by the imaging sensor carried by the relevant instrument is input into the recognition layer. The recognition layer reads the digital image through the TKinter interface library. If the TKinter interface library can read the digital image, the digital image is an 8-bit image. If the TKinter interface library cannot read the digital image, the digital image is a 32-bit image.

[0061] It should be noted that the entire system uses the Python programming language as the environment, and uses the openCV library and the TKinter interface library as the main libraries. The openCV library is used to process and analyze images, and the TKinter interface library is used as the system interface. The corresponding digital images are obtained through the imaging sensors carried by the relevant instruments. After being read by the recognition layer of the system, the parsing layer will determine the format of the image according to the image bit depth and file format, so as to correctly process and distinguish between 8-bit low dynamic range images and 32-bit high dynamic range images, and then call different processing methods to process the images.

[0062] In addition, the recognition layer determines the bit depth of the digital image by reading the digital image to obtain the digital image suffix, and uses different algorithms in the subsequent calculation process, and displays the digital image on the system interface. Since the tkinter interface library can only display 8-bit images, the 32-bit digital image needs to be converted into an 8-bit digital image during the high dynamic range image reading process.

[0063] The analysis layer selects a photoelectric conversion function or a functional relationship to analyze the digital image according to the reading result output by the recognition layer, and generates an analyzed digital image;

[0064] According to the reading result output by the recognition layer, a photoelectric conversion function or a functional relationship is selected to analyze the digital image. The method of generating the analyzed digital image is:

[0065] Convert the digital image into a grayscale image. If the digital image is an 8-bit image, the digital image is a low dynamic range image. Convert the grayscale image through a photoelectric conversion function to obtain a resolved digital image.

[0066] The photoelectric conversion function is:

[0067]

[0068] Wherein, L(x,y) is the brightness value of the grayscale image at (x,y), T is the exposure time, k is the first proportional coefficient, a is the slope parameter of the linear relationship between the grayscale value and the camera lens exposure, b is the offset parameter of the linear relationship between the grayscale value and the camera lens exposure, and D(x,y) is the grayscale value of the grayscale image at (x,y).

[0069] Specifically, k is the first proportional coefficient between the grayscale value and the brightness value, and k can be obtained by fitting the experimental data through regression analysis and the least squares method, wherein the experimental data are m groups of brightness values ​​and grayscale values ​​obtained in the experimental environment. It should be noted that the least squares method is used to fit the data; the goal of the least squares method is to minimize the sum of squares of the differences between the predicted value of the formula and the actual observed value; mathematical software or programming language can be used to perform this fitting; in the above process, the value of k is adjusted to minimize the error between the predicted value of the formula and the actual observed value, which can be achieved through an iterative algorithm, and the value of k is continuously adjusted until the minimum error is found.

[0070] The derivation process of the photoelectric conversion function is:

[0071] For the 8-bit low dynamic range image, the photosensitivity characteristic curve of the imaging sensor is obtained through calibration experiments, and the straight line segment of the photosensitivity characteristic curve is selected as the final photoelectric conversion function. The grayscale value of the digital image is obtained according to the relationship between the R, G and B values ​​of the digital image and their corresponding grayscale values. The grayscale value relationship is:

[0072] D(x,y)=0.299R+0.587G+0.144B,

[0073] Where D(x,y) is the grayscale value of the digital image at (x,y), R, G and B are the grayscale values ​​of the red, green and blue channels of each pixel, 0.299, 0.587 and 0.144 are the contribution weights of the red, green and blue channels to the grayscale value, respectively;

[0074] Therefore, the corresponding grayscale value can be obtained according to the R, G and B values ​​of the digital image pixel points. According to the principle of photometry, the relationship between the illumination of the imaging sensor array and the brightness value of the light source to be measured is:

[0075]

[0076] Where, E is the illumination of the imaging sensor array, F is the aperture value of the lens, π is the receiving range of the lens for light, τ is the transmission coefficient of the imaging sensor lens, f is the focal length of the lens, l is the distance between the light source and the lens, and L is the brightness value of the light source to be measured;

[0077] Under the preset measurement distance and when the camera lens is in normal exposure, the grayscale value of a pixel at any position on the digital image and the logarithm of the camera lens exposure are linearly related. The linear relationship is:

[0078] D(x,y)=algH+b,

[0079] Where D(x,y) is the grayscale value of the digital image at (x,y), H is the exposure value of the imaging sensor lens, a is the slope parameter of the linear relationship between the grayscale value and the camera lens exposure, and b is the offset parameter of the linear relationship between the grayscale value and the camera lens exposure;

[0080] At the same time, the exposure H is related to the brightness value L of the light source to be measured and the exposure time T, and the relationship is obtained:

[0081] H(x,y)=E(x,y)×T,

[0082] Combining the above formulas, we can get the relationship between the brightness value L and the gray value D:

[0083]

[0084] Therefore, on the basis of obtaining the photoelectric conversion function of the imaging sensor through the calibration experiment, the brightness value of any point in the captured digital image can be obtained according to the relevant information of the read pixel points.

[0085] If the digital image is a 32-bit image, then the digital image is a high dynamic range image, and the grayscale image is converted through a functional relationship to obtain a resolved digital image;

[0086] The functional relationship is:

[0087] L`(x`,y`)=k`×[ω1R`(x`,y`)+ω2G`(x`,y`)+ω3B`(x`,y`)]

[0088] Where L`(x`,y`) is the brightness value of the grayscale image at (x`,y`), R`(x`,y`), G`(x`,y`) and B`(x`,y`) are the relationship between the grayscale values ​​of the RGB channels and the actual stimulus values, ω1, ω2 and ω3 are the contribution coefficients corresponding to the RGB channels, and k1 is the second proportional coefficient.

[0089] Specifically, k1 is the first proportional coefficient between the grayscale value and the brightness value. k1 can be obtained by fitting the experimental data through regression analysis and the least squares method, wherein the experimental data are r groups of brightness values ​​and grayscale values ​​obtained in the experimental environment. It should be noted that the least squares method is used to fit the data; the goal of the least squares method is to minimize the sum of squares of the differences between the predicted value of the formula and the actual observed value; mathematical software or programming language can be used to perform this fitting; in the above process, the value of k1 is adjusted to minimize the error between the predicted value of the formula and the actual observed value, which can be achieved through an iterative algorithm to continuously adjust the value of k1 until the minimum error is found.

[0090] The derivation process of the functional relationship is:

[0091] For digital images with a 32-bit depth and high dynamic range, according to the XYZ color space, Consistent with the photopic spectral light effect function, the brightness value is measured by establishing the functional relationship between the grayscale value of the three RGB channels of the pixel point and the RGB color space stimulus value, and based on the conversion relationship between the 1931CIE-RGB system and the 1931CIE-XYZ system;

[0092] First, the conversion relationship between the 1931CIE-RGB system and the 1931CIE-XYZ system is as follows:

[0093]

[0094]

[0095] Through the functional relationship between the grayscale values ​​of the three RGB channels and the RGB color space stimulus values ​​and the conversion relationship between the 1931CIE-RGB system and the 1931CIE-XYZ system, the relationship between the grayscale values ​​of the three RGB channels and the actual brightness values ​​can be established, and the final functional relationship can be obtained. The final functional relationship is:

[0096] L`(x`,y`)=k`×[ω1R`(x`,y`)+ω2G`(x`,y`)+ω3B`(x`,y`)].

[0097] The analysis layer integrates the calculation formula of the above-mentioned photoelectric conversion function and functional relationship, and uses different formulas to calculate the brightness according to different image formats, so as to obtain the brightness information of the digital image.

[0098] Since the photoelectric conversion functions of different imaging sensor lenses are quite different, one function formula is only applicable to one type of lens. Therefore, this system adopts a customizable brightness measurement formula, which converts the formula input as a string into actual brightness values ​​in combination with corresponding variables, thereby improving the scope of application of this system. Furthermore, this system can be based on expanding the application surface and improving applicability, and adapts the brightness algorithms for high dynamic range images and low dynamic range images respectively.

[0099] In this embodiment, the system supports custom photoelectric conversion functions, and users can input corresponding function expressions based on the results of their own device calibration, thereby further improving the applicability of the system. The brightness information of any position in the digital image can be obtained through the photoelectric conversion function and the functional relationship, which can facilitate the subsequent output of the brightness information of any position in the digital image.

[0100] Example 2

[0101] See also Figure 1 In this embodiment, a brightness measurement system based on digital images further includes:

[0102] The processing layer includes a measuring module and an analyzing module. The measuring module measures the analyzed digital image to obtain the brightness information of the pixels in the analyzed digital image. The analyzing module generates an analysis diagram based on the brightness information of the pixels in the analyzed digital image.

[0103] The measurement module measures the resolved digital image to obtain the brightness information of the pixels in the resolved digital image in the following manner:

[0104] The measurement module may include a first measurement module, a second measurement module and a third measurement module;

[0105] The first measurement module measures the analyzed digital image in the following manner:

[0106] The processing layer is implemented by the openCV library for arbitrary point selection measurement. The number of points to be measured in the digital image is customized and parsed. Each time the mouse clicks on a point, the first measurement module records the pixel coordinate information, RGB value, gray value and brightness value corresponding to the point clicked by the mouse as brightness information, where the brightness information corresponds to the point.

[0107] The second measurement module measures the analyzed digital image in the following manner:

[0108] The measurement grid is evenly spaced on the analyzed digital image. The margins in the four directions of the measurement grid, as well as the required number of rows and columns of points, are customized. The measurement grid with even distribution is intelligently generated to ensure the spatial consistency between each measurement point. The brightness information of each point is output, which can measure the brightness values ​​of different areas more accurately and efficiently.

[0109] The measurement grid is arranged as follows:

[0110] L1=L p -(L left +L right ),

[0111] H1=H p -(H up +H down ),

[0112] Where L1 is the length of the entire measurement grid, H1 is the height of the entire measurement grid, and L p To resolve the length of the digital image, H p To resolve the height of the digital image, L left is the left margin, L right is the right margin, H up is the top margin, H downFor the bottom margin, enter the number of vertical points and the number of horizontal points in the prompt box on the measurement module;

[0113]

[0114]

[0115] In the formula, S1 is the horizontal distance between adjacent points, S h is the vertical distance between adjacent points, P h and P1 are the number of vertical points and the number of horizontal points respectively;

[0116] Using nested loops, all points in the measurement grid are traversed, and the corresponding brightness information is marked and output in the analyzed digital image.

[0117] The third measurement module measures the analyzed digital image in the following manner:

[0118] The two points precisely clicked on the analyzed digital image are used as the starting coordinates and the ending coordinates, and the preset points are intelligently arranged between the two points to form a flexible measurement grid to achieve the effect of arranging the grid. The variability and complexity in the actual scene are fully considered. Users can customize the number and distribution of points according to actual needs, making the measurement closer to the actual application scene. After the measurement is completed, the third measurement module will output the brightness information of each point and calculate the overall average brightness value;

[0119] The measurement grid is arranged as follows:

[0120] L2=|x1-x2|,

[0121] H2=|y1-y2|,

[0122] Where L2 is the length of the entire measurement grid, H2 is the height of the entire measurement grid, x1, y1, x2, y2 are the starting coordinates and ending coordinates on the digital image respectively;

[0123]

[0124]

[0125] In the formula, S1` is the horizontal distance between adjacent points, S h ` is the vertical distance between adjacent points, P h `P1` and P2` are the number of vertical points and the number of horizontal points respectively.

[0126] Using nested loops, all points within the rectangular area (measurement grid) defined by the user inside the rectangle are traversed, and the corresponding brightness information is marked and output in the image.

[0127] The analysis module includes a first analysis module, a second analysis module and a third analysis module;

[0128] The first analysis module is used to convert the single-band grayscale image into a color image and export a pseudo-color image;

[0129] Specifically, the first analysis module exports a pseudo-color map, converts a single-band grayscale image into a color image to enhance the visualization effect, make the information in the image clearer, easier to analyze and understand, to represent the brightness distribution state, and areas with higher brightness are usually mapped to brighter colors (such as white or colors close to white), while areas with lower brightness are mapped to darker colors (such as black or colors close to black); by observing the pseudo-color map, you can intuitively see the brightness distribution of different areas in the image; in this system, use the cv2.imread function to read the image, and specify the cv2.IMREAD_GRAYSCALE flag to ensure that the image is loaded in grayscale mode, then use the cv2.applyColorMap function to map the grayscale image to a color mode, and finally use the cv2.imshow function to display the generated pseudo-color map.

[0130] The second analysis module obtains the brightness information of the digital image from the analysis layer, and then, according to the specific threshold value input by the user, it goes through each pixel of the digital image one by one and calculates the brightness value of each pixel. If the brightness value of a pixel exceeds the specific threshold value set by the user, the pixel will be highlighted by the system.

[0131] Specifically, the second analysis module focuses on the threshold display function. On the basis that the analysis layer has accurately obtained the image brightness information, in the second analysis module, the system will go through each pixel of the image one by one according to the specific value entered by the user, and by applying the preset photoelectric conversion function and functional relationship in the analysis layer, it can accurately calculate the brightness value of each pixel in the digital image. Next, these calculated brightness values ​​will be compared with the threshold entered by the user. If the brightness value of a pixel exceeds the threshold set by the user, the pixel will be highlighted by the system so that the user can identify the area with excessive brightness at a glance, which can help in the control of light pollution. The threshold can be set according to the nature of the scene and the range exceeding the threshold can be highlighted, which plays a guiding role in the control of urban light pollution and provides strong technical support for environmental protection and urban management.

[0132] The third analysis module is to derive the statistical histogram. On the basis of reading and classifying the digital image, it traverses each pixel in the digital image, substitutes the RGB value of the digital image into the photoelectric conversion function, collects the generated brightness information, and selects the corresponding chart;

[0133] It should be noted that the third analysis module uses the matplotlib library to create functions of various analysis diagrams, generate and display corresponding statistical charts, including brightness distribution histograms, RGB value distribution histograms and other analysis diagrams.

[0134] The output layer will export the brightness information of the pixels in the analyzed digital image, the analysis diagram, and the actual location of the light pollution area and save them to the directory specified by the user.

[0135] In the output layer, the brightness information of the pixel points in the analyzed digital image and the actual position of the light pollution area are exported in the form of text, and the analysis diagram is exported in the form of an image. The brightness information of the pixel points, the analysis diagram and the actual position of the light pollution area exported by the analyzed digital image are all saved in a directory specified by the user;

[0136] Specifically, the output layer packages, integrates and outputs the brightness measurement data obtained in the above steps through the TKinter interface library to retain the measurement results, that is, outputs the measurement data of information such as brightness to retain the measurement results; the output module can be divided into a first output module and a second output module, the first output module outputs the measurement data of brightness information, and the second output module outputs information such as analysis diagrams, and the output results will be saved in the form of text or images in a directory specified by the user, and the actual location of the light pollution area can be output in the form of text or annotation on a digital image, and saved in a corresponding directory specified by the user; the output layer supports the export of multiple analysis diagrams, and a systematic and comprehensive analysis of the study area can be performed; among them, by taking digital images of architectural space or urban space in a certain time series, the trend of changes in the light environment of architectural space or urban space can be studied based on time changes.

[0137] This embodiment, through the functions of arranging points at arbitrary positions, arranging points according to margins, arranging points in an array, and calculating brightness by intelligently dividing areas, can meet the user's various measurement methods for digital images, can flexibly calculate the brightness of a selected area in a digital image, can avoid the time-consuming and labor-intensive problems of traditional measurement methods, and improve the efficiency of brightness measurement in digital images. Moreover, by utilizing a comprehensive point arrangement method, the brightness parameters of a certain area can be quickly obtained, which greatly improves the efficiency and accuracy of brightness measurement and avoids errors caused by changes in the light environment over time.

[0138] Example 3

[0139] See also Figure 1 and Figure 2 In this embodiment, a brightness measurement system based on digital images further includes:

[0140] The determination layer is used to determine the analyzed digital image and obtain the actual position of the light pollution area in the analyzed digital image;

[0141] The way to get the actual position of the light pollution area in the analyzed digital image is:

[0142] The analyzed digital image is input into the discrimination layer. The digital image may be a city aerial image taken by a drone. The discrimination layer discriminates the digital image with the night city image in the database to obtain the first night city image.

[0143] The analyzed digital image is adjusted to correspond to the first night city image, and an evaluation frame is set. The evaluation frames are sequentially arranged on the analyzed digital image to obtain an arrangement result. The analyzed digital image is divided into regions according to the arrangement result to obtain z evaluation regions. The z evaluation regions are evaluated by a light pollution evaluation formula to obtain z evaluation values. A light pollution evaluation threshold is preset, and the evaluation region above the light pollution evaluation threshold is defined as a light pollution region.

[0144] Specifically, n night city images in the database are used as experimental data, and the minimum rectangle that can display the light range in the experimental data is obtained, and the minimum rectangle is used as the evaluation frame; the light pollution evaluation threshold can be set by the user; the light pollution evaluation value can also be associated with the artificial light intensity to establish a regression relationship between the two, so as to set the light pollution evaluation threshold;

[0145] The analyzed digital image, the first night city image and the corresponding day city image are projected in parallel into the virtual space. The parallel projection may be a vertically parallel projection. Then, the corresponding virtual alignment line should penetrate the vertically parallel-projected analyzed digital image, the first night city image and the corresponding day city image.

[0146] Click on the light pollution area on the analyzed digital image, and generate a virtual alignment line at the clicked position. The virtual alignment line runs through the night city image and the day city image, and the intersecting position of the virtual alignment line and the day city image is obtained; wherein the day city image corresponds to the night city image, and the day city image is associated with the geographic information system to obtain the coordinates of the intersecting position, which is the actual position of the light pollution area;

[0147] Specifically, by selecting the lines corresponding to the angle sequences with the most overlap as the registration lines between the first night city image and the digital image, the parsed digital image is adjusted to correspond to the first night city image according to the registration lines and the angles on the registration lines, and the parsed digital image can be adjusted. By superimposing or geo-registering the daytime city image with the geographic information system, the daytime city image can be more accurately associated with the coordinates of the geographic information system. By associating the daytime city image with the coordinates of the geographic information system, the situation in which the superposition and registration of the night city image with the geographic information system is not accurate can be avoided.

[0148] The way to get the first night city image is:

[0149] The drone collects images of n cities at night and during the day, and obtains night city images and day city images corresponding to the night city images. The n night city images and day city images corresponding to the night city images constitute a database, wherein the coordinates and heights of the day city images and night city images collected by the drone for the same city are the same, and the day city images and night city images of the same city correspond to each other;

[0150] Preset the segmentation threshold, grayscale the analyzed digital image and the n night city images in the database, and save the grayscale values ​​above the segmentation threshold to obtain the analyzed contour image and n night contour images. The segmentation threshold is set by the user, and the grayscale value corresponding to the minimum light brightness displayed on the night city image can also be used as the segmentation threshold;

[0151] The similarity value between the analytical contour image and the n night contour images in the database is obtained by simplifying the SSIM formula, and the night city image corresponding to the night contour image with the highest similarity value is taken as the first night city image;

[0152] The simplified SSIM formula is:

[0153]

[0154] In the formula, SSIM(J x ,Y w ) is the similarity value between the analytical contour image and the night contour image, To analyze the pixel variance of the contour map, is the pixel variance of the analytical contour map, σJ x Y w To analyze the pixel covariance of the contour image and the night contour image, c1 and c2 are the first constant and the second constant respectively. c1 and c2 are constants used to stabilize the denominator, which are usually small positive numbers.

[0155] The method of adjusting the resolved digital image to correspond to the first night city image is:

[0156] Calculate all the intersection points of each line in the first night contour image corresponding to the analytical contour image and the first night city image by using a line segment intersection detection algorithm, and take the angles of all the intersection points on each line as an angle sequence;

[0157] The lines corresponding to the angle sequences with the most overlap are selected as the registration lines between the first night city image and the analyzed digital image, and the analyzed digital image is adjusted to correspond to the first night city image according to the registration lines and the angles on the registration lines.

[0158] The light pollution assessment formula is:

[0159]

[0160] Where Pgz is the light pollution assessment value of the assessment area, Lz is the average brightness value of the assessment area, Fb is the ratio of the dark area to the bright area in the assessment area, and δ is the influence coefficient;

[0161] Specifically, Lz can be obtained through the measurement module, Fb can be obtained by evaluating the ratio of the dark area to the bright area in the region, and δ can be obtained by obtaining the linear relationship between the air particle size and the average brightness value of different values, fitting the influence relationship through the least square method, and inputting the air particle size of the digital image on the day of shooting into the influence relationship to obtain the corresponding influence coefficient;

[0162] In this embodiment, by matching the digital image with the night city image in the database, the determination layer can quickly identify the light pollution area in the digital image, and use the light pollution assessment formula and the preset light pollution assessment threshold to objectively and accurately assess the degree of light pollution; by analyzing the parallel projection of the digital image, the night city image and the daytime city image in the virtual space, and clicking on the light pollution area, a virtual alignment line can be generated, and then the penetration position of the light pollution area in the daytime city image can be determined, and the actual position of the light pollution area can be obtained, which provides strong data support for the subsequent treatment and management of light pollution.

[0163] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in the present invention can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0164] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the units is only one, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0165] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

[0166] Finally: The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A brightness measurement system based on digital images, characterized in that: include: The recognition layer is used to read the digital image acquired by the imaging sensor carried by the relevant instrument and output the reading result; The analysis layer selects a photoelectric conversion function or a functional relationship to analyze the digital image according to the reading result output by the recognition layer, and generates an analyzed digital image; The processing layer includes a measuring module and an analyzing module. The measuring module measures the analyzed digital image to obtain the brightness information of the pixels in the analyzed digital image. The analyzing module generates an analysis diagram based on the brightness information of the pixels in the analyzed digital image. The determination layer is used to determine the analyzed digital image and obtain the actual position of the light pollution area in the analyzed digital image; The output layer exports the brightness information of the pixels in the analyzed digital image, the analysis diagram, and the actual location of the light pollution area and saves them to a directory specified by the user; In the recognition layer, a digital image acquired by an imaging sensor carried by a relevant instrument is input into the recognition layer, and the recognition layer reads the digital image through a TKinter interface library. If the TKinter interface library can read the digital image, the digital image is an 8-bit image. If the TKinter interface library cannot read the digital image, the digital image is a 32-bit image. The method of selecting a photoelectric conversion function or a functional relationship to analyze the digital image according to the reading result output by the recognition layer to generate the analyzed digital image is as follows: Convert the digital image into a grayscale image. If the digital image is an 8-bit image, the digital image is a low dynamic range image. Convert the grayscale image through a photoelectric conversion function to obtain a resolved digital image. If the digital image is a 32-bit image, the digital image is a high dynamic range image, and the grayscale image is converted through a functional relationship to obtain a resolved digital image; The method for determining the analyzed digital image and obtaining the actual position of the light pollution area in the analyzed digital image is: The analyzed digital image is input into the discrimination layer, and the discrimination layer discriminates the analyzed digital image with the night city image in the database to obtain the first night city image; The analyzed digital image is adjusted to correspond to the first night city image, and an evaluation frame is set. The evaluation frames are sequentially arranged on the analyzed digital image to obtain an arrangement result. The analyzed digital image is divided into regions according to the arrangement result to obtain z evaluation regions. The z evaluation regions are evaluated by a light pollution evaluation formula to obtain z evaluation values. A light pollution evaluation threshold is preset, and the evaluation region above the light pollution evaluation threshold is defined as a light pollution region. Projecting the analyzed digital image, the first night city image and its corresponding day city image into the virtual space in parallel; Click on the light pollution area on the analyzed digital image, and a virtual alignment line is generated at the clicked position. The virtual alignment line runs through the first night city image and the daytime city image to obtain the penetration position of the virtual alignment line and the daytime city image. Among them, the daytime city image is associated with the geographic information system to obtain the coordinates of the penetration position, and the coordinates of the penetration position are the actual position of the light pollution area.

2. The brightness measurement system based on digital images according to claim 1, characterized in that: The measuring module measures the analyzed digital image to obtain the brightness information of the pixels in the analyzed digital image in the following manner: The measurement grid is evenly spaced on the analyzed digital image, and the margins in the four directions of the measurement grid, as well as the required number of rows and columns of points, are customized to intelligently generate an evenly spaced measurement grid and output the brightness information of each point. The measurement grid is arranged as follows: L1=L p -(L left +L right ), H1=H p -(H up +H down ), Where L1 is the length of the entire measurement grid, H1 is the height of the entire measurement grid, and L p To resolve the length of the digital image, H p To resolve the height of the digital image, L left is the left margin, L right is the right margin, H up is the top margin, H down For the bottom margin, enter the number of vertical points and the number of horizontal points in the prompt box on the measurement module; In the formula, S1 is the horizontal distance between adjacent points, S h is the vertical distance between adjacent points, P h and P1 are the number of vertical points and the number of horizontal points respectively; Using nested loops, all points in the measurement grid are traversed, and the corresponding brightness information is marked and output in the analyzed digital image.

3. The brightness measurement system based on digital images according to claim 1, characterized in that: The analysis module includes a first analysis module, a second analysis module and a third analysis module; The first analysis module is used to convert a single-band grayscale image into a color image and export a pseudo-color image; the second analysis module, based on the brightness information of the digital image obtained at the analysis layer, traverses each pixel of the digital image one by one and calculates the brightness value of each pixel according to a specific threshold input by the user. If the brightness value of a pixel exceeds the specific threshold set by the user, the pixel will be highlighted by the system; the third analysis module is for exporting a statistical histogram. Based on reading and classifying the digital image, it traverses each pixel in the digital image, substitutes the RGB value of the digital image into the photoelectric conversion function, collects the generated brightness information, and selects the corresponding chart.

4. The brightness measurement system based on digital images according to claim 1, characterized in that: The light pollution assessment formula is: Where Pgz is the light pollution assessment value of the assessment area, Lz is the average brightness value of the assessment area, Fb is the ratio of the dark area to the bright area in the assessment area, and δ is the influence coefficient; The method of obtaining the first night city image is: Collect images of n cities at night and during the day to obtain night city images and day city images corresponding to the night city images, and the n night city images and day city images corresponding to the night city images constitute a database; Preset the segmentation threshold, perform grayscale processing on the analyzed digital image and n night city images in the database, and save the grayscale values ​​above the segmentation threshold to obtain the analyzed contour image and n night contour images; The similarity value between the analytical contour image and the n night contour images in the database is obtained by simplifying the SSIM formula, and the night city image corresponding to the night contour image with the highest similarity value is taken as the first night city image; The simplified SSIM formula is: In the formula, SSIM(J x ,Y w ) is the similarity value between the analytical contour image and the night contour image, To analyze the pixel variance of the contour map, is the pixel variance of the night contour image, σJ x Y w To resolve the pixel covariance between the contour image and the night contour image, c1 and c2 are the first constant and the second constant, respectively; The method of adjusting the analyzed digital image to correspond to the first night city image is: Calculate all the intersection points of each line in the first night contour image corresponding to the analytical contour image and the first night city image by using a line segment intersection detection algorithm, and take the angles of all the intersection points on each line as an angle sequence; The lines corresponding to the angle sequences with the most overlap are selected as the registration lines between the first night city image and the analyzed digital image, and the analyzed digital image is adjusted to correspond to the first night city image according to the registration lines and the angles on the registration lines.

5. The brightness measurement system based on digital images according to claim 1, characterized in that: In the output layer, the brightness information of the pixel points in the analyzed digital image and the actual location of the light pollution area are exported in text form, and the analysis diagram is exported in image form. The brightness information of the pixel points exported from the analyzed digital image, the analysis diagram and the actual location of the light pollution area are all saved in a directory specified by the user.