Bill Image Segmentation Method, Device, Medium and Equipment

By filtering the HSV value and preset threshold in the bill image, combined with K-MEANS clustering or histogram analysis, the target area in the bill image is accurately segmented, which solves the problems of inaccurate and long-term segmentation in traditional methods, and achieves efficient and accurate bill image segmentation.

CN113256644BActive Publication Date: 2025-07-01SHENZHEN YIHUA COMP +2
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202011498685.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-17
Publication Date
2025-07-01
Estimated Expiration
2040-12-17

AI Technical Summary

Technical Problem

The traditional bill image segmentation method is not accurate when dealing with interference with similar colors. The segmentation method based on the K-MEANS algorithm is complex and time-consuming, making it difficult to meet the requirements of high efficiency and high accuracy.

Method used

By obtaining the HSV value of pixel points in the ticket image, filtering out the area to be segmented using the preset threshold, and combining K-MEANS clustering calculation or histogram analysis, the target area is accurately segmented.

Benefits of technology

It improves the accuracy of bill image segmentation, reduces calculation time consumption, and solves the problem of inaccurate and excessive time-consuming segmentation caused by color interference in traditional methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113256644B_ABST
    Figure CN113256644B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of image processing, and specifically discloses a method for segmenting a bill image. First, a bill image containing a target to be segmented is obtained, and then a region to be segmented is screened out from the bill image according to the HSV values of the pixel points in the bill image and a preset threshold. Finally, clustering segmentation is performed based on the HSV values of the pixel points in the region to be segmented, and the target region is segmented out from the region to be segmented. Through three steps of segmenting the bill image containing the segmentation target, segmenting the region to be segmented with the same and similar colors as the segmentation target, and segmenting the segmentation target, this method removes interference elements step by step to achieve the purpose of accurate segmentation, solves the problems of inaccurate segmentation based on HSV values and long time consumption due to too many elements on the bill surface during K-MEANS clustering segmentation in the traditional method, improves the accuracy of bill image segmentation, and reduces the consumption of calculation time. In addition, a bill image segmentation device, medium, and equipment are also disclosed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular, to a method, device, medium, and equipment for segmenting bill images. Background Art

[0002] Segmentation algorithms are crucial preprocessings for image recognition and computer vision and are widely applied. With the economic development, the demand for bill processing is increasing day by day, and the requirements for processing efficiency and quality are also getting higher and higher. Bills have the characteristics of rich face colors, weak printing standardization, and easy alteration. Therefore, higher requirements are placed on the segmentation accuracy of areas with insignificant color differences in bills. For example, in the preprocessing stage of ticket number recognition, it is required to segment the ticket number from the complex elements of the bill image; or it is required to segment the altered areas with color differences in the printed fonts, and segment the red pen strokes with color differences in the red water-soluble lines, etc.

[0003] There are mainly two traditional image segmentation methods. One is the segmentation method based on HSV values, and the other is the segmentation method based on the K-MEANS algorithm. Among them, for the segmentation method based on HSV values, the segmentation result is inaccurate in the case of interfering images with similar but different colors. The segmentation method based on the K-MEANS algorithm is relatively complex in operation, and it takes a lot of time to perform operations for segmenting bills with rich colors and interfering elements, and has too high requirements for the processing ability of computer equipment. Summary of the Invention

[0004] Based on this, it is necessary to propose a precise and efficient method, device, medium, and equipment for segmenting bill images in view of the above problems.

[0005] The present invention proposes a method for segmenting bill images, and the method includes:

[0006] Obtain a bill image containing a target to be segmented;

[0007] Screen out the area to be segmented from the bill image according to the HSV values of the pixel points in the bill image and a preset threshold;

[0008] Perform K-MEANS clustering calculation according to the HSV values of the pixel points in the area to be segmented to obtain a clustering result map;

[0009] Select the clustering result with the most pixel points from the clustering result map as the target to be segmented for image segmentation.

