Image recognition method and system in complex lighting environment

By differentiating the regions affected by illumination from those not affected by illumination, employing high-density small-window sampling and low-density large-window sampling, and calculating similarity weights for noise reduction, the problem of low image recognition efficiency under complex lighting conditions is solved, achieving efficient and accurate image recognition.

CN120656112BActive Publication Date: 2026-06-26JIANGXI HUALIAN METAVERSE DIGITAL TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
JIANGXI HUALIAN METAVERSE DIGITAL TECH CO LTD
Filing Date
2025-04-29
Publication Date
2026-06-26

AI Technical Summary

Technical Problem

Existing technologies have low image recognition efficiency in complex lighting environments, and the random selection of image blocks in traditional NLM algorithms leads to low efficiency.

Method used

By analyzing the image to be recognized, regions affected by illumination and regions unaffected by illumination are divided. Differential processing is adopted, with high-density small window sampling in the illuminated regions and low-density large window sampling in the unaffected regions. The similarity weights between pixel blocks are calculated for noise reduction and then input into the image recognition model.

Benefits of technology

It achieves dual optimization of computational efficiency and denoising performance for image recognition under complex lighting conditions, thereby improving recognition efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120656112B_ABST
    Figure CN120656112B_ABST
Patent Text Reader

Abstract

The application discloses a kind of image recognition method and system under complex illumination environment, the method includes: obtaining the image to be identified needing to carry out image recognition, the illumination influence area is obtained by analyzing the image to be identified, and the illumination influence area is divided into a plurality of grid units according to pre-set rule by grid division;Respectively, randomly select pixel points from illumination influence area and non-illumination influence area, and obtain corresponding pixel block based on pre-set window size;The similarity weight between the pixel block of illumination influence area and non-illumination influence area is calculated respectively, to denoise the image to be identified, and the denoising identification image is input into pre-set image recognition model to obtain corresponding image recognition result.The application solves the problem of low image recognition efficiency in the prior art under complex illumination environment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image recognition technology, and in particular to an image recognition method and system under complex lighting conditions. Background Technology

[0002] With the increasing demand for image recognition technology in fields such as smart devices, autonomous driving, and security monitoring, accurate image recognition in complex lighting environments has become an important research direction. Complex lighting environments not only pose challenges to image processing but also significantly impact the performance and reliability of computer vision algorithms. Therefore, understanding and responding to changes in lighting has become one of the core issues in image recognition technology.

[0003] Currently, improving the neural network of the model enables it to learn more complex features and improves the accuracy of image recognition under complex lighting conditions. However, this approach suffers from high computational resource requirements and long model training times. Alternatively, image denoising techniques can be used to remove noise from the image to ensure recognition accuracy. The NLM algorithm removes noise by using a weighted average of pixel blocks in the image. However, in traditional NLM algorithms, the selection of image blocks is random, and denoising is usually performed on the entire image, resulting in relatively low efficiency. Summary of the Invention

[0004] In view of this, the purpose of the present invention is to provide an image recognition method and system under complex lighting conditions, which aims to solve the problem of low image recognition efficiency under complex lighting conditions in the prior art.

[0005] The embodiments of the present invention are implemented as follows:

[0006] An image recognition method under complex lighting conditions, the method comprising:

[0007] The image to be recognized is acquired, the image to be recognized is analyzed to obtain the area affected by illumination, and the area affected by illumination is divided into multiple grid cells according to preset rules.

[0008] Each pixel is selected from the center of the grid cell, and a corresponding pixel block is obtained with the pixel as the center based on the preset window size. Pixels are also randomly selected from the non-illuminated area of ​​the image to be recognized, and a corresponding pixel block is obtained based on the preset window size.

[0009] Calculate the distance between pixel blocks in the illuminated and unilluminated regions and determine the similarity weight between pixel blocks based on the distance between them. Use the similarity weight to denoise the image to be recognized to obtain the corresponding denoised recognition image. Then, input the denoised recognition image into the preset image recognition model to obtain the corresponding image recognition result.

