Brightness adjustment method and scanning device

By collecting images in the scanning device, determining the metering area, and adjusting the exposure parameters, the problems of low brightness adjustment efficiency and inability to ensure optimal brightness in the prior art are solved, and more efficient brightness adjustment and better scanning effect are achieved.

CN119729225BActive Publication Date: 2025-05-27SHINING 3D TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202510240118.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-03-03
Publication Date
2025-05-27
Estimated Expiration
2045-03-03

AI Technical Summary

Technical Problem

The existing scanning devices have low brightness adjustment efficiency and cannot ensure optimal brightness when scanning target objects.

Method used

By collecting the first image, the metering area is determined based on the preset area of ​​interest, and the object segmentation is performed to generate the object mask. If the grayscale value of the object mask is not within the preset range, the exposure parameters are adjusted based on the correlation between the grayscale value and the exposure parameters until the preset grayscale range is reached.

Benefits of technology

Improves the efficiency of brightness adjustment, ensures optimal brightness when scanning the target object, and avoids the inefficiency of adjusting brightness with fixed step length.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119729225B_ABST
    Figure CN119729225B_ABST
Patent Text Reader

Abstract

The present application provides a brightness adjustment method and a scanning device. The method includes: acquiring a first image according to the current exposure parameters of the scanning device; determining a photometric region on the first image based on a preset region of interest; performing object segmentation on the photometric region to generate an object mask; if a first gray value of the object mask is not within a preset gray value range, adjusting the current exposure parameters to target exposure parameters corresponding to a second gray value based on the correlation between the gray value and the exposure parameters, where the second gray value is within the preset gray value range. The above method can improve the efficiency of brightness adjustment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of display technologies, and in particular, to a brightness adjustment method and a scanning device. Background Art

[0002] When a scanning device is operating, an automatic exposure mode is generally set for the camera module. In the automatic exposure mode, the camera module will automatically adjust the exposure parameters to meet the brightness requirements. However, the current automatic exposure mode usually adjusts the brightness in a fixed step size, and this type of adjustment method has low efficiency. In addition, related technologies have limitations in optimizing the brightness of the scanned target object, and can only ensure that the brightness within a region or at a certain point reaches the brightness requirement, and cannot ensure the optimal brightness when scanning the target object. Summary of the Invention

[0003] Embodiments of this application disclose a brightness adjustment method and a scanning device, which solve the technical problems of low brightness adjustment efficiency and inability to ensure the optimal brightness when scanning the target object in related technologies.

[0004] This application provides a brightness adjustment method, and the method includes: acquiring a first image according to the current exposure parameter of the scanning device; determining a photometric region on the first image based on a preset region of interest; performing object segmentation on the photometric region to generate an object mask; if a first gray value of the object mask is not within a preset gray value range, adjusting the current exposure parameter to a target exposure parameter corresponding to a second gray value based on the correlation between the gray value and the exposure parameter, where the second gray value is within the preset gray value range.

[0005] In some embodiments of this application, adjusting the current exposure parameter to the target exposure parameter corresponding to the second gray value based on the correlation between the gray value and the exposure parameter includes: determining a linear interval based on the correlation; if the first gray value is within the linear interval, calculating a first adjustment ratio according to the first gray value and the second gray value; determining the target exposure parameter according to the first adjustment ratio and the current exposure parameter; and updating the current exposure parameter with the target exposure parameter.

[0006] In some embodiments of the present application, adjusting the current exposure parameter to the target exposure parameter corresponding to the second gray value based on the correlation between the gray value and the exposure parameter includes: determining a linear interval and a non-linear interval based on the correlation; if the first gray value is within the non-linear interval, obtaining an intermediate gray value located in the linear interval based on a preset interval adjustment ratio and the first gray value; calculating a second adjustment ratio according to the intermediate gray value and the second gray value, where the second gray value is within the preset gray value range; determining the target exposure parameter according to the second adjustment ratio and the current exposure parameter; and updating the current exposure parameter with the target exposure parameter.

[0007] In some embodiments of the present application, determining the photometric region on the first image based on a preset region of interest includes: responding to a setting instruction for the region of interest to determine the coordinates of the region of interest in the image coordinate system; and determining the photometric region based on the coordinates.

[0008] In some embodiments of the present application, segmenting an object in the photometric region to generate an object mask includes: determining a gray histogram according to the pixel values of the photometric region; determining the main part within the photometric region based on the gray histogram; and obtaining the object mask based on the pixel positions of the pixel points corresponding to the main part.