[0010] A device for segmenting bill images, the device includes:

[0011] A first acquisition module, configured to obtain a bill image containing a target to be segmented;

[0012] The first screening module is used to screen out the area to be segmented from the bill image according to the HSV values of the pixel points in the bill image and a preset threshold value;

[0013] The calculation module is used to perform K-MEANS clustering calculation according to the HSV values of the pixel points in the area to be segmented, and obtain a clustering result map;

[0014] The first segmentation module is used to select the clustering result with the most pixel points from the clustering result map as the target to be segmented for image segmentation.

[0015] A computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the processor is caused to perform the following steps:

[0016] Obtain a bill image containing the target to be segmented;

[0017] Screen out the area to be segmented from the bill image according to the HSV values of the pixel points in the bill image and a preset threshold value;

[0018] Perform K-MEANS clustering calculation according to the HSV values of the pixel points in the area to be segmented, and obtain a clustering result map;

[0019] Select the clustering result with the most pixel points from the clustering result map as the target to be segmented for image segmentation.

[0020] A computer device includes a memory and a processor. The memory stores a computer program. When the computer program is executed by the processor, the processor is caused to perform the following steps:

[0021] Obtain a bill image containing the target to be segmented;

[0022] Screen out the area to be segmented from the bill image according to the HSV values of the pixel points in the bill image and a preset threshold value;

[0023] Perform K-MEANS clustering calculation according to the HSV values of the pixel points in the area to be segmented, and obtain a clustering result map;

[0024] Select the clustering result with the most pixel points from the clustering result map as the target to be segmented for image segmentation.

[0025] The above-mentioned bill image segmentation method, device, medium and equipment first obtain a bill image containing a target to be segmented, then screen out the area to be segmented from the bill image according to the HSV values of the pixel points in the bill image and a preset threshold, and finally perform K-MEANS clustering calculation based on the HSV values of the pixel points in the area to be segmented, and select the clustering result with the most pixel points from the calculated clustering result map as the target to be segmented for image segmentation. This method removes interference elements step by step through three steps: segmenting the bill image containing the segmentation target, segmenting the area to be segmented composed of pixel points with the same and similar colors as the segmentation target in the bill image, and segmenting the segmentation target, achieving the purpose of accurately segmenting the segmentation target, solving the problem of long time consumption caused by too many ticket surface elements during K-MEANS clustering segmentation in the traditional method, improving the accuracy of bill image segmentation, and reducing the consumption of calculation time.

[0026] The present invention also proposes another bill image segmentation method, and the method includes:

[0027] Obtain a bill image containing a target to be segmented;

[0028] Screen out the area to be segmented from the bill image according to the HSV values of the pixel points in the bill image and a preset threshold;

[0029] Obtain the histogram of the area to be segmented;

[0030] Determine the segmentation center according to the histogram of the area to be segmented;

[0031] Screen out the color values that meet the requirements within a preset radius with the segmentation center as the center in the histogram;

[0032] Segment the target area from the area to be segmented according to the color values.

[0033] A bill image segmentation device, characterized in that the device includes:

[0034] A second acquisition module, configured to acquire a bill image containing a target to be segmented;

[0035] A second screening module, configured to screen out the area to be segmented from the bill image according to the HSV values of the pixel points in the bill image and a preset threshold;

[0036] A third acquisition module, configured to acquire the histogram of the area to be segmented;

[0037] A determination module, configured to determine the segmentation center according to the histogram of the area to be segmented;

[0038] A third screening module, configured to screen out color values that meet the requirements within a preset radius with the segmentation center as the center in the histogram;

[0039] A second segmentation module, configured to segment the target area from the area to be segmented according to the color value.

[0040] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor is caused to execute the following steps:

[0041] Obtain a bill image containing a target to be segmented;

[0042] Screen out an area to be segmented from the bill image according to the HSV values of the pixel points in the bill image and a preset threshold;

[0043] Obtain a histogram of the area to be segmented;

[0044] Determine a segmentation center according to the histogram of the area to be segmented;

[0045] Screen out color values that meet the requirements within a preset radius with the segmentation center as the center in the histogram;

[0046] Segment the target area from the area to be segmented according to the color value.

[0047] A computer device includes a memory and a processor. The memory stores a computer program, and when the computer program is executed by the processor, the processor is caused to execute the following steps:

[0048] Obtain a bill image containing a target to be segmented;

[0049] Screen out an area to be segmented from the bill image according to the HSV values of the pixel points in the bill image and a preset threshold;

[0050] Obtain a histogram of the area to be segmented;

[0051] Determine a segmentation center according to the histogram of the area to be segmented;

[0052] Screen out color values that meet the requirements within a preset radius with the segmentation center as the center in the histogram;

[0053] Segment the target area from the area to be segmented according to the color value.

[0054] The above-mentioned bill image segmentation method, device, medium and equipment first obtain a bill image containing the target to be segmented, then screen out the area to be segmented from the bill image according to the HSV values of the pixel points in the bill image and a preset threshold, determine the segmentation center according to the histogram of the area to be segmented, and screen out the color values that meet the requirements within a preset radius with the segmentation center as the center of the circle for segmentation, and segment the target area from the area to be segmented. This method removes interference elements step by step through three steps: segmenting the bill image containing the segmentation target, segmenting the area to be segmented composed of pixel points with the same and similar colors as the segmentation target in the bill image, and segmenting the segmentation target, so as to achieve the purpose of accurately segmenting the segmentation target, solve the problem of inaccuracy in traditional methods based on HSV value segmentation when affected by similar colors, and improve the accuracy of bill image segmentation. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0056] Among them:

[0057] Figure 1 is the implementation flowchart of the bill image segmentation method in an embodiment;

[0058] Figure 2 is an example of a bill image containing the target to be segmented;

[0059] Figure 3a is the image of the area to be segmented with seal interference;

[0060] Figure 3b is the image of the area to be segmented without interference elements;

[0061] Figure 4 is the implementation flowchart of the bill image segmentation method in another embodiment;

[0062] Figure 5 is the structural block diagram of the bill image segmentation device in an embodiment;

[0063] Figure 6 is the structural block diagram of the bill image segmentation device in another embodiment;

[0064] Figure 7 is the structural block diagram of a computer device in an embodiment. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0065] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without making creative efforts shall fall within the protection scope of the present invention.

[0066] As Figure 1 shown, a method for segmenting a bill image is proposed, and the method includes:

[0067] Step 102, obtain a bill image containing the target to be segmented.

[0068] Among them, the target to be segmented refers to the object that needs to be segmented from the bill image, and the target to be segmented can be custom-set according to actual needs. For example, the ticket number in the bill can be used as the target to be segmented, or the seal in the bill can be used as the target to be segmented.

[0069] In one embodiment, the bill image containing the target to be segmented can be a partial image of the original bill image. For example, when the ticket number needs to be segmented, the above-mentioned bill image containing the target to be segmented is an image containing ticket number information in the upper left corner or the upper right corner of the original bill image, as Figure 2 shown, Figure 2 is a partial image of the upper right corner of an original bill image, containing the target ticket number to be segmented.

[0070] Step 104, screen out the area to be segmented from the bill image according to the HSV values of the pixel points in the bill image and a preset threshold.

[0071] Among them, the HSV value is the three values corresponding to the pixel points in the bill image in the HSV color space, namely the H value (hue), the S value (saturation), and the V value (brightness); the preset threshold is related to the target to be segmented and is used to screen out the pixel points with colors similar to the target to be segmented in the HSV space. In one embodiment, when the target to be segmented is a red ticket number, the numerical range of red in the HSV space is used as the threshold to perform binary processing on the bill image, and the pixel points with HSV values belonging to the red range in the bill image are screened out; the area to be segmented refers to the image area that has been preliminarily screened and most of the interfering pixel points have been discarded. Only further segmentation is needed to remove the interfering elements with colors similar to but different from the segmentation target to obtain the segmentation target.

[0072] Step 106, perform K-MEANS clustering calculation according to the HSV values of the pixel points in the area to be segmented to obtain a clustering result map.

[0073] Among them, the object of the above-mentioned K-MEANS clustering calculation is the area to be segmented that has completed the preliminary screening. The pixels are clustered according to the HSV values. The target to be segmented and the interference area with similar colors are distinguished by clustering, so that the target to be segmented can be separated from the interference area with similar colors, thereby segmenting the target area.

[0074] Step 108: Select the clustering result with the most pixels from the clustering result map as the target to be segmented to perform image segmentation.

[0075] Among them, the clustered object to be segmented area is a set of image pixel points that have undergone secondary segmentation and have the target to be segmented as the main body. After clustering calculation, the target to be segmented and part of the interference image in the clustering result diagram are different clustering results respectively. The clustering result with the most pixels and a larger proportion in the area to be segmented is selected as the target to be segmented for image segmentation.

[0076] In one embodiment, the original image containing the entire bill image is first segmented, such as Figure 2 As shown, a partial image at the upper right corner of the original bill image is obtained, and the partial image contains the target bill number to be segmented and other interference elements; then the pixel points of the partial image are filtered, such as only retaining the pixel points whose HSV values ​​are within the red range. At this time, only the target to be segmented - the red bill number and the interference element - part of the red seal are retained in the image.

[0077] It can be understood that in the area to be segmented composed of pixels with HSV values ​​in the red range, the number of pixels of the target to be segmented - the red ticket number is greater than the number of interference elements - part of the red seal. Therefore, the clustering result with the most pixels is selected from the clustering result graph as the target to be segmented for image segmentation.

[0078] The above-mentioned bill image segmentation method first obtains a bill image containing a target to be segmented, then selects the area to be segmented from the bill image according to the HSV value of the pixel points in the bill image and a preset threshold, and finally performs K-MEANS clustering calculation based on the HSV value of the pixel points in the area to be segmented, and selects the clustering result with the most pixels from the calculated clustering result map as the target to be segmented for image segmentation. This method removes interference elements step by step through three steps, namely, segmenting the bill image containing the segmentation target, segmenting the area to be segmented composed of pixels with the same or similar color as the segmentation target in the bill image, and segmenting the segmentation target, so as to achieve the purpose of accurately segmenting the segmentation target. This method solves the problem of too many bill elements causing a long time consumption during K-MEANS clustering segmentation in the traditional method, improves the accuracy of bill image segmentation, and reduces the consumption of computing time.

[0079] In one embodiment, performing K-MEANS clustering calculation based on the HSV values of the pixel points in the region to be segmented to obtain a clustering result map, including: generating a sample set of N rows and 3 columns according to the HSV values of the pixel points in the region to be segmented, where each row is a vector sample composed of the HSV values of a pixel point, and the 3 columns are the H value, the S value, and the V value respectively; setting a plurality of cluster centers; and performing K-MEANS clustering calculation on the sample set according to the plurality of cluster centers to obtain a clustering result map.

[0080] Among them, obtaining the coordinates and corresponding HSV values of each pixel point in the region to be segmented, and using the vector composed of the H value, the S value, and the V value of each pixel point as a sample, generating a matrix of N rows and 3 columns according to the HSV values of all pixel points in the region to be segmented as the sample set of the K-MEANS algorithm.

[0081] Among them, the number K of cluster centers is a preset value, determined according to the partial bill image where the segmentation target is located. The ideal K value is 3, and generally 1-2 more will be set according to the number of interference elements. As shown in Figure 3, Figure 3a is an image of the region to be segmented with seal interference, so compared with Figure 3b the image of the region to be segmented without interference elements, 1 more cluster center needs to be set to avoid the failure of target segmentation due to interference.