[0010] Among them, the pixel density of the illuminated area is higher than that of the non-illuminated area, and the preset window size of the pixel block in the illuminated area is smaller than that of the pixel block in the non-illuminated area.

[0011] Furthermore, in the above-mentioned image recognition method under complex lighting conditions, the step of analyzing the image to be recognized to obtain the lighting-affected region includes:

[0012] Obtain the initial illumination-affected region in the image to be identified, obtain the contour information of the initial illumination-affected region, and determine the smallest bounding rectangle region covering the initial illumination-affected region as the illumination-affected region based on the contour information;

[0013] The step of obtaining the preliminary illumination-affected area in the image to be identified includes:

[0014] The image to be identified is converted to floating-point type, the RGB image of the image to be identified is logarithmically transformed, and the guided filter parameters are set to calculate the illumination component estimate of the image to be identified.

[0015] The reflection component of the image to be identified is estimated based on the logarithmic domain-transformed image and the illumination component, and then the reflection component is exponentially restored.

[0016] The reflection components are converted to HSV space, and the local variance of the V channel is analyzed. Regions with local variance higher than the global mean are identified as the initial illumination-affected areas.

[0017] Furthermore, in the above-mentioned image recognition method under complex lighting conditions, the method further includes:

[0018] In the area affected by illumination, identify the two target points with the greatest difference in illumination, and then draw the line connecting the two target points.

[0019] Obtain the perpendicular line connecting the two target points, determine the intersection of the perpendicular line and the area affected by the illumination, and determine the matching pixel block determination area based on the rectangular area enclosed by the intersection point and the target points.

[0020] Determine the target grid cells contained in the region of the matching pixel block, and select the corresponding pixel points from the center of each target grid cell;

[0021] Based on the preset window size, the corresponding matching pixel block is obtained with the pixel point as the center, and the matching pixel block is used as the target pixel block for similarity matching of pixel blocks in the illumination-affected area.

[0022] Furthermore, in the above-mentioned image recognition method under complex lighting conditions, before the step of inputting the denoised recognition image into a preset image recognition model to obtain the corresponding image recognition result, the method further includes:

[0023] The brightness of the denoised recognition image is adjusted using a preset algorithm, which includes the Retinex method or the gamma correction method.

[0024] Another object of the present invention is to provide an image recognition system under complex lighting conditions, the system comprising:

[0025] The acquisition module is used to acquire the image to be recognized, analyze the image to be recognized to obtain the area affected by illumination, and divide the area affected by illumination into multiple grid units according to preset rules.

[0026] The selection module is used to select corresponding pixels from the center position of the grid cell and obtain corresponding pixel blocks with the pixels as the center based on the preset window size, and to randomly select pixels from the non-illuminated area of ​​the image to be recognized and obtain corresponding pixel blocks based on the preset window size.

[0027] The recognition module is used to calculate the distance between pixel blocks in the illuminated and unilluminated regions and determine the similarity weight between pixel blocks based on the distance between them. The similarity weight is used to denoise the image to be recognized to obtain the corresponding denoised recognition image. The denoised recognition image is then input into a preset image recognition model to obtain the corresponding image recognition result.

[0028] Among them, the pixel density of the illuminated area is higher than that of the non-illuminated area, and the preset window size of the pixel block in the illuminated area is smaller than that of the pixel block in the non-illuminated area.

[0029] Another object of this invention is to provide a readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method described above.

[0030] Another object of the present invention is to provide an electronic device, including a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor executes the program to implement the steps of the method described above.

