Image Recognition Method, System, Electronic Device, and Storage Medium

By analyzing the ambient brightness and pixel point grayscale information of the image, a grayscale histogram is generated, pixel areas are divided, and exposure brightness is adjusted to adapt to different scenes, the problem of image recognition being greatly affected by environmental factors is solved and the recognition success rate is improved.

CN116645527BActive Publication Date: 2025-07-18HANGZHOU MOREDIAN TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310465327.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-24
Publication Date
2025-07-18
Estimated Expiration
2043-04-24

AI Technical Summary

Technical Problem

Image recognition technology is greatly affected by environmental factors, resulting in a low recognition success rate.

Method used

By obtaining the environmental brightness, default exposure brightness and pixel point grayscale information of the current frame image, a grayscale histogram is generated, a pixel area distribution map is divided, scene judgment parameters are determined, preset optimization brightness table is matched, and the target exposure brightness is adjusted to optimize image exposure and improve the recognition success rate.

Benefits of technology

Without relying on hardware, adapting to multiple scenarios will improve the success rate of image recognition and optimize image quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116645527B_ABST
    Figure CN116645527B_ABST
Patent Text Reader

Abstract

The present application relates to an image recognition method, which includes: obtaining a pixel area distribution map according to the gray-scale information of pixel points in the current frame image, determining a scene judgment parameter through the pixel area distribution map, matching the scene judgment parameter and the environmental brightness with a preset optimized brightness table to obtain an optimized exposure brightness adapted to the current scene, comparing the optimized exposure brightness with the default exposure brightness to determine the target exposure brightness, optimizing the next frame of image with the target exposure brightness, and recognizing the next frame of image. This solves the problem that image recognition is greatly affected by environmental factors, resulting in a low recognition success rate. By combining exposure information and gray-scale information of pixel points to analyze the scene where the target object is located, an optimized exposure brightness is adapted according to the analysis result, and the next frame of image is captured and recognized with the optimized exposure brightness, thereby improving the success rate of image recognition. This method does not rely on hardware and is applicable to all scenes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence, and in particular, to an image recognition method, system, electronic device, and storage medium. Background Art

[0002] With the rapid development of the field of artificial intelligence, the application of image recognition technology has become more and more extensive. However, the effect of image recognition is greatly affected by environmental factors (such as front light, backlight, indoor, outdoor, etc.). For example, in a backlight environment, the captured image will show a white background area and a dark recognition object area, resulting in inaccurate recognition.

[0003] In related technologies, the methods for image quality optimization mainly include the following several kinds:

[0004] 1. Optimize the image through the wide dynamic range function. Among them, the wide dynamic range function obtains two images by exposing twice at the same time (once fast and once slow), and then synthesizes the two images to obtain an image that can distinguish the dark area and the bright area. However, this function depends on hardware implementation and cannot be implemented on all devices;

[0005] 2. Optimize the image through the backlight compensation function. The backlight compensation function divides the image into several different regions, and then exposes each region separately. By improving the exposure amount, the brightness difference between the background and the subject is reduced, thereby realizing the optimization of the image. However, the backlight compensation function only optimizes the backlight scene and cannot improve other scenes (such as front light, multiple light sources, etc.);

[0006] 3. Judge the scene based on the deep learning algorithm, and adjust the camera exposure parameters according to the scene information to obtain an optimized image. This type of method requires the introduction of an algorithm library, and the algorithm training takes a long time. For a system with limited resources, introducing an algorithm library undoubtedly increases the system burden.

[0007] Currently, for the problem that image recognition in related technologies is greatly affected by environmental factors, resulting in a low recognition success rate, no effective solution has been proposed. Summary of the Invention

[0008] Embodiments of this application provide an image recognition method, system, electronic device, and storage medium to at least solve the problem that image recognition in related technologies is greatly affected by environmental factors, resulting in a low recognition success rate.

[0009] In a first aspect, an embodiment of this application provides an image recognition method, and the method includes:

[0010] Obtain the environmental brightness, default exposure brightness, and pixel point gray level information of the current frame image;

[0011] Generate a grayscale histogram based on the grayscale information of the pixel points, divide the grayscale histogram into regions to obtain a pixel region distribution map, and determine a first scene judgment parameter and a second scene judgment parameter according to the pixel region distribution map;

[0012] Match the first scene judgment parameter, the second scene judgment parameter, and the environmental brightness with a preset optimized brightness table to obtain an optimized exposure brightness, where the preset optimized brightness table stores the exposure brightness matched with the real scene;

[0013] Determine a target exposure brightness according to the optimized exposure brightness and the default exposure brightness;

[0014] Obtain the next frame of image through the target exposure brightness and recognize the next frame of image.

[0015] In some embodiments, generating a grayscale histogram based on the grayscale information of the pixel points and dividing the grayscale histogram into regions to obtain a pixel region distribution map includes:

[0016] Obtain the number of pixel points corresponding to each grayscale value in the current frame of image through the grayscale information of the pixel points;