[0082] In one embodiment, according to the plurality of cluster centers, calling the K-MEANS clustering function of openCV to perform clustering calculation on the sample set to obtain a clustering result map.

[0083] In one embodiment, screening out the region to be segmented from the bill image according to the HSV values of the pixel points in the bill image and a preset threshold, including: performing binary processing on the bill image according to the HSV values of the pixel points in the bill image and the preset threshold, screening out the pixel points that meet the preset threshold, and the pixel points that meet the preset threshold form the region to be segmented.

[0084] Among them, performing binary processing on the pixel points in the bill image with the preset threshold, keeping the pixel points that meet the preset threshold and discarding the pixel points that do not meet the preset threshold.

[0085] Among them, the preset threshold can limit one value or a combination of multiple values in the HSV values of pixel points; the preset threshold is the HSV value range of the color of the target to be segmented in the HSV color space, and the pixel points that meet the preset threshold are pixel points with colors similar to the color of the target to be segmented. Exemplarily, when segmenting the red ticket number on a bill, only the interval of the H value of the preset red in the HSV color space can be used as the threshold to screen pixel points, or the thresholds of the V value and the S value can be added to further limit the red color.

[0086] It can be understood that due to the influence of the bill printing quality and the sensor acquisition quality, it is relatively difficult to find a general threshold for the combination of multiple values in the HSV values. Generally, the preset threshold only limits the H value of pixel points. On the one hand, the H value can best reflect color changes. First, screen the preset threshold of the H value for the bill image, and colors that are similar but not the same can be segmented in the next clustering algorithm. On the other hand, screening the single HSV value of pixel points takes relatively less computing time and improves the computing efficiency.

[0087] In one embodiment, obtaining a bill image including a target to be segmented includes: extracting a partial image including the segmentation target in the original bill image and deleting other partial images; converting the partial image including the segmentation target from the RGB color space to the HSV color space.

[0088] Among them, extracting the partial image including the segmentation target can be in the way of extracting a preset area. For example, if it is necessary to segment the ticket number of a bill and the ticket number to be segmented is located in the upper right corner of the bill, then a preset M*N area in the upper right corner of the original bill image is extracted as the target area including the segmentation target; it can also be through algorithms such as edge finding and machine learning to locate the segmentation target and then extract the target area including the segmentation target.

[0089] Among them, converting the image from the RGB color space to the HSV color space makes use of the characteristic that the HSV color space is more sensitive to hue to segment similar-color targets in the subsequent image.

[0090] As Figure 4 shown, another bill image segmentation method is proposed, and this method includes:

[0091] Step 402, obtaining a bill image including a target to be segmented.

[0092] In one embodiment, obtaining a bill image including a target to be segmented includes: extracting a partial image including the segmentation target in the original bill image and deleting other partial images; converting the partial image including the segmentation target from the RGB color space to the HSV color space.

[0093] Step 404: Screen out the area to be segmented from the bill image according to the HSV values of the pixel points in the bill image and a preset threshold value.

[0094] In one embodiment, the screening out the area to be segmented from the bill image according to the HSV values of the pixel points in the bill image and a preset threshold value includes: performing binarization processing on the bill image according to the HSV values of the pixel points in the bill image and the preset threshold value, and screening out the pixel points that meet the preset threshold value, and the pixel points that meet the preset threshold value form the area to be segmented.

[0095] Step 406: Obtain the histogram of the area to be segmented.

[0096] Wherein, the histogram of the area to be segmented is a statistical histogram of the HSV values of the pixel points in the area to be segmented. By obtaining the coordinates and corresponding HSV values of the pixel points in the area to be segmented, a one-dimensional (H, S, V), two-dimensional (H-V, H-S, S-V), or three-dimensional (H-S-V) statistical histogram is generated according to the HSV values.