[0031] This invention acquires an image to be recognized, analyzes it to obtain the illumination-affected region, and divides the illumination-affected region into multiple grid units according to preset rules. Pixels are selected from the center of each grid unit, and pixel blocks are obtained centered on these pixels based on a preset window size. Similarly, pixels are randomly selected from the non-illumination-affected region of the image, and pixel blocks are obtained based on a preset window size. The distances between pixel blocks in the illumination-affected and non-illumination-affected regions are calculated, and similarity weights between pixel blocks are determined based on these distances. The similarity weights are used to denoise the image to obtain a denoised recognition image, which is then input into a preset image recognition model to obtain the corresponding image recognition result. The pixel density in the illumination-affected region is higher than that in the non-illumination-affected region, and the preset window size for the pixel blocks in the illumination-affected region is smaller than that for the pixel blocks in the non-illumination-affected region. By employing differentiated processing for illuminated and unilluminated regions, the search for similar pixel blocks is limited to their respective regions, avoiding global traversal. In unilluminated regions, a small number of pixels are randomly selected as sampling points to avoid oversampling. Furthermore, small-sized pixel blocks with high-density sampling are used in illuminated regions, while large-sized pixel blocks with low-density sampling are used in unilluminated regions. Small windows more easily capture the local structure (such as edges and textures) of illuminated regions, reducing noise interference, while large windows avoid the overhead of global search, achieving a dual optimization of computational efficiency and denoising performance. This solves the problem of low image recognition efficiency in complex lighting environments in existing technologies. Attached Figure Description

[0032] Figure 1 This is a flowchart of an image recognition process under complex lighting conditions, provided in Embodiment 1 of the present invention.

[0033] Figure 2 This is a structural block diagram of an image recognition system under complex lighting conditions according to the third embodiment of the present invention.

[0034] The following detailed description, in conjunction with the accompanying drawings, will further illustrate the present invention. Detailed Implementation

[0035] To facilitate understanding of the present invention, a more complete description will be given below with reference to the accompanying drawings. Several embodiments of the invention are illustrated in the drawings. However, the invention can be implemented in many different forms and is not limited to the embodiments described herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete.

[0036] It should be noted that when a component is said to be "fixed to" another component, it can be directly on the other component or there may be an intervening component. When a component is said to be "connected to" another component, it can be directly connected to the other component or there may be an intervening component. The terms "vertical," "horizontal," "left," "right," and similar expressions used in this document are for illustrative purposes only.

[0037] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used herein in the specification of this invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed types.

[0038] Example 1

[0039] Please see Figure 1 The image shown is an image recognition method under complex lighting conditions proposed in the first embodiment of the present invention, the method including steps S10 to S12.

[0040] Step S10: Obtain the image to be recognized, analyze the image to be recognized to obtain the illumination-affected area, and divide the illumination-affected area into multiple grid cells according to preset rules.

[0041] First, the original image to be recognized, i.e., the image to be recognized, is acquired. Then, the image is analyzed to detect and locate areas affected by factors such as uneven lighting or overexposure / underexposure (i.e., lighting-affected areas). Subsequently, these identified lighting-abnormal areas are divided into multiple regular grid units according to pre-set rules, such as uniform division. In this embodiment of the invention, the lighting-affected area is a regular rectangular area, and the preset rule division is to divide the rectangular area into multiple small rectangular grid units according to a preset resolution.

[0042] Specifically, the step of analyzing the image to be recognized to obtain the illumination-affected region includes:

[0043] Obtain the initial illumination-affected region in the image to be identified, obtain the contour information of the initial illumination-affected region, and determine the smallest bounding rectangle region covering the initial illumination-affected region as the illumination-affected region based on the contour information;

[0044] The step of obtaining the preliminary illumination-affected area in the image to be identified includes:

[0045] The image to be identified is converted to floating-point type, the RGB image of the image to be identified is logarithmically transformed, and the guided filter parameters are set to calculate the illumination component estimate of the image to be identified.

[0046] The reflection component of the image to be identified is estimated based on the logarithmic domain-transformed image and the illumination component, and then the reflection component is exponentially restored.

[0047] The reflection components are converted to HSV space, and the local variance of the V channel is analyzed. Regions with local variance higher than the global mean are identified as the initial illumination-affected areas.

[0048] Among them, the light-reflection decoupling analysis based on Retinex theory is used to initially extract the light-affected region. First, the data type of the image to be identified is converted to floating-point to avoid data overflow during subsequent logarithmic operations and improve computational accuracy. Then, its RGB color space image is transformed into a logarithmic domain, mapping the image from linear space to the logarithmic domain. This operation transforms the light intensity (multiplicative component) into an additive component, facilitating subsequent separation of light and reflection information through filtering. Then, appropriate guided filter parameters are set to estimate the light components of the image. Using the original RGB image as the guide image, the light components are estimated through a local linear model. Specifically, the parameters of the guided filter are: the filter radius (r) controls the smoothness of the light estimation, and the regularization parameter (r)... Prevent overfitting in edge regions;