[0009] In some embodiments of the present application, determining the main part within the photometric region based on the gray histogram includes: determining discrete data of the pixel gray values corresponding to the photometric region based on the gray histogram, where the discrete data includes the distribution of the pixel gray values within the photometric region; determining the main distribution information of the photometric region according to the discrete data; if the main distribution information indicates that the photometric region includes a single main body, taking the single main body as the main part; if the main distribution information indicates that the photometric region includes multiple main bodies, determining the main part from the multiple main bodies based on a preset gray threshold.

[0010] In some embodiments of the present application, determining the main part from the multiple main bodies based on a preset gray threshold includes: dividing the photometric region into a first sub-region greater than the gray threshold and a second sub-region less than or equal to the gray threshold based on the gray threshold and the gray histogram; obtaining a first ratio based on the first sub-region and the photometric region; obtaining a second ratio based on the second sub-region and the photometric region; if the first ratio is greater than the second ratio, taking the first sub-region as the main part; if the second ratio is greater than the first ratio, taking the second sub-region as the main part.

[0011] In some embodiments of the present application, the method further includes: obtaining a mask region corresponding to pixel points within the grayscale range in the first image; performing histogram equalization on the mask region to obtain a second image; coloring the second image using a preset color spectrum, where the color spectrum is determined according to the conversion of the original color of the display interface to a color space; and displaying the third image through the display interface.

[0012] In some embodiments of the present application, the method further includes: collecting a fourth image based on the target exposure parameter; updating the first image using the fourth image; obtaining the mask region corresponding to the fourth image, and continuing to perform the step of performing histogram equalization on the mask region.

[0013] The present application also provides a scanning device, which includes a processor and a memory. When the processor executes a computer program stored in the memory, the brightness adjustment method described above is implemented.

[0014] The present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the brightness adjustment method described above is implemented.

[0015] In the brightness adjustment method provided by the present application, according to the current exposure parameter of the scanning device, a first image is collected, and this first image is used to determine whether the current exposure parameter currently set by the scanning device meets a preset requirement. Based on a preset region of interest, a photometric region on the first image is determined, so as to determine whether the current exposure parameter meets the preset requirement through the photometric region. Object segmentation is performed on the photometric region to generate an object mask, and the object mask is extracted through a grayscale threshold, so as to evaluate whether a first grayscale value of the object mask is within a preset grayscale range. If the first grayscale value is not within the preset grayscale range, then based on the correlation relationship between the grayscale value and the exposure parameter, the current exposure parameter is adjusted to a target exposure parameter corresponding to a second grayscale value, thereby improving the efficiency of brightness adjustment and avoiding adjusting the brightness based on a fixed step size. In addition, through a pre-determined region of interest, it is possible to ensure that the brightness of the region of interest reaches the optimum. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 is a schematic structural diagram of a scanning device provided by an embodiment of the present application.

[0017] Figure 2 is a flowchart of a brightness adjustment method provided by an embodiment of the present application.

[0018] Figure 3 is a curve graph of the correlation relationship between the grayscale value and the exposure parameter provided by an embodiment of the present application.

[0019] Figure 4 It is a flowchart for adjusting the current exposure parameter to the target exposure parameter provided by an embodiment of the present application.

[0020] Figure 5 It is a curve graph of the correlation relationship between the gray value and the exposure parameter provided by another embodiment of the present application. Detailed implementation manners

[0021] For ease of understanding, some descriptions of concepts related to the embodiments of the present application are exemplarily given for reference.

[0022] It should be noted that in the present application, "at least one" means one or more, and "a plurality" means two or more than two. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone, where A and B may be singular or plural. Terms such as "first", "second", "third", "fourth", etc. (if any) in the description, claims and drawings of the present application are used to distinguish similar objects, rather than to describe a specific order or sequence.

[0023] When the scanning device is running, an automatic exposure mode is generally set for the camera module. In the automatic exposure mode, the camera module will automatically adjust the exposure parameter to meet the brightness requirement. However, the current automatic exposure mode usually adjusts the brightness in a fixed step, and this type of adjustment method has low efficiency. In addition, the related technology has limitations in the brightness optimization of the scanned target object, and can only ensure that the brightness in the area or at a certain point reaches the brightness requirement, and cannot ensure the optimal brightness when scanning the target object.

[0024] To solve the technical problems of low brightness adjustment efficiency and inability to ensure the optimal brightness when scanning the target object in the related technology, the present application proposes a brightness adjustment method and a scanning device. The photometric region on the first image is determined through a preset region of interest. By evaluating the gray value of the photometric region, the current exposure parameter is adjusted to the target exposure parameter, so that the brightness of the region of interest reaches the optimal, ensuring the optimal brightness when scanning the target object and meeting the user's needs. In addition, based on the correlation relationship between the gray value and the exposure parameter, the efficiency of brightness adjustment can be improved, and the use of a fixed step to adjust the brightness can be avoided. First, the structure of the scanning device will be described below.

[0025] Figure 1 It is a schematic structural diagram of the scanning device provided by an embodiment of the present application. As Figure 1As shown, the scanning device 10 may include a display device 100, a communication module 101, a memory 102, a processor 103, an input / output (I / O) interface 104, and a bus 105. The processor 103 is respectively coupled to the display device 100, the communication module 101, the memory 102, and the I / O interface 104 through the bus 105.

[0026] Among them, the display device 100 may be a touch screen, which is an inductive touchable liquid crystal display device. Alternatively, the display device 100 may also be a non-touch screen. In addition, the display device 100 may be a display screen external to the scanning device 10. Or, the scanning device 10 may also be communicatively connected to an electronic device (such as a computer), and the scanning device 10 displays the scanning result through the display device on the electronic device.

[0027] The communication module 101 may include a wired communication module and / or a wireless communication module. The wired communication module may provide one or more of the solutions for wired communication such as Universal Serial Bus (USB), Controller Area Network (CAN), etc. The wireless communication module may provide one or more of the solutions for wireless communication such as Wireless Fidelity (Wi-Fi), Bluetooth (BT), mobile communication network, Frequency Modulation (FM), Near Field Communication (NFC), Infrared (IR), etc.

[0028] The memory 102 may include one or more Random Access Memories (RAMs) and one or more Non-Volatile Memories (NVMs). The random access memory can be directly read and written by the processor 103, can be used to store the operating system or executable programs (such as machine instructions) of other running programs, and can also be used to store user and application data, etc.

[0029] Random access memory may include static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), etc.

[0030] The non-volatile memory can also store executable programs and data of users and applications, etc., which can be pre-loaded into the random access memory for the processor 103 to directly read and write. The non-volatile memory may include disk storage devices, flash memory.

[0031] The memory 102 is used to store one or more computer programs. The one or more computer programs are configured to be executed by the processor 103. The one or more computer programs include a plurality of instructions. When the plurality of instructions are executed by the processor 103, a brightness adjustment method executed on the scanning device 10 can be realized.

[0032] In other embodiments, the scanning device 10 further includes an external memory interface for connecting to an external memory to implement the storage capacity expansion of the scanning device 10.

[0033] The processor 103 may include one or more processing units. For example, the processor 103 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units may be independent devices or integrated in one or more processors.

[0034] The processor 103 provides computing and control capabilities. For example, the processor 103 is used to execute the computer program stored in the memory 102 to implement the above-mentioned brightness adjustment method.

[0035] The I / O interface 104 is used to provide channels for user input or output. For example, the I / O interface 104 can be used to connect various input and output devices, such as a mouse, a keyboard, a touch device, a display screen, etc., so that users can input information or visualize information.

[0036] The bus 105 is at least used to provide a communication channel for mutual communication among the communication module 101, the memory 102, the processor 103, and the I / O interface 104 in the scanning device 10.

[0037] The said schematic Figure 1 is merely an example of the scanning device 10 and does not constitute a limitation on the scanning device 10. It may include more or fewer components than those shown in the figure, or combine certain components, or different components. For example, the scanning device 10 may further include input and output devices, network access devices, etc.

[0038] Figure 2 is a flowchart of the brightness adjustment method provided by an embodiment of the present application, which is applied to a scanning device (such as Figure 1 the scanning device 10). According to different requirements, the order of steps in this flowchart can be changed, and some steps can be omitted.

[0039] Step S201, collect a first image according to the current exposure parameter of the scanning device.

[0040] In some embodiments of the present application, in order to improve the accuracy of the scanning device, the scanning device can be fixed at a specified position. In actual application scenarios, the scanning device can also perform mobile scanning according to requirements, and the present application does not limit the state of the scanning device during scanning.

