A data management method and system based on image recognition
By using the gray degree statistical histogram and adaptive histogram equilibrium technology in the image balancing processing, determine the optimal part of the interval, solve the problem that the color tone is separated when there is a large number of connected pictures in the existing technology, and realize the efficiency of efficiency. , Accurate image balanced processing.
Patent Information
- Application Number
- CN202410356528.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-27
- Publication Date
- 2025-01-24
- Estimated Expiration
- 2044-03-27
AI Technical Summary
The existing image equalization method is difficult to effectively batch processing a large number of pictures with interrelated and similar styles, resulting in the tones of individual pictures being separated from the overall tone, affecting the accuracy of subsequent management actions such as identification and classification.
By obtaining the ash statistical histogram of the image set to be processed, the number of peak points of each gray degree statistical direct map is statistically determined to determine the optimal part of each color channel, and based on these local interval Make sure the image is retained during the balance of the image and the gray relationship between the original gray characteristics and the color channel.
In the case of maintaining the overall style characteristics of the image, improve the efficiency and accuracy of the balanced image processing, avoid the problem of too obvious changes in individual images, losing the correlation with other images, and can efficiently handle a large number of pictures.
Smart Images

Figure CN118172570B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image recognition management, and in particular to a data management method and system based on image recognition. Background Art
[0002] When managing image data, preprocessing such as enhancement, deduplication, and segmentation is often required. These preprocessing methods are designed to extract or improve the features of the image for better analysis or application. Among them, image equalization is a common processing method in image enhancement. Through image equalization, we can stretch the grayscale distribution of pixels in the image, thereby enhancing the contrast of the image and making the details more clearly visible. This processing method can visually improve the quality of the image and help better analyze and process image data in some cases.
[0003] Specifically, image equalization usually uses the histogram equalization method. This method first calculates the grayscale histogram of the image, and then remaps the grayscale of the original image to a more uniform distribution by transforming the histogram. This process can make the grayscale of the pixels in the image more evenly distributed throughout the grayscale range.
[0004] However, the existing image equalization method is only for the equalization effect of a single image, without considering the correlation between the same batch of images. When batch processing is performed on interrelated images with similar styles (such as a large number of images taken in the same scene), it is very likely that the pursuit of balance for a single image will cause the color tone of individual images to be separated from the overall tone, thereby affecting the correlation between the image and other images and the accuracy of subsequent management actions such as recognition and classification. Summary of the invention
[0005] Therefore, the present invention provides a data management method and system based on image recognition, which is used to solve the problem that it is difficult to batch process a large number of pictures using an image equalization method in the existing image recognition management method.
[0006] The present invention provides a data management method based on image recognition, comprising:
[0007] Obtain an image set to be processed, count the grayscale values of all images in the image set to be processed on three color channels, and obtain grayscale statistical histograms of the three color channels;
[0008] Count the number of peak points of each grayscale statistical histogram, and use the number of peak points of each grayscale statistical histogram as the number of local intervals of the color channel;
[0009] According to the number of local intervals of the three color channels, the optimal local interval of each color channel is determined, and based on the optimal local interval, each image in the image set to be processed is subjected to adaptive histogram equalization processing to obtain an enhanced image set;
[0010] The images in the enhanced image set are identified, and data management of the enhanced image set is performed based on the identification results.
[0011] In a possible implementation, determining the optimal local interval of each color channel according to the number of local intervals of the three color channels, and performing adaptive histogram equalization processing on each image in the image set to be processed based on the optimal local interval to obtain an enhanced image set includes:
[0012] According to the three grayscale statistical histograms and the corresponding local interval numbers, the optimal local intervals in the three color channels are calculated based on the particle swarm algorithm with the goal of retaining the grayscale characteristics of the image itself and the grayscale relationship between the three color channels when the image is processed by adaptive histogram equalization.
[0013] Based on the optimal local intervals in the three color channels, each image in the processed image set is subjected to adaptive histogram equalization processing to obtain an enhanced image set.
[0014] In a possible implementation, the method is to calculate the optimal local intervals in the three color channels based on the particle swarm algorithm according to the three grayscale statistical histograms and the corresponding local interval numbers, with the grayscale characteristics of the image itself and the grayscale relationship between the three color channels being retained when the image is subjected to adaptive histogram equalization processing as the optimization goal, and including:
[0015] Determine the solution space according to the number of local intervals in the three grayscale statistical histograms and the value range of the local interval endpoints;
[0016] Establishing a reference particle in the solution space, wherein three grayscale statistical histograms are evenly distributed in the local intervals of the three color channels represented by the reference particle;
[0017] Determine the fitness function according to the element value in the position vector corresponding to the benchmark particle;
[0018] Establish an initial particle swarm in the solution space, and optimize the position of the initial particle swarm in the solution space based on the particle swarm algorithm according to the fitness function to obtain the optimized particle swarm;
[0019] According to the fitness function, the best particle in the optimized particle group is selected, and the optimal local interval endpoints in the three color channels are obtained according to the element value in the position vector corresponding to the best particle;
[0020] According to the optimal local interval endpoints in the three color channels, the optimal local interval in the three color channels is obtained.
[0021] In a possible implementation, the first The position vector of a particle is:
[0022] in, is the number of particles in the initial swarm The position vector of a particle, Each element value in is a local interval endpoint, and Respectively The first color channel represented by the particle The starting and ending endpoints of a local interval, is the number of local bins for the first color channel, and Respectively The second color channel represented by the particle The starting and ending endpoints of a local interval, is the number of local bins for the second color channel, and Respectively The third color channel represented by the particle The starting and ending endpoints of a local interval, is the number of local intervals of the third color channel;
[0023] The position vector of the reference particle is:
[0024] in, is the position vector of the reference particle, Each element value in is a local interval endpoint, and They are the first color channel represented by the reference particle. The starting and ending endpoints of a local interval, and The second color channel of the reference particle is represented by The starting and ending endpoints of a local interval, and They are the third color channel represented by the reference particle. The starting and ending endpoints of a local interval.
[0025] In a possible implementation, the fitness function is:
[0026]
[0027] in, is the number of particles in the initial swarm The fitness of each particle, the smaller the value, the higher the fitness; For the The grayscale feature retention of the image of each particle. The smaller the value, the higher the retention. For the The grayscale relationship retention degree between the three color channels of each particle. The smaller the value, the higher the retention degree.
[0028] For the The jth local interval endpoint in the position vector of the particle, For the The number of pixels in the local interval starting from the local interval endpoint of the color channel image corresponding to the jth local interval endpoint in the position vector of the particle, and Respectively not with The number of pixels of the two color channel images corresponding to the jth local interval endpoint in the position vector of the particle in the local interval starting from the local interval endpoint; is the jth local interval endpoint in the position vector of the reference particle, is the number of pixels in the local interval starting from the jth local interval endpoint of the color channel image corresponding to the jth local interval endpoint in the position vector of the reference particle, and are the number of pixels of the two color channel images that do not correspond to the jth local interval endpoint in the position vector of the reference particle in the local interval starting from the local interval endpoint, , and They are adjustment factors for different units.
[0029] In a possible implementation, the step of establishing an initial particle swarm in the solution space includes:
[0030] The grayscale value of the first pixel whose number is not 0 in the three grayscale statistical histograms is used as , and ;
[0031] The grayscale value of the last pixel whose number is not 0 in the three grayscale statistical histograms is used as , and ;
[0032] according to , , , , and , establish the initial particle swarm.
[0033] In a possible implementation, the step of performing adaptive histogram equalization processing on each image in the image set to be processed based on the optimal local intervals in the three color channels to obtain an enhanced image set includes:
[0034] Obtain a target image in the image set to be processed, and decompose the target image into three target color channel images on three color channels;
[0035] Equalizing the three target color channel images based on a preset equalization function to obtain three enhanced color channel images;
[0036] The three color-enhanced images are merged to obtain an enhanced image in the enhanced image set.
[0037] In a possible implementation, the preset equalization function is:
[0038] in, To enhance the grayscale value in the color channel image, is the grayscale value in the target color channel image, is the cumulative distribution function based on the grayscale value in the target color channel image, is the total number of pixels in the processed image set, Grayscale value in the target color channel image The optimal local interval where is the probability density function corresponding to the target color channel map, is the variable of the probability density function.
[0039] The present invention also provides a data management system based on image recognition, comprising:
[0040] The channel decomposition module is used to obtain the image set to be processed, count the grayscale values of all images in the image set to be processed on the three color channels, and obtain the grayscale statistical histograms of the three color channels;
[0041] The interval analysis module is used to count the number of peak points of each grayscale statistical histogram, and use the number of peak points of each grayscale statistical histogram as the number of local intervals of the color channel;
[0042] An image equalization module is used to determine the optimal local interval of each color channel according to the number of local intervals of the three color channels, and to perform adaptive histogram equalization processing on each image in the image set to be processed based on the optimal local interval to obtain an enhanced image set;
[0043] The recognition management module is used to recognize images in the enhanced image set and perform data management on the enhanced image set according to the recognition results.
[0044] The beneficial effects of adopting the above embodiment are:
[0045] The present invention provides a data management method and system based on image recognition, wherein the method first uses a grayscale statistical histogram obtained by statistically analyzing a set of images to be processed to determine the number of local intervals used when processing images using histogram equalization, and then uses an adaptive histogram equalization method to process the set of images to be processed after determining the optimal local interval that meets the quantity requirements, to obtain an enhanced image set, and then perform other recognition management operations. Compared with the prior art, the present invention uses a grayscale statistical histogram to describe the grayscale distribution statistical characteristics of all images in the set of images to be processed, and then determines the number of local intervals based on the peak value of the grayscale statistical histogram, so that the division of local intervals refers to the overall style of all images. At the same time, the present invention also uses an adaptive histogram equalization processing method to perform image enhancement, which is used to ensure that the equalization operation can flexibly follow the optimized local interval changes, so that the equalized image can still maintain the overall style characteristics of all images, avoiding the phenomenon that the individual processed images change too obviously and lose the correlation with other images. In addition, because the optimal local interval has been pre-determined before equalization, the present invention does not need to analyze the local space separately when equalizing each image subsequently, which greatly improves the efficiency of batch processing of images and solves the problem in existing image recognition management methods that it is difficult to batch process a large number of images using image equalization methods. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 A method flow chart of the data management method based on image recognition provided by the present invention;
[0047] Figure 2 for Figure 1 The method flow chart of step S103 in FIG.
[0048] Figure 3 for Figure 2 The method flow chart of step S201 in FIG.
[0049] Figure 4 A system architecture diagram of a data management system based on image recognition provided by the present invention;
[0050] Figure 5 is an image to be processed in one embodiment of the present invention;
[0051] Figure 6 To use existing technology to deal with Figure 5 The result image of
[0052] Figure 7 for Figure 6 Schematic diagram of local area division corresponding to histogram equalization;
[0053] Figure 8 To use the present invention to treat Figure 5 The result image of
[0054] Fig. 9 for Figure 8 Schematic diagram of local area division corresponding to histogram equalization. DETAILED DESCRIPTION
[0055] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0056] Combination Figure 1 As shown, a specific embodiment of the present invention discloses a data management method based on image recognition, comprising:
[0057] S101, obtaining a set of images to be processed, counting the grayscale values of all images in the set of images to be processed on three color channels, and obtaining grayscale statistical histograms of the three color channels;
[0058] S102, counting the number of peak points of each grayscale statistical histogram, and using the number of peak points of each grayscale statistical histogram as the number of local intervals of the color channel;
[0059] S103, determining the optimal local interval of each color channel according to the number of local intervals of the three color channels, and performing adaptive histogram equalization processing on each image in the image set to be processed based on the optimal local interval to obtain an enhanced image set;
[0060] S104: Identify images in the enhanced image set, and perform data management on the enhanced image set according to the identification result.
[0061] The present invention provides a data management method and system based on image recognition, wherein the method first uses a grayscale statistical histogram obtained by statistically analyzing a set of images to be processed to determine the number of local intervals used when processing images using histogram equalization, and then uses an adaptive histogram equalization method to process the set of images to be processed after determining the optimal local interval that meets the quantity requirements, to obtain an enhanced image set, and then perform other recognition management operations. Compared with the prior art, the present invention uses a grayscale statistical histogram to describe the grayscale distribution statistical characteristics of all images in the set of images to be processed, and then determines the number of local intervals based on the peak value of the grayscale statistical histogram, so that the division of local intervals refers to the overall style of all images. At the same time, the present invention also uses an adaptive histogram equalization processing method to perform image enhancement, which is used to ensure that the equalization operation can flexibly follow the optimized local interval changes, so that the equalized image can still maintain the overall style characteristics of all images, avoiding the phenomenon that the individual processed images change too obviously and lose the correlation with other images. In addition, because the optimal local interval has been pre-determined before equalization, the present invention does not need to analyze the local space separately when equalizing each image subsequently, which greatly improves the efficiency of batch processing of images and solves the problem in existing image recognition management methods that it is difficult to batch process a large number of images using image equalization methods.
[0062] It should be noted that the three color channels in this embodiment generally refer to the color channels of the three images of red, green and blue, i.e., RGB channels, which can also be changed according to the specific image mode in practice. The grayscale statistical histogram is a grayscale distribution histogram of all pixels of all images in a certain color channel in the image set to be processed, and can also be understood as the superposition of grayscale histograms of all images in a certain color channel. In this embodiment, the peak point generally refers to the peak point, including the maximum value, the maximum value, etc.
[0063] The adaptive histogram equalization in this embodiment is a technology for image enhancement, which is used to improve the contrast and brightness distribution of the image. Unlike traditional histogram equalization, adaptive histogram equalization can perform histogram equalization operations according to local areas of the image instead of operating on the entire image. Traditional histogram equalization maps the pixel value histogram of the entire image to a uniformly distributed histogram, thereby enhancing the contrast of the image. However, in some cases, the application of traditional histogram equalization may cause some problems, especially when there are areas with large differences in brightness and darkness in the image. Adaptive histogram equalization solves this problem by dividing the image into multiple local areas and applying histogram equalization in each area. The histogram of each local area will be mapped to a uniformly distributed histogram, so that the contrast of each area is enhanced. The advantage of doing this is that the detailed information of the image can be retained and excessive enhancement or destruction of the image can be avoided. The number of local intervals in this embodiment and the local interval endpoints mentioned later are all nouns in the histogram equalization processing method, and they and the adaptive histogram equalization method are both prior arts that can be understood by those skilled in the art, so this article will not make too much explanation.
[0064] Further, combined with Figure 2 As shown, in a preferred embodiment, step S103, according to the number of local intervals of the three color channels, determines the optimal local interval of each color channel, and performs adaptive histogram equalization processing on each image in the image set to be processed based on the optimal local interval to obtain an enhanced image set, specifically including:
[0065] S201, according to three grayscale statistical histograms and corresponding local interval numbers, taking the grayscale characteristics of the image itself and the grayscale relationship between the three color channels as the optimization goal when the image is subjected to adaptive histogram equalization processing, and calculating the optimal local intervals in the three color channels based on the particle swarm algorithm;
[0066] S202 , based on the optimal local intervals in the three color channels, perform adaptive histogram equalization processing on each image in the image set to be processed to obtain an enhanced image set.
[0067] In the prior art, when the number of local intervals is known, the range of a specific local interval is generally determined by dividing the histogram in each local interval in a manner that makes it evenly distributed. However, this division method only considers the grayscale distribution characteristics of the image itself and does not and cannot consider the connection with other images. Therefore, in this embodiment, a particle swarm optimization algorithm is used to find a better division method so that the optimal local interval finally obtained contains the grayscale distribution law between each image. The above idea is mainly achieved by establishing a fitness function based on the optimization goal of retaining the grayscale characteristics of the image itself and retaining the grayscale relationship between the three color channels.
[0068] In addition, it is worth noting that the traditional histogram equalization process only equalizes each color channel according to its own distribution. This leads to the problem of color unevenness and distortion if the three channels of the color image R, G, and B are directly equalized and then merged. However, in this embodiment, the grayscale relationship between the three color channels is considered during optimization, so that the optimal local interval obtained in the end also retains the original Figure 3 The distribution ratio of each channel reduces the adverse effects such as color unevenness and distortion.
[0069] The particle swarm optimization (PSO) algorithm in this embodiment is an optimization algorithm based on swarm intelligence, which simulates the group behavior in natural systems such as bird flocks or fish schools. The algorithm is based on the social behavior and cognitive behavior between individuals, and seeks the optimal solution through cooperation and information sharing.
[0070] In the particle swarm algorithm, the individuals that solve the problem are called particles. Each particle has its own position and speed, representing a candidate solution to the problem. The particle updates its speed and position based on its current position and speed, and is influenced by its own historical experience and group experience.
[0071] The basic process of particle swarm optimization is as follows:
[0072] 1. Initialize the position and velocity of the particle swarm. The position can be randomly selected, and the velocity is generally also a random initial value.
[0073] 2. For each particle, calculate its fitness according to the problem-specific function (i.e., fitness function).
[0074] 3. Update the particle’s velocity and position to move it toward the best historical position (individual optimal solution) and the global best position (group optimal solution).
[0075] 4. Determine whether to terminate the algorithm based on the set stopping criteria (for example, reaching a certain number of iterations or reaching the required fitness).
[0076] 5. If the termination condition is not met, return to step 3.
[0077] The core idea of the particle swarm algorithm is to find the optimal solution through cooperation and information transmission between individuals. It has good global search capabilities and good convergence in multidimensional and nonlinear problems. Therefore, the particle swarm algorithm is widely used in the fields of function optimization, combinatorial optimization, neural network training, etc. It is particularly suitable for the application scenario of this embodiment.
[0078] For this embodiment, how to design the fitness function so that it can evaluate the grayscale characteristics of the image itself and the grayscale relationship between the three color channels is the key to the operation effect of this method. Therefore, the present invention further optimizes the particle swarm algorithm by introducing the interval division method in the traditional histogram equalization method as the reference particle method into the particle swarm algorithm to participate in the design of the fitness function so that the fitness function can achieve the above functions.
[0079] Specifically, combined Figure 3 As shown, in a preferred embodiment, step S201, according to three grayscale statistical histograms and corresponding local interval numbers, with the grayscale characteristics of the image itself and the grayscale relationship between the three color channels being retained when the image is subjected to adaptive histogram equalization processing as the optimization goal, the optimal local intervals in the three color channels are calculated based on the particle swarm algorithm, specifically including:
[0080] S301, determining a solution space according to the number of local intervals in three grayscale statistical histograms and the value range of local interval endpoints;
[0081] S302, establishing a reference particle in the solution space, wherein three grayscale statistical histograms are evenly distributed in local intervals of three color channels represented by the reference particle;
[0082] S303, determining a fitness function according to an element value in a position vector corresponding to the reference particle;
[0083] S304, establishing an initial particle swarm in the solution space, and optimizing the position of the initial particle swarm in the solution space based on the particle swarm algorithm according to the fitness function to obtain an optimized particle swarm;
[0084] S305, selecting the best particle in the optimized particle group according to the fitness function, and obtaining the best local interval endpoints in the three color channels according to the element value in the position vector corresponding to the best particle;
[0085] S306 , obtaining the optimal local intervals in the three color channels according to the optimal local interval endpoints in the three color channels.
[0086] Since the reference particle needs to be determined according to the actual situation, the position of the data requiring the reference particle in the fitness function is reserved in the above process. After the value of the position vector of the reference particle is determined, the fitness function is determined to ensure the validity of the fitness function.
[0087] Specifically, in the above process, the first The position vector of a particle is:
[0088] in, is the number of particles in the initial swarm The position vector of a particle, Each element value in is a local interval endpoint, and Respectively The first color channel represented by the particle The starting and ending endpoints of a local interval, is the number of local bins for the first color channel, and Respectively The second color channel represented by the particle The starting and ending endpoints of a local interval, is the number of local bins for the second color channel, and Respectively The third color channel represented by the particle The starting and ending endpoints of a local interval, is the number of local intervals of the third color channel;
[0089] The position vector of the reference particle is:
[0090] in, is the position vector of the reference particle, Each element value in is a local interval endpoint, and They are the first color channel represented by the reference particle. The starting and ending endpoints of a local interval, and The second color channel of the reference particle is represented by The starting and ending endpoints of a local interval, and They are the third color channel represented by the reference particle. The starting and ending endpoints of a local interval.
[0091] It can be seen that in this embodiment, when encoding the solution, the dimension of the entire solution space is the number of local spaces plus three, which is used to represent the number of all local space endpoints in the three channels, and the value range of each dimension is the value range of the grayscale value (generally 0-255). In this embodiment, the encoding is performed in the form of a one-dimensional vector, and the distribution of the local intervals in the three color channels is collected in one vector. The data corresponding to the three channels is implicitly reflected through the position relationship of each element, which reduces the matrix calculation amount of the computer and improves the running speed.
[0092] It is understandable that in practice, it is necessary to pay attention to the size relationship of the elements in the position vector of each particle, as well as the size relationship between each element after movement. According to the encoding method of this embodiment, the initial particles and the reference particles representing multiple element values in the same color channel should be arranged in order from small to large. If an erroneous particle that does not meet the requirements appears during initialization or movement, it is necessary to roll the particle back to the previous position in time and move again or pause.
[0093] Furthermore, in a preferred embodiment, the fitness function is:
[0094]
[0095] in, is the number of particles in the initial swarm The fitness of each particle, the smaller the value, the higher the fitness; For the The grayscale feature retention of the image of each particle. The smaller the value, the higher the retention. For the The grayscale relationship retention degree between the three color channels of each particle. The smaller the value, the higher the retention degree.
[0096] For the The jth local interval endpoint in the position vector of the particle, For the The number of pixels in the local interval starting from the local interval endpoint of the color channel image corresponding to the jth local interval endpoint in the position vector of the particle, and Respectively not with The number of pixels of the two color channel images corresponding to the jth local interval endpoint in the position vector of the particle in the local interval starting from the local interval endpoint; is the jth local interval endpoint in the position vector of the reference particle, is the number of pixels in the local interval starting from the jth local interval endpoint of the color channel image corresponding to the jth local interval endpoint in the position vector of the reference particle, and are the number of pixels of the two color channel images that do not correspond to the jth local interval endpoint in the position vector of the reference particle in the local interval starting from the local interval endpoint, , and They are adjustment factors for different units.
[0097] In this embodiment The meaning of the term is to require the size of each local interval to be consistent with the density of pixels in the interval. By calculating the ratio of the lengths of adjacent intervals and the difference between the ratios of the sums of pixels in adjacent intervals, it is evaluated whether the length of the local interval is consistent with the distribution of pixels. In this way, the calculation result of the fitness function is affected by the grayscale distribution of the image itself, so that the optimization result can retain the grayscale characteristics of the image itself to the greatest extent.
[0098] In this embodiment The significance of the term is to limit the division ratio of the local intervals between the three channels. It takes the division method of the grayscale histogram of each channel by the benchmark particle as a reference, and describes the pixel distribution ratio relationship between different color channels by the ratio of the number of pixels in the grayscale histograms of different channels of the same local interval. The pixel allocation ratio relationship of the division method represented by the benchmark particle is described in the same way. The difference between the two is used to intuitively evaluate the proportional difference of the two division methods in different channels, so that the fitness finally calculated is affected by the grayscale relationship between colors, so that the optimization result can retain the grayscale relationship between the three color channels to the greatest extent.
[0099] Further, in a preferred embodiment, the step S304 of establishing an initial particle swarm in the solution space includes:
[0100] The grayscale value of the first pixel whose number is not 0 in the three grayscale statistical histograms is used as , and ;
[0101] The grayscale value of the last pixel whose number is not 0 in the three grayscale statistical histograms is used as , and ;
[0102] according to , , , , and , establish the initial particle swarm.
[0103] The above process can skip the extreme grayscale values where no pixels exist at both ends of the histogram, narrow the range of the local interval, improve the accuracy of the initial particle swarm, and improve the operating efficiency of the feature algorithm.
[0104] Further, in a preferred embodiment, the above step S202, based on the optimal local intervals in the three color channels, performs adaptive histogram equalization processing on each image in the image set to be processed to obtain an enhanced image set, specifically includes:
[0105] Obtain a target image in the image set to be processed, and decompose the target image into three target color channel images on three color channels;
[0106] Equalizing the three target color channel images based on a preset equalization function to obtain three enhanced color channel images;
[0107] The three color-enhanced images are merged to obtain an enhanced image in the enhanced image set.
[0108] Specifically, the preset equalization function is:
[0109] in, To enhance the grayscale value in the color channel image, is the grayscale value in the target color channel image, is the cumulative distribution function based on the grayscale value in the target color channel image, is the total number of pixels in the processed image set, Grayscale value in the target color channel image The optimal local interval where is the probability density function corresponding to the target color channel map, is the variable of the probability density function.
[0110] Since the adaptive histogram equalization process is adopted in this embodiment, the equalization function used needs to change the starting point and bias of the integration according to the different endpoints of the local area.
[0111] Combination Figure 4 As shown, in a preferred embodiment, the present invention also provides a data management system based on image recognition, specifically comprising:
[0112] The channel decomposition module 401 is used to obtain a set of images to be processed, count the grayscale values of all images in the set of images to be processed on three color channels, and obtain grayscale statistical histograms of the three color channels;
[0113] The interval analysis module 402 is used to count the number of peak points of each grayscale statistical histogram, and use the number of peak points of each grayscale statistical histogram as the number of local intervals of the color channel;
[0114] The image equalization module 403 is used to determine the optimal local interval of each color channel according to the number of local intervals of the three color channels, and perform adaptive histogram equalization processing on each image in the image set to be processed based on the optimal local interval to obtain an enhanced image set;
[0115] The recognition management module 404 is used to recognize images in the enhanced image set and perform data management on the enhanced image set according to the recognition result.
[0116] It should be noted here that the corresponding system provided in the above embodiments can implement the technical solutions described in the above method embodiments. The specific implementation principles of the above modules or units can be found in the corresponding contents in the above method embodiments, which will not be repeated here.
[0117] Finally, the present invention also provides a more detailed embodiment to clearly illustrate the above-mentioned data management method and system based on image recognition:
[0118] Figure 5 This is an image to be processed in this embodiment. Most of the image is dark red, and it gradually changes from dark to light from top to bottom. There are green stripes running horizontally through the image, and blue stripes running vertically through the image. The three colors are superimposed at the center of the image, and the image as a whole is darker.
[0119] Figure 6 The result of histogram equalization of the image to be processed using the existing technology is that the local area during equalization is roughly as follows: Figure 7 (The discrete histogram is represented by a continuous curve in the figure for easy understanding), and the dotted line in the figure is the boundary (endpoint) of the local area. It can be seen that because the three channels did not consider the influence of each other when balancing, the three channels were over-adjusted, making it obvious that the horizontal green stripes and the vertical blue stripes in the final image are wider, and the gradient effect of the boundary is not as good as the original image. For the intersection of different colors in the original image, the processed image has been distorted.
[0120] Figure 8 is the result of processing the image to be processed by the method in this embodiment. The local area during equalization is roughly as follows: Fig. 9(The discrete histogram is represented by a continuous curve in the figure for easy understanding). The dotted line in the figure is the boundary (endpoint) of the local area. It can be seen that the light and dark contrast of the red part of the image is more obvious, while the dark red tone is maintained, achieving image balance. At the same time, it can be seen from the width of the horizontal green stripes and the vertical blue stripes. Figure 6 In comparison, it can be clearly seen that the image processed by this method has less distortion and fewer defects.
[0121] The present invention provides a data management method and system based on image recognition, wherein the method first uses a grayscale statistical histogram obtained by statistically analyzing a set of images to be processed to determine the number of local intervals used when processing images using histogram equalization, and then uses an adaptive histogram equalization method to process the set of images to be processed after determining the optimal local interval that meets the quantity requirements, to obtain an enhanced image set, and then perform other recognition management operations. Compared with the prior art, the present invention uses a grayscale statistical histogram to describe the grayscale distribution statistical characteristics of all images in the set of images to be processed, and then determines the number of local intervals based on the peak value of the grayscale statistical histogram, so that the division of local intervals refers to the overall style of all images. At the same time, the present invention also uses an adaptive histogram equalization processing method to perform image enhancement, which is used to ensure that the equalization operation can flexibly follow the optimized local interval changes, so that the equalized image can still maintain the overall style characteristics of all images, avoiding the phenomenon that the individual processed images change too obviously and lose the correlation with other images. In addition, because the optimal local interval has been pre-determined before equalization, the present invention does not need to analyze the local space separately when equalizing each image subsequently, which greatly improves the efficiency of batch processing of images and solves the problem in existing image recognition management methods that it is difficult to batch process a large number of images using image equalization methods.
[0122] It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0123] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A data management method based on image recognition, characterized in that: include: Obtain an image set to be processed, count the grayscale values of all images in the image set to be processed on three color channels, and obtain grayscale statistical histograms of the three color channels; Count the number of peak points of each grayscale statistical histogram, and use the number of peak points of each grayscale statistical histogram as the number of local intervals of the color channel; According to the number of local intervals of the three color channels, the optimal local interval of each color channel is determined, and based on the optimal local interval, each image in the image set to be processed is subjected to adaptive histogram equalization processing to obtain an enhanced image set; Identify images in the enhanced image set, and perform data management on the enhanced image set according to the identification result; The method of determining the optimal local interval of each color channel according to the number of local intervals of the three color channels, and performing adaptive histogram equalization processing on each image in the image set to be processed based on the optimal local interval to obtain an enhanced image set includes: According to the three grayscale statistical histograms and the corresponding local interval numbers, the optimal local intervals in the three color channels are calculated based on the particle swarm algorithm with the goal of retaining the grayscale characteristics of the image itself and the grayscale relationship between the three color channels when the image is processed by adaptive histogram equalization. Based on the optimal local intervals in the three color channels, each image in the image set to be processed is subjected to adaptive histogram equalization processing to obtain an enhanced image set; Among them, according to the three grayscale statistical histograms and the corresponding local interval numbers, the optimization goal is to retain the grayscale characteristics of the image itself and the grayscale relationship between the three color channels when the image is subjected to adaptive histogram equalization processing, and calculate the optimal local intervals in the three color channels based on the particle swarm algorithm, including: Determine the solution space according to the number of local intervals in the three grayscale statistical histograms and the value range of the local interval endpoints; Establishing a reference particle in the solution space, wherein three grayscale statistical histograms are evenly distributed in the local intervals of the three color channels represented by the reference particle; Determine the fitness function according to the element value in the position vector corresponding to the benchmark particle; Establish an initial particle swarm in the solution space, and optimize the position of the initial particle swarm in the solution space based on the particle swarm algorithm according to the fitness function to obtain the optimized particle swarm; According to the fitness function, the best particle in the optimized particle group is selected, and the optimal local interval endpoints in the three color channels are obtained according to the element value in the position vector corresponding to the best particle; According to the optimal local interval endpoints in the three color channels, the optimal local intervals in the three color channels are obtained; The method of performing adaptive histogram equalization processing on each image in the image set to be processed based on the optimal local intervals in the three color channels to obtain an enhanced image set includes: Obtain a target image in the image set to be processed, and decompose the target image into three target color channel images on three color channels; Equalizing the three target color channel images based on a preset equalization function to obtain three enhanced color channel images; The three color-enhanced images are merged to obtain an enhanced image in the enhanced image set.
2. The data management method based on image recognition according to claim 1, characterized in that: The position vector of the i-th particle in the initial particle swarm is: X i =(x i1 ,x i2 ...x i(a-1) ,x ia , x i(a+1) ,x i(a+2) ...x i(a+b-1) ,x i(a+b) , x i(a+b+1) ,x i(a+b+2) ...x i(a+b+c-1) ,x i(a+b+c) ) Among them, X i is the position vector of the i-th particle in the initial particle swarm, X i Each element value in is a local interval endpoint, x i(a-1) and x ia are the starting and ending endpoints of the (a-1)th local interval in the first color channel represented by the ith particle, respectively. (a-1) is the number of local intervals in the first color channel. x i(a+b-1) and x i(a+b) are the starting and ending endpoints of the (b-1)th local interval in the second color channel represented by the ith particle, (b-1) is the number of local intervals in the second color channel, and x i(a+b+c-1) and x i(a+b+c) are the starting endpoint and the ending endpoint of the (c-1)th local interval in the third color channel represented by the ith particle, respectively, and (c-1) is the number of local intervals in the third color channel; The position vector of the reference particle is: X=(x1,x2...x a-1 ,x a ,x a+1 ,x a+2 ...x a+b-1 ,x a+b ,x a+b+1 ,x (a+b+2) ...x (a+b+c-1) ,x (a+b+c) ) Where X is the position vector of the reference particle, and each element value in X is an endpoint of a local interval. (a-1) and x a are the starting and ending endpoints of the (a-1)th local interval in the first color channel represented by the reference particle, respectively. (a+b-1) and x (a+b) are the starting and ending endpoints of the (b-1)th local interval in the second color channel represented by the reference particle, respectively. i(a+b+c-1) and x i(a+b+c) They are respectively the starting endpoint and the ending endpoint of the (c-1)th local interval in the third color channel represented by the reference particle.
3. The data management method based on image recognition according to claim 2, characterized in that: The fitness function is: Fitness(X i )=k1SelfFit(X i )+EachFit(X i ) j≠a, a+b, a+b+c, where Fitness(X ij ) is the fitness of the i-th particle in the initial particle group, and the smaller the value, the higher the fitness; SelfFit(X i ) is the grayscale feature retention of the image of the i-th particle itself, and the smaller the value, the higher the retention; EachFit(X i ) is the grayscale relationship preservation degree between the three color channels of the i-th particle, and the smaller the value, the higher the preservation degree; x ij is the jth local interval endpoint in the position vector of the ith particle, N(x ij ,x i(j+1) ) is the number of pixels in the local interval starting from the jth local interval endpoint of the color channel image corresponding to the jth local interval endpoint in the position vector of the ith particle, N1(x ij ,x i(j+1) ) and N2(x ij ,x i(j+1) ) are the number of pixels of the two color channel images that do not correspond to the jth local interval endpoint in the position vector of the ith particle in the local interval starting from the local interval endpoint; x j is the jth local interval endpoint in the position vector of the reference particle, N(x j ,x (j+1) ) is the number of pixels in the local interval starting from the jth local interval endpoint of the color channel image corresponding to the jth local interval endpoint in the position vector of the reference particle, N1(x j ,x (j+1) ) and N2(x j ,x (j+1) ) are the number of pixels of the two color channel images that do not correspond to the jth local interval endpoint in the position vector of the reference particle in the local interval starting from the local interval endpoint, and k1, k2 and k3 are different unit adjustment coefficients.
4. The data management method based on image recognition according to claim 2, characterized in that: The step of establishing an initial particle swarm in the solution space includes: The grayscale value of the first pixel whose number is not 0 in the three grayscale statistical histograms is respectively used as x i1 、x i(a+1) and x i(a+b+1) ; The grayscale value of the last pixel in the three grayscale statistical histograms that is not 0 is used as x ia 、x i(a+b) and x i(a+b+c) ; According to x i1 、x i(a+1) 、x i(a+b+1) 、x ia 、x i(a+b) and x i(a+b+c) , establish the initial particle swarm.
5. The data management method based on image recognition according to claim 1, characterized in that: The preset equalization function is: Where s is the grayscale value in the enhanced color channel image, r is the grayscale value in the target color channel image, T(r) is the cumulative distribution function based on the grayscale value in the target color channel image, and n pix is the total number of pixels in the processed image set, (α, β) is the optimal local interval of the grayscale value r in the target color channel image, and p r (t) is the probability density function corresponding to the target color channel map, and t is the variable of the probability density function.
6. A data management system based on image recognition, characterized in that: include: The channel decomposition module is used to obtain the image set to be processed, count the grayscale values of all images in the image set to be processed on the three color channels, and obtain the grayscale statistical histograms of the three color channels; The interval analysis module is used to count the number of peak points of each grayscale statistical histogram, and use the number of peak points of each grayscale statistical histogram as the number of local intervals of the color channel; An image equalization module is used to determine the optimal local interval of each color channel according to the number of local intervals of the three color channels, and to perform adaptive histogram equalization processing on each image in the image set to be processed based on the optimal local interval to obtain an enhanced image set; An identification management module, used for identifying images in the enhanced image set and performing data management on the enhanced image set according to the identification results; The method of determining the optimal local interval of each color channel according to the number of local intervals of the three color channels, and performing adaptive histogram equalization processing on each image in the image set to be processed based on the optimal local interval to obtain an enhanced image set includes: According to the three grayscale statistical histograms and the corresponding local interval numbers, the optimal local intervals in the three color channels are calculated based on the particle swarm algorithm with the goal of retaining the grayscale characteristics of the image itself and the grayscale relationship between the three color channels when the image is processed by adaptive histogram equalization. Based on the optimal local intervals in the three color channels, each image in the image set to be processed is subjected to adaptive histogram equalization processing to obtain an enhanced image set; Among them, according to the three grayscale statistical histograms and the corresponding local interval numbers, the optimization goal is to retain the grayscale characteristics of the image itself and the grayscale relationship between the three color channels when the image is subjected to adaptive histogram equalization processing, and calculate the optimal local intervals in the three color channels based on the particle swarm algorithm, including: Determine the solution space according to the number of local intervals in the three grayscale statistical histograms and the value range of the local interval endpoints; Establishing a reference particle in the solution space, wherein three grayscale statistical histograms are evenly distributed in the local intervals of the three color channels represented by the reference particle; Determine the fitness function according to the element value in the position vector corresponding to the benchmark particle; Establish an initial particle swarm in the solution space, and optimize the position of the initial particle swarm in the solution space based on the particle swarm algorithm according to the fitness function to obtain the optimized particle swarm; According to the fitness function, the best particle in the optimized particle group is selected, and the optimal local interval endpoints in the three color channels are obtained according to the element value in the position vector corresponding to the best particle; According to the optimal local interval endpoints in the three color channels, the optimal local intervals in the three color channels are obtained; The method of performing adaptive histogram equalization processing on each image in the image set to be processed based on the optimal local intervals in the three color channels to obtain an enhanced image set includes: Obtain a target image in the image set to be processed, and decompose the target image into three target color channel images on three color channels; Equalizing the three target color channel images based on a preset equalization function to obtain three enhanced color channel images; The three color-enhanced images are merged to obtain an enhanced image in the enhanced image set.
Citation Information
Patent Citations
Automatic contrast enhancement method and device
CN101599171A
Infrared image enhancement method based on particle swarm optimization
CN109919880A