[0017] Generate a grayscale histogram according to the number of pixel points corresponding to each grayscale value;

[0018] Divide the grayscale histogram into regions according to a preset grayscale partitioning condition to obtain the pixel region distribution map, where the pixel region distribution map includes a first pixel region, a second pixel region, and a third pixel region.

[0019] In some embodiments, determining a first scene judgment parameter and a second scene judgment parameter according to the pixel region distribution map includes:

[0020] Determine the central pixel points of each pixel region according to the pixel region distribution map;

[0021] Obtain the central grayscale values of each pixel region according to the central pixel points of each pixel region;

[0022] Determine the first scene judgment parameter and the second scene judgment parameter through the central grayscale values of each pixel region.

[0023] In some embodiments, the first scene judgment parameter is determined by the following formula:

[0024] BD = m3 - m1

[0025] where BD is the first scene judgment parameter, m1 is the central grayscale value corresponding to the first pixel region, and m3 is the central grayscale value corresponding to the third pixel region;

[0026] The second scene judgment parameter is determined by the following formula:

[0027]

[0028] Wherein, MBE is the second scene judgment parameter, m1 is the central gray value corresponding to the first pixel region, m2 is the central gray value corresponding to the second pixel region, and m3 is the central gray value corresponding to the third pixel region.

[0029] In some embodiments, the matching the first scene judgment parameter, the second scene judgment parameter, and the ambient brightness with a preset optimized brightness table to obtain an optimized exposure brightness includes:

[0030] Searching the preset optimized brightness table according to the first scene judgment parameter, the second scene judgment parameter, and the ambient brightness to obtain N matching exposure brightnesses;

[0031] According to the matching exposure brightnesses, obtaining the optimized exposure brightness through a linear interpolation algorithm.

[0032] In some embodiments, the determining the target exposure brightness according to the optimized exposure brightness and the default exposure brightness includes:

[0033] Obtaining the absolute difference between the default exposure brightness and the optimized exposure brightness,

[0034] When the absolute difference is greater than a preset brightness change threshold, setting the target exposure brightness to the optimized exposure brightness,

[0035] When the absolute difference is less than or equal to the preset brightness change threshold, setting the target exposure brightness to the default exposure brightness.

[0036] In a second aspect, an embodiment of the present application provides an image recognition system, the system includes: an information acquisition module, a parameter determination module, a brightness matching module, a brightness adjustment module, and an identification module:

[0037] The information acquisition module is configured to acquire the ambient brightness, the default exposure brightness, and the pixel point gray information of the current frame image;

[0038] The parameter determination module is configured to generate a gray histogram according to the pixel point gray information, perform region division on the gray histogram to obtain a pixel region distribution map, and determine a first scene judgment parameter and a second scene judgment parameter according to the pixel region distribution map;

[0039] The brightness matching module is configured to match the first scene determination parameter, the second scene determination parameter, and the ambient brightness with a preset optimized brightness table to obtain an optimized exposure brightness, where the preset optimized brightness table stores exposure brightnesses matched with real scenes;

[0040] The brightness adjustment module is configured to determine a target exposure brightness according to the optimized exposure brightness and the default exposure brightness;

[0041] The recognition module is configured to obtain a next frame of image through the target exposure brightness and recognize the next frame of image.

[0042] In some embodiments, the parameter determination module is further configured to obtain the number of pixels corresponding to each gray value in the current frame of image according to the pixel gray information, generate a gray histogram according to the number of pixels corresponding to each gray value, and perform region division on the gray histogram according to preset gray partition conditions to obtain the pixel region distribution map, where the pixel region distribution map includes a first pixel region, a second pixel region, and a third pixel region.

[0043] In a third aspect, an embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, where when the processor executes the computer program, the image recognition method as described in the first aspect above is implemented.

[0044] In a fourth aspect, an embodiment of the present application provides a storage medium, on which a computer program is stored, and when the program is executed by a processor, the image recognition method as described in the first aspect above is implemented.

[0045] Compared with the related art, the image recognition method provided by the embodiment of the present application obtains a pixel region distribution map through the pixel gray information of the current frame of image, determines a scene determination parameter according to the pixel region distribution map, matches the scene determination parameter and the ambient brightness with a preset optimized brightness table to obtain an optimized exposure brightness adapted to the current scene, compares the optimized exposure brightness with the default exposure brightness to determine a target exposure brightness, optimizes the next frame of image through the target exposure brightness, and recognizes the next frame of image. It solves the problem that image recognition is greatly affected by environmental factors, resulting in a low recognition success rate. By combining exposure information and pixel gray information to analyze the scene where the target object is located, a relatively optimal target exposure brightness is adapted according to the analysis result, and an image is captured and recognized through the target exposure brightness, improving the success rate of image recognition. This method does not depend on hardware and is applicable to all scenes. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] The accompanying drawings described herein are used to provide a further understanding of the present application and form a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and shall not be construed as an undue limitation of the present application. In the drawings:

[0047] Figure 1 is a schematic diagram of the application environment of the image recognition method according to an embodiment of the present application;

