CN108109166B - Method and device for calculating image entropy value in automatic exposure - Google Patents

Method and device for calculating image entropy value in automatic exposure Download PDF

Info

Publication number
CN108109166B
CN108109166B CN201711291996.6A CN201711291996A CN108109166B CN 108109166 B CN108109166 B CN 108109166B CN 201711291996 A CN201711291996 A CN 201711291996A CN 108109166 B CN108109166 B CN 108109166B
Authority
CN
China
Prior art keywords
bit
data
shift
input data
module
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
CN201711291996.6A
Other languages
Chinese (zh)
Other versions
CN108109166A (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.)
Shanghai IC R&D Center Co Ltd
Chengdu Image Design Technology Co Ltd
Original Assignee
Shanghai IC R&D Center Co Ltd
Chengdu Image Design 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 Shanghai IC R&D Center Co Ltd, Chengdu Image Design Technology Co Ltd filed Critical Shanghai IC R&D Center Co Ltd
Priority to CN201711291996.6A priority Critical patent/CN108109166B/en
Publication of CN108109166A publication Critical patent/CN108109166A/en
Application granted granted Critical
Publication of CN108109166B publication Critical patent/CN108109166B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/40Analysis of texture
    • G06T7/41Analysis of texture based on statistical description of texture
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/15Correlation function computation including computation of convolution operations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20021Dividing image into blocks, subimages or windows

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Computational Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Algebra (AREA)
  • Databases & Information Systems (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Computing Systems (AREA)
  • Probability & Statistics with Applications (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Processing (AREA)
  • Facsimile Image Signal Circuits (AREA)

Abstract

The invention provides a method and a device for calculating an image entropy value in automatic exposure, wherein the device comprises the following steps: the logarithm function calculation module is used for calculating a logarithm function taking 2 as a base for input data and multiplying the calculation result by the input data to obtain a product value, wherein an image to be calculated is divided into A block regions, each block region has the same shape and the same number of pixel points, each block region has number-level gray level quantization levels, and the number of the pixel points of each gray level quantization level in each block region is used as the input data of the logarithm function calculation module; the accumulation module is used for accumulating the product values of the number +1 input data to each block area to obtain the entropy value representation value of the block area; and the weight distribution module is used for distributing weights to the regions according to the entropy value representation values of the regions, wherein the lower the entropy value representation value is, the higher the distributed weight is, and the image exposure intensity is calculated according to the weight of each region. The device and the method provided by the invention optimize the calculation of the image entropy value.

Description

Method and device for calculating image entropy value in automatic exposure
Technical Field
The invention relates to the field of digital integrated circuits, in particular to a method and a device for calculating an image entropy value in automatic exposure.
Background
Currently, an entropy-based automatic exposure technology can automatically find a focus area, and then automatically adjust the weight of each partition, so that the determined exposure time and the gain are more reasonable.
Figure BDA0001499560440000011
But as shown in equation (1), it is a calculation formula for the image entropy value E in a region. p is a radical ofiThe probability of occurrence of different gray levels. n is the number of divided gray levels.
For piThere is a calculation formula: p is a radical ofi=NiN, wherein NiThe number of pixel points of a certain level of gray scale, and N is the total number of pixel points in the region.
When formula (2) is satisfied
Figure BDA0001499560440000012
Time of flight
The maximum value of the image entropy is:
Figure BDA0001499560440000013
it follows that the computation of a logarithmic function is unavoidable based on the automatic exposure computation of entropy values. However, the image entropy calculation has the following characteristics:
1) logarithmic function operations are inevitable, but do not require particular precision;
2) different base numbers have no significance to the calculation of the image entropy value for automatic exposure, and the relative weight influence of different blocks is larger;
3) the image size is limited, when the number of blocks is more, the number of pixel points counted in each block is less, and the requirement on the flow degree of entropy calculation of different blocks is improved; when the number of blocks is less, the number of pixel points counted in each block is more, and the requirement on the size and the speed of data volume calculated by the entropy value in each block is increased.
Based on the above characteristics, it is necessary to optimize the circuit for entropy calculation so as to adapt to the calculation requirements of different block numbers and different data bit widths (limited). Most of the conventional automatic exposure weight calculation schemes based on image entropy are software-based. Due to the relationship between the gray scale statistics and the difficulty of the logarithmic function calculation, there are some schemes based on ASIC circuits.
Disclosure of Invention
In order to overcome the defects in the prior art, the invention provides a method and a device for calculating a logarithmic function based on an optimized lookup table method, so as to optimize the logarithmic function calculation of the lookup table method.
According to an aspect of the present invention, there is provided a computing apparatus for image entropy in automatic exposure, including: the logarithm function calculation module is used for calculating a logarithm function taking 2 as a base for input data and multiplying the calculation result by the input data to obtain a product value, wherein an image to be calculated is divided into A block regions, each block region has the same shape and the same number of pixel points, each block region has number-level gray level quantization levels, the number of the pixel points of each gray level quantization level in each block region serves as the input data of the logarithm function calculation module, and the total number of the number +1 input data in each block region is obtained; the accumulation module is used for accumulating the product value of the number +1 input data of each block area to obtain the entropy value representation value of the block area; and the weight distribution module is used for distributing weights to the regions according to the entropy value representation values of the regions, wherein the lower the entropy value representation value is, the higher the distributed weight is, and the image exposure intensity is calculated according to the weight of each region.
Optionally, the logarithmic function calculation module includes: a data judging and converting module for receivingInputting data, judging whether the input data accords with a preset definition domain, and converting the input data into M-bit binary data if the input data accords with the preset definition domain, wherein M is a positive integer; a shift module for shifting the M-bit binary data to the right until the highest bit of the M-bit binary data is shifted to the 0 th bit to obtain a total shift bit and n-bit data adjacent to the highest bit in the M-bit binary data to the right, wherein the binary bit width of the total shift bit is M, n and M are integers, 2m-1<M≤2m(ii) a The lookup table and data splicing circuit module is used for splicing the total shift bit number to the upper m bits of the calculation result of the logarithmic function to represent an integer part, expanding N bits of data to the lower N bits of the calculation result of the logarithmic function to represent a decimal part according to the lookup table, and combining the integer part and the decimal part to obtain the total m + N bits of the calculation result of the logarithmic function, wherein N is a positive integer; and the coefficient multiplication module is used for multiplying the input data by the calculation result of the logarithmic function so as to obtain a product value of each input data.
Optionally, the shifting module comprises: the shift circuit module comprises a plurality of q bit shift circuits, each shift circuit is used for shifting M-bit binary data to the right by taking q bits as a unit, the shift circuit module is used for storing high n bits in the q-bit shifted-out data into a first register as n-bit first transmission data until all the other bits except the lowest q bits in the M-bit binary data are 0, the lowest q-bit data is taken as q-bit second transmission data, and a binary system of accumulated first shift bits is obtained through a shift counter, wherein q is a positive integer, and the bit width of the first register is more than or equal to n; the redundant bit data shifting and shifting accumulation circuit module is used for shifting second transmission data to the right to enable the highest bit to be shifted to the 0 th bit, storing the shifted data from the high bit into the first register to refresh the data in the first register, taking the refreshed data of the n-bit register as the n-bit data, and adding a binary system of a second shift bit and a binary system of a first shift bit to be taken as a binary system of the total shift bit, wherein the bit widths of the binary systems of the first shift bit and the second shift bit are m, and the bit width of the shift counter is larger than or equal to m.
Optionally, the method further comprises: the multi-stage register delay module comprises a plurality of buffers, receives input data and data validity marks, caches the input data and the data validity marks one by one in each buffer, and outputs the data validity marks to the logarithm function calculation module one by one as control signals.
Optionally, the multi-stage register delay module further receives a flag indicating whether the input data is 0, and each buffer buffers the flag one by one and outputs the flag to the logarithmic function calculation module.
Alternatively, if the flag indicates that the input data is 0, the logarithmic function calculation module multiplies the input data by 1 to obtain the product value.
According to another aspect of the present invention, there is also provided a method for calculating an image entropy value in automatic exposure, including: dividing an image to be calculated into A blocks of areas, wherein each block of area has the same shape and the same number of pixel points, and determining the number of gray quantization levels of each block of area; taking the number of pixel points of each gray scale quantization level in each block region as input data, calculating a logarithm function with 2 as a base for each input data, and multiplying the calculation result by the input data to obtain a product value, wherein the total number of the input data is +1 in each block region; for each block area, accumulating the product value of the number +1 input data of the block area to obtain the entropy value representation value of each block area; distributing weights to the regions according to the entropy value representation value of each region, wherein the lower the entropy value representation value is, the higher the distributed weight is; and calculating the image exposure intensity according to the weight of each region.
Optionally, the calculating a base-2 logarithmic function for each input data, and determining from the input data whether to multiply the calculation by the input data or 1 to obtain a product value comprises: judging whether the input data accord with a preset definition domain or not, if so, converting the input data into M-bit binary data, wherein M is a positive integer; the device comprises a search table, a log function, a bit-to-bit search module and a bit-to-bit search module, wherein the search table is used for searching N bits of the log function, the N bits of the log function are used for being searched, the M bits of the binary data are used for being shifted to the right until the highest bit of the M bits of the binary data is shifted to the 0 th bit, the total shift bit is spliced to the upper M bits of the calculation result of the log function by using N and M as integers, the N bits of the N bits are spliced to the lower N bits of the calculation result of the log function according to the search table, and the M + N bits of the calculation result of the log function are obtained by combining the integer part and the decimal part, wherein N is a positive integer; the input data is multiplied by the calculation result of the logarithmic function to obtain a product value of each input data.
Optionally, the step of shifting the M-bit binary data to the right until the highest bit of the M-bit binary data is shifted to the 0 th bit, and obtaining the total shift bit number and the n-bit data adjacent to the highest bit in the M-bit binary data includes: the method comprises the steps that q bits are taken as a unit, M-bit binary data are shifted to the right, high n bits in the q-bit shifted data are taken as n-bit first transmission data and stored in a first register, all the other bits except the lowest q bits in the M-bit binary data are 0, the lowest q-bit data are taken as q-bit second transmission data, a shift counter is used for obtaining a binary system of accumulated first shift bits, wherein q is a positive integer, and the bit width of the first register is larger than or equal to n; and right shifting second transmission data by a second shift digit to shift the highest digit to the 0 th digit, storing the shifted data from the high digit into the first register to refresh the data in the n-digit register, taking the refreshed data of the first register as the n-digit data, and adding a binary system of the second shift digit and a binary system of the first shift digit to be used as a binary system of the total shift digit, wherein the bit widths of the binary systems of the first shift digit and the second shift digit are m, and the bit width of the shift counter is more than or equal to m.
Optionally, the number of pixels in each block of region is B, and M is log2B+1,log2B is a positive integer.
Optionally, q is 8.
Optionally, the predetermined domain is an integer greater than or equal to 0, and the step of determining whether the input data conforms to the predetermined domain includes: judging whether the input data is equal to 0; if the input data is equal to 0, making the calculation result of the logarithmic function be 1; and if the input data is larger than 0, calculating a logarithmic function with the base 2 for the input data.
The invention derives formula (3) according to formula (1) and formula (2) of the background section:
Figure BDA0001499560440000041
wherein N is the total amount of pixel points in each block, N is the order of gray scale, and N isiThe number of the pixel points corresponding to the ith gray scale. Thus, there is a proportional relationship:
E∝-f(Ni)
Figure BDA0001499560440000051
i.e. the calculated mapping of the image entropy to the pairwise functional relationship f (N)i) And (4) calculating. When f (N)i) The larger the entropy value of the corresponding block is; conversely, the larger the entropy value of the corresponding partition.
Compared with the prior art, the method is based on the principle, the calculation of the logarithmic function is unified into the calculation of the logarithmic function with the base 2, the calculation process of the entropy value is simplified, and the method has the following advantages
1) The control of a state machine is removed by adopting the segmentation and the shift of the assembly line, and the throughput capacity of data is greatly improved. The support for different image quantity blocks, different gray level numbers and different data sizes is ensured.
2) The calculation of data 0 is supported. The invention adds the judgment to the input data through the method and the circuit design, completes the support to the natural number domain, and can control the calculation of the subsequent logarithmic function when the data is 0.
3) Is suitable for the requirement of high-speed circuits. Due to the adoption of a lookup table logic and pipeline (pipeline) structure, the circuit structure can operate under a high-speed clock.
4) By adopting the optimized table look-up method, the mapping of the calculation domain is completed by methods such as segmented shift and the like while the characteristic of easy realization of the table look-up method is kept, thereby greatly reducing the table look-up and improving the calculation precision.
5) In the algorithmic computation scheme, unnecessary computations are eliminated. Because the purpose of the automatic exposure entropy calculation is only to distinguish the weight of each block, and the real value of the entropy of each block is not interested, the calculation data and the formula are reasonably changed and reduced on the basis of not changing the relative size relationship of the entropy of each block. That is, in the present invention, only the value of the logarithmic function with the base number of 2 is calculated, and this value is multiplied by only the input data in the multiplication operation.
Drawings
The above and other features and advantages of the present invention will become more apparent by describing in detail exemplary embodiments thereof with reference to the attached drawings.
FIG. 1 shows a flow chart of a method for image entropy calculation in automatic exposure according to an embodiment of the invention.
FIG. 2 shows a flow chart of base 2 logarithm function calculation and product values according to an embodiment of the invention.
FIG. 3 is a diagram illustrating data variation of a base 2 logarithm function and a product value calculation process according to an embodiment of the present invention.
FIG. 4 illustrates a fixed-point correspondence of a lookup table according to an embodiment of the invention.
FIG. 5 shows a schematic diagram of a computing device for image entropy values in automatic exposure according to an embodiment of the invention.
FIG. 6 is a diagram illustrating an apparatus for computing image entropy in an auto-exposure, in accordance with a specific embodiment of the present invention.
Fig. 7 shows a gray scale distribution of each block region of an image according to an embodiment of the invention.
FIG. 8 illustrates entropy-characterizing values for block regions of an image according to a specific embodiment of the invention.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
Furthermore, the drawings are merely schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus their repetitive description will be omitted. Some of the block diagrams shown in the figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
The method is mainly used for determining the entropy of each block information in automatic exposure, and further completing automatic configuration of each block weight. Optimizing the calculation of a logarithmic function by adopting an optimized lookup table method; the adaptability to different block numbers and different gray level numbers is ensured through a pipeline technology, and the requirement of time sequence is ensured; unnecessary calculation is eliminated by optimizing the information entropy calculation formula. On the basis of consuming less hardware and time sequence resources, approximate calculation of a logarithmic function and judgment of the information entropy are completed, and the method has wide adaptability and reference significance.
The principle of the present invention will be explained below. From the equations (1) and (2) of the background section, equation (3) can be derived:
Figure BDA0001499560440000071
wherein N is the total amount of pixel points in each block, N is the order of gray scale, and N isiThe number of the pixel points corresponding to the ith gray scale. Thus, there is a proportional relationship:
E∝-f(Ni)
Figure BDA0001499560440000072
i.e. the calculated mapping of the image entropy to the pairwise functional relationship f (N)i) And (4) calculating. When f (N)i) The larger the entropy value of the corresponding block is; conversely, the larger the entropy value of the corresponding partition. For the functional relationship f (N)i) The logarithm function operation with the base number of 2 in (1) can adopt a logarithm function calculation method based on an optimized lookup table.
Based on the above principle, referring to fig. 1, fig. 1 shows a flowchart of a calculation method for image entropy in automatic exposure according to an embodiment of the present invention. Fig. 1 shows 5 steps:
step S110: dividing an image to be calculated into A blocks of areas, wherein each block of area has the same shape and the same number of pixel points, and determining the number of gray quantization levels of each block of area.
Step S120: taking the number of pixel points of each gray scale quantization level in each block region as input data, calculating a logarithm function with the base number of 2 for each input data, and multiplying the calculation result by the input data to obtain a product value. There are a total of number +1 input data in each block area.
Step S130: and for each block area, accumulating the product values of the number +1 input data of the block area to obtain the entropy value representation value of each block area.
Step S140: and assigning weights to the regions according to the entropy value representation values of each region, wherein the lower the entropy value representation value, the higher the assigned weight.
Step S150: and calculating the image exposure intensity according to the weight of each region.
Step S120 can refer to fig. 2, and fig. 2 shows a flowchart of the base-2 logarithm function and the product value calculation according to the embodiment of the present invention. Fig. 2 shows a total of 7 steps:
step S121: receiving the data and the calculation starting request, and judging whether the input data meets the requirement of the preset definition domain.
If it is determined in step S121 that the input data meets the requirement of the predetermined domain, the feedback signal may be pulled up as an interaction, so that the external device does not issue any more data request, and step S122 is continued.
If step S121 determines that the input data does not satisfy the requirement of the predetermined definition domain, the calculation request may be disregarded, and new data and data requests may continue to be received.
In one embodiment, the predetermined domain may be an integer greater than or equal to 0, and step S121 includes determining whether the input data is equal to 0. If the input data is equal to 0, step S122 to step S126 are not performed, and the calculation result of the logarithmic function is set to 1 to reduce the circuit power consumption (or if the input data is equal to 0, the input of the logarithmic function is set to 1 and step S122 to step S126 are continuously performed). And if the input data is larger than 0, continuing to execute the subsequent steps.
Step S122: the input data is converted into M-bit two-level system data. Specifically, the number of pixels in each block of region is B, and M is log2B+1,log2B is a positive integer.
Step S123: the data of the converted data except the lowest q bits (for example, 8 bits) are compared.
If all bits except the lowest q bits are 0, the process goes to step S125.
If there is a bit other than 0 except the lowest q bits, step S124 is executed to shift data in units of q bits, store the high n bits of the shifted data bits into the first register (bit width is greater than n), and accumulate the first shift bit number in the shift counter (bit width is greater than m). Therein, 2m-1<M≤2mAnd m is the bit width of the binary system of the first shift bit number.
Step S125, comparing the lowest q-bit data, determining the bit with the highest value of 1, and right-shifting the data in the lowest q-bit data by the corresponding bit number (i.e., right-shifting the bit with the highest value of 1 to 0 bit). Specifically, the data shifted out by the lowest q-bit data is shifted into the first register, and the n-bit data in the first register is reserved as an input spare of the next lookup table. The binary expression of the second shift digit in step S125 and the binary expression of the first shift digit in step S123 are accumulated. After the shift and accumulation calculation is completed, the process goes to S126.
In fact, the foregoing steps S123 to S125 implement right shift of the M-bit binary data until the highest bit of the M-bit binary data is shifted to the 0 th bit, so as to obtain a binary system of total shift bits and n-bit data adjacent to the highest bit in the M-bit binary data. The bit width of the binary system of the second shift digit and the total shift digit is also m
Step S126: inputting the N bits of data reserved in the first register into a lookup table to obtain an output value of N bits, splicing the total shift bits and the output value of N bits to obtain a calculation result of a logarithmic function, and obtaining a logarithmic function result of which the corresponding base number of the input numerical value is 2. Where the size of n determines the size 2 of the look-up tablenThe size of N determines the quantization precision and further determines the bit of the final output data.
Step S127: the multiplier determined according to step S121 is multiplied by the result of step S126. In some embodiments, the multiplication result in step S127 may be calculated using pipelining.
As shown in fig. 3 and 4, taking a 32-bit hexadecimal data 0218_9F99 as an example, the logarithmic function operation is performed. The look-up table has a quantization bit width of 10 bits. The quantization precision of the coefficients is 10 bits. That is, M is 32, M is 5, N is 10, and s is 10. Fig. 3 shows a calculation process and a corresponding result of 32-bit hexadecimal data 0218_9F99, in which a dotted line divides an integer part and a fractional part of the data, the left side represents an integer, and the right side represents a decimal (the calculation result is not shown, and only the integer part and the fractional part are schematically shown).
The input data _ in is greater than 1 in 32' b0000_0010_0001_1000_1001_1111_1001_1001, and the hexadecimal data 0218_9F99 of the 32bit corresponds to binary data of 0000_0010_0001_1000_1001_1111_1001_ 1001.
The input data is right shifted in units of 8 bits until all bits except the lowest 8 bits are 0. Since for different input data. The shifted data is stored in the 4-bit first register as the first transfer data sh _ look. As shown in fig. 3, after 8-bit shift is performed 3 times, only the data of the lowest 8 bits is left and is not 0, and the data is regarded as the second transmission data sh _ left of 8 bits and output. The value of the Sh _ look register is 4-bit binary data 0001. The stored shift bit number total _ sh is 11000 (5-bit binary data).
And then, calculating and shifting data corresponding to the second transmission data sh _ left, so that the highest bit of the data in the second transmission data sh _ left is shifted to the 0 th bit. The number of shifted bits is added to total _ sh and stored in the sh _ bits as the total number of shifted bits. The shifted-out data of the second transfer data sh _ left is shifted into the first register, and the data remaining in the first register is regarded as the third transfer data lok _ tab (i.e., n-bit data). As shown in fig. 3, the total shift register sh _ bits is 11001 (5-bit binary data), and the look-up table input value lok _ tab is 0000 (4-bit binary data).
The Sh _ bits are directly spliced to the high bit of the calculation result of the logarithmic function without operation as an integer part. The output of the lookup table is used as a low bit to characterize the fractional part of the data. The output of 10 bits corresponding to the lower 4 bits is looked up in the look-up table shown in fig. 4. The calculation result of the logarithmic function is that look _ o is 110_0100_0000_0000 (15-bit binary data). Wherein, the lower 10bit is the output result of the lookup table and represents the decimal part. The upper 5 bits are the shift output, representing the integer part.
Thereafter, look _ o is multiplied by the determined multiplier (i.e., input data) to obtain a calculation result.
FIG. 5 shows a schematic diagram of a computing device for image entropy values in automatic exposure according to an embodiment of the invention. The device is preferably realized by a circuit arrangement. In some variations, the apparatus may also be implemented by software or a combination of software and hardware.
The data determination and conversion module 210 is used to complete the determination of whether the data is within a predetermined domain (e.g., the predetermined domain is an integer greater than or equal to 0). The data determining and converting module 210 is further configured to send a zero indication signal zero _ flag to indicate whether the input data is zero. When the input data is 0, the zero indication signal zero _ flag is 1 (1-bit binary number).
Shift dieThe block comprises a shift circuit module 220 and a rest bit data shift and shift accumulation circuit module 230, which are used for shifting the M-bit binary data to the right until the highest bit of the M-bit binary data is shifted to the 0 th bit, obtaining the total shift bit and the n-bit data adjacent to the highest bit in the M-bit binary data to the right, wherein the binary bit width of the total shift bit is M, wherein n and M are integers, 2m-1<M≤2m
The shift circuit module 220 is used for shifting data and recording the shift amount. The shift circuit module 220 may include, for example, a plurality of 8-bit shift circuit modules 221. The 8-bit shift circuit module 221 completes the shift of data, the accumulation of shift amount, and the judgment of data size. The number of 8-bit shift circuit blocks 221 is determined by the bit width of the input data. Because the shift circuit module 220 adopts a pipeline processing mode, one 8-bit shift circuit module 221 completes one 8-bit shift. The output of the shift circuit module 220 comprises total _ sh, sh _ left and sh _ look, and the total _ sh represents the accumulated shift amount of the 8-bit shift circuit; sh _ left is 8-bit data output, and represents the residual shift required after 8-bit shift for several times; sh _ look characterizes the possible input values that need to enter the look-up table.
The remainder shift and shift accumulation circuit block 230 is used to complete the data shift within the lower 8 bits. And simultaneously, recording and accumulating the shift digit into the total _ sh to obtain the final output total shift quantity sh _ bits and the input value lok _ tab of the lookup table.
The lookup table and data stitching circuit module 240 is used to perform lookup table computation and data stitching. And taking the Lok _ tab as an input value of the lookup table, entering the lookup table, and outputting a corresponding calculated value. The Sh _ bit is used as a high bit and spliced with the output value of the lookup table. Nbit lookup table input and output values corresponding to Nbit lookup table output values, sh _ bit is mbit, and the final output calculation result look-up _ o characterization log2NiIs m + Nbit.
The coefficient multiplication circuit 250 is used to complete NiAnd log2And calculating Ni. Since the precision of the lookup table is variable, the bit width of the input data depends on the entry, and therefore the number of pipeline stages of the multiplier circuit depends on the case.
The data judgment and conversion module 210, the shift circuit module 220, the surplus data shift and shift accumulation circuit module 230, the lookup table and data concatenation circuit module 240 and the coefficient multiplication circuit 250 together form a logarithmic function calculation module. The logarithm function calculation module is used for calculating a logarithm function of input data, and multiplying the calculation result by the input data to obtain a product value, wherein an image to be calculated is divided into a block area a, each block area has the same shape and the same number of pixel points, each block area has a number-level gray scale quantization level (namely 0 to number-total number +1 level), and the number of the pixel points of each gray scale quantization level in each block area is used as the input data of the logarithm function calculation module with the base number of 2.
The accumulation module 260 is configured to accumulate, for each block area, the product values of the number +1 input data of the block area to obtain the entropy characterizing value of the block area. The calculation enable is indicated by data _ valid _ d 5.
The weight assignment module 270 is configured to assign weights to the regions according to entropy characterizing values of each region, where the lower the entropy characterizing value is, the higher the assigned weight is, and the image exposure intensity is calculated according to the weight of each region.
As shown in fig. 5, the computing device further includes a multi-stage registered delay module 280. Multi-stage registered delay block 280 includes a plurality of buffers 281. The multi-stage register delay module 280 receives the input data _ in and the data validity flag data _ valid. Each buffer 281 buffers the input data _ in and the data validity flag data _ valid one by one and outputs the data validity flag as a control signal to the shift circuit module 220, the surplus data shift and shift accumulation circuit module 230, the lookup table and data concatenation circuit module 240, and the coefficient multiplication module 250 one by one. In addition, the multi-stage register delay module 280 also receives a flag zero _ flag indicating whether the input data is 0, each buffer 281 buffers the flag zero _ flag one by one and outputs the flag to the logarithmic function calculation module, and when the buffer flag zero _ flag indicates that the input data is 0, the logarithmic function calculation module directly sets the calculation result to 1. In some variations, the flag zero _ flag may not be used to flag the input data as 0, and when the input data is 0, it will be directlyInput data plus 1 to compute log in a logarithmic function computation module2NiProduct with input data (i.e. log)21*0)。
With the circuit configuration as shown in fig. 5, the present invention achieves the following advantages;
1) the control of a state machine is removed by adopting the segmentation and the shift of the assembly line, and the throughput capacity of data is greatly improved. The support for different image quantity blocks, different gray level numbers and different data sizes is ensured.
2) The calculation of data 0 is supported. The prior logarithmic function calculation circuit based on the optimized lookup table has a definition field of positive integers which are not 0. In the process of gray level statistics, the condition that a pixel point in a gray level is 0 exists, and the circuit structure in the patent increases judgment on input data and completes support on a natural number domain.
3) The overall design of pipoline is completed, and the throughput capacity is improved. Is suitable for the requirement of high-speed circuits. Due to the adoption of a lookup table logic, pipeline structure, the circuit structure can operate under a high-speed clock.
An embodiment of the present invention is described below with reference to fig. 6 to 8. FIG. 6 is a diagram illustrating an apparatus for computing image entropy in an auto-exposure, in accordance with a specific embodiment of the present invention. Fig. 7 is a diagram illustrating a gray scale distribution of each block region of an image according to an embodiment of the present invention. FIG. 8 illustrates entropy-characterizing values for block regions of an image according to a specific embodiment of the invention.
In the present embodiment, it is assumed that an image requiring the auto exposure entropy calculation is divided into 9 regions (9 blocks) in total, and the number of the gradation quantization levels per one block is 7. Each partition has 16 × 16 to 256 pixels, so that the data bit width M of the data input data _ in is log2256+1 ═ 9. Fig. 7 shows statistics of gray-scale pixels in the blocks.
The number of pixels on each gray scale in each block is used as data _ in to be input into the structure diagram shown in fig. 6, and data enable is valid at the same time. The Number 7(0 to 7 levels) representation completes the calculation of one block after 8 times of operation, and outputs the representation value of the entropy value of the block. The bit width and structure of data are determined according to the blocking case of the present embodiment, as shown in fig. 6 below.
The data judging and converting module 210 receives a data valid flag data _ valid indicating that data is valid, and input data _ in is 9 ' h00b (9-bit 16-ary, decimal value of 11), and since data is a non-zero integer and can be adapted to a calculation region of the method, output data of the data judging and converting module 210 is directly input data, data _ c is 9 ' h00b (9-bit 16-ary data), while an indication signal zero _ flag that data input is 0 is guaranteed to be 1 ' b0 (1-bit 2-ary data, 0).
The shift circuit module 220 receives the data _ c, and since the total bit width of the input data is greater than 8 bits and less than 16 bits, the 8-bit shift circuit module 221 in the shift circuit module 220 cannot be cancelled, but the number is reduced to 1. Since all data of data _ c except for the lower 8 bits are 0, 8-bit shift is not required, total shift amount total _ sh is 4 ' b0 (4-bit 2-system data), lower 8-bit remaining data sh _ left is 8 ' h0b (8-bit 16-system data), and look-up table input sh _ look is 4 ' b0 (4-bit 2-system data).
The shift circuit module 220 outputs total _ sh, sh _ left and sh _ look to the surplus bit data shift and shift accumulation circuit module 230, and performs shift and shift amount accumulation within 8 bits. Since sh _ left is 8' b0000_1011(8 bits 2 bits), when the data is shifted right by 3 bits overall, it can be guaranteed that all bits except the lowest bit are 0. Adding the shift quantity 3 into total _ sh, and outputting the total data shift quantity sh _ bits to be 4' h3 (4-bit 16-system data); the data shifted out right is shifted into the input register of the lookup table, and finally the output lok _ tab is 4' b0110(4 bits of 2-system data).
The surplus bit data shift and shift accumulation circuit module 230 outputs the lok _ tab and the sh _ bits to the lookup table and data concatenation circuit module 240, the lok _ tab inputs the lookup table (the input and output correspondence of the lookup table is shown in fig. 4), and outputs the corresponding lookup table result as 10' b01_1101_0110 (10-bit 2-ary data). The sh _ bits 4 'h 3(4 bits 16 data) is spliced to the high bit, and the logarithm function relative value is finally output, namely look _ o 14' b00_1101_1101_0110 14 'hDD 6 14'd 3542(14 bits 10 data).
When the Zero _ flag _ d3 (the Zero _ flag is registered in multiple stages) is 1 'b 1, the data _ mult 23' b0 is directly output without multiplication; when the zero _ flag _ d3 is not 0, the coefficient multiplication circuit 250 multiplies the outputs look-up table and data _ in _ d3(data _ i is registered via multiple stages) of the data concatenation circuit block 240 by the look-up table. Data _ in _ d3 is a multi-level registered value of Data _ in (same as the Data _ in value), and ensures that the input time point is the same as that of look _ o. Data _ hook _ o Data _ in _ d3 Data _ b 38962.
The accumulation module 260 accumulates and outputs the data _ mult according to the number. For block 1, the coefficient multiplication circuit 250 outputs 8 gray-scale valid data, and after 8 times of accumulation, outputs the sum of 8 groups of data as the entropy-value-representing value of the block, and reaches the next block. For block 1, the received 8 groups of data accumulation result is data _ o ═ 26'd 1619000.
The weight assignment module 270 ranks the received 9 sets of token values, and assigns weights according to the principle that the lower the value, the higher the weight. And finally, outputting the mean weight of each block for the operation of the overall exposure intensity.
Fig. 8 lists 72 sets of data _ mult output values for 9 blocks, and entropy-value-representing values for each block. According to the principle that the lower the entropy value of the blocks is, the higher the weight is, the weight distribution of each block is according to the conditions that the block 9> the block 5> the block 2> the block 3> the block 8> the block 7> the block 6> the block 1> the block 3.
It will be appreciated that due to computational accuracy issues, the weight ordering error between two tiles for which the thresholds are close is within the tolerance of the auto-exposure computation.
In fig. 5 and 6, the brackets in the signal transmission between the modules are the lowest order bits and the highest order bits of the transmission data.
The foregoing is merely an illustration of one or more embodiments of the invention, and various modifications are possible within the scope of the invention without departing from the spirit of the invention.
1) The control of a state machine is removed by adopting the segmentation and the shift of the assembly line, and the throughput capacity of data is greatly improved. The support for different image quantity blocks, different gray level numbers and different data sizes is ensured.
2) The calculation of data 0 is supported. The invention adds the judgment to the input data through the method and the circuit design, completes the support to the natural number domain, and can control the calculation of the subsequent logarithmic function when the data is 0.
3) Is suitable for the requirement of high-speed circuits. Due to the adoption of a lookup table logic and pipeline (pipeline) structure, the circuit structure can operate under a high-speed clock.
4) By adopting the optimized table look-up method, the mapping of the calculation domain is completed by methods such as segmented shift and the like while the characteristic of easy realization of the table look-up method is kept, thereby greatly reducing the table look-up and improving the calculation precision.
5) In the algorithmic computation scheme, unnecessary computations are eliminated. Because the purpose of the automatic exposure entropy calculation is only to distinguish the weight of each block, and the real value of the entropy of each block is not interested, the calculation data and the formula are reasonably changed and reduced on the basis of not changing the relative size relationship of the entropy of each block. That is, in the present invention, only the value of the logarithmic function with the base number of 2 is calculated, and this value is multiplied by only the input data in the multiplication operation.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.