[0041] The scanning device may include a display device. A display interface for realizing user interaction can be displayed on the display device, and multiple controls can be set on the display interface, and each control has a corresponding function. For example, the start control is used to trigger the scanning device to wake up the internal program to start running, and the mode setting control is used to set the running mode of the scanning device. In another embodiment, multiple physical buttons can also be set on the scanning device. When the scanning device detects that any physical button is triggered, it performs the operation corresponding to the triggered physical button. For example, when the device start button is triggered, the scanning device wakes up the internal program to start running, and when the mode setting physical button is triggered, the scanning device enters the mode corresponding to the mode setting physical button.

[0042] After the scanning device is started, to improve the operating efficiency of the scanning device, it can operate based on the historical setting parameters of the scanning device. The historical setting parameters of the scanning device can include the operating mode, scanning parameters, etc. For example, when the historical setting parameters of the scanning device include the automatic exposure mode, after the scanning device is started currently, the scanning device can automatically turn on the automatic exposure mode.

[0043] In the case where the scanning device enters the automatic exposure mode, the scanning device can automatically set the initial exposure parameters and use the initial exposure parameters as the current exposure parameters. Among them, the initial exposure parameters can be randomly set according to the current scene and the characteristics of the scanning object, or can be set according to the historical setting parameters. The present application does not limit the setting method of the initial exposure parameters. In addition, in the case where the scanning device enters the automatic exposure mode, the exposure parameters can be dynamically adjusted according to the current scene and the characteristics of the scanning object, and the exposure parameters obtained by real-time adjustment can be used as the current exposure parameters.

[0044] In some embodiments of the present application, during the operation of the scanning device, the first image under the current exposure parameters can be collected in real time, which is convenient for effectively adjusting the exposure parameters of the scanning device by analyzing the first image subsequently.

[0045] Step S202: Determine the photometric region on the first image based on the preset region of interest.

[0046] In some embodiments of the present application, the scanning device may include a display device, and a display interface for realizing user interaction can be displayed on the display device. The user can perform operations such as clicking and swiping on the display interface. When the scanning device detects a setting instruction triggered by a setting operation on the display interface, it can determine the region of interest set by the setting operation.

[0047] Among them, the shape of the region of interest can be circular, rectangular or polygonal. The shape and size of the region of interest can be randomly set on the display interface, and the position of the region of interest on the display interface can also be dragged. There is no limit to the shape, size, and position of the region of interest on the display interface, and it can be set according to actual needs.

[0048] In some embodiments of the present application, after the scanning device determines the region of interest, it can obtain the coordinates of the region of interest in the image coordinate system. This image coordinate system can be set based on the scanning range of the scanning device, so the image coordinate system corresponding to the region of interest and the image coordinate system corresponding to the first image can be the same image coordinate system. Based on the coordinates of the region of interest in the image coordinate system, the photometric region can be determined on the first image. Among them, if the region of interest is a circular region, the photometric region is also a circular region; if the region of interest is a rectangular region, the photometric region is also a rectangular region. The present application does not limit the shape of the region of interest.

[0049] In one example, assume that the region of interest is a rectangular region, and the coordinates of the four vertices are (10, 15), (20, 15), (20, 20), and (10, 20) respectively. The scanning device can determine the photometric region on the first image according to (10, 15), (20, 15), (20, 20), and (10, 20), and the vertex coordinates of the photometric region are (10, 15), (20, 15), (20, 20), and (10, 20) respectively.

[0050] In some other embodiments of the present application, the scanning device can be communicatively connected to an electronic device with a display interface, and the user can perform setting operations such as clicking and swiping on the display interface of the electronic device. When the user performs a setting operation on the display interface of the electronic device, the electronic device can send the region of interest indicated by the setting operation to the scanning device through a setting instruction. The scanning device receives the setting instruction and obtains the region of interest by parsing the setting instruction.

[0051] Among them, since the device coordinate system of the region of interest on the display interface of the electronic device is different from the image coordinate system of the first image, the coordinates of the region of interest in the device coordinate system can be converted to the image coordinate system, so as to determine the coordinates of the region of interest in the image coordinate system.

[0052] Specifically, the scanning device obtains the resolution of the electronic device from the setting instruction. According to the resolution of the electronic device, the resolution of the first image, and the coordinates of the region of interest in the device coordinate system, a coordinate conversion ratio is obtained. The coordinates of the region of interest in the device coordinate system are converted to the image coordinate system according to the coordinate conversion ratio, and then the scanning device can determine the photometric region according to the coordinates of the region of interest in the image coordinate system.