[0048] Figure 2 is a flowchart of the image recognition method according to an embodiment of the present application;

[0049] Figure 3 is a grayscale histogram according to an embodiment of the present application;

[0050] Figure 4 is a pixel area distribution diagram according to an embodiment of the present application;

[0051] Figure 5 is a flowchart of an image exposure brightness setting method according to an embodiment of the present application;

[0052] Figure 6 is a structural block diagram of image recognition according to an embodiment of the present application;

[0053] Figure 7 is a schematic internal structure diagram of an electronic device according to an embodiment of the present application. Detailed implementation manners

[0054] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be described and explained below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application. Based on the embodiments provided in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present application.

[0055] Obviously, the accompanying drawings in the following description are only some examples or embodiments of the present application. For those of ordinary skill in the art, without creative efforts, the present application can also be applied to other similar scenarios based on these drawings. In addition, it can also be understood that although the efforts made in this development process may be complex and lengthy, for those of ordinary skill in the art related to the content disclosed in the present application, some design, manufacturing or production changes based on the technical content disclosed in the present application are only conventional technical means and should not be understood as the content disclosed in the present application being insufficient.

[0056] References to "embodiments" in this application mean that the specific features, structures, or characteristics described in connection with the embodiments can be included in at least one embodiment of this application. The phrase appears in various places in the specification and does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment mutually exclusive with other embodiments. It is explicitly and implicitly understood by those of ordinary skill in the art that the embodiments described in this application can be combined with other embodiments without conflict.

[0057] Unless otherwise defined, the technical terms or scientific terms involved in this application shall have the ordinary meaning understood by those with ordinary skills in the technical field to which this application pertains. The words "a", "an", "one", "the" and similar terms involved in this application do not denote a limitation of quantity and can mean singular or plural. The terms "include", "comprise", "have" and any variations thereof involved in this application are intended to cover non-exclusive inclusion; for example, a process, method, system, product or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may further include unlisted steps or units, or may further include other steps or units inherent to these processes, methods, products or devices. The terms "connected", "coupled" and similar terms involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The term "plurality" involved in this application means two or more. "And / or" describes the association relationship of associated objects and indicates that three relationships may exist. For example, "A and / or B" may mean: A exists alone, A and B exist simultaneously, and B exists alone. The character " / " generally indicates that the associated objects before and after are in an "or" relationship. The terms "first", "second", "third", etc. involved in this application are only used to distinguish similar objects and do not represent a specific order of the objects.

[0058] The image recognition method provided by this application can be applied to, for example Figure 1 the application environment schematic diagram shown. Figure 1 is the application environment schematic diagram of the image recognition method according to the embodiments of this application. As Figure 1 shown, the recognition terminal 10 obtains the ambient brightness, default exposure brightness, and pixel point gray information of the current frame image, sets the target exposure brightness according to the obtained information, and further, after obtaining the next frame image through the target exposure brightness, recognizes the next frame image. The image used for recognition can be a face image, and the specific application scenario can be a face recognition scenario. It should be noted that the recognition terminal in this embodiment can be an intelligent terminal device such as an access control card machine, a smart phone, and a tablet computer.

[0059] This embodiment also provides an image recognition method. Figure 2is a flowchart of an image recognition method according to an embodiment of the present application. As Figure 2 shown, the process includes the following steps:

[0060] Step S201: Obtain the ambient brightness, default exposure brightness, and pixel grayscale information of the current frame image, where the pixel grayscale information includes each pixel point and its corresponding grayscale value in the current frame image.

[0061] It should be noted that the default exposure brightness is the exposure brightness preset by the developer, and the current frame image is obtained according to this default exposure brightness. Specifically, at the first recognition, the recognition device adjusts the exposure time, ISP gain value, or sensor gain value according to this default exposure brightness. When the screen brightness reaches the default exposure brightness, the current frame image is obtained.

[0062] Step S202: Generate a grayscale histogram according to the pixel grayscale information, perform region division on the grayscale histogram to obtain a pixel region distribution map, and determine a first scene judgment parameter and a second scene judgment parameter according to the pixel region distribution map.

[0063] Figure 3 is a grayscale histogram according to an embodiment of the present application. As Figure 3 shown, the abscissa of the grayscale histogram is the grayscale value, and the ordinate is the number of pixels. This grayscale histogram records the number of pixels corresponding to each grayscale value in the current frame image.

[0064] According to the different grayscale values, perform pixel region division on the grayscale histogram, and determine the median grayscale value of the pixels corresponding to each pixel region. Further, determine the first scene judgment parameter and the second scene judgment parameter through the median grayscale values of each pixel region.

[0065] To reduce computing power consumption, optionally, map the grayscale values in the range of [0, 255] to the range of [0, M - 1] to obtain M gray levels, where M can be set to values such as 128 or 64.

[0066] Formula 1: Hist(k) = n k , k = 0, 1,..., M - 1

[0067] where k is the k-th gray level value of the image, and n k is the number of pixels with the gray level of k in the image, and M is the number of gray levels. The number of pixels at each gray level is statistically calculated through the above formula 1 to generate a grayscale histogram.