Claims (8)

1. An apparatus for computing an image entropy value in an automatic exposure, comprising:
the logarithm function calculation module is used for calculating a logarithm function taking 2 as a base for input data and multiplying the calculation result by the input data to obtain a product value, wherein an image to be calculated is divided into A block regions, each block region has the same shape and the same number of pixel points, each block region has number-level gray level quantization levels, the number of the pixel points of each gray level quantization level in each block region serves as the input data of the logarithm function calculation module, and the total number of the number +1 input data in each block region is obtained;
the accumulation module is used for accumulating the product value of the number +1 input data of each block area to obtain the entropy value representation value of the block area;
the weight distribution module is used for distributing weights to the regions according to the entropy value representation values of the regions, wherein the lower the entropy value representation value is, the higher the distributed weight is, and the image exposure intensity is calculated according to the weight of each region; wherein,
the logarithm function calculation module comprises a data judgment and conversion module, a shift module, a lookup table, a data splicing circuit module and a coefficient multiplication module, wherein the data judgment and conversion module is used for receiving input data, judging whether the input data accord with a preset definition domain or not, if yes, converting the input data into M-bit binary data, M is a positive integer, the shift module is used for shifting the M-bit binary data to the right until the highest bit of the M-bit binary data is shifted to the 0 th bit, obtaining a total shift bit and n-bit data adjacent to the highest bit in the M-bit binary data to the right, and the binary bit width of the total shift bit is M, wherein n and M are integers, 2m-1<M≤2mThe lookup table and data splicing circuit module is used for splicing the total shift bit number to the upper m-bit signed integer part of the calculation result of the logarithmic function, expanding N-bit data to the lower N-bit signed decimal part of the calculation result of the logarithmic function according to the lookup table, and combining the integer part and the decimal part to obtain the m + N bits of the calculation result of the logarithmic function, wherein N is a positive integer, and the coefficient multiplication module is used for multiplying the input data by the calculation result of the logarithmic function to obtain the product value of each input data; wherein,
the shift module comprises a shift circuit module and a spare bit data shift and shift accumulation circuit module, wherein the shift circuit module comprises a plurality of q bit shift circuits, each shift circuit is used for shifting M bit binary data to the right by taking q bit as a unit, the shift circuit module is used for storing high n bits in the q bit shifted data as n bit first transmission data into a first register until all the other bits except the lowest q bits in the M bit binary data are 0, the lowest q bit data is taken as q bit second transmission data, a shift counter is used for acquiring a binary system of accumulated first shift bit numbers, wherein q is a positive integer, the bit width of the first register is more than or equal to n, the spare bit data shift and shift accumulation circuit module is used for shifting the second transmission data to the right by a second shift bit number to shift the highest bit to the 0bit, the shifted data is stored in the first register from high order to refresh the data in the first register, the refreshed data of the first register is used as the n-bit data, a binary system of a second shift bit and a binary system of a first shift bit are added to be used as a binary system of the total shift bit, wherein the bit width of the binary systems of the first shift bit and the second shift bit is m, and the bit width of the shift counter is more than or equal to m.
2. The apparatus for computing image entropy values in automatic exposures as recited in claim 1, further comprising:
the multi-stage register delay module comprises a plurality of buffers, receives input data and data validity marks, caches the input data and the data validity marks one by one in each buffer, and outputs the data validity marks to the logarithm function calculation module one by one as control signals.
3. An apparatus for image entropy calculation in automatic exposure as defined in claim 2, wherein the multi-level register delay module further receives a flag indicating whether the input data is 0, and each buffer buffers the flag one by one and outputs the flag to the logarithmic function calculation module.
4. An apparatus for image entropy calculation in automatic exposure as defined in claim 3, wherein the logarithmic function calculation module multiplies 1 by the input data to obtain the product value if the flag indicates that the input data is 0.
5. A method for calculating an image entropy value in an automatic exposure, comprising:
dividing an image to be calculated into A blocks of areas, wherein each block of area has the same shape and the same number of pixel points, and determining the number of gray quantization levels of each block of area;
taking the number of pixel points of each gray scale quantization level in each block region as input data, calculating a logarithm function with 2 as a base for each input data, and multiplying the calculation result by the input data to obtain a product value, wherein the total number of the input data is +1 in each block region; wherein,
judging whether the input data accord with a preset definition domain or not, if so, converting the input data into M-bit binary data, wherein M is a positive integer; right shifting M-bit binary data until the highest bit of the M-bit binary data is shifted to the 0 th bit, obtaining a total shift bit and n-bit data adjacent to the highest bit in the M-bit binary data to the right, wherein the binary bit width of the total shift bit is M, n and M are integers, 2m-1<M≤2m(ii) a Wherein,
the method comprises the steps that q bits are taken as a unit, M-bit binary data are shifted to the right, high n bits in the q-bit shifted-out data are taken as n-bit first transmission data and stored in a first register, all the other bits except the lowest q bits in the M-bit binary data are 0, the lowest q-bit data are taken as q-bit second transmission data, a shift counter is used for obtaining a binary system of accumulated first shift bits, wherein q is a positive integer, and the bit width of the first register is larger than or equal to n; right shifting second transmission data by a second shift digit to enable the highest digit to be shifted to the 0 th digit, storing the shifted data from the high digit into the n-digit register to refresh the data in the first register, taking the refreshed data of the first register as the n-digit data, and adding a binary system of the second shift digit and a binary system of a first shift digit to be used as a binary system of the total shift digit, wherein the bit widths of the binary systems of the first shift digit and the second shift digit are m, and the bit width of the shift counter is more than or equal to m;
splicing the total shift bit number to the upper m bits of the calculation result of the logarithmic function to characterize an integer part, expanding N bits of data to the lower N bits of the calculation result of the logarithmic function to characterize a decimal part according to a lookup table, and combining the integer part and the decimal part to obtain the total m + N bits of the calculation result of the logarithmic function, wherein N is a positive integer; multiplying the input data by the result of the calculation of the logarithmic function to obtain a product value for each input data;
for each block area, accumulating the product value of the number +1 input data of the block area to obtain the entropy value representation value of each block area;
distributing weights to the regions according to the entropy value representation value of each region, wherein the lower the entropy value representation value is, the higher the distributed weight is;
and calculating the image exposure intensity according to the weight of each region.
6. The method for image entropy calculation in automatic exposure of claim 5, wherein the number of pixels per block area is B, and M is log2B+1,log2B is a positive integer.
7. A method of calculating image entropy values for use in automatic exposures as claimed in claim 5, where q is 8.
8. A method for image entropy calculation in automatic exposure as defined in claim 5, wherein the predetermined domain is an integer equal to or greater than 0, and the step of determining whether the input data conforms to the predetermined domain comprises:
judging whether the input data is equal to 0;
if the input data is equal to 0, making the calculation result of the logarithmic function be 1;
and if the input data is larger than 0, calculating a logarithmic function with the base 2 for the input data.
CN201711291996.6A 2017-12-08 2017-12-08 Method and device for calculating image entropy value in automatic exposure Active CN108109166B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711291996.6A CN108109166B (en) 2017-12-08 2017-12-08 Method and device for calculating image entropy value in automatic exposure

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711291996.6A CN108109166B (en) 2017-12-08 2017-12-08 Method and device for calculating image entropy value in automatic exposure