[0053] Step S203: Perform object segmentation on the photometric region to generate an object mask.

[0054] In some embodiments of the present application, after determining the photometric region, the pixel gray values of each pixel point in the photometric region can be obtained. A gray histogram is constructed based on the pixel gray values. According to the gray histogram, the discrete data of the pixel gray values corresponding to the photometric region can be determined, and this discrete data includes the distribution of the pixel gray values within the photometric region. Specifically, according to the gray histogram, the mean and median of the pixel gray values of the pixel points in the entire photometric region can be statistically calculated. Based on the difference between the mean and the median, the discrete data is determined. If the difference between the mean and the median is less than a preset difference threshold, it indicates that the mean and the median are close and the degree of dispersion is small, then the discrete data can be recorded as the degree of dispersion being less than the preset dispersion threshold. If the difference between the mean and the median is greater than or equal to the preset difference threshold, it indicates that the mean and the median are quite different and the degree of dispersion is large, then the discrete data can be recorded as the degree of dispersion being greater than or equal to the preset dispersion threshold.

[0055] In addition, the standard deviation between each pixel point in the photometric region and the mean can also be calculated, and the discrete data is determined through the standard deviation. If the standard deviation is greater than a preset standard deviation threshold, it indicates that the distribution of the pixel gray values is relatively dispersed, then the discrete data can be recorded as the degree of dispersion being greater than or equal to the preset dispersion threshold. If the standard deviation is less than or equal to the preset standard deviation threshold, it indicates that the pixel gray values are relatively concentrated near the mean and the degree of dispersion is small, then the discrete data can be recorded as the degree of dispersion being less than the preset dispersion threshold.

[0056] In some embodiments of the present application, after determining the discrete data, the main body distribution information of the photometric region can be determined according to the discrete data. Specifically, if the discrete data characterizes that the degree of dispersion is less than the preset dispersion threshold, it is determined that the photometric region includes a single main body, and the main body distribution information can be characterized as the photometric region including a single main body. In the case where the photometric region includes a single main body, the single main body is taken as the main body part.

[0057] If the discrete data characterizes that the degree of dispersion is greater than or equal to the preset dispersion threshold, it is determined that the photometric region includes multiple main bodies, and the main body distribution information can be characterized as the photometric region including multiple main bodies. In the case where the photometric region includes multiple main bodies, the main body part can be determined from the multiple main bodies based on a preset gray threshold.

[0058] Specifically, based on the grayscale threshold and the grayscale histogram, the photometric region is divided into a first sub-region greater than the grayscale threshold and a second sub-region less than or equal to the grayscale threshold. Based on the first sub-region and the photometric region, calculate the first ratio of the first sub-region to the photometric region. Based on the second sub-region and the photometric region, calculate the second ratio of the second sub-region to the photometric region. If the first ratio is greater than the second ratio, then the first sub-region is taken as the main part of the photometric region. If the second ratio is greater than the first ratio, then the second sub-region is taken as the main part of the photometric region. If the first ratio is the same as the second ratio, then either the first sub-region or the second sub-region is randomly taken as the main part of the photometric region.

[0059] After determining the main part of the photometric region, extract the pixel positions of the pixels corresponding to the main part to generate an object mask.

[0060] Step S204, if the first grayscale value of the object mask is not within the preset grayscale range, based on the correlation between the grayscale value and the exposure parameter, adjust the current exposure parameter to the target exposure parameter corresponding to the second grayscale value.

[0061] In some embodiments of the present application, based on the rule of Gaussian weight, calculate the normalized weighted grayscale under the object mask, denoted as the first grayscale value. If the first grayscale value is not within the preset grayscale range, it means that the brightness of the photometric region under the current exposure parameter does not meet the preset requirements, that is, the main brightness of the photometric region does not reach the optimum. In the case where the first grayscale value is not within the preset grayscale range, obtain the correlation between the grayscale value and the exposure parameter. This correlation can be presented by a relationship curve, and through this relationship curve, the linear interval and the non-linear interval can be driven. The following is combined with Figure 3 for description. As Figure 3 shown in the coordinate system, the abscissa represents the exposure parameter Exp, the ordinate represents the grayscale value Gray, and the relationship curve includes a linear interval and a non-linear interval.

[0062] By determining whether the first grayscale value is in the linear interval or the non-linear interval, adjust the current exposure parameter to the target exposure parameter corresponding to the second grayscale value using the corresponding interval rule, where the second grayscale value is within the preset grayscale range. Among them, how to adjust the current exposure parameter to the target exposure parameter corresponding to the second grayscale value based on the interval rule can refer to the embodiment shown in Figure 4 shown.

[0063] Based on the above embodiments, a first image is collected according to the current exposure parameters of the scanning device, and this first image is used to determine whether the current exposure parameters set by the scanning device currently meet the preset requirements. Based on the preset region of interest, the photometric region on the first image is determined, so as to judge whether the current exposure parameters meet the preset requirements through the photometric region. Object segmentation is performed on the photometric region to generate an object mask, and the object mask is extracted through a gray threshold, so as to evaluate whether the first gray value of the object mask is within the preset gray range. If the first gray value is not within the preset gray range, based on the correlation relationship between the gray value and the exposure parameters, the current exposure parameters are adjusted to the target exposure parameters corresponding to the second gray value, thereby improving the efficiency of brightness adjustment and avoiding adjusting the brightness based on a fixed step size. In addition, through the pre-determined region of interest, it is possible to ensure that the brightness of the region of interest reaches the optimum.

[0064] In other embodiments of the present application, after the scanning device collects the first image, the first image can be processed for display on the display interface. Specifically, the pixel points within the gray range in the first image are obtained, and the region corresponding to the pixel is used as the mask region. Histogram equalization is performed on the mask region to adjust the contrast of the mask region on the first image, and a second image is obtained. The second image is colored using a preset color spectrum to obtain a third image. Expressed by the formula: I(x,y) = Cmap(h, s, H(x,y)), where Cmap represents the color spectrum, which is generated by converting the original color C of the display interface to the color space HSV; h represents the hue; s represents the saturation; H(x,y) represents the second image; I(x,y) represents the third image. Among them, the display interface can be the display interface on the scanning device or the display interface on an electronic device communicatively connected to the scanning device. After determining the third image, the third image is displayed on the display interface.

[0065] Among them, if the display interface is the display interface of the electronic device, the scanning device can send the first image to the electronic device after collecting the first image. After receiving the first image, the electronic device adjusts the contrast, hue, saturation, etc. of the first image in the above manner, so as to display the third image on the display interface of the electronic device. By generating the third image on the electronic device, the computational load of the scanning device is reduced.

[0066] In some embodiments of the present application, since the images displayed on the display interface are real-time, after adjusting the current exposure parameters to the target exposure parameters, a fourth image is collected based on the target exposure parameters. The fourth image is used to replace the first image. The mask region of the fourth image is obtained, and then the fourth image is processed by adjusting the contrast, hue, saturation, etc., so as to display the processed fourth image on the display interface.

[0067] Figure 4 This is a flowchart provided by an embodiment of the present application for adjusting the current exposure parameter to a target exposure parameter. The linear interval and the non-linear interval can be determined through the correlation relationship between the gray value and the exposure parameter as shown in Figure 2 the following. Based on the linear interval and the non-linear interval, the specific method for adjusting the current exposure parameter to the target exposure parameter can be determined, including the following steps. Figure 5 The following. Based on the linear interval and the non-linear interval, the specific method for adjusting the current exposure parameter to the target exposure parameter can be determined, including the following steps.

[0068] Step S401: Determine the linear interval and the non-linear interval based on the correlation relationship.

[0069] In some embodiments of the present application, the correlation relationship between the gray value and the exposure parameter can be preset. The correlation relationship between the gray value and the exposure parameter can also be obtained by collecting images for a preset duration in the current scanning scenario, and then analyzing the gray values of the images and the exposure parameters for collecting the images to construct a relationship curve. Based on the relationship curve, the linear interval and the non-linear interval can be divided. As shown in Figure 5 the following, based on the relationship curve determined by the correlation relationship between the gray value and the exposure parameter, the linear interval and the non-linear interval can be determined.

[0070] Step S402: Determine whether the first gray value is within the linear interval.

[0071] In some embodiments of the present application, if the first gray value is within the linear interval, step S403 is executed. If the first gray value is not within the linear interval, it means that the first gray value is within the non-linear interval, and step S405 is executed.

[0072] Step S403: Calculate the first adjustment ratio according to the first gray value and the second gray value.

[0073] In some embodiments of the present application, if the first gray value is within the linear interval, the first adjustment ratio can be calculated according to the linear rule. As shown in Figure 5 the following, point A2 is located within the linear interval, and the first adjustment ratio P1 = G / B2 can be calculated according to the first gray value B2 and the second gray value G.