[0068] For example, when M is set to 128, the gray levels corresponding to the gray values 0 and 1 are 0, the gray levels corresponding to the gray values 2 and 3 are 1, the gray levels corresponding to the gray values 4 and 5 are 2, and so on. The gray levels corresponding to the gray values 254 and 255 are 127. The number of pixels at each gray level is counted respectively to generate a gray histogram. The abscissa of the gray histogram is the gray level, and the ordinate is the number of pixels.

[0069] Step S203: Match the first scene judgment parameter, the second scene judgment parameter, and the ambient brightness with a preset optimized brightness table to obtain an optimized exposure brightness, where the preset optimized brightness table stores the exposure brightness matched with the real scene.

[0070] It should be noted that the preset optimized brightness table is obtained by testing the actual scene, and a relatively optimal exposure brightness is adapted for all scenes. Since the ambient brightness and scene judgment parameters of different scenes are different, the scene where the recognition object is located can be determined by the ambient brightness and scene judgment parameters, and the relatively optimal exposure brightness for this scene can be obtained by looking up the table.

[0071] Step S204: Determine the target exposure brightness according to the optimized exposure brightness and the default exposure brightness, obtain the next frame of image through the target exposure brightness, and recognize the next frame of image.

[0072] It should be noted that the optimized exposure brightness is compared with the default exposure brightness. If the difference between the optimized exposure brightness and the default exposure brightness is large, it is considered that the image quality obtained by the default exposure brightness is low and the image recognition success rate is small. The exposure brightness needs to be adjusted to the optimized exposure brightness, and an image with better quality is obtained by shooting according to the optimized exposure brightness, and this image is recognized, thereby improving the image recognition success rate. If the difference between the exposure brightness and the default exposure brightness is very small, it is considered that the difference in image quality obtained by the default exposure brightness and the optimized exposure brightness is very small, and the exposure brightness is still set to the default exposure brightness to prevent the exposure brightness from changing too frequently and resulting in poor user experience.

[0073] In this embodiment, by adjusting parameters such as the exposure time, ISP gain value, or sensor gain value, the exposure brightness when shooting the next frame of image reaches the target exposure brightness, improving the quality of the captured image, and thus improving the success rate of image recognition.

[0074] Through the above steps S201 to S204, by analyzing the ambient brightness, default exposure brightness, and pixel gray-scale information of the current frame image, the scene where the recognition object is located is judged, the target exposure brightness is set according to the judgment result, and the shooting parameters of the recognition device are adjusted to make the exposure brightness of the next frame image reach the target exposure brightness. Thus, the problem that image recognition is greatly affected by environmental factors, resulting in a low recognition success rate, is solved. By using the pixel gray-scale information and exposure information to judge the scene where the captured image is located in real time, and optimizing the quality of the next frame image according to the judgment result, the success rate of image recognition in different scenarios is improved. Moreover, the image recognition method of this embodiment does not require additional hardware modules and can be realized only through software algorithms, and multi-scene judgment and image optimization can also be realized in devices without wide dynamic range mode and backlight compensation function.

[0075] In some embodiments, a gray-scale histogram is generated according to the pixel gray-scale information, and the gray-scale histogram is regionally divided to obtain a pixel region distribution map, including:

[0076] Through the pixel gray-scale information, the number of pixels corresponding to each gray-scale value in the current frame image is obtained, and a gray-scale histogram is generated according to the number of pixels corresponding to each gray-scale value;

[0077] According to the preset gray-scale partitioning conditions, the gray-scale histogram is regionally divided to obtain a pixel region distribution map, where the pixel region distribution map includes a first pixel region, a second pixel region, and a third pixel region.

[0078] Figure 4 is a pixel region distribution map according to an embodiment of the present application. As Figure 4 shown, the first pixel region corresponds to the Darkarea region in the pixel region distribution map, the second pixel region corresponds to the Middlekarea region in the pixel region distribution map, and the third pixel region corresponds to the Brightarea region in the pixel region distribution map. The contrast between the bright and dark areas of the current frame image can be reflected by the central pixel points in the three regions. Further, according to these parameters, the scene where the target object is located is judged, and the exposure brightness is adjusted to improve the recognition success rate of the captured image.

[0079] For example, the preset gray-scale partitioning conditions are: pixel points with a gray-scale value range of 0-49 are classified into the first pixel region, pixel points with a gray-scale value range of 50-200 are classified into the second pixel region, and pixel points with a gray-scale value range of 200-255 are classified into the third pixel region. The gray-scale histogram is divided into three regions: Darkarea, Middlekarea, and Brightarea through the preset gray-scale partitioning conditions.

[0080] In some embodiments, according to the pixel region distribution map, determining the first scene judgment parameter and the second scene judgment parameter includes:

[0081] According to the pixel area distribution map, determine the central pixel points of each pixel area, and obtain the central gray values corresponding to the central pixel points of each pixel area. Determine the first scene judgment parameter and the second scene judgment parameter based on the central gray values of each pixel area.

[0082] Formula 2:

[0083] Among them, N1 is the number of pixel points in the first pixel area, M1 is the maximum gray level of the first pixel area, and k is the k-th gray value of the image. Calculate the number of pixel points in the first pixel area through the above Formula 2.

[0084] Formula 3:

[0085] Among them, N2 is the number of pixel points in the second pixel area, M1 is the maximum gray level of the first pixel area, M2 is the maximum gray level of the second pixel area, and k is the k-th gray value of the image. Calculate the number of pixel points in the second pixel area through the above Formula 3.

[0086] Formula 4:

[0087] Among them, N3 is the number of pixel points in the third pixel area, M2 is the maximum gray level of the second pixel area, M3 is the maximum gray level of the third pixel area, and k is the k-th gray value of the image. Calculate the number of pixel points in the third pixel area through the above Formula 4.

[0088] In this embodiment, by counting the number of pixel points in each pixel area and combining the pixel area distribution map, the central pixel points of each pixel area are obtained. The gray value corresponding to the central pixel point of each pixel area is the central gray value. The first scene judgment parameter obtained in this embodiment shows the contrast of gray values between the bright and dark areas of the current frame image, and the second scene judgment parameter shows the proportion of the bright and dark areas in the current frame image.

[0089] For example, if N1 = 140 is calculated through the above Formula 2, N2 = 260 is calculated through the above Formula 3, and N3 = 100 is calculated through the above Formula 4, then according to the size of the abscissa value in the pixel area distribution map, the 70th pixel point is the central pixel point of the first pixel area, the 270th pixel point is the central pixel point of the second pixel area, and the 450th pixel point is the central pixel point of the third pixel area. The gray value of the central pixel point of each pixel area is the central gray value.

[0090] The central gray value can also be obtained by calculating the proportion of the number of pixel points in each area.

[0091] Formula 5: N = N1 + N2 + N3

[0092] Where N is the total number of pixels in the current frame image, N1 is the number of pixels in the first pixel region, N2 is the number of pixels in the second pixel region, and N3 is the number of pixels in the third pixel region. The total number of pixels in the current frame image is calculated by the above formula 5.

[0093] Formula 6:

[0094] Where R(N1) is the ratio of the number of pixels in the first pixel region to the total number of pixels, N is the total number of pixels in the current frame image, and N1 is the number of pixels in the first pixel region. The ratio of the number of pixels in the first pixel region to the total number of pixels is calculated by the above formula 6.

[0095] Formula 7:

[0096] Where R(N2) is the ratio of the number of pixels in the second pixel region to the total number of pixels, N is the total number of pixels in the current frame image, and N2 is the number of pixels in the second pixel region. The ratio of the number of pixels in the second pixel region to the total number of pixels is calculated by the above formula 7.

[0097] Formula 8:

[0098] Where R(N3) is the ratio of the number of pixels in the third pixel region to the total number of pixels, N is the total number of pixels in the current frame image, and N3 is the number of pixels in the third pixel region. The ratio of the number of pixels in the third pixel region to the total number of pixels is calculated by the above formula 8.

[0099] For example, the number of pixels in each region and the total number of pixels in the current frame image are calculated by the above formulas 2, 3, 4, and 5 respectively. By the above formula 6, R(N1) = 20% is obtained. By the above formula 7, R(N2) = 60% is obtained. By the above formula 8, R(N3) = 20% is obtained. Then the central gray value of the first pixel region is the gray value corresponding to the pixel whose cumulative number of pixels accounts for 10% of the total number of pixels. The central gray value of the second pixel region is the gray value corresponding to the pixel whose cumulative number of pixels accounts for 50% of the total number of pixels. The central gray value of the third pixel region is the gray value corresponding to the pixel whose cumulative number of pixels accounts for 90% of the total number of pixels.

[0100] In some of the embodiments, the first scene determination parameter is determined by the following formula:

[0101] BD = m3 - m1

[0102] Among them, BD is the first scene judgment parameter, m1 is the central gray value corresponding to the first pixel region, and m3 is the central gray value corresponding to the third pixel region. The first scene judgment parameter obtained in this embodiment can reflect the contrast of gray values between the bright and dark regions of the current frame image. The larger this value is, the larger the proportion of the brightest and darkest regions in the captured image.

[0103] The second scene judgment parameter is determined by the following formula:

[0104]

[0105] Among them, MBE is the second scene judgment parameter, m1 is the central gray value corresponding to the first pixel region, m2 is the central gray value corresponding to the second pixel region, and m3 is the central gray value corresponding to the third pixel region. The second scene judgment parameter in this embodiment can reflect the proportion of bright and dark regions in the current frame image. The larger the second scene judgment parameter is, the larger the proportion of the bright region in the current frame image. Conversely, the proportion of the dark region is large.

[0106] By comprehensively considering the ambient brightness, the first scene judgment parameter, and the second scene judgment parameter, the scene where the current recognition object is located can be determined.