Publications (2)

Publication Number Publication Date
CN108109166A CN108109166A (en) 2018-06-01
CN108109166B true CN108109166B (en) 2022-03-29

Family

ID=62208191

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711291996.6A Active CN108109166B (en) 2017-12-08 2017-12-08 Method and device for calculating image entropy value in automatic exposure

Country Status (1)

Country Link
CN (1) CN108109166B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111479070B (en) * 2019-01-24 2022-02-01 杭州海康机器人技术有限公司 Image brightness determination method, device and equipment
CN110312083B (en) * 2019-08-28 2020-03-06 朱红雷 Self-cruise adjusting device and method for automatic exposure and hardware accelerator
CN110602414B (en) * 2019-09-19 2021-04-27 天地伟业技术有限公司 Camera automatic exposure method based on ambient brightness and image information entropy
CN110519527A (en) * 2019-09-19 2019-11-29 天津英田视讯科技有限公司 A kind of camera auto exposure parameter generation method based on image big data

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101008764A (en) * 2006-01-26 2007-08-01 致伸科技股份有限公司 Automatic exposure measuring method
KR20070105028A (en) * 2006-04-25 2007-10-30 한국전기연구원 Apparatus for processing image signal

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7565071B2 (en) * 2006-01-12 2009-07-21 Primax Electronics Ltd. Metering method of automatic exposure

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101008764A (en) * 2006-01-26 2007-08-01 致伸科技股份有限公司 Automatic exposure measuring method
KR20070105028A (en) * 2006-04-25 2007-10-30 한국전기연구원 Apparatus for processing image signal