[0049] Next, the reflection component of the image is calculated by comparing the image after the digital domain transformation with the estimated value of the illumination component. Then, an exponential operation is performed on the reflection component to restore its original range. The reflection component is then converted to the HSV color space. By analyzing the local variance of its V (luminance) channel, the region where the local variance exceeds the global mean variance of the V channel of the image is identified as the preliminary illumination-affected region.

[0050] Based on this, we can: perform morphological operations on the mask image of the initial illumination-affected area (such as opening operations to remove noise and closing operations to fill holes), and obtain a binary contour map through threshold segmentation (such as the Otsu algorithm). We can then use edge detection algorithms (such as Canny) or contour lookup functions (such as OpenCV's findContours) to extract the boundary coordinates of each illumination-abnormal area. Based on the contour information, we can determine the smallest bounding rectangle that can completely contain all the initial illumination-affected areas, and finally determine this rectangular area as the illumination-affected area.

[0051] Step S11: Select corresponding pixels from the center of the grid cell and obtain corresponding pixel blocks centered on the pixels based on a preset window size; randomly select pixels from the non-illuminated areas of the image to be identified and obtain corresponding pixel blocks based on a preset window size.

[0052] Specifically, for the area affected by illumination, pixel blocks are obtained by combining geometric center localization and local window sampling. Each grid cell within the area affected by illumination is traversed, the center coordinates of each grid cell are calculated, and the center coordinates are used as sampling anchor points to locate the pixel corresponding to the center point in the original pixel space of the image to be identified. Then, based on the center pixel, a pixel block centered on the center pixel and covering its neighborhood is extracted from the image according to a pre-set window size (such as an n×n square area). This pixel block contains image information of the center of the grid cell and its surrounding local area, which can reflect the local features of a specific location within the area affected by illumination.

[0053] Meanwhile, pixels are randomly selected from the non-illuminated areas of the image to be identified, excluding the areas affected by illumination, as sampling points. Specifically, random coordinates can be generated within the pixel coordinate range of the non-illuminated areas using a random number generator to ensure that the sampling points uniformly cover the non-illuminated areas. Also based on a preset window size, corresponding pixel blocks are cropped in the image with these randomly selected pixels as the center. These pixel blocks represent local image features under normal illumination conditions.

[0054] By using the two sampling methods described above, and by applying differentiated processing to areas affected by illumination and areas not affected by illumination, the search for similar pixel blocks is limited to their respective regions, thus avoiding global traversal.

[0055] Furthermore, the pixel density in the illuminated area is higher than that in the unilluminated area, and the preset window size for the pixel blocks in the illuminated area is smaller than that in the unilluminated area. In the unilluminated area, a small number of pixels are randomly selected as sampling points to avoid oversampling. Small-sized pixel blocks with high-density sampling are used in the illuminated area, while large-sized pixel blocks with low-density sampling are used in the unilluminated area. Small windows more easily capture the local structure (such as edges and textures) of the illuminated area, reducing noise interference, while large windows avoid the overhead of global search, achieving a dual optimization of computational efficiency and denoising performance.

[0056] Step S12: Calculate the distance between pixel blocks in the illuminated and unilluminated regions and determine the similarity weight between pixel blocks based on the distance between them. Use the similarity weight to denoise the image to be recognized to obtain the corresponding denoised recognition image. Input the denoised recognition image into the preset image recognition model to obtain the corresponding image recognition result.

[0057] Specifically, for the pixel sets extracted from the illuminated and unilluminated regions respectively, similarity weights are calculated within each region to achieve pixel denoising. That is, pixel blocks in two regions are only compared with pixel blocks within their respective regions. For example, the similarity distance between pixel blocks in the two regions can be calculated based on a specific distance metric (such as Euclidean distance, SSIM structural similarity index, or distance based on depth features). For instance, for a pixel block in the illuminated region, the distance between it and all pixel blocks in the illuminated region is calculated, and this distance is converted into a similarity weight. This similarity weight is then used to denoise the pixel blocks in the illuminated region. Adaptive denoising is performed on pixel blocks in the affected areas, and similarly, denoising is also performed on pixels in areas not affected by illumination, generating a denoised recognition image. This image significantly improves the visual quality of the image while preserving the semantic information of the original image. Finally, the denoised recognition image is input into a preset image recognition model (such as a classification / detection model based on CNN, Transformer, or a hybrid architecture). Since the denoising process eliminates the interference of uneven illumination on feature extraction, the model can more accurately focus on the semantic content of the image (such as the shape, texture, and contextual relationships of the target object), thereby outputting more reliable image recognition results.

[0058] In summary, the image recognition method under complex lighting conditions in the above embodiments of the present invention involves acquiring an image to be recognized, analyzing the image to be recognized to obtain the lighting-affected region, and dividing the lighting-affected region into multiple grid units according to preset rules; selecting corresponding pixels from the center position of each grid unit, and obtaining corresponding pixel blocks centered on the pixels based on a preset window size; randomly selecting pixels from the non-light-affected region of the image to be recognized, and obtaining corresponding pixel blocks based on a preset window size; calculating the distance between pixel blocks in the lighting-affected region and the non-light-affected region, and determining the similarity weight between pixel blocks based on the distance between pixel blocks; using the similarity weight to denoise the image to be recognized to obtain the corresponding denoised recognition image, and inputting the denoised recognition image into a preset image recognition model to obtain the corresponding image recognition result; wherein, the acquisition density of pixel blocks in the lighting-affected region is higher than that in the non-light-affected region, and the preset window size of the pixel blocks in the lighting-affected region is smaller than that of the pixel blocks in the non-light-affected region. By employing differentiated processing for illuminated and unilluminated regions, the search for similar pixel blocks is limited to their respective regions, avoiding global traversal. In unilluminated regions, a small number of pixels are randomly selected as sampling points to avoid oversampling. Furthermore, small-sized pixel blocks with high-density sampling are used in illuminated regions, while large-sized pixel blocks with low-density sampling are used in unilluminated regions. Small windows more easily capture the local structure (such as edges and textures) of illuminated regions, reducing noise interference, while large windows avoid the overhead of global search, achieving a dual optimization of computational efficiency and denoising performance. This solves the problem of low image recognition efficiency in complex lighting environments in existing technologies.

[0059] Example 2

[0060] This embodiment also proposes an image recognition method under complex lighting conditions. The difference between the image recognition method under complex lighting conditions in this embodiment and the image recognition method under complex lighting conditions proposed in Embodiment 1 is as follows:

[0061] The method further includes:

[0062] In the area affected by illumination, identify the two target points with the greatest difference in illumination, and then draw the line connecting the two target points.

[0063] Obtain the perpendicular line connecting the two target points, determine the intersection of the perpendicular line and the area affected by the illumination, and determine the matching pixel block determination area based on the rectangular area enclosed by the intersection point and the target points.

[0064] Determine the target grid cells contained in the region of the matching pixel block, and select the corresponding pixel points from the center of each target grid cell;

[0065] Based on the preset window size, the corresponding matching pixel block is obtained with the pixel point as the center, and the matching pixel block is used as the target pixel block for similarity matching of pixel blocks in the illumination-affected area.

[0066] Among them, locating the two extreme points with the most significant difference in light intensity within the area affected by light can be achieved by calculating the light intensity values ​​of all pixels within the area affected by light (such as the average of the three RGB channels or the V channel value in the HSV space), and using extreme value search algorithms (such as traversing all pixels and comparing light values) or gradient analysis-based clustering methods (such as performing K-means clustering on light intensity and selecting the center points of the two clusters as candidate extreme points) to find the two target points with the maximum (overexposure) and minimum (underexposure) light values. These two points represent the most extreme and most distorted local locations in the area of ​​abnormal light, respectively, and the direction of the line connecting them implicitly represents the main direction of light change.

[0067] Subsequently, a geometrically constrained region for feature matching is constructed based on the line connecting the extreme points of illumination (target points). This can be achieved by calculating the slope of the line connecting two target points and obtaining the equation of the perpendicular line (if the slope of the line is k, then the slope of the perpendicular line is k). 1 / k), in the image coordinate system, determine the intersection of the vertical line and the boundary of the illumination-affected area. Define the rectangular area enclosed by the intersection of the target point and the vertical line as the matching pixel block determination area. Then, extract the target grid cell and generate matching pixel blocks within the matching pixel block determination area. Traverse the grid cells within the rectangular area, filter out the target grid cells that are completely located within the rectangle, and calculate the center coordinates of each target grid cell. Using it as the center, extract the corresponding matching pixel blocks from the original image according to the preset window size. These pixel blocks can fully reflect the local feature distribution of illumination anomalies.

[0068] Finally, the extracted matching pixel blocks are used as feature anchor points in the illumination-affected region to perform similarity matching with pixel blocks in the illumination-affected region, achieving accurate noise reduction while reducing the number of matching pixel blocks.

[0069] In addition, in some optional embodiments of the present invention, the step of inputting the denoised recognition image into a preset image recognition model to obtain the corresponding image recognition result further includes:

[0070] The brightness of the denoised recognition image is adjusted using a preset algorithm, which includes the Retinex method or the gamma correction method.

[0071] In practical implementation, the Retinex method or gamma correction method can be used to adjust the brightness of the denoised recognition image, or a combination of the two can be used. For example, the denoised recognition image is subjected to HSV spatial transformation, and then the illumination component is extracted from the brightness part represented by V and gamma correction is performed. The illumination components before and after processing are guided by a preset algorithm to obtain the first component and the second component. The first component and the second component are fused according to preset weights to obtain the fused illumination component, and the fused illumination component is corrected to obtain the corrected fused illumination component. The reflection component corresponding to the corrected fused illumination component is obtained. The component of the final brightness part represented by V is determined according to the reflection component and the corrected fused illumination component, and then the reverse transformation is performed to obtain the final denoised recognition image.

[0072] Specifically, the denoised image is first converted from the RGB color space to the HSV color space. Utilizing the characteristic that the V channel (luminance component) independently represents brightness in the HSV model, the image's brightness information is decoupled from its hue (H) and saturation (S) information. Then, the illumination component is extracted from the V channel. Specifically, this can be achieved by using a priori-based decomposition method (such as low-pass filtering of the V channel or estimating the illumination basis using Retinex theory) to separate the global illumination distribution in the image. Finally, gamma correction is applied to the extracted illumination component, and the brightness distribution of the illumination component is dynamically adjusted using a nonlinear transformation function to achieve global equalization of illumination intensity.

[0073] Next, guided filtering is used to perform structured enhancement on the illumination components before and after processing. Guided filtering uses the original V channel image as the guide map to perform edge-preserving smoothing on the original illumination component (uncorrected) and the gamma-corrected illumination component (corrected), generating the first component and the second component. Guided filtering suppresses noise while maintaining the sharpness of the illumination component edges through the idea of ​​combined bilateral filtering.

[0074] Then, the first and second components are dynamically fused according to the preset weights. The weight coefficients can be optimized by light intensity, local contrast or task-oriented loss function. The fusion strategy can adopt linear weighting or nonlinear fusion based on attention mechanism to generate a fused light component that takes into account both the realism of the light and the balance of brightness.

[0075] The fused illumination component is further corrected by optimizing its brightness distribution through histogram matching, contrast-limited adaptive histogram equalization, or a deep learning-based illumination compensation network to make it more in line with the visual characteristics of the human eye or the input requirements of downstream tasks (such as recognition and segmentation), thus obtaining the corrected fused illumination component.

[0076] Finally, the reflection component is inferred by using the illumination-reflection model, and the reflection component is estimated by the ratio of the original V channel image to the calibrated fused illumination component. Finally, the calibrated fused illumination component and the reflection component are recombined to obtain the optimized V channel. The brightness information is recovered by pixel-by-pixel multiplication, while keeping the H and S channels unchanged. The HSV image is then converted back to RGB space to generate the final denoised recognition image.