[0107] For example, if both the ambient brightness and the first scene judgment parameter are large, it indicates that the current ambient light is strong, and the contrast between the dark and bright regions is strong. The current scene is probably a backlight scene. At the same time, if the second scene judgment parameter is large, it means that the proportion of the bright region is larger than that of the dark region, and the recognition object in the backlight scene is far from the device.

[0108] In some of these embodiments, matching the first scene judgment parameter, the second scene judgment parameter, and the ambient brightness with a preset optimized brightness table to obtain the optimized exposure brightness includes:

[0109] According to the first scene judgment parameter, the second scene judgment parameter, and the ambient brightness, search the preset optimized brightness table to obtain N matching exposure brightness values; according to the matching exposure brightness values, use the linear interpolation algorithm to obtain the optimized exposure brightness. Through this embodiment, the exposure brightness that best matches the current scene is obtained.

[0110] Table 1 is a preset optimized brightness table according to an embodiment of the present application. As shown in Table 1, it records different ambient brightnesses (Hight BV 、Middle BV and LOw BV ), different first scene judgment parameters (Hight BD 、Middle BD and Low BD ) and different second scene judgment parameters (Hight MD / BD 、Middle MD / BD and LowMD / BD )The corresponding matching exposure brightnesses respectively.

[0111] Table 1 Preset Optimization Brightness Table

[0112]

[0113] For example, when the ambient brightness BV is 80000, the first scene judgment parameter BD is 150, and the second scene judgment parameter MD / BD is 78%, referring to Table 1, it can be known that the closest ambient brightness is Hight BV : 100000, the first scene judgment parameter 150 is between Middle BD : 127 and LOw BD : 200, the second scene judgment parameter 78% is between Middle MD / BD : 50% and Low MD / BD : 80%, then four matching exposure brightnesses are obtained: 1000, 1250, 950, and 1150. Through the linear interpolation algorithm, these four exposure brightnesses are calculated to obtain the optimized exposure brightness.

[0114] In some of these embodiments, determining the target exposure brightness based on the optimized exposure brightness and the default exposure brightness includes:

[0115] Obtain the absolute difference between the default exposure brightness and the optimized exposure brightness. In the case where the absolute difference is greater than the preset brightness change threshold, set the target exposure brightness to the optimized exposure brightness. In the case where the absolute difference is less than or equal to the preset brightness change threshold, set the target exposure brightness to the default exposure brightness. Among them, if the preset brightness change threshold is too large, the optimization effect will be poor; if it is too small, the exposure brightness will change frequently, affecting the user experience. In this embodiment, the preset brightness change threshold is the most appropriate change threshold obtained through actual scene testing.

[0116] Through this embodiment, it is judged whether it is necessary to adjust the exposure brightness to the calculated optimized exposure brightness. According to the judgment result, the exposure brightness when shooting the next frame of image is adjusted, thereby optimizing the captured image and improving the recognition success rate of the image.

[0117] Figure 5 is a flowchart of an image exposure brightness setting method according to an embodiment of the present application. As Figure 5 shown, this process includes the following steps:

[0118] S51, obtain the current frame image information, where the current frame image information includes: ambient brightness BV, default exposure brightness Target_ori, and pixel point gray information hist[M - 1];

[0119] S52. Divide the grayscale histogram into a Darkarea region, a Middlekarea region, and a Brightarea region according to the current frame image information to obtain a pixel region distribution map;

[0120] S53. Obtain the central position coordinates m1, m2, and m3 of each region through the pixel region distribution map;

[0121] S54. Calculate a first scene judgment parameter BD and a second scene judgment parameter MBE, where BD = m3 - m1, MD = m2 - m1, and MBE = MD / BD;

[0122] S55. Search for a preset optimized brightness table according to the scene judgment parameter to obtain an optimized exposure brightness Target_eew;

[0123] S56. Determine whether the absolute difference between the optimized exposure brightness and the default exposure brightness reaches a preset brightness change threshold T. If so, set the target exposure brightness to the optimized exposure brightness Target_new. If not, the target exposure brightness is still set to the default exposure brightness Target_ori.

[0124] It should be noted that the steps shown in the above process or the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. And although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than here.

[0125] This embodiment also provides an image recognition system. This device is used to implement the above embodiment and the preferred implementation manners, and those that have been described will not be repeated. As used hereinafter, terms such as "module", "unit", "sub-unit", etc. can be a combination of software and / or hardware that can achieve a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware is also possible and contemplated.

[0126] Figure 6 is a structural block diagram of an image recognition system according to an embodiment of the present application. As Figure 6 shown, the system includes: an information acquisition module 61, a parameter determination module 62, a brightness matching module 63, a brightness adjustment module 64, and an identification module 65:

[0127] The information acquisition module 61 is used to acquire the ambient brightness, default exposure brightness, and pixel point grayscale information of the current frame image;

[0128] A parameter determination module 62, configured to generate a grayscale histogram based on the grayscale information of pixel points, perform region division on the grayscale histogram to obtain a pixel region distribution map, and determine a first scene judgment parameter and a second scene judgment parameter according to the pixel region distribution map;