Non-Patent Citations (5)

* Cited by examiner, † Cited by third party
Title
A Novel Method to Increase LinLog CMOS Sensors’ Performance in High Dynamic Range Scenarios;Antonio Martnez-Snchez等;《Sensors》;20110829;全文 *
关于log2x的快速计算;任二民;《计算机工程与应用》;19950228;全文 *
基于FPGA的数字相机自动曝光技术研究;仵宗钦;《中国优秀硕士学位论文全文数据库信息科技辑》;20170315;全文 *
基于图像熵的自动曝光设计;行长印等;《长春理工大学学报(自然科学版)》;20090315(第01期);全文 *
基于图像熵的高动态范围场景的自动曝光算法;杨作廷等;《光子学报》;20130615(第06期);全文 *

Also Published As

Publication number Publication date
CN108109166A (en) 2018-06-01

Similar Documents

Publication Publication Date Title
CN108109166B (en) Method and device for calculating image entropy value in automatic exposure
CN110070178B (en) Convolutional neural network computing device and method
US7577699B2 (en) Apparatus and method for reducing precision of data
US11249721B2 (en) Multiplication circuit, system on chip, and electronic device
CN108228136B (en) Logarithmic function calculation method and device based on optimization lookup table method
CN110852416A (en) CNN accelerated computing method and system based on low-precision floating-point data expression form
US20120030203A1 (en) Method for establishing multiple look-up tables and data acquisition method using multiple look-up tables
US20210064341A1 (en) Curve function device and operation method thereof
CN109165006B (en) Design optimization and hardware implementation method and system of Softmax function
CN114223137A (en) Flexible Huffman tree approximation for low-latency coding
CN108322749A (en) The coefficient optimization method of RDOQ, the accelerating method and device of RDOQ
KR980003999A (en) Histogram equalization circuit based on CDF computation domain and its method
CN110889080B (en) Multiply-accumulate operation device, multiply-accumulate operation method and system
WO2020100393A1 (en) Neural network processing device, neural network processing method, and neural network processing program
CN112199072B (en) Data processing method, device and equipment based on neural network layer
US20060220932A1 (en) Signal processing apparatus, signal processing method, and noise reducing apparatus
JP4279626B2 (en) Remainder calculation system, scaling calculator, scaling calculation method, program thereof and recording medium
CN116186473A (en) Data conversion method, device and storage medium
CN112967208A (en) Image processing method and device, electronic equipment and storage medium
US5960122A (en) Method of and apparatus for processing digital image data
CN108174114B (en) Entropy calculation device and entropy calculation method
EP1107090A1 (en) First order interpolation with input value interval detection
US8316249B2 (en) Variable scaling for computing elements
JP2846816B2 (en) Digital signal processor
US7165086B2 (en) System, method, and apparatus for division coupled with rounding of signed binary numbers

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