[0074] Step S404: Determine the target exposure parameter according to the first adjustment ratio and the current exposure parameter.

[0075] In some embodiments of the present application, the target exposure parameter is calculated according to the first adjustment ratio and the current exposure parameter. As shown in Figure 5 the following, the first adjustment ratio P1 = G / B2, and the current exposure parameter is C2, then the target exposure parameter C = (G / B2) × C2. Then, the current parameter C2 is adjusted to the target exposure parameter C so that the gray value of the image collected at the target exposure parameter C is G.

[0076] After determining the target exposure parameter, step S408 can be executed by jumping.

[0077] Step S405: Based on the preset interval adjustment ratio and the first gray value, obtain the intermediate gray value within the linear interval.

[0078] In some embodiments of the present application, if the first gray value is within the non-linear interval, the intermediate gray value within the linear interval can be calculated according to the non-linear rule. The preset interval adjustment ratio can be the ratio for converting from the non-linear interval to the linear interval and can be set according to the actual scenario. Based on the interval adjustment ratio and the first gray value, the intermediate gray value within the linear interval can be obtained. As Figure 5 shown, assuming the interval adjustment ratio is K, then transform the first gray value B1 of point A1 to the intermediate gray value B2 within the linear interval, which is expressed by the formula B2 = B1 × K.

[0079] Step S406: Calculate the second adjustment ratio according to the intermediate gray value and the second gray value.

[0080] In some embodiments of the present application, since the intermediate gray value is within the linear interval, the second adjustment ratio can be calculated according to the linear rule. As Figure 5 shown, point A2 is within the linear interval, then the second adjustment ratio P2 = G / B2 can be calculated according to the first gray value B2 and the second gray value G.

[0081] Step S407: Determine the target exposure parameter according to the second adjustment ratio and the current exposure parameter.

[0082] In some embodiments of the present application, calculate the target exposure parameter according to the second adjustment ratio and the current exposure parameter. As Figure 5 shown, the second adjustment ratio P2 = G / B2, and the current exposure parameter is C1, then the target exposure parameter C = (G / B2) × C1. Then adjust the current parameter C1 to the target exposure parameter C so that the gray value of the image collected under the target exposure parameter C is G.

[0083] Step S408: Update the current exposure parameter using the target exposure parameter.

[0084] In some embodiments of the present application, after determining the target exposure parameter, it only takes one step size to adjust from the current exposure parameter to the target exposure parameter, so that the current gray value reaches the target gray value (i.e., the second gray value). Compared with the related art that slowly adjusts based on a preset fixed step size, the solution described in the embodiments of the present application has higher efficiency.

[0085] Based on the above embodiments, in the case where the first gray value is not within the preset gray range, the current exposure parameter can be quickly adjusted to the target exposure parameter through the rule of the linear interval or the rule of the non-linear region, avoiding slow adjustment based on a fixed step size.

[0086] In one example, the second gray value is 150 and the first gray value is 50. Using the related art to adjust with a fixed step size of 50, it is necessary to adjust in the order of 50 - 100 - 150. However, using the adjustment method described in this application, it can be directly adjusted from 50 to 150.

[0087] The embodiments of the present application further provide a computer-readable storage medium. A computer program is stored on the computer-readable storage medium, and the computer program includes program instructions. The method implemented when the program instructions are executed can refer to the methods in the above various embodiments of the present application.

[0088] Among them, the computer-readable storage medium can be the internal memory of the scanning device in the above embodiments, such as the hard disk or memory of the scanning device. The computer-readable storage medium can also be an external storage device of the scanning device, such as a plug-in hard disk equipped on the scanning device, a Smart Media Card (SMC), a Secure Digital (SD) card, a Flash Card, etc.

[0089] In some embodiments, the computer-readable storage medium may include a storage program area and a storage data area. Among them, the storage program area can store an operating system, application programs required for at least one function, etc.; the storage data area can store data created according to the use of the scanning device, etc.

[0090] In the above embodiments, the descriptions of the various embodiments have their own emphases. For parts not detailed or recorded in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0091] Those of ordinary skill in the art can realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.

[0092] In the embodiments provided in the present application, it should be understood that the disclosed device / terminal device and method can be implemented in other ways. For example, the device / terminal device embodiments described above are merely illustrative. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other division methods. For example, 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 displayed or discussed coupling or direct coupling or communication connection to each other can be through some interfaces. The indirect coupling or communication connection of devices or units can be in electrical, mechanical or other forms.