[0129] A brightness matching module 63, configured to match the first scene judgment parameter, the second scene judgment parameter, and the ambient brightness with a preset optimized brightness table to obtain an optimized exposure brightness, where the preset optimized brightness table stores the exposure brightness matched with the real scene;

[0130] A brightness adjustment module 64, configured to determine a target exposure brightness according to the optimized exposure brightness and the default exposure brightness;

[0131] An identification module 65, configured to obtain the next frame of image through the target exposure brightness and identify the next frame of image.

[0132] In this embodiment, the information acquisition module 61 obtains the ambient brightness, the default exposure brightness, and the grayscale information of pixel points of the current frame image. Based on the acquired current frame image information, the parameter determination module 62 obtains the scene judgment parameter through a preset rule. The brightness matching module 63 matches the scene judgment parameter with the preset optimized brightness table to obtain the optimized exposure brightness most suitable for the current scene. The brightness adjustment module 64 sets the target exposure brightness based on the optimized exposure brightness. Finally, the identification module 65 captures the next frame of image through the target exposure brightness and performs identification. This solves the problem that image recognition is greatly affected by environmental factors, resulting in a low recognition success rate. By combining the ambient brightness, the default exposure brightness, and the grayscale information of pixel points to judge the scene where the target object is located, and adjusting the image exposure brightness according to the judgment result. Further, an image is captured and identified, improving the success rate of image recognition.

[0133] In some of these embodiments, the parameter determination module 62 is further configured to obtain the number of pixels corresponding to each grayscale value in the current frame image according to the grayscale information of pixel points, generate a grayscale histogram according to the number of pixels corresponding to each grayscale value, and perform region division on the grayscale histogram through preset grayscale partition conditions to obtain a pixel region distribution map, where the pixel region distribution map includes a first pixel region, a second pixel region, and a third pixel region. In this embodiment, the grayscale histogram is divided into three regions: bright, medium, and dark according to the preset grayscale partition conditions. Parameters for judging the scene where the recognition object is located are obtained through the pixel points in these three regions. Further, the exposure brightness is adjusted according to these parameters, improving the recognition success rate of the captured image.

[0134] It should be noted that each of the above modules can be a functional module or a program module, and can be implemented either by software or by hardware. For the modules implemented by hardware, each of the above modules can be located in the same processor; or each of the above modules can also be located in different processors in any combined form.

[0135] This embodiment also provides an electronic device, including a memory and a processor. A computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0136] Optionally, the above electronic device may further include a transmission device and an input / output device. Among them, the transmission device is connected to the above processor, and the input / output device is connected to the above processor.

[0137] Optionally, in this embodiment, the above processor may be configured to execute the following steps through a computer program:

[0138] S1, Obtain the ambient brightness, default exposure brightness, and pixel point gray-scale information of the current frame image.

[0139] S2, Generate a gray-scale histogram according to the pixel point gray-scale information, perform region division on the gray-scale histogram to obtain a pixel region distribution map, and determine a first scene judgment parameter and a second scene judgment parameter according to the pixel region distribution map.

[0140] S3, Match the first scene judgment parameter, the second scene judgment parameter, and the ambient brightness with a preset optimized brightness table to obtain an optimized exposure brightness, where the preset optimized brightness table stores the exposure brightness matching the real scene.

[0141] S4, Determine the target exposure brightness according to the optimized exposure brightness and the default exposure brightness.

[0142] S5, Obtain the next frame image through the target exposure brightness and recognize the next frame image.

[0143] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementation manners, and will not be repeated here.

[0144] In one embodiment, Figure 4 is a schematic internal structure diagram of an electronic device according to an embodiment of the present application. As Figure 4 shown, an electronic device is provided. The electronic device can be a server, and its internal structure diagram can be as Figure 4As shown. The electronic device includes a processor, a memory, a network interface, and a database connected via a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the electronic device is used to store data. The network interface of the electronic device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, it implements an image recognition method.

[0145] Those skilled in the art can understand that Figure 4 the structure shown in [FIGURE REFERENCE] is only a block diagram of some structures related to the solution of this application, and does not constitute a limitation on the electronic device to which the solution of this application is applied. The specific electronic device may include more or fewer components than those shown in the figure, or combine some components, or have a different component layout.

[0146] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to the memory, storage, database, or other media used in the various embodiments provided in this application can include non-volatile and / or volatile memories. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or an external cache. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and Rambus dynamic RAM (RDRAM), etc.

[0147] Those skilled in the art should understand that the technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered to be within the scope described in this specification.

[0148] The embodiments described above merely represent several implementation manners of the present application. The description thereof is relatively specific and detailed, but it should not be construed as a limitation to the scope of the invention patent. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all fall within the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the appended claims.

Claims