[0097] Step 408: Determine the segmentation center according to the histogram of the area to be segmented.

[0098] Wherein, select the color value with the highest probability in the statistical histogram as the segmentation center, and use the segmentation center as the center of a circle; the color value is the HSV value statistically in the current statistical histogram, and can be one-dimensional (H, S, V), two-dimensional (H-V, H-S, S-V), or three-dimensional (H-S-V).

[0099] Step 410: Screen out the color values that meet the requirements within a preset radius with the segmentation center as the center of the circle in the histogram.

[0100] Wherein, use a preset Euclidean distance threshold value as the radius, and the color values within the radius are target color values.

[0101] In one embodiment, the histogram is an H value statistical histogram, and the H value with the highest probability is 70, that is, the H values that meet |H - 70| ≤ d are all target color values, where d is the preset Euclidean distance radius.

[0102] In another embodiment, the histogram is an H-V histogram, and the HV value with the highest probability is (70, 70), that is, the HV values that meet are all target color values.

[0103] Step 412: Segment out the target area from the area to be segmented according to the color values.

[0104] According to the selected target color value, perform binaryzation processing on the image of the area to be segmented, and all pixel points corresponding to the target color value form a target area.

[0105] For the above-mentioned bill image segmentation method, first obtain a bill image containing the target to be segmented, then screen out the area to be segmented from the bill image according to the HSV values of the pixel points in the bill image and a preset threshold, determine the segmentation center according to the histogram of the area to be segmented, and screen out the color values that meet the requirements within a preset radius with the segmentation center as the center of the circle for segmentation, and segment the target area from the area to be segmented. Through three steps of segmenting the bill image containing the segmentation target, segmenting the area to be segmented composed of pixel points with the same and similar colors as the segmentation target in the bill image, and segmenting the segmentation target, this method removes interference elements step by step, achieving the purpose of accurately segmenting the segmentation target, solving the problem of inaccuracy in traditional methods when segmenting based on HSV values and being interfered by similar colors, and improving the accuracy of bill image segmentation.

[0106] In one embodiment, the histogram is an H-V histogram; the determining the segmentation center according to the histogram of the area to be segmented includes: obtaining the HV value with the highest probability in the H-V histogram of the area to be segmented as the segmentation center.

[0107] Among them, it is better to use a two-dimensional histogram for the statistical histogram. The information of a one-dimensional histogram is too single, which easily leads to deviation in the clustering results, and the three-dimensional histogram consumes more time. Among two-dimensional histograms, the H-V histogram has the best effect. The common interference factor is the interference of similar colors. For example, a red seal and a red ticket number have greater differences in H value and V value, and the segmentation effect is better with an H-V histogram.

[0108] It can be understood that, compared with the K-MEANS algorithm, clustering with a statistical histogram and a preset Euclidean distance radius does not need to consider the number of clustering centers and the screening of clustering results, consumes less time, and has higher efficiency.

[0109] Among them, take the gray level with the highest probability in the H-V statistical histogram (the combination of H and V values is the gray level) as the central gray level of the target area, and use the preset Euclidean distance threshold as the radius. The area composed of pixel points corresponding to similar gray levels within the radius is the target area.

[0110] As Figure 5 shown, a bill image segmentation device is proposed, and the device includes:

[0111] A first acquisition module 510, configured to acquire a bill image containing the target to be segmented;

[0112] The first screening module 520 is configured to screen out a region to be segmented from the bill image according to the HSV values of the pixel points in the bill image and a preset threshold value;

[0113] The calculation module 530 is configured to perform K-MEANS clustering calculation according to the HSV values of the pixel points in the region to be segmented, and obtain a clustering result graph;

[0114] The first segmentation module 540 is configured to select the clustering result with the most pixel points from the clustering result graph as the target to be segmented for image segmentation.

[0115] As Figure 6 shown, a bill image segmentation device is also proposed. The device includes:

[0116] The second acquisition module 610 is configured to acquire a bill image including a target to be segmented;

[0117] The second screening module 620 is configured to screen out a region to be segmented from the bill image according to the HSV values of the pixel points in the bill image and a preset threshold value;

[0118] The third acquisition module 630 is configured to acquire a histogram of the region to be segmented;

[0119] The determination module 640 is configured to determine a segmentation center according to the histogram of the region to be segmented;

[0120] The third screening module 650 is configured to screen out color values that meet the requirements within a preset radius with the segmentation center as the center in the histogram;

[0121] The second segmentation module 660 segments the target region from the region to be segmented according to the color values.

[0122] Figure 7 shows the internal structure diagram of a computer device in an embodiment. The computer device may specifically be a terminal or a server. As Figure 7 shown, the computer device includes a processor, a memory, and a network interface connected through a system bus. Among them, the memory includes a non-volatile storage medium and an internal memory. The non-volatile storage medium of the computer device stores an operating system and may also store a computer program. When the computer program is executed by the processor, the processor can implement the above-mentioned bill image segmentation method. The internal memory may also store a computer program. When the computer program is executed by the processor, the processor can execute the above-mentioned bill image segmentation method. Those skilled in the art can understand, Figure 7The structure shown is only a block diagram of some structures related to the solution of this application, and does not constitute a limitation on the computer device to which the solution of this application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.

[0123] A computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the processor is caused to perform the following steps:

[0124] Obtain a bill image containing a target to be segmented; screen out a region to be segmented from the bill image according to the HSV values of pixel points in the bill image and a preset threshold; perform K-MEANS clustering calculation according to the HSV values of pixel points in the region to be segmented to obtain a clustering result map; select the clustering result with the most pixel points from the clustering result map as the target to be segmented for image segmentation.

[0125] In one embodiment, the performing K-MEANS clustering calculation according to the HSV values of pixel points in the region to be segmented to obtain a clustering result map includes: generating a sample set of N rows and 3 columns according to the HSV values of pixel points in the region to be segmented, where each row is a vector sample composed of the HSV values of a pixel point, and the 3 columns are the H value, the S value, and the V value respectively; setting a plurality of clustering centers; performing K-MEANS clustering calculation on the sample set according to the plurality of clustering centers to obtain a clustering result map.

[0126] In one embodiment, the screening out a region to be segmented from the bill image according to the HSV values of pixel points in the bill image and a preset threshold includes: performing binarization processing on the bill image according to the HSV values of pixel points in the bill image and the preset threshold, and screening out pixel points that meet the preset threshold, and the pixel points that meet the preset threshold form the region to be segmented.

[0127] In one embodiment, obtaining a bill image containing a target to be segmented includes: extracting a partial image containing the segmentation target from the original bill image and deleting other partial images; converting the partial image containing the segmentation target from the RGB color space to the HSV color space.

[0128] A computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the processor is caused to perform the following steps:

[0129] Obtain a bill image containing a target to be segmented; screen out the area to be segmented from the bill image according to the HSV values of the pixel points in the bill image and a preset threshold; obtain the histogram of the area to be segmented; determine the segmentation center according to the histogram of the area to be segmented; screen out the color values that meet the requirements within a preset radius with the segmentation center as the center in the histogram; segment the target area from the area to be segmented according to the color values.

[0130] In one embodiment, the histogram is an H-V histogram; the determining the segmentation center according to the histogram of the area to be segmented includes: obtaining the HV value with the highest probability in the H-V histogram of the area to be segmented as the segmentation center.

[0131] A computer device includes a memory and a processor. When a computer program stored in the memory is executed by the processor, the processor is caused to perform the following steps:

[0132] Obtain a bill image containing a target to be segmented; screen out the area to be segmented from the bill image according to the HSV values of the pixel points in the bill image and a preset threshold; perform K-MEANS clustering calculation according to the HSV values of the pixel points in the area to be segmented to obtain a clustering result map; select the clustering result with the most pixel points from the clustering result map as the target to be segmented for image segmentation.

[0133] In one embodiment, the performing K-MEANS clustering calculation according to the HSV values of the pixel points in the area to be segmented to obtain a clustering result map includes: generating a sample set with N rows and 3 columns according to the HSV values of the pixel points in the area to be segmented, where each row is a vector sample composed of the HSV values of a pixel point, and the 3 columns are the H value, the S value, and the V value respectively; setting multiple clustering centers; performing K-MEANS clustering calculation on the sample set according to the multiple clustering centers to obtain a clustering result map.

[0134] In one embodiment, the screening out the area to be segmented from the bill image according to the HSV values of the pixel points in the bill image and a preset threshold includes: performing binarization processing on the bill image according to the HSV values of the pixel points in the bill image and the preset threshold, screening out the pixel points that meet the preset threshold, and the pixel points that meet the preset threshold form the area to be segmented.

[0135] In one embodiment, obtaining a bill image containing a target to be segmented includes: extracting the partial image containing the segmentation target in the original bill image and deleting other partial images; converting the partial image containing the segmentation target from the RGB color space to the HSV color space.

[0136] A computer device, comprising a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor is caused to perform the following steps:

[0137] Obtain a bill image containing a target to be segmented; screen out a region to be segmented from the bill image according to the HSV values of pixel points in the bill image and a preset threshold; obtain a histogram of the region to be segmented; determine a segmentation center according to the histogram of the region to be segmented; screen out color values that meet the requirements within a preset radius with the segmentation center as the center in the histogram; and segment the target region from the region to be segmented according to the color values.

[0138] In one embodiment, the histogram is an H-V histogram; and the determining the segmentation center according to the histogram of the region to be segmented includes: obtaining the HV value with the highest probability in the H-V histogram of the region to be segmented as the segmentation center.

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

[0140] The technical features of the above embodiments can be combined arbitrarily. For the sake of concise description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope described in this specification.

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

Claims

1. A method for bill image segmentation, the method comprising: Obtaining a bill image containing the target to be segmented; Filtering out the area to be segmented from the bill image according to the HSV values of the pixel points in the bill image and a preset threshold; Obtaining the histogram of the area to be segmented; Determining the segmentation center according to the histogram of the area to be segmented; Filtering out the color values that meet the requirements within a preset radius with the segmentation center as the center in the histogram; Segmenting the target area from the area to be segmented according to the color values.

2. The bill image segmentation method according to claim 1, wherein The histogram is an H-V histogram; The determining the segmentation center according to the histogram of the area to be segmented includes: Obtaining the HV value with the highest probability in the H-V histogram of the area to be segmented as the segmentation center.

3. A bill image segmentation device, characterized in that, The device includes: A second obtaining module, configured to obtain a bill image containing the target to be segmented; A second filtering module, configured to filter out the area to be segmented from the bill image according to the HSV values of the pixel points in the bill image and a preset threshold; A third obtaining module, configured to obtain the histogram of the area to be segmented; A determining module, configured to determine the segmentation center according to the histogram of the area to be segmented; A third filtering module, configured to filter out the color values that meet the requirements within a preset radius with the segmentation center as the center in the histogram; A second segmentation module, configured to segment the target area from the area to be segmented according to the color values.

4. A computer-readable storage medium, characterized in that, A computer program is stored, and when the computer program is executed by a processor, the processor is caused to execute the steps of the bill image segmentation method according to any one of claims 1 to 3.

5. A computer device, characterized in that, Comprising a memory and a processor, the memory stores a computer program, and when the computer program is executed by the processor, the processor is caused to execute the steps of the bill image segmentation method according to any one of claims 1 to 3.

Citation Information

Patent Citations

  • Method, device and equipment for segmenting rape flowers in field image and storage medium

    CN111079637A