[0077] In summary, the image recognition method under complex lighting conditions in the above embodiments of the present invention involves acquiring an image to be recognized, analyzing the image to be recognized to obtain the lighting-affected region, and dividing the lighting-affected region into multiple grid units according to preset rules; selecting corresponding pixels from the center position of each grid unit, and obtaining corresponding pixel blocks centered on the pixels based on a preset window size; randomly selecting pixels from the non-light-affected region of the image to be recognized, and obtaining corresponding pixel blocks based on a preset window size; calculating the distance between pixel blocks in the lighting-affected region and the non-light-affected region, and determining the similarity weight between pixel blocks based on the distance between pixel blocks; using the similarity weight to denoise the image to be recognized to obtain the corresponding denoised recognition image, and inputting the denoised recognition image into a preset image recognition model to obtain the corresponding image recognition result; wherein, the acquisition density of pixel blocks in the lighting-affected region is higher than that in the non-light-affected region, and the preset window size of the pixel blocks in the lighting-affected region is smaller than that of the pixel blocks in the non-light-affected region. By employing differentiated processing for illuminated and unilluminated regions, the search for similar pixel blocks is limited to their respective regions, avoiding global traversal. In unilluminated regions, a small number of pixels are randomly selected as sampling points to avoid oversampling. Furthermore, small-sized pixel blocks with high-density sampling are used in illuminated regions, while large-sized pixel blocks with low-density sampling are used in unilluminated regions. Small windows more easily capture the local structure (such as edges and textures) of illuminated regions, reducing noise interference, while large windows avoid the overhead of global search, achieving a dual optimization of computational efficiency and denoising performance. This solves the problem of low image recognition efficiency in complex lighting environments in existing technologies.

[0078] Example 3

[0079] Please see Figure 2 The image shown is an image recognition system under complex lighting conditions proposed in the third embodiment of the present invention. The system includes:

[0080] The acquisition module 100 is used to acquire the image to be recognized, analyze the image to be recognized to obtain the area affected by illumination, and divide the area affected by illumination into multiple grid units according to preset rules.

[0081] The selection module 200 is used to select corresponding pixels from the center position of the grid cell and obtain corresponding pixel blocks with the pixels as the center based on a preset window size, and to randomly select pixels from the non-illuminated area in the image to be recognized and obtain corresponding pixel blocks based on a preset window size.

[0082] The recognition module 300 is used to calculate the distance between pixel blocks in the illumination-affected area and the non-illumination-affected area, and determine the similarity weight between pixel blocks based on the distance between pixel blocks. The similarity weight is used to denoise the image to be recognized to obtain the corresponding denoised recognition image, and the denoised recognition image is input into the preset image recognition model to obtain the corresponding image recognition result.

[0083] Among them, the pixel density of the illuminated area is higher than that of the non-illuminated area, and the preset window size of the pixel block in the illuminated area is smaller than that of the pixel block in the non-illuminated area.

[0084] The functions or operation steps implemented by the above modules are largely the same as those in the above method embodiments, and will not be repeated here.

[0085] Example 4

[0086] In another aspect, the present invention provides a readable storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the steps of the method described in any one of Embodiments 1 to 2 above.

[0087] Example 5

[0088] In another aspect, the present invention provides an electronic device, the electronic device including a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor executes the program to implement the steps of any one of the methods described in Embodiments 1 to 2 above.

[0089] The technical features of the above embodiments can be combined in any way. For the sake of brevity, 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, they should be considered to be within the scope of this specification.

[0090] Those skilled in the art will understand that the logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any storage medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "storage medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device.

[0091] More specific examples of storage media (a non-exhaustive list) include: electrical connections (electronic devices) with one or more wires, portable computer disk drives (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, the storage medium can even be paper or other suitable media on which the program can be printed, since the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.

[0092] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.

[0093] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0094] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the scope of protection of the present invention. Therefore, the scope of protection of this patent should be determined by the appended claims.

Claims