1. An image recognition method, characterized in that, The method includes: Obtaining the ambient brightness, default exposure brightness, and pixel grayscale information of the current frame image; Generating a grayscale histogram based on the pixel grayscale information, dividing regions of the grayscale histogram to obtain a pixel region distribution map, and determining a first scene judgment parameter and a second scene judgment parameter according to the pixel region distribution map, including: Determining the central pixel points of each pixel region according to the pixel region distribution map; Obtaining the central grayscale values of each pixel region according to the central pixel points of each pixel region; Determining the first scene judgment parameter and the second scene judgment parameter through the central grayscale values of each pixel region; Determining the first scene judgment parameter through the following formula: BD = m3 - m1 where BD is the first scene judgment parameter, m1 is the central grayscale value corresponding to the first pixel region, and m3 is the central grayscale value corresponding to the third pixel region; Determining the second scene judgment parameter through the following formula: where MBE is the second scene judgment parameter, m1 is the central grayscale value corresponding to the first pixel region, m2 is the central grayscale value corresponding to the second pixel region, and m3 is the central grayscale value corresponding to the third pixel region; Matching the first scene judgment parameter, the second scene judgment parameter, and the ambient brightness with a preset optimized brightness table to obtain an optimized exposure brightness, where the preset optimized brightness table stores exposure brightnesses matched with real scenes; Determining a target exposure brightness according to the optimized exposure brightness and the default exposure brightness; Obtaining the next frame image through the target exposure brightness and recognizing the next frame image.

2. The method according to claim 1, wherein Generating a grayscale histogram based on the pixel grayscale information, and dividing regions of the grayscale histogram to obtain a pixel region distribution map includes: Obtaining the number of pixels corresponding to each grayscale value in the current frame image through the pixel grayscale information; Generating a grayscale histogram according to the number of pixels corresponding to each grayscale value; Dividing regions of the grayscale histogram according to preset grayscale partitioning conditions to obtain the pixel region distribution map, where the pixel region distribution map includes a first pixel region, a second pixel region, and a third pixel region.

3. The method according to claim 1, wherein The matching the first scene judgment parameter, the second scene judgment parameter, and the ambient brightness with a preset optimized brightness table to obtain an optimized exposure brightness includes: Searching the preset optimized brightness table according to the first scene judgment parameter, the second scene judgment parameter, and the ambient brightness to obtain N matching exposure brightnesses; Obtaining the optimized exposure brightness through a linear interpolation algorithm according to the matching exposure brightnesses.

4. The method according to claim 1, characterized in that, The determining a target exposure brightness according to the optimized exposure brightness and the default exposure brightness includes: Obtaining the absolute difference between the default exposure brightness and the optimized exposure brightness; In the case where the absolute difference is greater than a preset brightness change threshold, setting the target exposure brightness to the optimized exposure brightness; In the case where the absolute difference is less than or equal to the preset brightness change threshold, setting the target exposure brightness to the default exposure brightness.

5. An image recognition system, characterized in that, The system includes: an information acquisition module, a parameter determination module, a brightness matching module, a brightness adjustment module, and an identification module: The information acquisition module is used to acquire the ambient brightness, default exposure brightness, and pixel point gray level information of the current frame image; The parameter determination module is used to generate a gray level histogram according to the pixel point gray level information, perform region division on the gray level histogram to obtain a pixel region distribution map, and determine a first scene judgment parameter and a second scene judgment parameter according to the pixel region distribution map, including: Determine the central pixel points of each pixel region according to the pixel region distribution map; Obtain the central gray level values of each pixel region according to the central pixel points of each pixel region; Determine the first scene judgment parameter and the second scene judgment parameter through the central gray level values of each pixel region; Determine the first scene judgment parameter through the following formula: BD = m3 - m1 where BD is the first scene judgment parameter, m1 is the central gray level value corresponding to the first pixel region, and m3 is the central gray level value corresponding to the third pixel region; Determine the second scene judgment parameter through the following formula: where MBE is the second scene judgment parameter, m1 is the central gray level value corresponding to the first pixel region, m2 is the central gray level value corresponding to the second pixel region, and m3 is the central gray level value corresponding to the third pixel region; The brightness matching module is used to match the first scene judgment parameter, the second scene judgment parameter, and the ambient brightness with a preset optimized brightness table to obtain an optimized exposure brightness, where the preset optimized brightness table stores the exposure brightness matched with the real scene; The brightness adjustment module is used to determine the target exposure brightness according to the optimized exposure brightness and the default exposure brightness; The identification module is used to acquire the next frame image through the target exposure brightness and identify the next frame image.

6. The system according to claim 5, wherein The parameter determination module is further used to acquire the number of pixel points corresponding to each gray level value in the current frame image according to the pixel point gray level information, generate a gray level histogram according to the number of pixel points corresponding to each gray level value, and perform region division on the gray level histogram according to preset gray level partition conditions to obtain the pixel region distribution map, where the pixel region distribution map includes a first pixel region, a second pixel region, and a third pixel region.

7. An electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the image recognition method according to any one of claims 1 to 4.

8. A storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the image recognition method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Exposure parameter adjustment method and device, electronic device and readable memory medium

    CN107592473A

  • Method and device for determining illumination quality of face image and storage medium

    CN115760816A