[0093] The units described as separate components may or may not be physically separated. The components displayed as units may or may not be physical units, that is, they can be located in one place, or they can be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0094] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A brightness adjustment method, characterized in that: The method comprises: Acquire a first image according to current exposure parameters of the scanning device; Based on a preset region of interest, determining a light metering area on the first image; Performing object segmentation on the photometric area to generate an object mask; If the first grayscale value of the object mask is not within a preset grayscale range, based on the association between the grayscale value and the exposure parameter, the current exposure parameter is adjusted to a target exposure parameter corresponding to the second grayscale value, including: determining a linear interval and a nonlinear interval based on the association; if the first grayscale value is within the nonlinear interval, obtaining an intermediate grayscale value located in the linear interval based on a preset interval adjustment ratio and the first grayscale value; calculating a second adjustment ratio based on the intermediate grayscale value and the second grayscale value; determining the target exposure parameter based on the second adjustment ratio and the current exposure parameter; and updating the current exposure parameter using the target exposure parameter; the second grayscale value is within the preset grayscale range.

2. The brightness adjustment method according to claim 1, characterized in that: The adjusting the current exposure parameter to a target exposure parameter corresponding to the second gray value based on the association relationship between the gray value and the exposure parameter includes: Determine a linear interval based on the association relationship; If the first gray value is within the linear interval, calculating a first adjustment ratio according to the first gray value and the second gray value; determining the target exposure parameter according to the first adjustment ratio and the current exposure parameter; The current exposure parameter is updated using the target exposure parameter.

3. The brightness adjustment method according to claim 1, characterized in that: The step of determining the light measurement area on the first image based on the preset region of interest includes: In response to an instruction for setting the region of interest, determining coordinates of the region of interest in an image coordinate system; The light metering area is determined based on the coordinates.

4. The brightness adjustment method according to claim 1, characterized in that: The step of performing object segmentation on the light metering area to generate an object mask comprises: Determining a grayscale histogram according to the pixel values ​​of the light metering area; Determining a subject portion within the photometric area based on the grayscale histogram; The object mask is obtained based on the pixel positions of the pixel points corresponding to the main part.

5. The brightness adjustment method according to claim 4, characterized in that: The determining the main part within the light metering area based on the grayscale histogram comprises: Based on the grayscale histogram, determining discrete data of the pixel grayscale values ​​corresponding to the light metering area, the discrete data including the distribution of the pixel grayscale values ​​in the light metering area; Determine subject distribution information of the photometric area according to the discrete data; If the subject distribution information indicates that the photometric area includes a single subject, the single subject is used as the subject part; If the subject distribution information represents that the light metering area includes a plurality of subjects, the subject portion is determined from the plurality of subjects based on a preset grayscale threshold.

6. The brightness adjustment method according to claim 5, characterized in that: The determining the subject part from the plurality of subjects based on a preset grayscale threshold comprises: Based on the grayscale threshold and the grayscale histogram, the light metering area is divided into a first sub-area greater than the grayscale threshold and a second sub-area less than or equal to the grayscale threshold; Based on the first sub-area and the light measurement area, a first proportion is obtained; Based on the second sub-area and the light measuring area, a second proportion is obtained; If the first proportion is greater than the second proportion, the first sub-area is used as the main body; If the second proportion is greater than the first proportion, the second sub-area is used as the main body.

7. The brightness adjustment method according to claim 1, characterized in that: The method further comprises: Acquire a mask area corresponding to pixels in the first image that are within the grayscale range; Performing histogram equalization on the mask area to obtain a second image; Assigning color to the second image using a preset color spectrum to obtain a third image, wherein the color spectrum is determined according to the conversion of the original color of the display interface into the color space; The third image is displayed through the display interface.

8. The brightness adjustment method according to claim 7, characterized in that: The method further comprises: Based on the target exposure parameter, acquiring a fourth image; updating the first image using the fourth image; A mask area corresponding to the fourth image is obtained, and the step of performing histogram equalization on the mask area is continued.

9. A scanning device, characterized in that: The scanning device comprises a processor and a memory, wherein the processor is configured to execute a computer program stored in the memory to implement the brightness adjustment method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Photometry method and device

    CN104219518A

  • Determination method and determination device for exposure time of image acquisition equipment and processor

    CN111432134A

  • Automatic exposure method for improving mobile scanning effect of scanning head

    CN114302066A

  • Image pickup device

    JP1992170163A