1. An image recognition method under complex lighting conditions, characterized in that, The method includes: The image to be recognized is acquired, the image to be recognized is analyzed to obtain the area affected by illumination, and the area affected by illumination is divided into multiple grid cells according to preset rules. Each pixel is selected from the center of the grid cell, and a corresponding pixel block is obtained with the pixel as the center based on the preset window size. Pixels are also randomly selected from the non-illuminated area of ​​the image to be recognized, and a corresponding pixel block is obtained based on the preset window size. Calculate the distance between pixel blocks in the illuminated and unilluminated regions and determine the similarity weight between pixel blocks based on the distance between them. Use the similarity weight to denoise the image to be recognized to obtain the corresponding denoised recognition image. Then, input the denoised recognition image into the preset image recognition model to obtain the corresponding image recognition result. Among them, the pixel density of the illuminated area is higher than that of the non-illuminated area, and the preset window size of the pixel block in the illuminated area is smaller than that of the pixel block in the non-illuminated area.

2. The image recognition method under complex lighting conditions according to claim 1, characterized in that, The step of analyzing the image to be identified to obtain the illumination-affected region includes: Obtain the initial illumination-affected region in the image to be identified, obtain the contour information of the initial illumination-affected region, and determine the smallest bounding rectangle region covering the initial illumination-affected region as the illumination-affected region based on the contour information; The step of obtaining the preliminary illumination-affected area in the image to be identified includes: The image to be identified is converted to floating-point type, the RGB image of the image to be identified is logarithmically transformed, and the guided filter parameters are set to calculate the illumination component estimate of the image to be identified. The reflection component of the image to be identified is estimated based on the logarithmic domain-transformed image and the illumination component, and then the reflection component is exponentially restored. The reflection components are converted to HSV space, and the local variance of the V channel is analyzed. Regions with local variance higher than the global mean are identified as the initial illumination-affected areas.

3. The image recognition method under complex lighting conditions according to claim 1, characterized in that, The method further includes: In the area affected by illumination, identify the two target points with the greatest difference in illumination, and then draw the line connecting the two target points. Obtain the perpendicular line connecting the two target points, determine the intersection of the perpendicular line and the area affected by the illumination, and determine the matching pixel block determination area based on the rectangular area enclosed by the intersection point and the target points. Determine the target grid cells contained in the region of the matching pixel block, and select the corresponding pixel points from the center of each target grid cell; Based on a preset window size, the corresponding matching pixel block is obtained with the pixel point as the center, and the matching pixel block is used as the target pixel block for similarity matching of pixel blocks within the illumination influence area.

4. The image recognition method under complex lighting conditions according to claim 1, characterized in that, Before the step of inputting the denoised recognition image into the preset image recognition model to obtain the corresponding image recognition result, the method further includes: The brightness of the denoised recognition image is adjusted using a preset algorithm, which includes the Retinex method or the gamma correction method.

5. An image recognition system under complex lighting conditions, characterized in that, The system is used to implement the image recognition method under complex lighting conditions as described in any one of claims 1 to 4, the system comprising: The acquisition module is used to acquire the image to be recognized, analyze the image to be recognized to obtain the area affected by illumination, and divide the area affected by illumination into multiple grid units according to preset rules. The selection module is used to select corresponding pixels from the center position of the grid cell and obtain corresponding pixel blocks with the pixels as the center based on the preset window size, and to randomly select pixels from the non-illuminated area of ​​the image to be recognized and obtain corresponding pixel blocks based on the preset window size. The recognition module is used to calculate the distance between pixel blocks in the illuminated and unilluminated regions and determine the similarity weight between pixel blocks based on the distance between them. The similarity weight is used to denoise the image to be recognized to obtain the corresponding denoised recognition image. The denoised recognition image is then input into a preset image recognition model to obtain the corresponding image recognition result. Among them, the pixel density of the illuminated area is higher than that of the non-illuminated area, and the preset window size of the pixel block in the illuminated area is smaller than that of the pixel block in the non-illuminated area.

6. A readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the steps of the method as described in any one of claims 1 to 4.

7. An electronic device, characterized in that, It includes a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor, when executing the program, implements the steps of the method as described in any one of claims 1 to 4.