CN114845042A - Camera automatic focusing method based on image information entropy - Google Patents
Camera automatic focusing method based on image information entropy Download PDFInfo
- Publication number
- CN114845042A CN114845042A CN202210249149.8A CN202210249149A CN114845042A CN 114845042 A CN114845042 A CN 114845042A CN 202210249149 A CN202210249149 A CN 202210249149A CN 114845042 A CN114845042 A CN 114845042A
- Authority
- CN
- China
- Prior art keywords
- image
- information entropy
- pixels
- camera
- entropy
- 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.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 26
- 238000012545 processing Methods 0.000 claims description 2
- 238000004364 calculation method Methods 0.000 abstract description 25
- 239000000470 constituent Substances 0.000 abstract 1
- 238000010586 diagram Methods 0.000 description 3
- 238000005259 measurement Methods 0.000 description 3
- 208000032170 Congenital Abnormalities Diseases 0.000 description 1
- 238000012512 characterization method Methods 0.000 description 1
- 238000007796 conventional method Methods 0.000 description 1
- 238000000691 measurement method Methods 0.000 description 1
- XLYOFNOQVPJJNP-UHFFFAOYSA-N water Substances O XLYOFNOQVPJJNP-UHFFFAOYSA-N 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N23/00—Cameras or camera modules comprising electronic image sensors; Control thereof
- H04N23/60—Control of cameras or camera modules
- H04N23/67—Focus control based on electronic image sensor signals
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/0002—Inspection of images, e.g. flaw detection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/30—Subject of image; Context of image processing
- G06T2207/30168—Image quality inspection
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Quality & Reliability (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Focusing (AREA)
- Automatic Focus Adjustment (AREA)
Abstract
The invention discloses a camera automatic focusing method based on image information entropy. The method comprises the following steps: calculating the information entropy of the image aiming at the image of the camera in the real-time view, and automatically adjusting the focal length by the camera according to the calculated information entropy data to obtain the focusing distance; fitting a curve according to the focusing distance and the calculated information entropy data to obtain a maximum fitting value of the information entropy; continuously calculating the information entropy of the image in real time, and when the real-time image information entropy at a certain moment is equal to the maximum fitting value of the information entropy, keeping the camera in a focusing state and stopping focusing; otherwise, the camera continues to automatically focus. The image information entropy calculation method provided by the invention can be used for calculating the image information entropy aiming at the gray level image and distinguishing different images, and compared with the traditional Shannon entropy calculation method which only can distinguish the constituent proportion of pixels with different gray level values of the image, the image information entropy calculation method provided by the invention has more advantages in distinguishing the image structure information.
Description
Technical Field
The invention relates to a camera automatic focusing method based on image information entropy, and belongs to the field of camera automatic focusing.
Background
The current main focusing methods of cameras are divided into manual focusing and automatic focusing. The manual focusing depends on the operation ability of the photographing subject, and the precision is low. The automatic focusing mainly comprises single automatic focusing and continuous automatic focusing, wherein the single automatic focusing is performed after the shutter is pressed for focusing by half to the shutter is pressed for photographing completely, and if a scene changes, a photographed picture can be out of focus and blurred; continuous auto-focus requires the designation of the target to follow the focus and does not clearly capture the scene as a whole.
The entropy of image information is a characterization method for describing the amount of information carried by an image. When a picture is in a quasi-focus state, namely the definition is the highest, the information transmitted to the picture is the most, namely the information entropy is the largest; when the picture is out of focus and blurred, enough information cannot be obtained from the picture, namely, the information entropy is small. Since the information entropy is a numerical representation, the description precision is high.
The most popular and widely accepted image measurement method at present is the entropy proposed by shannon in 1948, commonly referred to as shannon entropy. The calculation formula of the Shannon entropy is
In the image, i corresponds to the pixel gray value, P (x) i ) The proportion of the number of pixels corresponding to the gray value i to the total number of pixels of the image. Since shannon entropy was originally proposed on the basis of the condition that two channels do not interfere with each other in communications, and is calculated on the basis of the probability distribution of the components of a data set, it is a measure of statistical information, and depends only on the composition of the data set, and cannot characterize structural information of the data, and is stored on images used for possible correlations between pixelsPrior to the congenital defect. Therefore, the Shannon entropy-based image information entropy calculation method has no wide applicability in representing image structure information.
Disclosure of Invention
In view of the above drawbacks in the prior art, an object of the present invention is to provide an auto-focusing method for a camera based on image information entropy.
The technical scheme of the invention is as follows:
a camera automatic focusing method based on image information entropy comprises the following steps:
calculating the information entropy of the image aiming at the image of the camera in the real-time view, and automatically adjusting the focal length by the camera according to the calculated information entropy data to obtain the focusing distance;
fitting a curve according to the focusing distance and the calculated information entropy data to obtain a maximum fitting value of the information entropy;
continuously calculating the information entropy of the image in real time, and when the real-time image information entropy at a certain moment is equal to the maximum fitting value of the information entropy, keeping the camera in a focusing state and stopping focusing; otherwise, the camera continues to automatically focus.
Further, when calculating the information entropy of the image, for each pixel in the image, a neighborhood of 3 × 3 size with the current pixel as the center is considered, if a pixel which has a difference of more than 8 gray values from the current pixel exists in the neighborhood, the current pixel is regarded as an effective pixel, and the number i of the pixels which have a difference of more than 8 gray values from the current pixel in the neighborhood is recorded, wherein the value of i is 1-8.
Further, when calculating the information entropy of the image, after all pixels are processed, all effective pixels meeting the conditions are found and the number n of pixels respectively corresponding to the condition that i is 1 to 8 is further obtained i Then, the information entropy of the image is calculated by the following formula:
wherein, P (x) i )=n i The number of pixels of each i value corresponding to/N occupies the graphProportion of the total number of pixels, where n i N is the total number of image pixels.
Further, when calculating the information entropy of the image, a circle of padding is printed on the outermost periphery of the image, and the printed padding value is the gray level average value of all pixels of the image.
The image information entropy calculation method provided by the invention can be used for calculating the image information entropy aiming at the gray level image and distinguishing different images, and compared with the traditional Shannon entropy calculation method which only can distinguish the component proportion of different gray level pixels of the image, the calculation method provided by the invention has more advantages in distinguishing the image structure information. Therefore, compared with the traditional camera automatic focusing method, the camera automatic focusing method based on the calculation method is simpler and more effective.
Drawings
FIG. 1 is a flow chart of the calculation of entropy of image information according to the present invention;
FIG. 2 is a diagram illustrating a 3 × 3 neighborhood of pixels in an embodiment of the present invention;
FIG. 3 is a graph showing two graphs having the same gray distribution in the embodiment of the present invention, (a) is a noise graph, and (b) is a graph with a structure;
FIG. 4 is a diagram of two exemplary embodiments of the present invention, both 256 × 256 (a) with more ordered structures and (b) with less ordered structures;
fig. 5 shows two pictures with sizes of 512 × 512 in the embodiment of the present invention, (a) is a quasi-focus picture, and (b) is an out-of-focus picture.
Detailed Description
Fig. 1 is a flow of a method for calculating an entropy of image information according to an embodiment of the present invention. For each pixel in an image, a neighborhood with the size of 3 × 3 (which is the minimum neighborhood and the calculation result is the most accurate) with the pixel as the center is considered, if a pixel with the gray value difference of more than 8 from the pixel exists in the neighborhood, the pixel is regarded as an effective pixel, and the number i (1-8) of the pixels with the gray value difference of more than 8 from the pixel in the neighborhood is recorded. In order to make all pixels of the image processed by the image information entropy calculation method (make the pixels of the outermost circle of the image obtain a neighborhood with a size of 3 × 3), the image is padded by one circle, and in order to make the error as small as possible, the padded value is padded to be the gray level mean value of all pixels of the image. However, the conventional method usually compensates for one circle of 0, but the gray value of the pixel is a positive value, and this method of compensating for 0 will cause an error in the processing result of the edge pixel.
After all the pixels are processed, all the effective pixels meeting the conditions are found, and the number n of the pixels corresponding to the pixels with the i of 1 to 8 is further obtained i . The entropy of the image information is calculated again using the following formula:
wherein i corresponds to the number of pixels in the 3 x 3 neighborhood of the active pixel that differ from the center pixel by more than 8 gray values, P (x) i )=n i N is the ratio of the number of i-value pixels to the total number of image pixels, where N i I number of valid pixels and N is the total number of image pixels. Compared with a Shannon entropy formula, the method increases a scale factor during calculation: the calculation formula can better quantify the structural difference of different images because the pixel number i is related to structural information in the neighborhood of the pixel.
The pseudo code of the calculation method is as follows:
fig. 2 is a schematic diagram of a 3 × 3 neighborhood of a certain pixel in an image according to an embodiment, where a circle is circled to be a central pixel, and for the central pixel, 6 pixels (smiling face labels) in the 3 × 3 neighborhood are different from the central pixel by more than 8 gray-scale values, so that the corresponding i value of the pixel is 6, and the corresponding n value is n 6 The value is increased by 1.
In order to verify the effectiveness of the image information entropy calculation method of the present invention, the following is to compare results of different methods.
1. As shown in fig. 3, two images having the same size of 512 × 512 and the same gray-scale value distribution but different image space structures are used as measurement targets. If the Shannon entropy formula is used for calculation, the entropy calculation results of the two images are both 7.7212. By adopting the method of the invention, the result of the information entropy calculated by the graph (a) is 10.9015, and the result of the information entropy calculated by the graph (b) is 0.1566, so that the method of the invention can effectively distinguish the two images with the same Shannon entropy, and the calculated information entropy is correspondingly larger for the graph (a) with obviously more disordered structure.
2. As shown in fig. 4, two images each having a size of 256 × 256 are used as measurement targets. If the Shannon entropy formula is used for calculation, the information entropy result calculated by the graph (a) is 7.0115, and the information entropy result calculated by the graph (b) is 7.0097, so that the difference between the two images cannot be well represented by comparing the two digital Shannon entropy calculation methods. If the method of the present invention is adopted, the result of the information entropy calculated by the graph (a) is 9.8632, and the result of the information entropy calculated by the graph (b) is 8.2224, it can be seen that the difference between the two images can be better reflected by the calculation method of the present invention compared with the shannon entropy.
Based on the above image information entropy calculation method, as shown in fig. 5, in this embodiment, two images with the size of 512 × 512 are used as measurement objects, and the correctness of the method of the present invention in the application of the quasi-focal water balance amount of the image is verified. Wherein, the picture (a) is an in-focus picture, and the picture (b) is a corresponding out-of-focus picture. By adopting the method of the invention, the result of the information entropy calculated by the graph (a) is 6.9166, and the result of the information entropy calculated by the graph (b) is 4.1545, and the information entropy of the focusing picture is larger than that of the defocusing picture, thereby meeting the theoretical requirement. When the shannon entropy formula is used for calculation, the information entropy result calculated by the graph (a) is 7.4472, and the difference cannot be basically distinguished by the graph (b) being 7.3965.
Therefore, when the method is applied to the focusing process of the camera, the real-time information entropy calculation is carried out on the shot image by using the calculation method, meanwhile, the camera continuously and automatically adjusts the focal length according to the information entropy, and the maximum fitting value of the information entropy is obtained by using the calculated information entropy and the focusing distance fitting curve. When the information entropy calculated in real time is equal to the maximum fitting value of the fitted information entropy in the shooting process, the definition of the picture is considered to be the highest, and the camera is in a focus-in state, so that automatic focusing is realized.
Claims (4)
1. A camera automatic focusing method based on image information entropy is characterized by comprising the following steps:
calculating the information entropy of the image aiming at the image of the camera in the real-time view, and automatically adjusting the focal length by the camera according to the calculated information entropy data to obtain the focusing distance;
fitting a curve according to the focusing distance and the calculated information entropy data to obtain a maximum fitting value of the information entropy;
continuously calculating the information entropy of the image in real time, and when the real-time image information entropy at a certain moment is equal to the maximum fitting value of the information entropy, keeping the camera in a focusing state and stopping focusing; otherwise, the camera continues to automatically focus.
2. The method as claimed in claim 1, wherein in calculating the information entropy of the image, a neighborhood of 3 × 3 size centered on the current pixel is considered for each pixel in the image, if there are pixels in the neighborhood that differ from the current pixel by more than 8 gray values, the current pixel is considered as an effective pixel, and the number i of pixels in the neighborhood that differ from the gray value of the current pixel by more than 8 gray values is recorded, and the value of i is 1-8.
3. The method according to claim 2, wherein when calculating the entropy of the image information, after processing all pixels, finding all valid pixels satisfying the condition and further obtaining the number n of pixels respectively corresponding to i from 1 to 8 i Then, the information entropy of the image is calculated by the following formula:
wherein, P (x) i )=n i N is the ratio of the number of i-value pixels to the total number of image pixels, where N i N is the total number of image pixels.
4. A camera automatic focusing method based on image information entropy as claimed in claim 1, wherein when calculating the information entropy of the image, a padding is applied to the outermost periphery of the image, and the padded value is the average of the gray levels of all pixels of the image.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210249149.8A CN114845042B (en) | 2022-03-14 | 2022-03-14 | Camera automatic focusing method based on image information entropy |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210249149.8A CN114845042B (en) | 2022-03-14 | 2022-03-14 | Camera automatic focusing method based on image information entropy |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114845042A true CN114845042A (en) | 2022-08-02 |
CN114845042B CN114845042B (en) | 2023-03-10 |
Family
ID=82562340
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210249149.8A Active CN114845042B (en) | 2022-03-14 | 2022-03-14 | Camera automatic focusing method based on image information entropy |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114845042B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117221736A (en) * | 2023-11-09 | 2023-12-12 | 成都中轨轨道设备有限公司 | Automatic regulating AI camera system for low-illumination clear collection |
Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH05300421A (en) * | 1992-04-17 | 1993-11-12 | Mitsubishi Electric Corp | Automatic focusing device |
CN103237173A (en) * | 2013-04-28 | 2013-08-07 | 中国空间技术研究院 | Adaptive quick focusing device and method for optical camera |
CN203241676U (en) * | 2013-04-28 | 2013-10-16 | 中国空间技术研究院 | Self-adapting rapid focusing device of optical camera |
CN105607218A (en) * | 2015-08-24 | 2016-05-25 | 闽南师范大学 | Image auto-focusing method measurement data transmission device and method based on fuzzy entropy |
CN110288618A (en) * | 2019-04-24 | 2019-09-27 | 广东工业大学 | A kind of Segmentation of Multi-target method of uneven illumination image |
CN111145125A (en) * | 2019-12-30 | 2020-05-12 | 南京信息工程大学 | Image denoising method based on residual learning and convolutional neural network |
CN112465846A (en) * | 2020-11-26 | 2021-03-09 | 西安电子科技大学 | Cloud-containing remote sensing image compression method based on filling strategy |
CN112526705A (en) * | 2020-12-07 | 2021-03-19 | 中国科学院长春光学精密机械与物理研究所 | On-orbit self-adaptive focusing method, device, equipment and medium for optical load of spacecraft |
CN113391644A (en) * | 2021-06-11 | 2021-09-14 | 中新国际联合研究院 | Unmanned aerial vehicle shooting distance semi-automatic optimization method based on image information entropy |
CN113794828A (en) * | 2021-07-27 | 2021-12-14 | 广西电网有限责任公司电力科学研究院 | Automatic focusing method and system |
-
2022
- 2022-03-14 CN CN202210249149.8A patent/CN114845042B/en active Active
Patent Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH05300421A (en) * | 1992-04-17 | 1993-11-12 | Mitsubishi Electric Corp | Automatic focusing device |
CN103237173A (en) * | 2013-04-28 | 2013-08-07 | 中国空间技术研究院 | Adaptive quick focusing device and method for optical camera |
CN203241676U (en) * | 2013-04-28 | 2013-10-16 | 中国空间技术研究院 | Self-adapting rapid focusing device of optical camera |
CN105607218A (en) * | 2015-08-24 | 2016-05-25 | 闽南师范大学 | Image auto-focusing method measurement data transmission device and method based on fuzzy entropy |
CN110288618A (en) * | 2019-04-24 | 2019-09-27 | 广东工业大学 | A kind of Segmentation of Multi-target method of uneven illumination image |
CN111145125A (en) * | 2019-12-30 | 2020-05-12 | 南京信息工程大学 | Image denoising method based on residual learning and convolutional neural network |
CN112465846A (en) * | 2020-11-26 | 2021-03-09 | 西安电子科技大学 | Cloud-containing remote sensing image compression method based on filling strategy |
CN112526705A (en) * | 2020-12-07 | 2021-03-19 | 中国科学院长春光学精密机械与物理研究所 | On-orbit self-adaptive focusing method, device, equipment and medium for optical load of spacecraft |
CN113391644A (en) * | 2021-06-11 | 2021-09-14 | 中新国际联合研究院 | Unmanned aerial vehicle shooting distance semi-automatic optimization method based on image information entropy |
CN113794828A (en) * | 2021-07-27 | 2021-12-14 | 广西电网有限责任公司电力科学研究院 | Automatic focusing method and system |
Non-Patent Citations (1)
Title |
---|
朱铮涛等: "基于图像熵的自动聚焦函数研究", 《光学精密工程》 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117221736A (en) * | 2023-11-09 | 2023-12-12 | 成都中轨轨道设备有限公司 | Automatic regulating AI camera system for low-illumination clear collection |
CN117221736B (en) * | 2023-11-09 | 2024-01-26 | 成都中轨轨道设备有限公司 | Automatic regulating AI camera system for low-illumination clear collection |
Also Published As
Publication number | Publication date |
---|---|
CN114845042B (en) | 2023-03-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111028189B (en) | Image processing method, device, storage medium and electronic equipment | |
WO2019085603A1 (en) | Method for image-processing and mobile terminal using dual cameras | |
US9019426B2 (en) | Method of generating image data by an image device including a plurality of lenses and apparatus for generating image data | |
US9288392B2 (en) | Image capturing device capable of blending images and image processing method for blending images thereof | |
US8493464B2 (en) | Resolution adjusting method | |
JP4364078B2 (en) | Imaging method and imaging apparatus | |
CN107948520A (en) | Image processing method and device | |
US8294785B2 (en) | Method for adjusting photosensitiveness of digital camera | |
US20150195482A1 (en) | Method, system and smartphone that chooses optimal image to reduce shutter shake | |
US20110069190A1 (en) | Fast focusing method for digital camera | |
CN104205800B (en) | Picture pick-up device | |
CN110533618B (en) | Lens distortion correction method and photographic device | |
JP2012058352A (en) | Focus adjustment device and imaging device | |
CN114845042B (en) | Camera automatic focusing method based on image information entropy | |
CN111405185B (en) | Zoom control method and device for camera, electronic equipment and storage medium | |
CN113099135A (en) | Infrared image focusing, terminal device and computer readable storage medium | |
RU2389050C1 (en) | Automatic focusing method | |
CN103167226B (en) | Produce method and the device of panoramic deep image | |
CN113391644A (en) | Unmanned aerial vehicle shooting distance semi-automatic optimization method based on image information entropy | |
US8102464B2 (en) | Automatic focusing method in high-noise environment and digital imaging device using the same | |
CN111199536A (en) | Focus evaluation method and device | |
CN109257540B (en) | Photographing correction method of multi-photographing lens group and photographing device | |
US9262833B2 (en) | Methodology for performing depth estimation with defocused images under extreme lighting conditions | |
US10475162B2 (en) | Image processing device, method, and storage medium for gamma correction based on illuminance | |
CN110930440B (en) | Image alignment method, device, storage medium and electronic equipment |
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 |