CN115278104B - Image brightness adjustment method and device, electronic equipment and storage medium - Google Patents

Image brightness adjustment method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN115278104B
CN115278104B CN202210780694.XA CN202210780694A CN115278104B CN 115278104 B CN115278104 B CN 115278104B CN 202210780694 A CN202210780694 A CN 202210780694A CN 115278104 B CN115278104 B CN 115278104B
Authority
CN
China
Prior art keywords
brightness
image
connected domain
maximum connected
pixel
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210780694.XA
Other languages
Chinese (zh)
Other versions
CN115278104A (en
Inventor
潘润发
陈焕
陈天钧
张东
沈广月
卢二利
况璐
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Dahua Technology Co Ltd
Original Assignee
Zhejiang Dahua Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Dahua Technology Co Ltd filed Critical Zhejiang Dahua Technology Co Ltd
Priority to CN202210780694.XA priority Critical patent/CN115278104B/en
Publication of CN115278104A publication Critical patent/CN115278104A/en
Application granted granted Critical
Publication of CN115278104B publication Critical patent/CN115278104B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/90Dynamic range modification of images or parts thereof
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N9/00Details of colour television systems
    • H04N9/77Circuits for processing the brightness signal and the chrominance signal relative to each other, e.g. adjusting the phase of the brightness signal relative to the colour signal, correcting differential gain or differential phase

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Image Processing (AREA)
  • Studio Devices (AREA)

Abstract

The embodiment of the application provides an image brightness adjustment method, an image brightness adjustment device, electronic equipment and a storage medium, which are used for adjusting the relation of picture contrast and avoiding overstretching the picture contrast. Comprising the following steps: acquiring an image in the visual field of a camera and drawing a brightness histogram corresponding to the image; acquiring a first pixel brightness change curve by using a histogram equalization method based on the brightness histogram; wherein the slope in the pixel brightness change curve is used to indicate the contrast enhancement amplitude between the current brightness and the adjacent brightness; according to the mapping relation between the brightness and a preset slope threshold, adjusting the slope in the brightness change curve of the first pixel to obtain a brightness change curve of the second pixel; the mapping relation is determined according to a plurality of maximum connected domains of the image, one maximum connected domain corresponds to one sub-image, and the sub-image is obtained by dividing the image according to a preset dividing rule; the brightness of each pixel in the image is adjusted based on the second pixel brightness variation curve.

Description

Image brightness adjustment method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of image processing technologies, and in particular, to an image brightness adjustment method, an image brightness adjustment device, an electronic device, and a storage medium.
Background
In the field of image processing, histogram equalization is a commonly used method for enhancing the contrast of an image, which adjusts the contrast of the image by observing basic information such as the histogram distribution of the image and the change of the contrast in the gray scale of the image.
However, although the histogram equalization improves the contrast of the image, has low operation complexity and is suitable for performing rough real-time enhancement of the image, the histogram equalization method may cause problems that certain areas of the picture become darker or brighter and partial detail information is lost after the contrast is adjusted, and the histogram equalization is easy to overstretch the contrast of the picture, so that the equalized image is distorted.
Disclosure of Invention
The embodiment of the application provides an image brightness adjustment method, an image brightness adjustment device, electronic equipment and a storage medium, which are used for adjusting the relation of picture contrast and avoiding overstretching the picture contrast.
In a first aspect, there is provided an image brightness adjustment method, including:
acquiring an image in the visual field of a camera and drawing a brightness histogram corresponding to the image;
acquiring a first pixel brightness change curve by using a histogram equalization method based on the brightness histogram; wherein the slope in the pixel brightness change curve is used to indicate the contrast enhancement amplitude between the current brightness and the adjacent brightness;
according to the mapping relation between the brightness and a preset slope threshold, adjusting the slope in the first pixel brightness change curve to obtain a second pixel brightness change curve; the mapping relation is determined according to a plurality of maximum connected domains of the image, one maximum connected domain corresponds to one sub-image, and the sub-image is obtained by dividing the image according to a preset dividing rule;
and adjusting the brightness of each pixel in the image based on the second pixel brightness variation curve.
Optionally, the method further comprises:
dividing the image into a plurality of sub-images according to a preset brightness interval;
determining a maximum connected domain corresponding to each sub-image, and calculating the size of the maximum connected domain corresponding to the maximum connected domain;
drawing a relation curve of the maximum connected domain size and the brightness according to the maximum connected domain size and a preset brightness interval, and determining a first mapping relation between the maximum connected domain size and the brightness;
and determining the mapping relation between the brightness and the preset slope threshold based on a second mapping relation between the preset maximum connected domain size and the preset slope threshold and the first mapping relation.
Optionally, the calculating the maximum connected domain size corresponding to the maximum connected domain includes:
acquiring the number of pixels contained in a maximum connected domain of a target;
and opening the pixel number, and dividing the pixel number by the image size corresponding to the image to obtain the maximum connected domain size corresponding to the target maximum connected domain.
Optionally, the determining the maximum connected domain corresponding to each sub-image includes:
performing binarization processing on each sub-image to obtain a plurality of binarized images;
and determining the maximum connected domain corresponding to each sub-image based on the plurality of binarized images.
Optionally, the adjusting the slope in the first pixel brightness change curve according to the mapping relationship between the brightness and the preset slope threshold includes:
determining a target slope of a target luminance on the first pixel luminance change curve;
determining whether the target slope is greater than a preset slope threshold corresponding to the target brightness;
and if the target slope is larger than the preset slope threshold corresponding to the target brightness, adjusting the target slope to be the preset slope threshold corresponding to the target brightness.
In a second aspect, there is provided an image brightness adjustment device comprising:
the acquisition module is used for acquiring an image in the visual field range of the camera and drawing a brightness histogram corresponding to the image through the processing module;
the acquisition module is further used for acquiring a first pixel brightness change curve by using a histogram equalization method based on the brightness histogram; wherein the slope in the pixel brightness change curve is used to indicate the contrast enhancement amplitude between the current brightness and the adjacent brightness;
the processing module is further configured to adjust a slope in the first pixel brightness change curve according to a mapping relationship between brightness and a preset slope threshold value, so as to obtain a second pixel brightness change curve; the mapping relation is determined according to a plurality of maximum connected domains of the image, one maximum connected domain corresponds to one sub-image, and the sub-image is obtained by dividing the image according to a preset dividing rule;
the processing module is further configured to adjust a brightness of each pixel in the image based on the second pixel brightness variation curve.
Optionally, the processing module is further configured to:
dividing the image into a plurality of sub-images according to a preset brightness interval;
determining a maximum connected domain corresponding to each sub-image, and calculating the size of the maximum connected domain corresponding to the maximum connected domain;
drawing a relation curve of the maximum connected domain size and the brightness according to the maximum connected domain size and a preset brightness interval, and determining a first mapping relation between the maximum connected domain size and the brightness;
and determining the mapping relation between the brightness and the preset slope threshold based on a second mapping relation between the preset maximum connected domain size and the preset slope threshold and the first mapping relation.
Optionally, the acquiring module is specifically configured to:
acquiring the number of pixels contained in a maximum connected domain of a target;
the processing module is specifically configured to:
and opening the pixel number, and dividing the pixel number by the image size corresponding to the image to obtain the maximum connected domain size corresponding to the target maximum connected domain.
Optionally, the processing module is specifically configured to:
performing binarization processing on each sub-image to obtain a plurality of binarized images;
and determining the maximum connected domain corresponding to each sub-image based on the plurality of binarized images.
Optionally, the processing module is specifically configured to:
determining a target slope of a target luminance on the first pixel luminance change curve;
determining whether the target slope is greater than a preset slope threshold corresponding to the target brightness;
and if the target slope is larger than the preset slope threshold corresponding to the target brightness, adjusting the target slope to be the preset slope threshold corresponding to the target brightness.
In a third aspect, an electronic device is provided, the electronic device comprising:
a memory for storing program instructions;
and a processor, configured to call the program instructions stored in the memory, and execute the steps included in the method according to any one of the first aspect according to the obtained program instructions.
In a fourth aspect, there is provided a computer readable storage medium storing computer executable instructions for causing a computer to perform the steps comprised by the method of any one of the first aspects.
In a fifth aspect, a computer program product is provided comprising instructions which, when run on a computer, cause the computer to perform the image brightness adjustment method described in the various possible implementations described above.
In the embodiment of the application, an image in a camera view range is obtained, a luminance histogram corresponding to the image is drawn, a first pixel luminance change curve is obtained by utilizing a histogram equalization method based on the luminance histogram, wherein the slope in the pixel luminance change curve is used for indicating the contrast enhancement amplitude between the current luminance and the adjacent luminance, the slope in the first pixel luminance change curve is adjusted according to the mapping relation between the luminance and a preset slope threshold value, a second pixel luminance change curve is obtained, the mapping relation is determined according to a plurality of maximum connected domains of the image, one maximum connected domain corresponds to one sub-image, the sub-image is obtained by dividing the image in the camera view range according to a preset division rule, and the luminance of each pixel in the image is adjusted based on the second pixel luminance change curve.
That is, the preset slope threshold value in the first pixel brightness change curve obtained by using the histogram equalization method is limited by the mapping relationship between brightness and the preset slope threshold value, for example, when the slope corresponding to a certain brightness on the first pixel brightness change curve is greater than the preset slope threshold value corresponding to the brightness, the slope corresponding to the brightness on the first pixel brightness change curve is adjusted to the preset slope threshold value corresponding to the brightness, so as to obtain the second pixel brightness change curve, and the brightness of the picture is adjusted based on the limited pixel brightness change curve (the second pixel brightness change curve), so that the adjusted image contrast is in a relatively suitable range, thereby avoiding the situation that the contrast of the picture is overstretched. In addition, the stretching contrast ratio of the large-area homochromatic scenery can be reduced, so that the large-area homochromatic scenery is identified through the maximum connected domain of each sub-image, the contrast ratio enhancement range of corresponding brightness can be weakened, and the contrast ratio stretching range of the large-area homochromatic scenery is effectively reduced.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the description below are only some embodiments of the present application.
Fig. 1 is a flowchart of an image brightness adjustment method according to an embodiment of the present application;
FIG. 2 is a flowchart of another image brightness adjustment method according to an embodiment of the present disclosure;
fig. 3 is a block diagram of an image brightness adjusting device according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the present application more apparent, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it is apparent that the described embodiments are only some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present disclosure. Embodiments and features of embodiments in this application may be combined with each other arbitrarily without conflict. Also, while a logical order is depicted in the flowchart, in some cases, the steps depicted or described may be performed in a different order than presented herein.
The terms first and second in the description and claims of the present application and in the above-described figures are used for distinguishing between different objects and not for describing a particular sequential order. Furthermore, the term "include" and any variations thereof is intended to cover non-exclusive protection. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those listed steps or elements but may include other steps or elements not listed or inherent to such process, method, article, or apparatus. The term "plurality" in the present application may mean at least two, for example, two, three or more, and embodiments of the present application are not limited.
In addition, the term "and/or" herein is merely an association relationship describing an association object, and means that three relationships may exist, for example, a and/or B may mean: a exists alone, A and B exist together, and B exists alone. The character "/" herein generally indicates that the associated object is an "or" relationship unless otherwise specified.
For easy understanding, the technical background of the embodiments of the present invention will be described first.
As described above, the histogram equalization may cause problems such as darkening or brightening of certain areas of the picture, loss of part of detail information, etc. after adjusting the picture contrast, and the histogram equalization is easy to overstretch the picture contrast, so that the equalized image is distorted. At present, a method is to uniformly divide a preprocessed image into blocks and draw a pixel distribution histogram of each small image, optimize the histogram according to a preset threshold value and set a dynamically adjustable enhanced image gray level range to obtain a pixel transformation function of a corresponding sub-image block, and avoid discontinuity phenomenon among the sub-image blocks after pixel transformation by using a bilinear interpolation method. The preprocessed image is segmented according to a calculation method to obtain four corresponding calculation areas, and pixel points are processed in batches in different areas in a matrix calculation mode, so that an image with enhanced contrast is obtained. Wherein, when the partial sub-image with low contrast is locally enhanced by adopting a preset threshold value, the situation of excessive stretching of the picture is not considered, and the stable and uniform contrast enhancement degree cannot be found; and, for large-area homochromatic scenes, contrast stretching is still performed, and at this time, the picture quality is reduced.
In view of this, the embodiment of the application provides an image brightness adjustment method, by acquiring an image in a camera view range and drawing a brightness histogram corresponding to the image, acquiring a first pixel brightness change curve based on the brightness histogram by using a histogram equalization method, adjusting a slope in the first pixel brightness change curve according to a mapping relationship between brightness and a preset slope threshold to obtain a second pixel brightness change curve, and adjusting brightness of each pixel in the image based on the second pixel brightness change curve, so that the adjusted image contrast is in a relatively suitable range, thereby avoiding the situation that the contrast of the image is excessively stretched. The mapping relation between the brightness and the preset slope threshold is determined according to a plurality of maximum connected domains of the image, one maximum connected domain corresponds to one sub-image, and the sub-image is obtained by dividing the image in the view range of the camera according to a preset dividing rule, so that a large-area homochromatic scene can be identified through the maximum connected domain of each sub-image, the contrast enhancement amplitude of the corresponding brightness is weakened, and the contrast stretching of the large-area homochromatic scene is effectively reduced.
After the design concept of the embodiment of the present application is introduced, some simple descriptions are made below for application scenarios applicable to the technical solution of the embodiment of the present application, and it should be noted that the application scenarios described below are only used to illustrate the embodiment of the present application and are not limiting. In specific implementation, the technical scheme provided by the embodiment of the application can be flexibly applied according to actual needs.
In the embodiment of the application, the provided image brightness adjustment method and the image brightness adjustment device can be applied to a video monitoring system, wherein the video monitoring system comprises an image acquisition system and a data analysis control system. The image brightness adjustment method can be executed by an image acquisition system in a video monitoring system, or the image acquisition system sends the image to a data analysis control system and the data analysis control system executes the image brightness adjustment method. The image capturing system provides a capturing device, for example, a video camera, an electronic device such as a mobile phone or a tablet with an image capturing function, a monitoring device, and the like, which can capture an image, and is used for capturing an image of a monitored area.
The following describes an image brightness adjustment method provided in the embodiments of the present application with reference to the drawings. Referring to fig. 1, the flow of the image brightness adjustment method in the embodiment of the present application is described as follows:
step 101: acquiring an image in the visual field of a camera and drawing a brightness histogram corresponding to the image;
in the embodiment of the application, an image in the view range of a camera is obtained, the number of pixels contained in the image of each brightness value is counted and displayed in a histogram form, and a brightness histogram yHist corresponding to the image is obtained.
Step 102: acquiring a first pixel brightness change curve by using a histogram equalization method based on the brightness histogram;
in this embodiment of the present application, the first pixel luminance change curve heY (y) is obtained based on yHist by using a histogram equalization method, where the pixel luminance change curve heY (y) is used to represent the change condition of each pixel luminance, that is, the abscissa in the pixel luminance change curve is the pixel luminance value before being subjected to the histogram equalization method, the ordinate is the luminance value after being subjected to the histogram equalization method, for example, the current luminance is 67, the luminance after being subjected to the histogram equalization method is 34, the ordinate corresponding to the abscissa 67 of the pixel luminance change curve is 34, the slope in the pixel luminance change curve heY (y) is used to indicate the contrast enhancement amplitude between the current luminance and the adjacent luminance, the greater the slope is, for example, the adjacent luminance (for example, 68) of the current luminance, the contrast is 1, the pixel luminance after being subjected to the histogram equalization is 38, the contrast is 4, and the contrast enhancement amplitude between the current luminance and the adjacent luminance is 4/1=4 (that is, the slope is 4).
Step 103: according to the mapping relation between the brightness and a preset slope threshold, adjusting the slope in the brightness change curve of the first pixel to obtain a brightness change curve of the second pixel;
as described above, the histogram equalization may cause problems such as darkening or brightening of certain areas of the picture, loss of part of detail information, etc. after adjusting the picture contrast, and the histogram equalization is easy to overstretch the picture contrast, so that the equalized image is distorted. Therefore, in the embodiment of the present application, the slope in the first pixel brightness change curve is defined by the mapping relationship between the brightness and the preset slope threshold, that is, the slope in the first pixel brightness change curve is adjusted by the mapping relationship between the brightness and the preset slope threshold, so as to obtain the second pixel brightness change curve.
Specifically, a target slope of the target brightness in a first pixel brightness change curve is obtained, wherein the target slope of the target brightness in the first pixel brightness change curve can be represented by a tangent value corresponding to an included angle between a tangent line of the first pixel brightness change curve at the target brightness and an abscissa (brightness); determining whether the target slope is larger than a preset slope threshold corresponding to the target brightness, and if the target slope is smaller than or equal to the preset slope threshold corresponding to the target brightness, not adjusting the target slope corresponding to the target brightness; and if the target slope is greater than the preset slope threshold corresponding to the target brightness, adjusting the target slope to the preset slope threshold corresponding to the target brightness to obtain a second pixel brightness change curve. For example, the preset slope threshold corresponding to 20% brightness is 4, and the target slope of the point with 20% brightness on the first pixel brightness change curve is 3.8, when the target slope is smaller than the preset slope threshold corresponding to the current brightness, the slope corresponding to the current brightness in the first pixel brightness change curve is not adjusted; for another example, the preset slope threshold corresponding to 10% brightness is 2, and the target slope of the point with 10% brightness on the first pixel brightness change curve is 2.5, at this time, the target slope is greater than the preset slope threshold corresponding to the current brightness, and the slope on the first pixel brightness change curve is adjusted to be 2.
The mapping relationship between the brightness and the preset slope threshold is determined according to a plurality of maximum connected domains of the image, one maximum connected domain corresponds to one sub-image, the plurality of sub-images are obtained by dividing the image according to a preset dividing rule, and the determining process of the mapping relationship between the brightness and the preset slope threshold is described in detail below.
Dividing the image into a plurality of sub-images according to a preset brightness interval, for example, extracting pixels with pixel brightness of 0-10% as sub-image 1 (img 1), extracting pixels with pixel brightness of 11% -20% as sub-image 2 (img 2), … …, extracting pixels with pixel brightness of 91% -100% as sub-image 10 (img 10), determining the maximum connected domain corresponding to each sub-image, calculating the maximum connected domain size (maxCr 1, maxCr2, … …, maxCr 10) corresponding to each maximum connected domain, wherein maxCr1 is the maximum connected domain size corresponding to img1, maxCr2 is the maximum connected domain size corresponding to img2, maxCr10 is the maximum connected domain size corresponding to img10, drawing a maximum connected domain size and brightness relation curve according to the maximum connected domain size and the preset brightness interval, for example, maxCr1, maxCr2, … …, maxCr10 is taken as an ordinate, a relationship curve (for example, a first relationship curve) of the maximum connected domain size maxCr and the luminance y is drawn with 5%,15%, … …, and 95% luminance as an abscissa, the relationship curve is taken as a first mapping relationship between the maximum connected domain size maxCr and the luminance y, and a mapping relationship between the luminance and a preset slope threshold is determined based on a second mapping relationship and the first mapping relationship, wherein the second mapping relationship is a mapping relationship between the preset maximum connected domain size and the preset slope threshold, and the preset slope threshold generally decreases as the maximum connected domain size becomes larger, and the specific value can be adjusted according to the effect.
As a possible implementation manner, the second mapping relationship is a relationship curve between the maximum connected domain size and the preset slope threshold, and at this time, the maximum connected domain size may be taken as an abscissa, the preset slope threshold may be taken as an ordinate, a relationship curve (for example, a second relationship curve) between the maximum connected domain size and the preset slope threshold may be drawn, and the first relationship curve may be interpolated by the second relationship curve to form a relationship curve between the brightness and the preset slope threshold.
The size of the maximum connected domain corresponding to each maximum connected domain may be calculated by the number of pixels contained in the maximum connected domain of each sub-image, for example, the number of pixels contained in the target maximum connected domain is obtained, the number of pixels is square (for example, square, … …) and divided by the image size to normalize, so as to obtain the size of the maximum connected domain corresponding to the target maximum connected domain.
As a possible implementation manner, since the maximum connected domain generally refers to the maximum connected domain in the binary image, in this embodiment of the present application, before determining the maximum connected domain corresponding to each sub-image, binarization processing may be further performed on each sub-image to obtain multiple binarized images, and then the maximum connected domain corresponding to each sub-image is determined based on the multiple binarized images.
In a specific implementation process, the larger the size of the maximum connected domain is, the more likely a large-area homochromatic scene exists under the corresponding brightness, and at this time, the smaller the contrast stretching of the brightness should be, so that the large-area homochromatic scene is identified through the maximum connected domain of each sub-image, the contrast enhancement amplitude of the corresponding brightness can be weakened, and the contrast stretching amplitude of the large-area homochromatic scene is effectively reduced.
Step 104: the brightness of each pixel in the image is adjusted based on the second pixel brightness variation curve.
In a specific implementation process, the preset slope threshold value corresponding to each brightness in the first pixel brightness change curve is limited through the mapping relation between the brightness and the preset slope threshold value, so that the adjusted image contrast is in a proper range, the contrast stretching amplitude of a large-area homochromatic scene can be obviously weakened, and the picture quality is high.
In order to better understand the technical solution of the present application, the predistortion extension model provided in the present application and the method for implementing predistortion will be explained below with reference to specific embodiments.
Examples
Referring to fig. 2, an image in a camera view range is obtained as an original image, a luminance histogram corresponding to the original image is drawn, a pixel transformation curve (a first pixel luminance change curve) heY (y) is obtained by using a histogram equalization method based on the luminance histogram, the original image is divided according to a preset luminance interval to generate a plurality of segmented luminance images (sub-images img 1-img 10), a maximum connected domain size corresponding to each sub-image is obtained, a relationship curve maxCr (y) of luminance and the maximum connected domain size is drawn based on the maximum connected domain size and the corresponding luminance interval (i.e., a first mapping relation), then a relationship curve kmaxCurve (y) (i.e., a second mapping relation) between the preset maximum connected domain size and a preset slope threshold is interpolated to obtain a relationship curve ylimCurve (y) between luminance and the preset slope threshold, and the heY (y) is slope limited by ylimCurve (y) to obtain a second pixel luminance change curve, and each pixel luminance curve in the second pixel change image is adjusted based on the second pixel luminance curve.
Based on the same inventive concept, the embodiment of the application provides an image brightness adjusting device, which can realize the functions corresponding to the image brightness adjusting method. The image brightness adjustment device may be a hardware structure, a software module, or a hardware structure plus a software module. The image brightness adjusting device can be realized by a chip system, and the chip system can be formed by a chip or can contain the chip and other discrete devices. Referring to fig. 3, the image brightness adjusting apparatus includes an acquisition module 301 and a processing module 302. Wherein:
an acquisition module 301, configured to acquire an image within a view range of a camera and draw a luminance histogram corresponding to the image through a processing module 302;
the obtaining module 301 is further configured to obtain a first pixel brightness variation curve by using a histogram equalization method based on the brightness histogram; wherein the slope in the pixel brightness change curve is used to indicate the contrast enhancement amplitude between the current brightness and the adjacent brightness;
the processing module 302 is further configured to adjust a slope in the first pixel brightness change curve according to a mapping relationship between brightness and a preset slope threshold value, so as to obtain a second pixel brightness change curve; the mapping relation is determined according to a plurality of maximum connected domains of the image, one maximum connected domain corresponds to one sub-image, and the sub-image is obtained by dividing the image according to a preset dividing rule;
the processing module 302 is further configured to adjust a brightness of each pixel in the image based on the second pixel brightness variation curve.
Optionally, the processing module 302 is further configured to:
dividing the image into a plurality of sub-images according to a preset brightness interval;
determining a maximum connected domain corresponding to each sub-image, and calculating the size of the maximum connected domain corresponding to the maximum connected domain;
drawing a relation curve of the maximum connected domain size and the brightness according to the maximum connected domain size and a preset brightness interval, and determining a first mapping relation between the maximum connected domain size and the brightness;
and determining the mapping relation between the brightness and the preset slope threshold based on a second mapping relation between the preset maximum connected domain size and the preset slope threshold and the first mapping relation.
Optionally, the acquiring module 301 is specifically configured to:
acquiring the number of pixels contained in a maximum connected domain of a target;
the processing module 302 is specifically configured to:
and opening the pixel number, and dividing the pixel number by the image size corresponding to the image to obtain the maximum connected domain size corresponding to the target maximum connected domain.
Optionally, the processing module 302 is specifically configured to:
performing binarization processing on each sub-image to obtain a plurality of binarized images;
and determining the maximum connected domain corresponding to each sub-image based on the plurality of binarized images.
Optionally, the processing module 302 is specifically configured to:
determining a target slope of a target luminance on the first pixel luminance change curve;
determining whether the target slope is greater than a preset slope threshold corresponding to the target brightness;
and if the target slope is larger than the preset slope threshold corresponding to the target brightness, adjusting the target slope to be the preset slope threshold corresponding to the target brightness.
All relevant contents of each step related to the foregoing embodiments of the image brightness adjustment method may be cited in the functional description of the functional module corresponding to the image brightness adjustment device in the embodiments of the present application, which is not described herein again.
The division of the modules in the embodiments of the present application is schematically only one logic function division, and there may be another division manner in actual implementation, and in addition, each functional module in each embodiment of the present application may be integrated in one processor, or may exist separately and physically, or two or more modules may be integrated in one module. The integrated modules may be implemented in hardware or in software functional modules.
Based on the same inventive concept, the embodiment of the application provides electronic equipment. Referring to fig. 4, the electronic device includes at least one processor 401 and a memory 402 connected to the at least one processor, in this embodiment, a specific connection medium between the processor 401 and the memory 402 is not limited, and in fig. 4, the connection between the processor 401 and the memory 402 is exemplified by a bus 400, and the bus 400 is shown in a bold line in fig. 4, and a connection manner between other components is only illustrative and not limited. The bus 400 may be divided into an address bus, a data bus, a control bus, etc., and is represented by only one thick line in fig. 4 for ease of illustration, but does not represent only one bus or one type of bus.
In the embodiment of the present application, the memory 402 stores instructions executable by the at least one processor 401, and the at least one processor 401 may execute the steps included in the foregoing image brightness adjustment method by executing the instructions stored in the memory 402.
The processor 401 is a control center of the electronic device, and may use various interfaces and lines to connect various parts of the entire electronic device, and by executing or executing instructions stored in the memory 402 and invoking data stored in the memory 402, various functions of the electronic device and processing data, so as to monitor the electronic device as a whole. Alternatively, the processor 401 may include one or more processing units, and the processor 401 may integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system and an application program, etc., and the modem processor mainly processes wireless communication. It will be appreciated that the modem processor described above may not be integrated into the processor 401. In some embodiments, processor 401 and memory 402 may be implemented on the same chip, and in some embodiments they may be implemented separately on separate chips.
The processor 401 may be a general purpose processor such as a Central Processing Unit (CPU), digital signal processor, application specific integrated circuit, field programmable gate array or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, which may implement or perform the methods, steps and logic blocks disclosed in the embodiments of the present application. The general purpose processor may be a microprocessor or any conventional processor or the like. The steps of the image brightness adjustment method disclosed in connection with the embodiments of the present application may be directly embodied and executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.
Memory 402 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. The Memory 402 may include at least one type of storage medium, which may include, for example, flash Memory, hard disk, multimedia card, card Memory, random access Memory (Random Access Memory, RAM), static random access Memory (Static Random Access Memory, SRAM), programmable Read-Only Memory (Programmable Read Only Memory, PROM), read-Only Memory (ROM), charged erasable programmable Read-Only Memory (Electrically Erasable Programmable Read-Only Memory), magnetic Memory, magnetic disk, optical disk, and the like. Memory 402 is any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited to such. The memory 402 in the present embodiment may also be circuitry or any other device capable of implementing a memory function for storing program instructions and/or data.
The codes corresponding to the image brightness adjustment method described in the foregoing embodiment may be cured into the chip by programming the processor 401, so that the chip can execute the steps of the image brightness adjustment method when running, and how to program the processor 401 is a technology known to those skilled in the art, which is not repeated here.
Based on the same inventive concept, the embodiments of the present application also provide a computer-readable storage medium storing computer instructions that, when run on a computer, cause the computer to perform the steps of the image brightness adjustment method as described above.
In some possible embodiments, aspects of the image brightness adjustment method provided herein may also be implemented in the form of a program product comprising program code for causing a detection device to perform the steps of the image brightness adjustment method according to various exemplary embodiments of the present application as described herein above when the program product is run on an electronic device.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be apparent to those skilled in the art that various modifications and variations can be made in the present application without departing from the spirit or scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims and the equivalents thereof, the present application is intended to cover such modifications and variations.

Claims (8)

1. An image brightness adjustment method, comprising:
acquiring an image in the visual field of a camera and drawing a brightness histogram corresponding to the image;
acquiring a first pixel brightness change curve by using a histogram equalization method based on the brightness histogram; wherein the slope in the pixel brightness change curve is used to indicate the contrast enhancement amplitude between the current brightness and the adjacent brightness;
according to the mapping relation between the brightness and a preset slope threshold, adjusting the slope in the first pixel brightness change curve to obtain a second pixel brightness change curve; the mapping relation is determined according to a plurality of maximum connected domains of the image, one maximum connected domain corresponds to one sub-image, and the sub-image is obtained by dividing the image according to a preset dividing rule;
adjusting the brightness of each pixel in the image based on the second pixel brightness variation curve;
before adjusting the slope in the first pixel brightness change curve according to the mapping relation between the brightness and the preset slope threshold value, the method further comprises:
dividing the image into a plurality of sub-images according to a preset brightness interval;
determining a maximum connected domain corresponding to each sub-image, and calculating the size of the maximum connected domain corresponding to the maximum connected domain;
drawing a relation curve of the maximum connected domain size and the brightness according to the maximum connected domain size and a preset brightness interval, and determining a first mapping relation between the maximum connected domain size and the brightness;
and determining the mapping relation between the brightness and the preset slope threshold based on a second mapping relation between the preset maximum connected domain size and the preset slope threshold and the first mapping relation.
2. The method of claim 1, wherein the calculating the maximum connected domain size corresponding to the maximum connected domain comprises:
acquiring the number of pixels contained in a maximum connected domain of a target;
and opening the pixel number, and dividing the pixel number by the image size corresponding to the image to obtain the maximum connected domain size corresponding to the target maximum connected domain.
3. The method of claim 1, wherein determining the largest connected domain for each sub-image comprises:
performing binarization processing on each sub-image to obtain a plurality of binarized images;
and determining the maximum connected domain corresponding to each sub-image based on the plurality of binarized images.
4. The method of claim 1, wherein adjusting the slope in the first pixel brightness variation curve according to the mapping between brightness and a preset slope threshold comprises:
determining a target slope of a target luminance on the first pixel luminance change curve;
determining whether the target slope is greater than a preset slope threshold corresponding to the target brightness;
and if the target slope is larger than the preset slope threshold corresponding to the target brightness, adjusting the target slope to be the preset slope threshold corresponding to the target brightness.
5. An image brightness adjustment device, comprising:
the acquisition module is used for acquiring an image in the visual field range of the camera and drawing a brightness histogram corresponding to the image through the processing module;
the acquisition module is further used for acquiring a first pixel brightness change curve by using a histogram equalization method based on the brightness histogram; wherein the slope in the pixel brightness change curve is used to indicate the contrast enhancement amplitude between the current brightness and the adjacent brightness;
the processing module is further configured to: dividing the image into a plurality of sub-images according to a preset brightness interval;
determining a maximum connected domain corresponding to each sub-image, and calculating the size of the maximum connected domain corresponding to the maximum connected domain; drawing a relation curve of the maximum connected domain size and the brightness according to the maximum connected domain size and a preset brightness interval, and determining a first mapping relation between the maximum connected domain size and the brightness; determining a mapping relation between the brightness and a preset slope threshold value based on a second mapping relation between a preset maximum connected domain size and the preset slope threshold value and the first mapping relation;
the processing module is further configured to adjust a slope in the first pixel brightness change curve according to a mapping relationship between brightness and a preset slope threshold value, so as to obtain a second pixel brightness change curve; the mapping relation is determined according to a plurality of maximum connected domains of the image, one maximum connected domain corresponds to one sub-image, and the sub-image is obtained by dividing the image according to a preset dividing rule;
the processing module is further configured to adjust a brightness of each pixel in the image based on the second pixel brightness variation curve.
6. The apparatus of claim 5, wherein the acquisition module is specifically configured to:
acquiring the number of pixels contained in a maximum connected domain of a target;
the processing module is specifically configured to:
and opening the pixel number, and dividing the pixel number by the image size corresponding to the image to obtain the maximum connected domain size corresponding to the target maximum connected domain.
7. An electronic device, comprising:
a memory for storing program instructions;
a processor for invoking program instructions stored in said memory and for performing the steps comprised in the method according to any of claims 1-4 in accordance with the obtained program instructions.
8. A computer readable storage medium, characterized in that the computer readable storage medium stores a computer program comprising program instructions which, when executed by a computer, cause the computer to perform the method of any of claims 1-4.
CN202210780694.XA 2022-07-04 2022-07-04 Image brightness adjustment method and device, electronic equipment and storage medium Active CN115278104B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210780694.XA CN115278104B (en) 2022-07-04 2022-07-04 Image brightness adjustment method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210780694.XA CN115278104B (en) 2022-07-04 2022-07-04 Image brightness adjustment method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN115278104A CN115278104A (en) 2022-11-01
CN115278104B true CN115278104B (en) 2024-02-09

Family

ID=83763953

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210780694.XA Active CN115278104B (en) 2022-07-04 2022-07-04 Image brightness adjustment method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115278104B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116246265B (en) * 2023-05-12 2023-08-08 威海凯思信息科技有限公司 Property management method and device based on image processing

Citations (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7227893B1 (en) * 2002-08-22 2007-06-05 Xlabs Holdings, Llc Application-specific object-based segmentation and recognition system
WO2017162069A1 (en) * 2016-03-25 2017-09-28 阿里巴巴集团控股有限公司 Image text identification method and apparatus
CN107452355A (en) * 2017-08-09 2017-12-08 青岛海信电器股份有限公司 The method of adjustment and device of a kind of dynamic contrast
CN107730477A (en) * 2017-10-13 2018-02-23 西安科技大学 Substation equipment infrared intelligent monitoring system and monitoring image feature extracting method
CN108460744A (en) * 2018-03-21 2018-08-28 武汉理工大学 A kind of enhancing of cement cutting pavement image noise reduction and FRACTURE CHARACTERISTICS extracting method
CN110809146A (en) * 2019-11-01 2020-02-18 厦门美图之家科技有限公司 Image contrast adjusting method and device, terminal equipment and storage medium
CN111402147A (en) * 2020-02-26 2020-07-10 浙江大华技术股份有限公司 Video image processing method, video image processing device, computer equipment and storage medium
CN111862228A (en) * 2020-06-04 2020-10-30 福瑞泰克智能系统有限公司 Occlusion detection method, system, computer device and readable storage medium
CN112489055A (en) * 2020-11-30 2021-03-12 中南大学 Satellite video dynamic vehicle target extraction method fusing brightness-time sequence characteristics
WO2021189222A1 (en) * 2020-03-24 2021-09-30 华为技术有限公司 Image enhancement processing method and device
CN113689396A (en) * 2021-08-20 2021-11-23 深圳先进技术研究院 Cell fluorescence image thresholding method, system, terminal and storage medium
CN113747008A (en) * 2021-08-18 2021-12-03 浙江大华技术股份有限公司 Camera and light supplementing method
CN113822897A (en) * 2021-11-22 2021-12-21 武汉楚精灵医疗科技有限公司 Blood vessel segmentation method, terminal and computer-readable storage medium
CN113888429A (en) * 2021-09-29 2022-01-04 Oppo广东移动通信有限公司 Image brightening method and device and electronic equipment
CN114612310A (en) * 2020-12-04 2022-06-10 深圳Tcl新技术有限公司 Image enhancement processing method and computer equipment

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8456545B2 (en) * 2009-05-08 2013-06-04 Qualcomm Incorporated Systems, methods, and apparatus for generation of reinforcement pattern and systems, methods, and apparatus for artifact evaluation
US10074162B2 (en) * 2016-08-11 2018-09-11 Intel Corporation Brightness control for spatially adaptive tone mapping of high dynamic range (HDR) images

Patent Citations (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7227893B1 (en) * 2002-08-22 2007-06-05 Xlabs Holdings, Llc Application-specific object-based segmentation and recognition system
WO2017162069A1 (en) * 2016-03-25 2017-09-28 阿里巴巴集团控股有限公司 Image text identification method and apparatus
CN107452355A (en) * 2017-08-09 2017-12-08 青岛海信电器股份有限公司 The method of adjustment and device of a kind of dynamic contrast
CN107730477A (en) * 2017-10-13 2018-02-23 西安科技大学 Substation equipment infrared intelligent monitoring system and monitoring image feature extracting method
CN108460744A (en) * 2018-03-21 2018-08-28 武汉理工大学 A kind of enhancing of cement cutting pavement image noise reduction and FRACTURE CHARACTERISTICS extracting method
CN110809146A (en) * 2019-11-01 2020-02-18 厦门美图之家科技有限公司 Image contrast adjusting method and device, terminal equipment and storage medium
CN111402147A (en) * 2020-02-26 2020-07-10 浙江大华技术股份有限公司 Video image processing method, video image processing device, computer equipment and storage medium
WO2021189222A1 (en) * 2020-03-24 2021-09-30 华为技术有限公司 Image enhancement processing method and device
CN111862228A (en) * 2020-06-04 2020-10-30 福瑞泰克智能系统有限公司 Occlusion detection method, system, computer device and readable storage medium
CN112489055A (en) * 2020-11-30 2021-03-12 中南大学 Satellite video dynamic vehicle target extraction method fusing brightness-time sequence characteristics
CN114612310A (en) * 2020-12-04 2022-06-10 深圳Tcl新技术有限公司 Image enhancement processing method and computer equipment
CN113747008A (en) * 2021-08-18 2021-12-03 浙江大华技术股份有限公司 Camera and light supplementing method
CN113689396A (en) * 2021-08-20 2021-11-23 深圳先进技术研究院 Cell fluorescence image thresholding method, system, terminal and storage medium
CN113888429A (en) * 2021-09-29 2022-01-04 Oppo广东移动通信有限公司 Image brightening method and device and electronic equipment
CN113822897A (en) * 2021-11-22 2021-12-21 武汉楚精灵医疗科技有限公司 Blood vessel segmentation method, terminal and computer-readable storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
基于双边滤波和Black-hat变换的OSTU裂缝分割算法;宋巧君;《信息技术》;全文 *
复杂环境下车牌定位算法仿真研究;刘翔;信息技术(02);全文 *

Also Published As

Publication number Publication date
CN115278104A (en) 2022-11-01

Similar Documents

Publication Publication Date Title
CN111028189B (en) Image processing method, device, storage medium and electronic equipment
JP6160004B2 (en) Scene recognition method and apparatus
CN110796600B (en) Image super-resolution reconstruction method, image super-resolution reconstruction device and electronic equipment
CN111383206B (en) Image processing method and device, electronic equipment and storage medium
CN113596573B (en) Image processing method, image processing device, electronic equipment and computer readable storage medium
CN111601048B (en) Image processing method and device
CN110223244B (en) Image processing method and device, electronic equipment and storage medium
CN115278104B (en) Image brightness adjustment method and device, electronic equipment and storage medium
CN113538271A (en) Image display method, image display device, electronic equipment and computer readable storage medium
CN113747008B (en) Camera and light supplementing method
CN111563517A (en) Image processing method, image processing device, electronic equipment and storage medium
CN115082350A (en) Stroboscopic image processing method and device, electronic device and readable storage medium
CN111160340B (en) Moving object detection method and device, storage medium and terminal equipment
CN113436068A (en) Image splicing method and device, electronic equipment and storage medium
CN111654747B (en) Bullet screen display method and device
CN111539975B (en) Method, device, equipment and storage medium for detecting moving object
CN112700456A (en) Image area contrast optimization method, device, equipment and storage medium
CN106971386B (en) Method and device for judging image integrity and page loading degree and client equipment
CN111507923A (en) Method, device, equipment and medium for processing noise of video image
CN111064897B (en) Exposure evaluation value statistical method and imaging equipment
CN112801932A (en) Image display method, image display device, electronic equipment and storage medium
CN113115109B (en) Video processing method, device, electronic equipment and storage medium
CN113327215B (en) Wide dynamic image synthesis method and device, electronic equipment and storage medium
CN111507358B (en) Face image processing method, device, equipment and medium
CN114125344B (en) Video processing apparatus, video processing method, monitor device, computer device, and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant