Method and device for measuring spatial distribution of ambient luminance
By acquiring initial images, determining exposure parameters, capturing target images, and calculating object brightness values, a pseudo-color map of brightness spatial distribution is generated. This solves the problem of the inability to visualize ambient brightness in traditional methods, providing an intuitive design reference and improving the accuracy of lighting design.
Patent Information
- Application Number
- PCT/CN2025/096910
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-05-28
- Filing Date
- 2025-05-23
- Publication Date
- 2025-12-04
AI Technical Summary
Traditional methods cannot provide a visual representation of the spatial distribution of ambient brightness, thus failing to offer intuitive design references for lighting designers.
By receiving an ambient brightness measurement command, the camera is triggered to acquire an initial image, the target exposure parameters are determined, a target image file is captured, the object-side brightness value of each pixel is calculated, a brightness spatial distribution pseudo-color map is generated and displayed, and a brightness distribution file is generated and the user-specified target object-side brightness value is displayed by combining the object-side brightness values.
It enables the visualization of ambient brightness, providing lighting designers with intuitive design references and improving the accuracy and efficiency of lighting layout.
Smart Images

Figure CN2025096910_04122025_PF_FP_ABST
Abstract
Description
Method and device for measuring spatial distribution of ambient brightness
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application claims priority to the Chinese patent application No. 2024106784177, filed on May 28, 2024, and entitled “Method and device for measuring spatial distribution of ambient brightness”, which is incorporated by reference herein in its entirety. TECHNICAL FIELD
[0003] The present application relates to the field of brightness measurement, in particular to a method and device for measuring spatial distribution of ambient brightness. BACKGROUND
[0004] In the conventional related art, there are few studies on identifying ambient brightness through photos, and photometric stereo in computational photography is one of the few similar studies. In photometric stereo, it is assumed that the illumination is uniform, directional, and the direction of illumination is known. By taking images of an object under different illumination conditions, a series of images can be obtained, and the pixel value in each image is affected by the surface normal of the object and the direction of illumination. According to the photometric equation, the object brightness value (the actual brightness value of each pixel in the photo under the shooting environment, unit: candela / square meter) of the pixel can be expressed as a function of the illumination direction and the surface normal. By analyzing these images, the normal information of the pixel can be estimated by solving the equation set, i.e., the object brightness value of the pixel can be obtained.
[0005] The above method can only estimate the object brightness value of the pixel, and cannot obtain the visual display of the spatial distribution of the ambient brightness, and cannot intuitively provide design reference for lighting designers. SUMMARY
[0006] The present application provides a method and device for measuring spatial distribution of ambient brightness to solve the problem that the conventional ambient brightness measurement method cannot obtain the visual display of the spatial distribution of the ambient brightness and cannot intuitively provide design reference for lighting designers.
[0007] The present application provides a method for measuring spatial distribution of ambient brightness, comprising the following steps:
[0008] Receiving an ambient brightness measurement instruction, triggering the image sensor of the camera to collect an initial image of the environment to be measured;
[0009] Determining a target exposure parameter based on the initial image;
[0010] Receiving a shooting instruction, triggering the camera to take a photo according to the target exposure parameter, and obtaining a target image file of the environment to be measured under shooting;
[0011] calculating an object-side luminance value of each pixel in the target image file based on the target image file and the target exposure parameter;
[0012] generating and displaying a luminance space distribution false color map of the environment to be measured based on the object-side luminance value.
[0013] According to the environment luminance space distribution measurement method provided in the present application, after calculating the object-side luminance value of each pixel in the target image file based on the target image file and the target exposure parameter, the method further comprises:
[0014] generating a luminance distribution file based on the object-side luminance value, the luminance distribution file being configured to store the object-side luminance value of each pixel in the target image file in the form of a table;
[0015] wherein the row and column positions of the object-side luminance value of each pixel in the table correspond to the row and column coordinates of the corresponding pixel in the target image file one by one.
[0016] According to the environment luminance space distribution measurement method provided in the present application, after generating and displaying the luminance space distribution false color map of the environment to be measured based on the object-side luminance value, the method further comprises:
[0017] obtaining the row and column coordinates of a target pixel point specified by a user on the luminance space distribution false color map;
[0018] querying the target object-side luminance value recorded in the corresponding row and column positions in the luminance distribution file based on the row and column coordinates of the target pixel point;
[0019] displaying the target object-side luminance value.
[0020] According to the environment luminance space distribution measurement method provided in the present application, after generating and displaying the luminance space distribution false color map of the environment to be measured based on the object-side luminance value, the method further comprises:
[0021] obtaining a target region specified by a user on the luminance space distribution false color map;
[0022] taking all the pixels in the target region as target pixel points, and obtaining the row and column coordinates of the target pixel points;
[0023] querying the target object-side luminance value recorded in the corresponding row and column positions in the luminance distribution file based on the row and column coordinates of the target pixel;
[0024] displaying the statistical value of the target object-side luminance value.
[0025] According to the environment brightness spatial distribution measurement method provided in the application, after the object side brightness value of each pixel in the target image file is calculated based on the target image file and the target exposure parameter, the method further comprises:
[0026] A statistical value of the object side brightness values of all pixels in the target image file is calculated and displayed.
[0027] According to the environment brightness spatial distribution measurement method provided in the application, after the object side brightness value of each pixel in the target image file is calculated based on the target image file and the target exposure parameter, the method further comprises:
[0028] A scene category to which the environment to be measured belongs is received according to a user input;
[0029] Based on the scene category, a recommended statistical value of the brightness corresponding to the environment to be measured is determined.
[0030] According to the environment brightness spatial distribution measurement method provided in the application, a target image file of a photographed environment to be measured is obtained, comprising:
[0031] A raw format file photographed by a camera is obtained;
[0032] The raw format file is converted into an rgb three-channel format file according to a preset conversion mode, and the rgb three-channel format file is determined as the target image file.
[0033] According to the environment brightness spatial distribution measurement method provided in the application, based on the object side brightness value, a brightness spatial distribution false color map of the environment to be measured is generated and displayed, comprising:
[0034] The object side brightness value of each pixel is normalized to 0-2 n -1 to generate an n-bit storage bit representation of a brightness distribution grayscale map, n being a multiple of 8;
[0035] The grayscale map is converted into a brightness distribution false color map.
[0036] According to the environment brightness spatial distribution measurement method provided in the application, based on the target image file and the target exposure parameter, the object side brightness value of each pixel in the target image file is calculated, comprising:
[0037] The pixel value of each pixel in the target image file in r, g and b three channels is extracted respectively;
[0038] The pixel value and the target exposure parameter are input into an object side brightness regression model to obtain the object side brightness value of each pixel output by the object side brightness regression model;
[0039] The object-side luminance regression model is obtained by regression based on an exposure parameter of a sample target image file, pixel values of pixels in the sample target image file, and object-side luminance standard values corresponding to the pixels in the sample target image file.
[0040] According to the environmental luminance spatial distribution measuring device provided in the application, the device is applied to a terminal, and the device comprises the following modules.
[0041] The measuring instruction receiving module is configured to receive an environmental luminance measuring instruction, and trigger an image sensor of a camera to collect an initial image of an environment to be measured.
[0042] The exposure parameter determining module is configured to determine a target exposure parameter based on the initial image.
[0043] The target image file obtaining module is configured to receive a photographing instruction, trigger the camera to take a photograph according to the target exposure parameter, and obtain a target image file of the environment to be measured.
[0044] The luminance value calculating module is configured to calculate object-side luminance values of each pixel in the target image file based on the target image file and the target exposure parameter.
[0045] The false color map generating module is configured to generate and display a luminance spatial distribution false color map of the environment to be measured based on the object-side luminance values.
[0046] The application further provides an electronic device, which comprises a memory, a processor, and a computer program stored in the memory and capable of being executed on the processor, and the processor implements the environmental luminance spatial distribution measuring method according to any one of the above when executing the program.
[0047] The application further provides a computer program product, which comprises a computer program, and the computer program implements the environmental luminance spatial distribution measuring method according to any one of the above when executed by a processor.
[0048] The environment brightness spatial distribution measurement method and device provided in the application, by receiving an environment brightness measurement instruction, triggering the image sensor of the camera to collect an initial image of the environment to be measured; based on the initial image, determining a target exposure parameter; receiving a shooting instruction, triggering the camera to shoot according to the target exposure parameter, and obtaining a target image file of the environment to be measured; based on the target image file and the target exposure parameter, calculating the object side brightness value of each pixel in the target image file; based on the object side brightness value, generating and displaying a brightness spatial distribution false color map of the environment to be measured. The application realizes the visual display of the environment brightness by acquiring the target image file through real-time shooting of the current environment to be measured, calculating the object side brightness value of each pixel in the target image file in combination with the exposure parameter when shooting, and generating and displaying the brightness spatial distribution false color map of the environment to be measured according to the object side brightness value of each pixel, thereby providing a design reference for a lighting designer intuitively. BRIEF DESCRIPTION OF DRAWINGS
[0049] In order to more clearly illustrate the technical solutions in the application or the prior art, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced. Obviously, the drawings in the following description are some embodiments of the application, and other drawings can be obtained by those skilled in the art without creative effort.
[0050] Fig. 1 is a flowchart of the environment brightness spatial distribution measurement method provided in the embodiment of the application.
[0051] Fig. 2 is an interface display diagram of the photo of the environment to be measured taken by the terminal in the environment brightness spatial distribution measurement method provided in the embodiment of the application.
[0052] Fig. 3 is a display interface diagram of the brightness spatial distribution false color map in the environment brightness spatial distribution measurement method provided in the embodiment of the application.
[0053] Fig. 4 is a flowchart of the environment brightness spatial distribution measurement method provided in the embodiment of the application.
[0054] Fig. 5 is a diagram for displaying the object side brightness value of the pixel of the user specified point in the environment brightness spatial distribution measurement method provided in the embodiment of the application.
[0055] Fig. 6 is a flowchart of the environment brightness spatial distribution measurement method provided in the embodiment of the application.
[0056] Fig. 7 is a diagram for displaying the object side brightness value of the target pixel of the user specified region in the environment brightness spatial distribution measurement method provided in the embodiment of the application.
[0057] FIG. 8 is a fourth flowchart of a method for measuring ambient brightness spatial distribution according to an embodiment of the present application.
[0058] FIG. 9 is a fifth flowchart of a method for measuring ambient brightness spatial distribution according to an embodiment of the present application.
[0059] FIG. 10 is a sixth flowchart of a method for measuring ambient brightness spatial distribution according to an embodiment of the present application.
[0060] FIG. 11 is a seventh flowchart of a method for measuring ambient brightness spatial distribution according to an embodiment of the present application.
[0061] FIG. 12 is a schematic diagram of a device for measuring ambient brightness spatial distribution according to an embodiment of the present application.
[0062] FIG. 13 is a schematic diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0063] For the purpose, technical solutions and advantages of the present application to be clearer, the technical solutions of the present application will be described clearly and completely below with reference to the drawings in the present application. Obviously, the described embodiments are some embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of the present application.
[0064] The method for measuring ambient brightness spatial distribution according to an embodiment of the present application is applied to a terminal, which can be a smart phone or a tablet computer or the like, and comprises the following steps S110 to S140.
[0065] Step S110: receiving an ambient brightness measurement instruction to trigger the image sensor of the camera to collect an initial image of the environment to be measured. Specifically, the terminal receives an ambient brightness measurement instruction triggered by a user to trigger the image sensor of the camera in the terminal to collect an initial image of the environment to be measured. That is, upon receiving the ambient brightness measurement instruction, the camera module is started, and the initial image collected by the image sensor is displayed on the display screen of the terminal, so that the user can observe the initial image and adjust the shooting angle.
[0066] Step S120: determining a target exposure parameter based on the initial image. Specifically, the default exposure parameter of the camera (for different scenes, the camera will automatically generate a set of default exposure parameters) can be determined as the target exposure parameter. Preferably, the user adjusts the default exposure parameter, and the adjusted exposure parameter is determined as the target exposure parameter. The target image file obtained by exposure according to the adjusted exposure parameter will have an overall brightness of the picture close to the actual scene in the user's sense, so that the subsequent calculation of the object side brightness value of the pixel is more accurate.
[0067] Step S130: receiving a shooting instruction, triggering the camera to take a picture according to the target exposure parameter, and obtaining a target image file of the environment to be measured. After determining the target exposure parameter, the user issues a shooting instruction, the terminal receives the shooting instruction, and triggers the camera to take a picture according to the target exposure parameter, thereby obtaining a target image file of the environment to be measured. As shown in FIG. 2, a schematic diagram of a target image file of a bedroom environment taken by a smart phone is shown. The lower area of the image can show the exposure parameter corresponding to the image.
[0068] Step S140: calculating the object-side luminance value of each pixel in the target image file based on the target image file and the target exposure parameter.
[0069] Step S150: generating and displaying a luminance space distribution false color map of the environment to be measured based on the object-side luminance value. As shown in FIG. 3, a luminance space distribution false color map of the target image file corresponding to FIG. 2 is shown. The luminance space distribution false color map can more intuitively show the light and dark distribution of the entire environment to be measured. The user can understand the luminance space distribution of the entire environment to be measured by observing the false color map, thereby providing a more intuitive reference for light design in the environment.
[0070] The environment luminance space distribution measurement method of the embodiment realizes visual display of the environment luminance, and can intuitively provide a design reference for a light designer, by acquiring a target image file by real-time shooting of the current environment to be measured, calculating the object-side luminance value of each pixel in the target image file in combination with the exposure parameter when shooting, and generating and displaying a luminance space distribution false color map of the environment to be measured according to the object-side luminance value of each pixel.
[0071] In some embodiments, after step S140, the method further includes: calculating and displaying a statistical value of the object-side luminance value of all pixels in the target image file, wherein the statistical value includes: an average object-side luminance value, a maximum object-side luminance value, and a minimum object-side luminance value. As shown in FIG. 3, the terminal interface displays not only the luminance space distribution false color map, but also the average object-side luminance value, the maximum object-side luminance value, and the minimum object-side luminance value on one side of the false color map. Preferably, a marker point of the maximum object-side luminance value and a marker point of the minimum object-side luminance value are also displayed in the luminance space distribution false color map, so as to mark the respective positions of the brightest and darkest parts in the environment to be measured. In actual applications, multiple lamps with the same power can be arranged in the environment to be measured. Therefore, the marker point of the maximum object-side luminance value can have multiple marker points, and the marker point of the minimum object-side luminance value can also have multiple marker points.
[0072] In some embodiments, after step S140, the method further includes: generating a brightness distribution file based on the object-side brightness values. The brightness distribution file is configured to store the object-side brightness values of each pixel in the target image file in tabular form, wherein the row and column positions of the table containing the object-side brightness value of each pixel correspond one-to-one with the row and column coordinates of the corresponding pixel in the target image file. Specifically, the brightness distribution file is a CSV file. A CSV file is a file that stores tabular data in plain text format. It can be understood that the total number of rows and columns in the table in the CSV file is the same as the total number of rows and columns of pixels in the target image file. The object-side brightness values of each pixel in the target image file can be stored in the CSV file for subsequent querying of the object-side brightness value of any pixel.
[0073] In some embodiments, as shown in FIG4, steps S410 to S430 are further included after step S150.
[0074] Step S410: Obtain the row and column coordinates of the target pixel point specified by the user on the luminance spatial distribution pseudo-color map. Specifically, the target pixel point specified by the user is the touch point clicked by the user on the luminance spatial distribution pseudo-color map. The row and column coordinates of the target pixel point can be determined by sensing the user's touch point position through the terminal screen.
[0075] Step S420: Based on the row and column coordinates of the target pixel, query the target object brightness value recorded at the corresponding row and column position in the brightness distribution file. That is, according to the one-to-one correspondence between the row and column position of the table in the brightness distribution file where the object brightness value of each pixel is located and the row and column coordinates of the corresponding pixel in the target image file, query the target object brightness value corresponding to the target pixel in the brightness distribution file.
[0076] Step S430: Display the target object brightness value. As shown in Figure 5, the target object brightness value of two specified target pixels on the brightness spatial distribution pseudo-color map is displayed.
[0077] This embodiment enables real-time display of the target object brightness value of a user-specified target pixel. In practical applications, it can display the target object brightness values corresponding to multiple target pixels in a user-specified spatial area, allowing the user to view the differences between the brightness values of multiple target objects. Large differences indicate uneven brightness distribution in that spatial area. For example, in Figure 5, multiple target pixels in the space where the bed is located are specified, thus displaying the real-time brightness values of multiple target objects in that space. If the differences between the brightness values of multiple target objects in the space where the bed is located are large (e.g., the difference between the brightness values of one or two points and other points is too large), it indicates uneven brightness distribution in the space where the bed is located, which will affect sleep and necessitates a proper lighting arrangement around the bed.
[0078] Preferably, step S430 is followed by further steps of calculating a target average value of the plurality of target object-side luminance values in real time, and comparing any target object-side luminance value with the target average value, and if the difference between any target object-side luminance value and the target average value is greater than a preset threshold (the preset threshold can be set according to actual conditions, for example, 20% of the target average value), prompting the user on the display interface of the terminal that the luminance distribution is uneven. Specifically, the user specifies a target pixel point each time, and the average value is calculated and compared each time, so as to prompt the user in real time whether the luminance distribution is uniform.
[0079] In some embodiments, as shown in FIG. 6, after step S150, steps S610 to S640 are further included.
[0080] Step S610: Obtain a target region specified by the user on the luminance spatial distribution false color map. Specifically, the target region is obtained by sensing the closed region circled by the user on the terminal interface, as shown in FIG. 7, the user circled the region of the space where the bed is located.
[0081] Step S620: Take all the pixels in the target region as target pixel points, and obtain the row and column coordinates of the target pixel points. Specifically, all the target pixel points in the target region are determined, and the row and column coordinates of the target pixel points are obtained.
[0082] Step S630: Based on the row and column coordinates of the target pixel, query the target object-side luminance value recorded in the corresponding row and column position in the luminance distribution file. Specifically, for each target pixel point, according to the one-to-one correspondence between the row and column position of the object-side luminance value of each pixel in the table of the luminance distribution file and the row and column coordinates of the corresponding pixel in the target image file, the target object-side luminance value corresponding to the target pixel point is queried in the luminance distribution file.
[0083] Step S640: Display the statistical value of the target object-side luminance value. As shown in FIG. 7, the region object-side luminance statistical value of the target region on the luminance spatial distribution false color map is displayed, that is, the statistical value of the target object-side luminance value of the target region, for example, the average value of the target object-side luminance value of all target pixel points in the target region is displayed, and the overall luminance of the target region is represented by the average value.
[0084] In this embodiment, by displaying the region object-side luminance statistical value of the target region circled by the user, a region luminance reference is provided for the user.
[0085] It should be noted that on the basis of performing steps S610 to S640, in combination with performing the above steps S410 to S430, the target pixel points are further specified in the target region, so as to not only obtain the overall luminance of the target region, but also judge whether the luminance distribution uniformity of the target region meets the requirements.
[0086] In some embodiments, as shown in FIG. 8, after step S150, steps S810 and S820 are further included.
[0087] Step S810: receiving a scene category to which the environment to be measured belongs, for example: bedroom, living room, study, tea room, KTV room and gymnasium, etc. Specifically, as shown in FIGS. 3, 5 and 7, the scene category is input in the edit box on one side of the terminal interface luminance space distribution false color map.
[0088] Step S820: determining a recommended statistical value of the luminance corresponding to the environment to be measured based on the scene category. Specifically, a mapping table of scene categories and corresponding recommended statistical values of luminance can be preset, after receiving the scene category input by the user, the corresponding recommended statistical value is found according to the mapping table, and the recommended statistical value is displayed in the area where the recommended statistical value is displayed. The recommended statistical value corresponding to the scene category can be the average value of luminance, reflecting the average luminance of different scenes. In this embodiment, the recommended statistical value of luminance is output through the scene category, which can quickly provide the user with a reference for luminance distribution design.
[0089] In some embodiments, as shown in FIG. 9, step S130 specifically includes steps S910 and S920.
[0090] Step S910: obtaining a raw format file photographed by the camera, the raw format file being image encoding data that is not processed and not compressed, recording the original information of the camera sensor.
[0091] Step S920: converting the raw format file into an rgb three-channel format file according to a preset conversion mode, determining the rgb three-channel format file as the target image file, for example: converting the raw format file into a jpg or png format file. Wherein, the preset conversion mode is a unified ISP (Image Signal Processor) processing flow, obtaining the rgb three-channel format file, and the unified ISP flow can be converted by the postprocess function in the ISP algorithm flow library libraw C++ library or the rawpy library encapsulated by python. Specifically, the raw format file is input into the postprocess function as a parameter, and the raw format file is converted into the rgb three-channel format file by the unified ISP flow and output.
[0092] In this embodiment, no matter what shooting device is used, the raw format file of the shooting device is converted into an rgb three-channel format file through a unified ISP process, which shields the adverse effects of different ISP processes of different mobile phone or camera manufacturers on the calculation of pixel values in different target image files, so that the object-side pixel value of the finally measured pixel is more accurate and stable.
[0093] In some embodiments, as shown in FIG. 10, step S150 specifically includes step S1010 and step S1020.
[0094] Step S1010: performing 0-2 n -1 normalization processing on the object-side luminance value of each pixel to generate a n-bit storage bit representing a luminance distribution grayscale map, n being a multiple of 8. For example, n is 16, the object-side luminance value of each pixel is normalized to 0-65535 (2 16 -1), and a 16-bit png format storage luminance distribution grayscale map is generated.
[0095] Step S1020: converting the grayscale map into a luminance distribution pseudocolor map. In this embodiment, the grayscale map can be converted into a luminance distribution pseudocolor map through the opencv: cv2.applyColorMap function.
[0096] In some embodiments, as shown in FIG. 11, step S140 specifically includes step S1110 and step S1120.
[0097] Step S1110: extracting the pixel values of each pixel in the r, g and b three channels of the target image file. Each pixel in the target image file corresponds to r, g and b three channels, and each channel has a pixel value in the range of 0-255. In this step, the pixel values of each pixel in the r, g and b three channels are extracted, thereby obtaining the pixel values of each pixel in the r, g and b three channels: IR value, IG value and IB value, and the IR value, IG value and IB value are all integers between 0 and 255.
[0098] Step S1120: inputting the pixel values and the target exposure parameter into the object-side luminance regression model to obtain the object-side luminance value of each pixel output by the object-side luminance regression model. The object-side luminance value of each pixel is the environmental luminance value corresponding to the point of each pixel in the shooting environment, that is, the measurement of the environmental luminance through the shooting image file is realized.
[0099] The object-side luminance regression model is obtained by fitting and regression based on the exposure parameter of a sample target image file, the pixel values of the pixels in the sample target image file, and the object-side luminance standard value corresponding to the pixels in the sample target image file.
[0100] Specifically, when fitting the object-side luminance regression model, the exposure parameter of the sample target image file and the pixel value of the pixel in the sample target image file are known quantities, and for the object-side luminance standard value corresponding to the pixel in the sample target image file, the imaging luminance meter or the like can be used to measure the value in the same environment as the shooting environment. Since the imaging luminance meter can measure the luminance of the object in the shooting environment, the accurate object-side luminance value (i.e., the object-side luminance standard value) is obtained, and the fitting coefficients of the object-side luminance regression model that is adapted to the object-side luminance standard value are obtained based on the object-side luminance standard value, so that the object-side luminance value (i.e., the environmental luminance value) of each pixel in the real-time shot target image file can be accurately regressed by using the object-side luminance regression model, and it is no longer necessary to rely on other luminance measurement devices, thereby eliminating the interference of the device factor, and the output object-side luminance value has higher stability.
[0101] It should be noted that: when the object-side luminance regression model is fitted, the sample shooting image file is also a rgb three-channel format file converted from a raw format file according to a unified ISP process, so that the object-side luminance value of each pixel output by the finally obtained object-side luminance regression model is more accurate.
[0102] In some embodiments, the object-side luminance regression model includes a first sub-model and a second sub-model, the first sub-model is configured to determine a tristimulus value corresponding to the pixel value according to the pixel value, and determine a floating-point gray value of each pixel according to the tristimulus value of each pixel.
[0103] The second sub-model is configured to determine the object-side luminance value of each pixel according to the floating-point gray value of each pixel and the exposure parameter.
[0104] In some embodiments, the first sub-model can be regressed and fitted by the following formula. GF = a x R + b x G + g x B (1)
[0105] Wherein, GF is the floating-point gray value of the pixel, IR, IG and IB are the pixel values of the three channels respectively, R, G and B are the tristimulus values of IR, IG and IB respectively, A1, A2, A3, B1, B2 and B3 are fitting coefficients, A'1, A'2 and A'3 are intermediate variables, and a, b and g are constants. According to the relationship between the floating-point gray value and the tristimulus value, a = 0.299, b = 0.587, and g = 0.114 in formula (1). Substituting the above formulas (2), (3) and (4) into formula (1) to obtain formula (5), wherein A1 = a x A'1, A2 = b x A'2, and A3 = g x A'3.
[0106] In the first sub-model, the relationship between the pixel value and the corresponding tristimulus value can be represented by a power function with the pixel value IR value, IG value and IB value as the base number. In the process of fitting regression of the first sub-model, the accurate tristimulus value of the pixel in the sample target image file is obtained through the camera optical characteristic calibration experiment, and a plurality of (at least 6) accurate tristimulus values and the pixel value of the corresponding pixel in the sample target image file are substituted into formulas (2), (3) and (4) to obtain fitting coefficients A'1, A'2, A'3, B1, B2 and B3, that is, A1, A2, A3, B1, B2 and B3 are obtained, thereby completing the fitting regression process of the first sub-model.
[0107] In some embodiments, the second sub-model can be obtained by regression fitting the following formula.
[0108] Wherein, A4 and B4 are fitting coefficients, L is the object side luminance value of the pixel, which can be obtained by measuring the luminance meter in the fitting process, F, T and ISO are all exposure parameters, representing the aperture coefficient, exposure time and sensitivity respectively. The log can be a logarithmic function with any number as the base, for example: the natural constant e as the base of the logarithmic function ln, or the base 10 of the logarithmic function lg, the A4 and B4 fitted by the different base logarithmic functions are different. The GF of the pixel in the sample target image file is obtained by the first sub-model, and a plurality of (at least two) sample target image files corresponding to the exposure parameters and a plurality of groups of sample target image files corresponding to the object side luminance standard value of the pixel are fitted to obtain the fitting coefficients A4 and B4, thereby completing the fitting regression of the second sub-model.
[0109] In some embodiments, the object side luminance regression model is obtained by regression fitting the following formula.
[0110] Wherein, IR, IG and IB are the pixel values of the three channels respectively, A1, A2, A3, A4, B1, B2, B3 and B4 are fitting coefficients, L is the object side luminance value of the pixel, F, T and ISO are all exposure parameters, representing the aperture coefficient, exposure time and sensitivity respectively.
[0111] In this embodiment, a total of eight fitting coefficients, at least eight different sample target image file pixel three-channel pixel values and corresponding different exposure parameters are substituted into formula (7) to obtain A1, A2, A3, A4, B1, B2, B3 and B4 by regression at one time. In this embodiment, it is not necessary to divide the experiment into multiple steps, and it is not necessary to first calibrate the camera optical characteristics to obtain the relationship between the three stimulus values and the image RGB values, that is, it is not necessary to fit the intermediate variables A'1, A'2 and A'3 in the above formulas (2), (3) and (4), and then fit the relationship between the floating-point gray value calculated by the three stimulus values and the object-side luminance value. Instead, a plurality of sample target image files under different exposure parameters are directly used to obtain A1, A2, A3, A4, B1, B2, B3 and B4 by regression at one time, which is more efficient, and does not require multiple fittings, thereby reducing the fitting error and improving the accuracy and stability of the final calculated object-side luminance value of the pixel.
[0112] Generally, the images taken will have a vignetting effect, that is, the pixels at the edge of the image will be dark, and the rgb pixel values of these edge pixels will also be inaccurate, thereby affecting the measurement of the object-side luminance value of the pixel. Therefore, in some embodiments, before step S120, the target image file is also subjected to vignetting effect correction, specifically, the vignetting effect of the target image file is reduced by a resize function (for example, a resize function of Python or C++), and the object-side luminance value of the pixel obtained after reducing the vignetting effect of the target image file is more accurate. The simplest way to correct the vignetting effect is to reduce the size of the target image file by the resize function, thereby reducing the influence of the darkening of the edge pixels on the luminance distribution map of the entire environment to be measured.
[0113] The vignetting effect can also be corrected by correcting the vignetting effect coefficient of the photographing device to reduce the darkening of the edge pixels of the target image file.
[0114] It should be noted that when the object-side luminance regression model is fitted, the sample photographing image file can also be subjected to vignetting effect correction, so that the object-side luminance value of each pixel output by the finally obtained object-side luminance regression model is more accurate.
[0115] The environmental luminance spatial distribution measuring device provided by the present application is described below, and the environmental luminance spatial distribution measuring device described below can be correspondingly referred to the environmental luminance spatial distribution measuring method described above.
[0116] The environmental luminance spatial distribution measuring device of the embodiment of the present application is applied to a terminal, as shown in FIG. 12, and the device comprises a measurement instruction receiving module 1210, an exposure parameter determining module 1220, a target image file obtaining module 1230, a luminance value calculating module 1240 and a false color map generating module 1250.
[0117] The measurement instruction receiving module 1210 is configured to receive an environment brightness measurement instruction, trigger the image sensor of the camera to capture an initial image of the environment to be measured.
[0118] The exposure parameter determining module 1220 is configured to determine a target exposure parameter based on the initial image.
[0119] The target image file obtaining module 1230 is configured to receive a shooting instruction, trigger the camera to take a picture according to the target exposure parameter, and obtain a target image file of the environment to be measured.
[0120] The brightness value calculating module 1240 is configured to calculate the object-side brightness value of each pixel in the target image file based on the target image file and the target exposure parameter.
[0121] The false color map generating module 1250 is configured to generate and display a brightness space distribution false color map of the environment to be measured based on the object-side brightness value.
[0122] The environment brightness space distribution measurement device of the embodiment of the present application realizes the visual display of the environment brightness by capturing the target image file of the current environment to be measured in real time, calculating the object-side brightness value of each pixel in the target image file in combination with the exposure parameter when shooting, and generating and displaying the brightness space distribution false color map of the environment to be measured according to the object-side brightness value of each pixel, thereby providing the design reference for the lighting designer intuitively.
[0123] Optionally, the environment brightness space distribution measurement device further comprises a brightness distribution file generating module configured to generate a brightness distribution file based on the object-side brightness value after calculating the object-side brightness value of each pixel in the target image file based on the target image file and the target exposure parameter, the brightness distribution file being configured to store the object-side brightness value of each pixel in the target image file in the form of a table; wherein the row and column positions of each pixel in the table correspond to the row and column coordinates of the corresponding pixel in the target image file one by one.
[0124] Optionally, the environment brightness space distribution measurement device further comprises a first row and column coordinate obtaining module configured to obtain the row and column coordinates of a target pixel point specified by a user on the brightness space distribution false color map after generating and displaying the brightness space distribution false color map of the environment to be measured based on the object-side brightness value.
[0125] The first brightness value querying module is configured to query the target object-side brightness value recorded in the corresponding row and column positions in the brightness distribution file based on the row and column coordinates of the target pixel point.
[0126] The pixel luminance value display module is configured to display the target object-side luminance value.
[0127] Optionally, the environmental luminance spatial distribution measuring device further comprises a target region acquisition module configured to acquire a target region specified by a user on the luminance spatial distribution false-color map after the luminance spatial distribution false-color map of the environment to be measured is generated and displayed based on the object-side luminance value.
[0128] The second row and column coordinate acquisition module is configured to acquire row and column coordinates of the target pixel based on all pixels in the target region as target pixel points.
[0129] The second luminance value query module is configured to query the target object-side luminance value recorded in the corresponding row and column position of the luminance distribution file based on the row and column coordinates of the target pixel.
[0130] The region luminance value display module is configured to display a statistical value of the target object-side luminance value.
[0131] Optionally, the environmental luminance spatial distribution measuring device further comprises a luminance statistical value display module configured to calculate and display a statistical value of the object-side luminance values of all pixels in the target image file after the object-side luminance value of each pixel in the target image file is calculated based on the target image file and the target exposure parameter.
[0132] Optionally, the environmental luminance spatial distribution measuring device further comprises a scene category receiving module configured to receive a scene category to which the environment to be measured belongs input by a user after the luminance spatial distribution false-color map of the environment to be measured is generated and displayed based on the object-side luminance value.
[0133] The recommended statistical value determination module is configured to determine a recommended statistical value of the luminance corresponding to the environment to be measured based on the scene category.
[0134] Optionally, the target image file acquisition module 1230 specifically comprises a raw format file acquisition module configured to acquire a raw format file shot by a camera.
[0135] The file format conversion module is configured to convert the raw format file into an rgb three-channel format file in a preset conversion manner, and determine the rgb three-channel format file as the target image file.
[0136] Optionally, the false-color map generation module 1250 specifically comprises a grayscale map generation module configured to perform normalization processing on the object-side luminance value of each pixel in a range of 0-2 n -1 to generate an n-bit storage bit luminance distribution grayscale map, n being a multiple of 8.
[0137] The pseudo-color map conversion module is configured to convert the grayscale map into a luminance distribution pseudo-color map.
[0138] Optionally, the luminance value calculation module 1240 specifically comprises a pixel value extraction module configured to extract pixel values of each pixel in the target image file in r, g and b three channels respectively.
[0139] The regression model execution module is configured to input the pixel values and the target exposure parameter into the object-side luminance regression model to obtain object-side luminance values of each pixel output by the object-side luminance regression model.
[0140] The object-side luminance regression model is obtained by fitting regression based on exposure parameters of sample target image files, pixel values of pixels in the sample target image files and object-side luminance standard values corresponding to the pixels in the sample target image files.
[0141] FIG. 13 shows an entity structure diagram of an electronic device, as shown in FIG. 13, the electronic device can include a processor 1310, a communications interface 1320, a memory 1330 and a communications bus 1340, wherein the processor 1310, the communications interface 1320 and the memory 1330 complete mutual communication through the communications bus 1340. The processor 1310 can invoke logical instructions in the memory 1330 to execute an ambient luminance space distribution measurement method, which includes the following steps.
[0142] Receiving an ambient luminance measurement instruction triggers the image sensor of the camera to collect an initial image of the environment to be measured.
[0143] Based on the initial image, a target exposure parameter is determined.
[0144] Receiving a shooting instruction triggers the camera to take a picture under the target exposure parameter to obtain a target image file of the environment to be measured.
[0145] Based on the target image file and the target exposure parameter, object-side luminance values of each pixel in the target image file are calculated.
[0146] Based on the object-side luminance values, a luminance space distribution pseudo-color map of the environment to be measured is generated and displayed.
[0147] Further, the logic instructions in the memory 1330 described above can be implemented in the form of software functional units and sold or used as independent products, and can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the parts that make contributions to the prior art or parts of the technical solutions can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.
[0148] In another aspect, the present application also provides a computer program product, which can be on a non-transitory computer readable medium, or an app downloaded online, etc. The computer program product includes a computer program, which can be stored on a non-transitory computer readable storage medium, and when the computer program is executed by a processor, the computer can execute the ambient brightness spatial distribution measurement method provided by the above-mentioned methods, which includes the following steps.
[0149] Receiving an ambient brightness measurement instruction, triggering the image sensor of the camera to collect an initial image of the environment to be measured.
[0150] Based on the initial image, determining a target exposure parameter.
[0151] Receiving a shooting instruction, triggering the camera to take a picture according to the target exposure parameter, and obtaining a target image file of the environment to be measured.
[0152] Based on the target image file and the target exposure parameter, calculating the object side brightness value of each pixel in the target image file.
[0153] Based on the object side brightness value, generating and displaying a brightness spatial distribution false color map of the environment to be measured.
[0154] In yet another aspect, the present application also provides a non-transitory computer readable storage medium having a computer program stored thereon, which is executed by a processor to implement the ambient brightness spatial distribution measurement method provided by the above-mentioned methods, which includes the following steps.
[0155] Receiving an ambient brightness measurement instruction, triggering the image sensor of the camera to collect an initial image of the environment to be measured.
[0156] Determine a target exposure parameter based on the initial image.
[0157] Receive a shooting instruction, trigger a camera to take a picture according to the target exposure parameter, and obtain a target image file of the to-be-measured environment.
[0158] Calculate an object-side luminance value of each pixel in the target image file based on the target image file and the target exposure parameter.
[0159] Generate and display a luminance space distribution false color map of the to-be-measured environment based on the object-side luminance value.
[0160] The device embodiments described above are merely illustrative, wherein the units described as separate components can or can not be physically separated, and the components displayed as units can or can not be physical units, i.e., can be located in one place or distributed on multiple network units. Part or all of the modules can be selected to achieve the purpose of the embodiment scheme according to actual needs. Those skilled in the art can understand and implement without creative labor.
[0161] Through the description of the above embodiments, those skilled in the art can clearly understand that the embodiments can be realized by means of software and necessary universal hardware platforms, and of course can also be realized by hardware. Based on such understanding, the above technical solutions can be embodied in the form of software products, and the computer software products can be stored in a computer readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and include a plurality of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute the methods described in each embodiment or some parts of the embodiments.
[0162] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for some technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for measuring ambient brightness spatial distribution, applied to a terminal, comprising: receiving an ambient brightness measurement instruction, triggering a camera's image sensor to capture an initial image of an environment to be measured; determining a target exposure parameter based on the initial image; receiving a shooting instruction, triggering the camera to take a picture according to the target exposure parameter, and obtaining a target image file of the environment to be measured; calculating an object-side brightness value of each pixel in the target image file based on the target image file and the target exposure parameter; generating and displaying a brightness spatial distribution false color map of the environment to be measured based on the object-side brightness value.
2. The environmental brightness spatial distribution measurement method of claim 1, wherein, After calculating the object-side brightness value of each pixel in the target image file based on the target image file and the target exposure parameter, the method further comprises: generating a brightness distribution file based on the object-side brightness value, the brightness distribution file being configured to store the object-side brightness value of each pixel in the target image file in the form of a table; wherein the row and column positions of each pixel's object-side brightness value in the table correspond one-to-one with the row and column coordinates of the corresponding pixel in the target image file.
3. The environmental brightness spatial distribution measurement method of claim 2, wherein, After generating and displaying the brightness spatial distribution false color map of the environment to be measured based on the object-side brightness value, the method further comprises: obtaining the row and column coordinates of a target pixel point specified by a user on the brightness spatial distribution false color map; querying the target object-side brightness value recorded in the corresponding row and column position in the brightness distribution file based on the row and column coordinates of the target pixel point; displaying the target object-side brightness value.
4. The environmental brightness spatial distribution measurement method of claim 2, wherein, After generating and displaying the brightness spatial distribution false color map of the environment to be measured based on the object-side brightness value, the method further comprises: obtaining a target region specified by a user on the brightness spatial distribution false color map; taking all pixels in the target region as target pixel points, and obtaining the row and column coordinates of the target pixel points; querying the target object-side brightness value recorded in the corresponding row and column position in the brightness distribution file based on the row and column coordinates of the target pixel; displaying the statistical value of the target object-side brightness value.
5. The environmental brightness spatial distribution measurement method of claim 1, wherein, After calculating the object-side brightness value of each pixel in the target image file based on the target image file and the target exposure parameter, the method further comprises: calculating and displaying the statistical value of the object-side brightness value of all pixels in the target image file.
6. The environmental brightness spatial distribution measurement method of claim 1, wherein, After generating and displaying the brightness spatial distribution false color map of the environment to be measured based on the object-side brightness value, the method further comprises: receiving a scene category to which the environment to be measured belongs, input by a user; determining a recommended statistical value of the brightness corresponding to the environment to be measured based on the scene category.
7. The ambient brightness spatial distribution measurement method according to any one of claims 1 to 6, wherein, Obtaining the target image file of the environment to be measured, comprising: obtaining a raw format file shot by the camera; converting the raw format file into an rgb three-channel format file according to a preset conversion mode, and determining the rgb three-channel format file as the target image file.
8. The ambient brightness spatial distribution measurement method according to any one of claims 1 to 6, wherein, Generating and displaying the brightness spatial distribution false color map of the environment to be measured based on the object-side brightness value, comprising: The object side luminance value of each pixel is normalized to 0~2 n -1 to generate an n-bit storage bit representation of the luminance distribution gray scale, n being a multiple of 8. converting the grayscale map into a brightness distribution false color map.
9. The ambient brightness spatial distribution measurement method according to any one of claims 1 to 6, wherein, Calculating the object-side brightness value of each pixel in the target image file based on the target image file and the target exposure parameter, comprising: extracting a pixel value of each pixel in the target image file in r, g and b three channels respectively; inputting the pixel value and the target exposure parameter into an object-side luminance regression model to obtain an object-side luminance value of each pixel output by the object-side luminance regression model; wherein the object-side luminance regression model is obtained by fitting and regression based on an exposure parameter of a sample target image file, a pixel value of a pixel in the sample target image file and an object-side luminance standard value corresponding to the pixel in the sample target image file.
10. An environmental luminance spatial distribution measuring device applied to a terminal, comprising: a measuring instruction receiving module configured to receive an environmental luminance measuring instruction, trigger an image sensor of a camera to collect an initial image of an environment to be measured; an exposure parameter determining module configured to determine a target exposure parameter based on the initial image; a target image file obtaining module configured to receive a photographing instruction, trigger the camera to take a photograph according to the target exposure parameter and obtain a target image file of the environment to be measured; a luminance value calculating module configured to calculate an object-side luminance value of each pixel in the target image file based on the target image file and the target exposure parameter; a false color map generating module configured to generate and display a luminance spatial distribution false color map of the environment to be measured based on the object-side luminance value.
11. An electronic device comprising: a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the environmental luminance spatial distribution measuring method according to any one of claims 1 to 9 when executing the computer program.
12. A computer program product comprising a computer program, wherein the computer program implements the environmental luminance spatial distribution measuring method according to any one of claims 1 to 9 when executed by a processor.
Citation Information
Patent Citations
Luminosity information measurement device and method
CN103017897A
Image assisted exposure processing method and apparatus, and electronic device
CN109660781A
Ambient brightness determination method and device, medium, product and camera
CN113556477A
Portable luminance meter
KR1020150002990A