Content identification method and system based on digital color image
By performing grayscale image conversion and feature analysis on digital color images, obtaining the membership of the winning number and performing contrast stretching processing, the problem of low recognition accuracy of winning number in digital color images in the prior art is solved, and higher recognition accuracy and more accurate contrast stretching results are achieved.
Patent Information
- Application Number
- CN202510027904.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-08
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2045-01-08
AI Technical Summary
When identifying the winning numbers in digital color images, the prior art is limited by the quality problems of the paper version of digital color and the limitations of the image enhancement algorithm, resulting in low recognition accuracy and prone to errors.
By acquiring digital color images and converting them into digital color grayscale images, analyzing the grayscale distribution to obtain the connectivity domain, calculating the black highlighting, peer height consistency and shape feature values, combining these features to obtain the membership of the winning number, and performing contrast stretching based on the membership to improve the recognition accuracy of the winning number.
It improves the recognition accuracy of the winning numbers in digital color images, reduces the interference of other lottery information on the recognition of winning numbers, and enhances the accuracy of the contrast stretching results.
Smart Images

Figure CN119851286A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image recognition technology, and in particular to a method and system for content recognition based on digital color images. Background Art
[0002] Currently popular digital lotteries, such as Color Ball and Lotto, are all paper lotteries, which require manual comparison of winning results, which is inefficient and prone to errors. The existing technology automatically verifies the winning results by identifying the content in the captured digital color image. However, paper digital lottery is not easy to preserve and is prone to wrinkles, folds and bends. In addition, there are differences in shooting equipment, resulting in different quality of digital color images, which in turn affects the recognition of winning numbers in the digital color images. Therefore, it is necessary to enhance the image information in the digital color image.
[0003] Traditional image enhancement algorithms based on contrast stretching usually perform uniform contrast stretching processing on all pixels in the entire image. However, for digital color images containing complex information, such as lottery information such as lottery issue numbers, site numbers, serial numbers, winning numbers, and anti-counterfeiting codes, uniform contrast stretching processing may cause the loss of local features of the winning number information and increase the interference of other lottery information on the recognition of the winning number information, thereby making the winning number difficult to recognize. Summary of the invention
[0004] In view of the above, it is necessary to provide a content recognition method and system based on digital color images, which improves the recognition accuracy of the winning numbers in the digital color images compared with the traditional content recognition method of digital color images: In a first aspect, an embodiment of the present application provides a content recognition method based on a digital color image, the method comprising the following steps: Get a digital color image and convert it into a digital color grayscale image; By analyzing the grayscale distribution of all pixels in the digital color grayscale image, each connected domain in the digital color grayscale image is obtained; Obtain the black prominence of each connected domain through the distribution of the grayscale values of the pixels in each connected domain; By analyzing the similarity of the coordinates of the pixels in each connected domain and all other connected domains in the set direction, the connected domains in the same line of each connected domain are obtained; by analyzing the difference in the position distribution range of the pixels in each connected domain and its connected domains in the same line in the set direction, the height consistency of each connected domain in the same line is obtained; The shape feature value of each connected domain is obtained by analyzing the degree to which the shape of each connected domain is close to a rectangle and the position distribution range of the pixel points in each connected domain in the set direction; Comprehensively analyzing the black prominence, the same height consistency and the shape feature value to obtain the lottery number membership of each connected domain; When a pixel point is located in a connected domain in a digital color grayscale image, the contrast stretching result of the pixel point is obtained through the lottery number membership of the connected domain where the pixel point is located; and the lottery number of the digital color image is obtained through the contrast stretching result.
[0005] In one embodiment, the process of acquiring the connected domain is as follows: A threshold segmentation algorithm is used to obtain a segmentation threshold of the grayscale values of all pixels in the digital color grayscale image, and pixels in the digital color grayscale image that are smaller than the segmentation threshold are used as lottery information pixels; The edge detection operator is used to extract the edge image of the digital color grayscale image, and the connected domain is extracted for all the lottery information pixels in the edge image to obtain each connected domain in the digital color grayscale image.
[0006] In one embodiment, the process of obtaining the black prominence is: calculating the average of the grayscale values of all pixels in each connected domain, and the black prominence is inversely proportional to the average.
[0007] In one embodiment, the process of acquiring the same peer connectivity domain is as follows: Calculate the mean value of the coordinates of all pixels in each connected domain in the set direction, and record it as the coordinate mean; Calculate the difference between the coordinate means of any connected domain and the remaining connected domains, and record it as the coordinate difference; The coordinate differences are arranged in ascending order, and the connected domains corresponding to the first preset number of the coordinate differences are used as connected domains in the same row of any connected domain.
[0008] In one embodiment, the process of obtaining the high consistency of the same peer is as follows: Calculating the range of coordinates of all pixels in each connected domain in the set direction; the distribution range is reflected by the range; Calculate the difference between the ranges of each connected domain and its connected domains in the same row, and record it as the height difference; The peer height consistency is inversely proportional to the height difference.
[0009] In one embodiment, the shape characteristic value is the ratio of the rectangularity of each connected domain to the range.
[0010] In one embodiment, the process of obtaining the membership of the winning number is as follows: Calculate the product of the black prominence and the same height consistency; The membership degree of the winning number is proportional to the product and inversely proportional to the shape feature value.
[0011] In one embodiment, the expression of the contrast stretching result is: ; In the formula, Indicates the contrast stretching result of pixel a in the digital color grayscale image; a represents the pixel in the digital color grayscale image; round() represents the rounding function; norm() represents the normalization function; represents the membership degree of the winning number of the connected domain where the pixel point a is located; AN represents the set of pixels in all connected domains in the digital color grayscale image; g represents a preset non-negative integer used to control the contrast stretching result of the pixel point a.
[0012] In one embodiment, the method for obtaining the winning number of the digital color image is: The grayscale values of the pixels in each connected domain in the digital color grayscale image are replaced with the contrast stretching result to obtain a digital color grayscale enhanced image; A threshold segmentation algorithm is used to obtain a foreground image in a digital color grayscale enhanced image, an optical character recognition technology is used to recognize digital content in the foreground image, and the recognized digital content is used as the winning number of the digital color image.
[0013] In a second aspect, an embodiment of the present application further provides a content recognition system based on digital color images, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, wherein when the processor executes the computer program, the system implements the steps of any one of the above-mentioned content recognition methods based on digital color images.
[0014] This application has at least the following beneficial effects: The present application obtains black prominence by analyzing the grayscale distribution of the winning numbers and other lottery information in the digital lottery grayscale image, reflecting the possibility that the characters corresponding to each connected domain belong to the winning numbers, anti-counterfeiting marks or the purchase amount, which can reduce the influence of the remaining information in the digital color image except the winning numbers, anti-counterfeiting marks and the purchase amount on the recognition accuracy of subsequent winning numbers; identifies the characters in the same row in the digital color image through the coordinates of the pixel points in each connected domain in the set direction, and analyzes the height difference of the characters in the same row to obtain the same row height consistency, reflecting the possibility that the characters corresponding to each connected domain belong to the purchase amount or the characters inside the QR code, which can reduce the influence of the purchase amount in the digital color image and the characters inside the QR code on the recognition accuracy of subsequent winning numbers; obtains shape feature values by analyzing the shape and height of each connected domain, reflecting the possibility that the characters corresponding to each connected domain are anti-counterfeiting codes, which can reduce the influence of anti-counterfeiting codes on the recognition accuracy of subsequent winning numbers; Furthermore, the black prominence, the same height consistency and the shape feature value are comprehensively considered to obtain the winning number membership, which fully considers the difference between the winning number and the rest of the lottery information. The winning numbers in the digital color image can be located more accurately, and then based on the winning number membership, the pixels in the digital color grayscale image are appropriately stretched for contrast, which can more effectively highlight the winning numbers and reduce the visual impact of the rest of the lottery information, thereby improving the recognition accuracy of the winning numbers in the digital color image. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present application or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0016] Figure 1 A flowchart of a method for content recognition based on a digital color image provided by an embodiment of the present application; Figure 2 A schematic diagram of the process of obtaining a peer-to-peer connectivity domain; Figure 3 A schematic diagram of the process of obtaining high consistency among peers; Figure 4 Schematic diagram of the process of obtaining contrast stretching results. DETAILED DESCRIPTION
[0017] In the description of the embodiments of the present application, words such as "exemplary", "or", "for example" and the like are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary", "or", "for example" and the like is intended to present related concepts in a concrete manner.
[0018] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art in the present application. The terms used in the present application are only for the purpose of describing specific embodiments and are not intended to limit the present application. It should be understood that, unless otherwise specified, " / " means or.
[0019] It should also be noted that the terms "first" and "second" in the present application are used to distinguish similar objects rather than to describe a specific order or sequence.
[0020] The specific scheme of the content recognition method and system based on digital color images provided by the present application is described in detail below with reference to the accompanying drawings.
[0021] See also Figure 1 , which shows a flowchart of a method for content recognition based on a digital color image provided by an embodiment of the present application, the method comprising the following steps: Step 1: Obtain a digital color image and convert it into a digital color grayscale image.
[0022] Under sufficient light conditions, a CCD camera is used to shoot directly above the digital lottery to obtain a digital color image. The digital color image is converted into a digital color grayscale image, and a filtering algorithm is used to perform denoising on the digital color grayscale image to reduce the influence of noise generated during the shooting process on the subsequent recognition of the winning numbers in the digital color image. Among them, the conversion of the grayscale image is a well-known technology and will not be described in detail in this application.
[0023] In this embodiment, a bilateral filtering algorithm is used to denoise the digital color grayscale image. As other implementation methods, on the basis of being able to denoise the digital color grayscale image, the implementer may use other existing technologies to denoise the digital color grayscale image, such as a median filtering algorithm, a Gaussian filtering algorithm, etc., and this application does not impose any special restrictions.
[0024] Step 2: Analyze the grayscale distribution of all pixels in the digital color grayscale image to obtain each connected domain in the digital color grayscale image.
[0025] Since the captured digital color image may contain some background that is not lottery information, the lottery information in the digital color image, such as the text, numbers, and anti-counterfeiting code of the lottery ticket, are all black and have a smaller grayscale value than the background in the digital color image.
[0026] Based on the above analysis, in order to improve the recognition accuracy of the winning numbers in the subsequent digital color images, the grayscale values of all pixels in the digital color grayscale image are used as the input of the threshold segmentation algorithm, and the segmentation threshold is output. The pixels in the digital color grayscale image with grayscale values less than the segmentation threshold are used as lottery information pixels, which are used to characterize the pixels corresponding to the lottery information such as the text, numbers and anti-counterfeiting code of the lottery in the digital color image.
[0027] In this embodiment, the Otsu threshold segmentation algorithm is used to obtain the segmentation threshold. The Otsu threshold segmentation algorithm is a well-known technology and will not be described in detail in this application. As other implementation methods, on the basis of being able to obtain the segmentation threshold, the implementer may adopt other existing technologies to obtain the segmentation threshold, such as global threshold segmentation, iterative threshold segmentation, etc., and this application does not make any special restrictions.
[0028] The edge image of the digital color grayscale image is extracted by using an edge detection operator, and connected domains are extracted for all lottery information pixels in the edge image to obtain connected domains in the digital color grayscale image. Each connected domain corresponds to an image region, and an image region includes all pixels constituting a character (such as Chinese characters, numbers, and other symbols). The extraction of connected domains is a well-known technology and will not be described in detail in this application.
[0029] In this embodiment, the Roberts operator is used to extract the edge image of the digital color grayscale image. The Roberts operator is a well-known technology and will not be described in detail in this application. As other implementation methods, on the basis of being able to extract the edge image of the digital color grayscale image, the implementer may use other existing technologies to extract the edge image of the digital color grayscale image, such as the Prewitt operator, the Sobel operator, etc., and this application does not make any special restrictions.
[0030] Step 3: Obtain the black prominence of each connected domain through the distribution of the grayscale values of the pixels in each connected domain.
[0031] Generally speaking, the winning numbers, anti-counterfeiting logo and purchase amount in digital lottery are the most important information in the lottery. Usually, darker black characters than the rest of the information in the lottery are used to highlight these important information to facilitate observation and verification by buyers.
[0032] Based on the above analysis, taking the nth connected domain in the digital color grayscale image as an example, the mean of the grayscale values of all pixels in the nth connected domain is calculated, and the reciprocal of the sum of the mean and the preset value α greater than 0 is used as the black prominence of the nth connected domain, which is used to characterize the black prominence of the character corresponding to the nth connected domain. The purpose of adding α is to avoid the denominator being 0. The value of α is preset by humans and can be set by the implementer. In this embodiment, the value of α is 0.01.
[0033] Step 4, by analyzing the similarity of the coordinates of each connected domain with the pixel points in all other connected domains in the set direction, obtain the connected domains in the same row of each connected domain; by analyzing the difference in the position distribution range of the pixel points in each connected domain and its connected domains in the same row in the set direction, obtain the height consistency of each connected domain in the same row.
[0034] Since the printing standard of digital lottery is to print clear, complete and uniform graphics and text, the characters in the same line usually maintain the same height and format during the printing process, and there is a certain interval between two adjacent lines of characters to ensure the standardization and readability of the lottery information. However, the purchase amount in the digital lottery is usually highlighted in a larger font size, which makes the purchase amount and the other text information in the same line have a large difference in character height; and QR codes may appear in digital lottery, and the character shapes inside the QR code are diverse, which makes the characters in the QR code and the other characters in the same line also have a large difference in height.
[0035] In this embodiment, the placement direction of the digital color image is 90 degrees.
[0036] Based on the above analysis, in order to reduce the influence of the purchase amount and the QR code on the recognition accuracy of the winning numbers in the digital color image, the nth connected domain is still taken as an example, and the mean of the ordinates of all the pixels in the nth connected domain is recorded as the coordinate mean, which is used to characterize the row position of the character corresponding to the nth connected domain in the digital color; the range of the ordinates of all the pixels in the nth connected domain is calculated to characterize the height value of the character corresponding to the nth connected domain in the digital color. Among them, the ordinate is only an embodiment of the present application, which needs to be determined according to the placement direction of the digital color image, and the placement direction of the digital color image can be set by the implementer.
[0037] Further, the difference in the coordinate mean between the nth connected domain and the remaining connected domains in the digital color grayscale image is calculated and recorded as the coordinate difference. The coordinate differences are arranged in ascending order, and the connected domains corresponding to the first preset number of coordinate differences are used as the connected domains in the same row of the nth connected domain, which are used to represent the characters in the same row as the characters corresponding to the nth connected domain in the digital color grayscale image. The schematic diagram of the process of obtaining the connected domains in the same row is shown in FIG. Figure 2 shown.
[0038] In this embodiment, the difference between the coordinate means is the absolute value of the difference. As other implementation methods, on the basis of being able to measure the difference between the coordinate means, the implementer can use other calculation methods for measurement, such as ratio, square of difference, etc., and this application does not impose any special restrictions.
[0039] In this embodiment, the value of the preset number is 8. The value of the preset number is preset manually and can be set by the implementer according to actual conditions. This application does not impose any special restrictions.
[0040] Furthermore, the difference in the extreme difference between the nth connected domain and its connected domains in the same row is calculated respectively, recorded as the height difference, and the average value of all the height differences is calculated. The reciprocal of the sum of the average value and a preset constant μ greater than 0 is used as the height consistency of the nth connected domain in the same row, which is used to characterize the degree of consistency in height between the character corresponding to the nth connected domain and the other characters in the same row in the digital color grayscale image. The larger the value of the height consistency in the same row, the greater the degree of consistency. Among them, the purpose of adding μ is to avoid the denominator being 0. The value of μ is preset manually and can be set by the implementer. In this embodiment, the value of μ is 0.01. The schematic diagram of the process of obtaining the height consistency in the same row is shown in the figure. Figure 3 shown.
[0041] In this embodiment, the difference between the extremes is the absolute value of the difference. As other implementation methods, on the basis of being able to measure the difference between the extremes, the implementer may use other calculation methods for measurement, such as ratio, square of difference, etc., and this application does not impose any special restrictions.
[0042] Step 5: acquiring shape feature values of each connected domain by analyzing the degree to which the shape of each connected domain is close to a rectangle and the position distribution range of the pixel points in each connected domain in the set direction.
[0043] Generally speaking, the anti-counterfeiting code in the digital lottery is a regular rectangle, and the height of the characters corresponding to the anti-counterfeiting code is smaller than the height of the characters corresponding to the winning numbers in the digital lottery.
[0044] Based on the above analysis, in order to reduce the impact of the anti-counterfeiting code on the recognition accuracy of the winning numbers in the digital color image, the ratio of the rectangularity of the nth connected domain to the extreme difference is taken as the shape feature value of the nth connected domain, which is used to characterize the possibility that the character corresponding to the nth connected domain belongs to the anti-counterfeiting code. The larger the shape feature value, the greater the possibility that the character corresponding to the nth connected domain has the anti-counterfeiting code feature. Among them, the calculation of rectangularity is a well-known technology and will not be repeated in this application.
[0045] Step 6, comprehensively analyzing the black prominence, the same level height consistency and the shape feature value to obtain the lottery number membership of each connected domain.
[0046] Furthermore, based on the black prominence, the same height consistency and the shape feature value of the nth connected domain, the lottery number membership of the nth connected domain is obtained to characterize the possibility that the character corresponding to the nth connected domain belongs to the lottery number. The expression is: ; In the formula, Indicates the membership degree of the winning numbers of the nth connected domain; Indicates the black prominence of the nth connected domain; Indicates the peer height consistency of the nth connected domain; represents the shape characteristic value of the nth connected domain; β represents a preset value greater than 0, the purpose of which is to avoid the denominator being 0. The value of β is preset manually and can be set by the implementer. In this embodiment, the value of β is 0.01.
[0047] It should be noted that: in the digital color grayscale image, the greater the black prominence of the character corresponding to the nth connected domain, that is, The larger the value is, the less likely the character corresponding to the nth connected domain is to belong to the other information in the digital color grayscale image except the winning number, anti-counterfeiting mark and purchase amount; the more consistent the height of the character corresponding to the nth connected domain is with the other characters in the same row, that is, The larger the value is, the less likely the characters corresponding to the nth connected domain are to belong to the purchase amount and the characters inside the QR code; if the characters corresponding to the nth connected domain have less characteristics of the anti-counterfeiting code, that is, The smaller it is, the less likely the character corresponding to the nth connected domain is to belong to the anti-counterfeiting code; The larger the value is, the more likely it is that the character corresponding to the nth connected domain belongs to the winning number in the digital color grayscale image. The bigger.
[0048] The winning number membership of the remaining connected domains in the digital color grayscale image is obtained using the same method as that of obtaining the winning number membership of the nth connected domain.
[0049] Step 7, when the pixel point is located in a connected domain in the digital color grayscale image, the contrast stretching result of the pixel point is obtained through the lottery number membership of the connected domain where the pixel point is located, otherwise, the contrast stretching result of the pixel point is obtained according to a preset rule; and the lottery number of the digital color image is obtained through the contrast stretching result.
[0050] It is determined whether each pixel in the digital color grayscale image exists in a connected domain. Based on the determination result, the contrast stretching result of each pixel in the digital color grayscale image is obtained in different cases. The result is used to characterize the grayscale value of each pixel in the digital color grayscale image after image enhancement. The expression is: ; In the formula, Indicates the contrast stretching result of pixel a in the digital color grayscale image; a represents the pixel in the digital color grayscale image; round() represents the rounding function; norm() represents the normalization function; represents the membership degree of the winning number in the connected domain where the pixel point a is located; AN represents the set of pixels in all connected domains in the digital color grayscale image; g represents a preset non-negative integer used to control the contrast stretching result of the pixel point a, and the value of g is 255.
[0051] In this embodiment, the Min-Max normalization method is used to normalize the membership of the winning numbers. As other implementation methods, on the basis of being able to realize the normalization of the membership of the winning numbers, the implementer can use other existing technologies to normalize the membership of the winning numbers, such as the decimal calibration normalization method, the Sigmoid function, etc., and this application does not make any special restrictions.
[0052] It should be noted that: if pixel a is located in the background area of the digital color image without lottery information, the gray value of pixel a is large, and the gray value of pixel a is not processed; if pixel a is located in the lottery information area of the digital color image, that is, , and the greater the possibility that the character corresponding to pixel a belongs to the winning number in the digital color grayscale image, that is, When the value is larger, in order to improve the subsequent recognition probability of the winning number information corresponding to pixel a, the gray value of pixel a in the digital color grayscale image after image enhancement should be smaller, that is, the contrast stretching result of pixel a should be smaller, so as to enhance the gray difference between the characters corresponding to the remaining information and the characters corresponding to the winning number. The schematic diagram of the process of obtaining the contrast stretching result is shown in the figure. Figure 4 shown.
[0053] The contrast stretching results of the remaining pixels in the connected domain of the digital color grayscale image are obtained in the same way as the contrast stretching result of pixel a. The grayscale values of the pixels in each connected domain of the digital color grayscale image are replaced with the contrast stretching results to obtain a digital color grayscale enhanced image.
[0054] A threshold segmentation algorithm is used to obtain a foreground image in a digital color grayscale enhanced image, and an optical character recognition technology is used to recognize digital content in the foreground image, and the recognized digital content is used as the winning number of the digital color image.
[0055] In this embodiment, the Otsu threshold segmentation algorithm is used to obtain the foreground image. As other implementation methods, on the basis of being able to obtain the foreground image, the implementer may use other existing technologies to obtain the foreground image, such as global threshold segmentation, iterative threshold segmentation, etc., and this application does not impose any special restrictions.
[0056] Based on the same inventive concept as the above method, an embodiment of the present application also provides a content recognition system based on digital color images, including a memory, a processor, and a computer program stored in the memory and running on the processor, and when the processor executes the computer program, the steps of any one of the above-mentioned content recognition methods based on digital color images are implemented.
[0057] In summary, the present application obtains the black prominence by analyzing the grayscale distribution of the winning numbers and other lottery information in the digital lottery grayscale image, reflecting the possibility that the characters corresponding to each connected domain belong to the winning numbers, anti-counterfeiting marks or the purchase amount, which can reduce the influence of the remaining information in the digital color image except the winning numbers, anti-counterfeiting marks and the purchase amount on the recognition accuracy of the subsequent winning numbers; identifies the characters in the same row in the digital color image through the coordinates of the pixel points in each connected domain in the set direction, and analyzes the difference in height of the characters in the same row to obtain the height consistency of the same row, reflecting the possibility that the characters corresponding to each connected domain belong to the purchase amount or the characters inside the QR code, which can reduce the influence of the purchase amount in the digital color image and the characters inside the QR code on the recognition accuracy of the subsequent winning numbers; obtains the shape feature value by analyzing the shape and height of each connected domain, reflecting the possibility that the characters corresponding to each connected domain are the anti-counterfeiting code, which can reduce the influence of the anti-counterfeiting code on the recognition accuracy of the subsequent winning numbers; Furthermore, the black prominence, the same height consistency and the shape feature value are comprehensively considered to obtain the winning number membership, which fully considers the difference between the winning number and the rest of the lottery information. The winning numbers in the digital color image can be located more accurately, and then based on the winning number membership, the pixels in the digital color grayscale image are appropriately stretched for contrast, which can more effectively highlight the winning numbers and reduce the visual impact of the rest of the lottery information, thereby improving the recognition accuracy of the winning numbers in the digital color image.
[0058] The flowchart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to the embodiment of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. In some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. In the description corresponding to the flowchart and the block diagram in the accompanying drawings, the operations or steps corresponding to different boxes can also occur in a different order from the order disclosed in the description, and sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. Each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented by a dedicated hardware-based system that performs the specified functions or actions, or may be implemented by a combination of dedicated hardware and computer instructions.
[0059] It is obvious to those skilled in the art that the present application is not limited to the details of the above exemplary embodiments, and that the present application can be implemented in other specific forms without departing from the basic features of the present application. Therefore, no matter from which point of view, the above embodiments of the present application should be regarded as exemplary and non-restrictive.
Claims
1. A content recognition method based on digital color images, characterized in that: The method comprises the following steps: Get a digital color image and convert it into a digital color grayscale image; By analyzing the grayscale distribution of all pixels in the digital color grayscale image, each connected domain in the digital color grayscale image is obtained; Obtain the black prominence of each connected domain through the distribution of the grayscale values of the pixels in each connected domain; By analyzing the similarity of the coordinates of the pixels in each connected domain and all other connected domains in the set direction, the connected domains in the same line of each connected domain are obtained; by analyzing the difference in the position distribution range of the pixels in each connected domain and its connected domains in the same line in the set direction, the height consistency of each connected domain in the same line is obtained; The shape feature value of each connected domain is obtained by analyzing the degree to which the shape of each connected domain is close to a rectangle and the position distribution range of the pixel points in each connected domain in the set direction; Comprehensively analyzing the black prominence, the same height consistency and the shape feature value to obtain the lottery number membership of each connected domain; When a pixel point is located in a connected domain in a digital color grayscale image, the contrast stretching result of the pixel point is obtained through the lottery number membership of the connected domain where the pixel point is located; and the lottery number of the digital color image is obtained through the contrast stretching result.
2. The method for content recognition based on digital color images according to claim 1, characterized in that: The process of obtaining the connected domain is as follows: A threshold segmentation algorithm is used to obtain a segmentation threshold of the grayscale values of all pixels in the digital color grayscale image, and pixels in the digital color grayscale image that are smaller than the segmentation threshold are used as lottery information pixels; The edge detection operator is used to extract the edge image of the digital color grayscale image, and the connected domain is extracted for all the lottery information pixels in the edge image to obtain each connected domain in the digital color grayscale image.
3. The method for content recognition based on digital color images according to claim 1, characterized in that: The process of obtaining the black prominence is: calculating the average of the grayscale values of all pixels in each connected domain, and the black prominence is inversely proportional to the average.
4. The method for content recognition based on digital color images according to claim 1, characterized in that: The process of obtaining the peer connectivity domain is as follows: Calculate the mean value of the coordinates of all pixels in each connected domain in the set direction, and record it as the coordinate mean; Calculate the difference between the coordinate means of any connected domain and the remaining connected domains, and record it as the coordinate difference; The coordinate differences are arranged in ascending order, and the connected domains corresponding to the first preset number of the coordinate differences are used as connected domains in the same row of any connected domain.
5. The method for content recognition based on digital color images according to claim 1, characterized in that: The process of obtaining the high consistency of the same industry is as follows: Calculating the range of coordinates of all pixels in each connected domain in the set direction; the distribution range is reflected by the range; Calculate the difference between the ranges of each connected domain and its connected domains in the same row, and record it as the height difference; The peer height consistency is inversely proportional to the height difference.
6. The method for content recognition based on digital color images according to claim 5, characterized in that: The shape characteristic value is the ratio of the rectangularity of each connected domain to the range.
7. The method for content recognition based on digital color images according to claim 1, characterized in that: The process of obtaining the membership degree of the winning number is as follows: Calculate the product of the black prominence and the same height consistency; The membership degree of the winning number is proportional to the product and inversely proportional to the shape feature value.
8. The method for content recognition based on digital color images according to claim 1, characterized in that: The expression of the contrast stretching result is: ; In the formula, Indicates the contrast stretching result of pixel a in the digital color grayscale image; a represents the pixel in the digital color grayscale image; round() represents the rounding function; norm() represents the normalization function; represents the membership degree of the winning number of the connected domain where the pixel point a is located; AN represents the set of pixels in all connected domains in the digital color grayscale image; g represents a preset non-negative integer used to control the contrast stretching result of the pixel point a.
9. The method for content recognition based on digital color images according to claim 1, characterized in that: The method for obtaining the winning number of the digital color image is: The grayscale values of the pixels in each connected domain in the digital color grayscale image are replaced with the contrast stretching result to obtain a digital color grayscale enhanced image; A threshold segmentation algorithm is used to obtain a foreground image in a digital color grayscale enhanced image, an optical character recognition technology is used to recognize digital content in the foreground image, and the recognized digital content is used as the winning number of the digital color image.
10. A content recognition system based on digital color images, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the computer program, the steps of the content recognition method based on digital color images as described in any one of claims 1 to 9 are implemented.
Citation Information
Patent Citations
Lottery printing verification method, device and equipment
CN109147149A
Floating grinding head control method based on machine vision
CN115272376A
Method for detecting chromatic aberration of cobalt chloride test paper for diabetes
CN116626029A
Cattle carcass spine area rapid extraction method based on computer vision
CN116883328A
Teaching toy kit and number identification method thereof
WO2018032626A1