CN108090511B - Image classification method and device, electronic equipment and readable storage medium - Google Patents

Image classification method and device, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN108090511B
CN108090511B CN201711348128.7A CN201711348128A CN108090511B CN 108090511 B CN108090511 B CN 108090511B CN 201711348128 A CN201711348128 A CN 201711348128A CN 108090511 B CN108090511 B CN 108090511B
Authority
CN
China
Prior art keywords
image
gradient
matrix
brightness
classified
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201711348128.7A
Other languages
Chinese (zh)
Other versions
CN108090511A (en
Inventor
朱兴杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Taikang Insurance Group Co Ltd
Original Assignee
Taikang Insurance Group Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Taikang Insurance Group Co Ltd filed Critical Taikang Insurance Group Co Ltd
Priority to CN201711348128.7A priority Critical patent/CN108090511B/en
Publication of CN108090511A publication Critical patent/CN108090511A/en
Application granted granted Critical
Publication of CN108090511B publication Critical patent/CN108090511B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/241Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
    • G06F18/2415Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches based on parametric or probabilistic models, e.g. based on likelihood ratio or false acceptance rate versus a false rejection rate
    • G06F18/24155Bayesian classification
    • G06T5/73
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/40Analysis of texture
    • G06T7/41Analysis of texture based on statistical description of texture
    • G06T7/45Analysis of texture based on statistical description of texture using co-occurrence matrix computation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/44Local feature extraction by analysis of parts of the pattern, e.g. by detecting edges, contours, loops, corners, strokes or intersections; Connectivity analysis, e.g. of connected components
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/46Descriptors for shape, contour or point-related descriptors, e.g. scale invariant feature transform [SIFT] or bags of words [BoW]; Salient regional features
    • G06V10/469Contour-based spatial representations, e.g. vector-coding
    • G06V10/473Contour-based spatial representations, e.g. vector-coding using gradient analysis

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Probability & Statistics with Applications (AREA)
  • Data Mining & Analysis (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • General Engineering & Computer Science (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Artificial Intelligence (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Multimedia (AREA)
  • Image Analysis (AREA)

Abstract

The embodiment of the invention provides an image classification method, an image classification device, electronic equipment and a readable storage medium, wherein at least one candidate subgraph is obtained from an image to be classified; determining a brightness matrix and a gradient matrix of each candidate subgraph; determining the number of pixel points which simultaneously meet a preset brightness value and a preset gradient value according to the brightness matrix and the gradient matrix of each candidate subgraph to form a brightness-gradient co-occurrence matrix corresponding to each candidate subgraph; and determining the image category of the image to be classified according to the brightness-gradient co-occurrence matrix corresponding to each candidate subgraph. According to the image classification method, the brightness and gradient characteristic information of the image is extracted, and the brightness-gradient characteristic is synthesized to perform statistical analysis on each pixel point in the image, so that the texture characteristic information of the image is accurately obtained, the accuracy of correct identification of the image type is improved, the method only performs characteristic information analysis on candidate sub-images, the data volume to be analyzed is small, and the efficiency of image type identification is effectively improved.

Description

Image classification method and device, electronic equipment and readable storage medium
Technical Field
The embodiment of the invention relates to the field of image processing, in particular to an image classification method and device, electronic equipment and a readable storage medium.
Background
With the widespread use of handheld terminal devices equipped with cameras, more and more businesses handle digital images taken by the terminal devices, such as digital images of hospital medical bills, identification cards, bank cards and the like.
However, in the business handling process, the above digital images usually need to be checked by workers manually to see whether the data are complete, and the processing efficiency is low, so that the time for a client to handle the business is prolonged, and the client experience is poor.
Therefore, a method for accurately and rapidly classifying digital images is needed to improve the efficiency of automatic image classification.
Disclosure of Invention
The embodiment of the invention provides an image classification method, an image classification device, electronic equipment and a readable storage medium, and aims to solve the technical problem that digital images cannot be efficiently and accurately classified in the prior art.
One aspect of the embodiments of the present invention provides an image classification method, including:
acquiring at least one candidate subgraph in an image to be classified;
determining a brightness matrix and a gradient matrix of each candidate subgraph;
determining the number of pixel points which simultaneously meet a preset brightness value and a preset gradient value according to the brightness matrix and the gradient matrix of each candidate subgraph to form a brightness-gradient co-occurrence matrix corresponding to each candidate subgraph;
and determining the image category of the image to be classified according to the brightness-gradient co-occurrence matrix corresponding to each candidate subgraph.
Optionally, before acquiring at least one candidate subgraph from the image to be classified, the method further includes:
carrying out image preprocessing on the image to be classified to obtain the image to be classified after the image preprocessing;
wherein the pre-processing comprises at least one of: size normalization adjustment, image position correction and image picture definition adjustment.
Optionally, before acquiring at least one candidate subgraph from the image to be classified, the method further includes:
carrying out gray level conversion on the image to be classified after the image preprocessing to obtain the image to be classified after the gray level processing;
carrying out binarization processing on the image to be classified after the gray processing to obtain an image to be classified represented by binarization;
and acquiring at least one candidate subgraph in the image to be classified represented by the binaryzation.
Optionally, the obtaining at least one candidate subgraph in the image to be classified includes:
determining at least one graph contour in the image to be classified represented by the binaryzation;
determining a minimum outline bounding rectangle surrounding the outline of the graph;
if the minimum outline circumscribed rectangle is smaller than a preset rectangle size, intercepting an image which meets the preset rectangle size and surrounds the graph outline from the image to be classified according to the center position of the image outline region corresponding to the center of the preset rectangle size to form the candidate subgraph;
and if the minimum outline bounding rectangle is larger than or equal to the preset rectangle size, intercepting the image surrounded by the minimum outline bounding rectangle from the image to be classified to form the candidate subgraph.
Optionally, the determining a luminance matrix and a gradient matrix of each candidate subgraph includes:
determining the brightness value of each pixel point in each candidate subgraph to form a brightness matrix of each candidate subgraph;
determining the gradient value of each pixel point in the transverse X direction and the gradient value in the longitudinal Y direction according to the brightness matrix of each candidate subgraph;
and forming a gradient matrix of each candidate subgraph according to the gradient value of each pixel point in the transverse X direction and the gradient value in the longitudinal Y direction.
Optionally, the determining, according to the luminance matrix and the gradient matrix of each candidate sub-image, the number of pixel points that satisfy a preset luminance value and a preset gradient value at the same time to form a luminance-gradient co-occurrence matrix corresponding to each candidate sub-image includes:
according to a maximum preset brightness level V1Normalizing the brightness matrix of each candidate subgraph to obtain a brightness matrix F (x, y) after normalization;
according to a maximum preset gradient level V2Normalizing the gradient matrix of each candidate subgraph to obtain a gradient matrix G (x, y) after normalization;
wherein, (x, y) represents the position of a pixel point in the candidate subgraph; the preset brightness value is less than or equal to the maximum preset brightness level V1The preset gradient value is less than or equal to the maximum preset gradient level V2(ii) a The V is1Said V is2Is a positive integer;
determining the number of pixel points which simultaneously satisfy a preset brightness value and a preset gradient value to form a brightness-gradient co-occurrence matrix [ V ] corresponding to each candidate sub-image1、V2](ii) a Or forming a luminance-gradient co-occurrence matrix [ V ] corresponding to each candidate subgraph2、V1]。
Optionally, the determining, according to the luminance-gradient co-occurrence matrix corresponding to each candidate sub-image, an image category of the image to be classified includes:
converting the brightness-gradient co-occurrence matrix corresponding to each candidate subgraph into a feature vector of each candidate subgraph;
and identifying the feature vector of each candidate sub-image based on a Bayesian classifier, judging the identification result based on a voting mechanism, and determining the image category of the image to be classified.
Optionally, the method further includes:
extracting a target sub-graph corresponding to a preset target area from the image to be classified after the image preprocessing according to the preset target area;
converting the target sub-image from an RGB color space to a gray scale image space;
based on a Laplacian enhancement operator, sharpening the target sub-image converted into a gray image space;
recognizing the sharpened target sub-image based on the optical character recognition OCR model;
determining the image category of the image to be classified according to the recognition result;
if the image category of the image to be classified is not identified, executing the step of obtaining at least one candidate subgraph in the image to be classified; determining a brightness matrix and a gradient matrix of each candidate subgraph; determining the number of pixel points which simultaneously meet a preset brightness value and a preset gradient value according to the brightness matrix and the gradient matrix of each candidate subgraph to form a brightness-gradient co-occurrence matrix corresponding to each candidate subgraph; and determining the image category of the image to be classified according to the brightness-gradient co-occurrence matrix corresponding to each candidate subgraph.
Another aspect of an embodiment of the present invention provides an image classification apparatus, including:
the acquisition module is used for acquiring at least one candidate subgraph from the image to be classified;
a determining module for determining a luminance matrix and a gradient matrix for each candidate subgraph; determining the number of pixel points which simultaneously meet a preset brightness value and a preset gradient value according to the brightness matrix and the gradient matrix of each candidate subgraph to form a brightness-gradient co-occurrence matrix corresponding to each candidate subgraph; and determining the image category of the image to be classified according to the brightness-gradient co-occurrence matrix corresponding to each candidate subgraph.
Yet another aspect of an embodiment of the present invention provides an electronic device, including: a memory, a processor, and a computer program stored on the memory and executable on the processor,
the processor, when executing the computer program, performs any of the image classification methods described above.
Yet another aspect of embodiments of the present invention provides an electronic device-readable storage medium, which includes a program that, when run on an electronic device, causes the electronic device to perform any one of the image classification methods described above.
According to the image classification method, the image classification device, the electronic equipment and the readable storage medium, at least one candidate subgraph is obtained from the image to be classified; determining a brightness matrix and a gradient matrix of each candidate subgraph; determining the number of pixel points which simultaneously meet a preset brightness value and a preset gradient value according to the brightness matrix and the gradient matrix of each candidate subgraph to form a brightness-gradient co-occurrence matrix corresponding to each candidate subgraph; and determining the image category of the image to be classified according to the brightness-gradient co-occurrence matrix corresponding to each candidate subgraph. According to the image classification method, the brightness and gradient characteristic information of the image is extracted, and the brightness-gradient characteristic is synthesized to perform statistical analysis on each pixel point in the image, so that the texture characteristic information of the image is accurately obtained, the accuracy of correct identification of the image type is improved, the method only performs characteristic information analysis on candidate sub-images, the data volume to be analyzed is small, and the efficiency of image type identification is effectively improved.
Drawings
Fig. 1 is a flowchart illustrating an image classification method according to an exemplary embodiment of the present invention;
FIG. 2 is a flowchart illustrating an image classification method according to another exemplary embodiment of the present invention;
FIG. 3 is a diagram illustrating a voting mechanism according to the embodiment of FIG. 2;
FIG. 4 is a flowchart illustrating an image classification method according to another exemplary embodiment of the present invention;
fig. 5 is a schematic structural diagram of an image classification apparatus according to an exemplary embodiment of the present invention;
fig. 6 is a schematic structural diagram of an electronic device according to an exemplary embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Example one
Fig. 1 is a flowchart illustrating an image classification method according to an exemplary embodiment of the present invention, and as shown in fig. 1, an execution subject of the image classification method in this embodiment may be any electronic device with data processing capability, such as various mobile or non-mobile electronic devices, for example, a server, a desktop PC, a notebook computer, a PAD (PAD for short) of a tablet computer, or a mobile phone. The image classification method of this embodiment may specifically include:
step 101, at least one candidate subgraph is obtained from an image to be classified.
In this step, the candidate subgraph is a partial image segmented from the image to be classified, wherein the segmentation principle of the candidate subgraph can be determined by a person skilled in the art according to the image features of the image to be classified, which is not specifically limited in this embodiment. In addition, the number of candidate subgraphs is also not specifically limited in this embodiment, and generally, the greater the number of candidate subgraphs, the higher the accuracy of class identification of the image to be classified can be raised to a certain extent; however, the data amount for performing data processing on the candidate subgraphs can also be increased to a certain extent, so that a person skilled in the art can comprehensively determine the number of acquired candidate subgraphs according to the image characteristics of the image to be classified and the processing capacity of hardware equipment for performing data processing on the image to be classified.
And step 102, determining a brightness matrix and a gradient matrix of each candidate subgraph.
In the step, for each acquired candidate subgraph, determining the brightness value of each pixel point and the gradient value of each pixel point to form a brightness matrix F (x, y) and a gradient matrix G (x, y) of each candidate subgraph; wherein, (x, y) represents the position of the pixel point in the candidate subgraph, the number of elements in the brightness matrix and the gradient matrix is the same as the number of the pixel points contained in each candidate subgraph, the element value of each element in the brightness matrix is the brightness value of the pixel point, and the element value of each element in the gradient matrix is the gradient value of the pixel point.
And 103, determining the number of pixel points which simultaneously meet a preset brightness value and a preset gradient value according to the brightness matrix and the gradient matrix of each candidate subgraph to form a brightness-gradient co-occurrence matrix corresponding to each candidate subgraph.
In this step, the values of the preset brightness value and the preset gradient value and the number of the values may be determined by those skilled in the art according to the values of each element in the brightness matrix and the gradient matrix of each candidate subgraph, which is not specifically limited in this embodiment. According to formula (1)
W(n,m)=Num(F(x,y)=n,G(x,y)=m) (1)
Determining the number of pixel points which simultaneously satisfy F (x, y) ═ n and G (x, y) ═ m; that is to say, when the preset brightness value is n and the preset gradient value is m, the number of the pixel points satisfying the two conditions in the candidate subgraph is counted. Assuming that the candidate subgraph contains P pixels in total, the number of pixels satisfying F (x, y) ═ n and G (x, y) ═ m at the same time should be less than or equal to P and greater than or equal to 0; assuming that the number of the preset brightness values to be counted is N and the number of the preset gradient values is M, an mxn statistical matrix W (M, N) or an nxm statistical matrix W (N, M) can be obtained. The statistical matrix W is the luminance-gradient co-occurrence matrix.
And step 104, determining the image category of the image to be classified according to the brightness-gradient co-occurrence matrix corresponding to each candidate subgraph.
In this step, the extracted luminance-gradient co-occurrence matrix of the candidate subgraph is identified based on a preset identification model, and the image category of the image to be classified is determined according to the identification result. The preset recognition model is not specifically limited in this embodiment, and those skilled in the art may select various image classification models in the prior art, such as classification based on a decision tree, bayesian classification, Support Vector Machine (SVM), convolutional neural network, and the like.
In the image classification method provided by the embodiment, at least one candidate subgraph is obtained from an image to be classified; determining a brightness matrix and a gradient matrix of each candidate subgraph; determining the number of pixel points which simultaneously meet a preset brightness value and a preset gradient value according to the brightness matrix and the gradient matrix of each candidate subgraph to form a brightness-gradient co-occurrence matrix corresponding to each candidate subgraph; and determining the image category of the image to be classified according to the brightness-gradient co-occurrence matrix corresponding to each candidate subgraph. According to the image classification method, the brightness and gradient characteristic information of the image is extracted, and the brightness-gradient characteristic is synthesized to perform statistical analysis on each pixel point in the image, so that the texture characteristic information of the image is accurately obtained, the accuracy of correct identification of the image type is improved, the method only performs characteristic information analysis on candidate sub-images, the data volume to be analyzed is small, and the efficiency of image type identification is effectively improved.
Example two
Fig. 2 is a schematic flowchart of an image classification method according to another exemplary embodiment of the present invention, and as shown in fig. 2, on the basis of the previous embodiment, the image classification method according to the present embodiment specifically includes:
step 201, performing image preprocessing on an image to be classified to obtain the image to be classified after the image preprocessing.
Wherein the pre-processing comprises at least one of the following processes: size normalization adjustment, image position correction and image picture definition adjustment.
In this step, in order to improve the image processing efficiency and improve the accuracy of image category identification, the image to be classified may be subjected to normalization processing, and the processing mode may be size normalization of the image to be classified, for example, the resolution of each image to be classified is determined, and the resolution of the image to be classified is subjected to equal-proportion conversion according to the standard resolution, so as to obtain images of the same size. The method can also comprise the following steps: the image position is corrected, for example, the photographing angle of the image is inclined by 45 degrees, and the image may be reversely rotated by 45 degrees so that the position thereof is located at the standardized position. The method can also comprise the following steps: and adjusting the image by sharpening, brightness and the like so as to make the picture of the image clearer.
Step 202, performing gray level conversion on the image to be classified after the image preprocessing to obtain the image to be classified after the gray level processing.
In this step, the purpose of the gray level conversion is to improve the image quality of the image, and each pixel point expressed by RGB in the image is converted into a pixel point expressed by a gray level space, so that the display effect of the image is clearer.
And step 203, performing binarization processing on the image to be classified after the gray level processing to obtain the image to be classified represented by binarization.
In this step, Image Binarization (Image Binarization) is a process of setting the gray value of a pixel point on an Image in the previous step to 0 or 255, so that the whole Image has an obvious black-and-white effect. The image to be classified is subjected to binarization processing, so that the data volume in the image can be greatly reduced, and the outline of the image is highlighted.
And step 204, acquiring at least one candidate subgraph in the image to be classified represented by the binaryzation.
Specifically, the implementation of this step may specifically include:
step 2041, at least one graph contour is determined in the image to be classified represented by binarization.
After the image to be classified is subjected to binarization processing in step 203, each figure contour in the image to be classified can be highlighted, and therefore one or more figure contours can be selected directly according to the closed contour. Certainly, the number of the selected graphic outlines is different according to the difference of the image content in each image to be classified, for the accuracy of the subsequent analysis, a skilled person in the art may preset a reference number of one graphic outline, and if the graphic outline meeting the reference number cannot be determined in the image to be classified after the binarization processing, any one outline region may be selected in the image to be classified to complement the reference number, for example, a random factor is set to select a corresponding sub-image from the image to complement. Preferably, the selected figure outlines do not overlap with each other, so as to reduce the data amount of repeated calculation.
And step 2042, determining a minimum outline bounding rectangle surrounding the outline of the graph.
In this step, the minimum bounding rectangle is a bounding rectangle that can completely wrap the outline of the graphic and is drawn along the edge of the outline of the graphic. Due to the large differences in the size of the contours in the different types of images. Thus, it can be discussed in two cases:
step 2043a, if the minimum outline bounding rectangle is smaller than the preset rectangle size, intercepting an image which meets the preset rectangle size and surrounds the graph outline from the image to be classified according to the center position of the image outline region corresponding to the center of the preset rectangle size to form a candidate subgraph.
That is, if the acquired minimum outline bounding rectangle is smaller than the preset a × b image size, a sub-image of a × b size is cut out from the original image with the center position coordinates of the outline as the center.
And 2043b, if the minimum outline circumscribed rectangle is larger than or equal to the size of the preset rectangle, intercepting the image surrounded by the minimum outline circumscribed rectangle from the image to be classified to form a candidate subgraph.
That is, if the acquired minimum outline bounding rectangle is larger than the preset a × b image size, the clipping is performed according to the actual size of the outline.
Step 205, determining the brightness value of each pixel point in each candidate subgraph to form a brightness matrix of each candidate subgraph.
In this step, the candidate sub-images may be converted from RGB color space to HIS
(Hue-Saturation-Intensity, abbreviated as "HIS") color space, which is a color space in which when a person observes a colored object, the color of the object is described in terms of Hue, Saturation, and brightness. The color characteristics are described by using H, S, I three parameters, wherein H defines the wavelength of the color and is called hue; s represents the shade degree of the color, called saturation; i denotes intensity or brightness. Therefore, the value of the brightness channel I of each pixel point in each candidate subgraph is obtained through calculation according to the conversion formula (2):
Figure BDA0001509715520000081
wherein, R, G, B respectively represent the values of different color channels in RGB color space, and I is the value of brightness channel.
And calculating the I value of each pixel point in the candidate subgraph to obtain the brightness matrix of the candidate subgraph.
206, according to the maximum preset brightness level VnFor each ofAnd carrying out normalization processing on the brightness matrix of the candidate subgraph to obtain a brightness matrix F (x, y) after normalization processing.
In this step, in order to reduce the complexity of the calculation, the luminance matrix of the obtained candidate subgraph is normalized. Assuming that the maximum luminance value in the candidate sub-graph Q (x, y) is Vm and the normalized maximum luminance level is Vn, the luminance matrix of the candidate sub-graph Q (x, y) is normalized as:
Figure BDA0001509715520000091
substituting the I value of each pixel point calculated in the formula (2) into Q (x, y) to obtain the brightness value of each pixel point after normalization, and further forming a brightness matrix F (x, y) of each candidate subgraph, wherein INT is integer operation on the normalized brightness value.
And step 207, determining the gradient value of each pixel point in the transverse X direction and the gradient value in the longitudinal Y direction according to the brightness matrix of each candidate subgraph.
And step 208, forming a gradient matrix of each candidate subgraph according to the gradient value of each pixel point in the transverse X direction and the gradient value in the longitudinal Y direction.
Step 209, according to the maximum preset gradient level VgAnd carrying out normalization processing on the gradient matrix of each candidate subgraph to obtain a gradient matrix G (x, y) after normalization processing.
In steps 207 to 209, the gradient value of the normalized luminance matrix F (x, y) is calculated. The specific calculation formula is shown in formula (4) to formula (6):
Figure BDA0001509715520000092
gx=F(x+1,y-1)+2F(x+1,y)+F(x+1,y+1)-F(x-1,y-1)-2F(x-1,y)-F(x-1,y+1) (5)
gy=F(x-1,y+1)+2F(x,y+1)+F(x+1,y+1)-F(x-1,y+1)-2F(x,y-1)-F(x+1,y-1) (6)
wherein x and y represent candidate subgraphsThe position coordinate of the current pixel point, G (x, y), is the gradient value at pixel point (x, y). Similarly, in order to reduce the complexity of the calculation, the calculated gradient value needs to be normalized, assuming that the maximum gradient level after the normalization change is Vg, and then according to the maximum preset gradient level VgAnd carrying out normalization processing on the gradient matrix of each candidate subgraph to obtain a gradient matrix G (x, y) after normalization processing.
Step 210, determining the number of pixel points satisfying the preset brightness value and the preset gradient value at the same time, and forming a brightness-gradient co-occurrence matrix [ V ] corresponding to each candidate sub-graphn、Vg](ii) a Or forming a luminance-gradient co-occurrence matrix [ V ] corresponding to each candidate subgraphg、Vn]。
In this step, the luminance-gradient co-occurrence matrix is calculated using F (x, y), G (x, y), with reference to the formula (1) set forth in the previous embodiment
W(n,m)=Num(F(x,y)=n,G(x,y)=m) (1)
That is, when F (x, y) is n, G (x, y) is m pixel numbers. Wherein the preset brightness value n is less than or equal to the maximum preset brightness level VnThe preset gradient value m is less than or equal to the maximum preset gradient level Vg;Vn,VgIs a positive integer. Extracting a size of [ V ] by formula (1)g、Vn]Or [ V ]n、Vg]Luminance-gradient co-occurrence matrix.
And step 211, converting the luminance-gradient co-occurrence matrix corresponding to each candidate subgraph into a feature vector of each candidate subgraph.
In this step, for convenience of calculation, the luminance-gradient co-occurrence matrices acquired in step 210 may be connected into one feature vector, so as to obtain respective feature vectors characterizing features of each candidate sub-image.
And step 212, based on a Bayes classifier, identifying the feature vector of each candidate sub-image, judging the identification result based on a voting mechanism, and determining the image category of the image to be classified.
In this step, a certain number of sample images of different categories are respectively obtained, a feature vector corresponding to each sample image is extracted according to the method in the above step 201 to step 211, and each sample image is trained by using a naive bayesian classifier to obtain a trained bayesian classifier, and then each candidate sub-image is classified by using the trained bayesian classifier, and if the classification results obtained for each candidate sub-image in one image to be classified are different, the final category judgment can be performed by using a voting mechanism. As shown in fig. 3, fig. 3 is a schematic diagram of a voting mechanism in the embodiment shown in fig. 2 of the present invention, and votes are voted for each classification result (classification result 1, classification result 2, and classification result 3), where a large number of votes are finally determined image categories of an image to be classified.
EXAMPLE III
Fig. 4 is a flowchart of an image classification method according to another exemplary embodiment of the present invention, and as shown in fig. 4, on the basis of the foregoing embodiment, in order to further improve the efficiency of image classification, step-by-step identification may be performed on an image to be classified. For example, the images to be classified are firstly identified by the following steps 401 to 405, and if the image category of the images to be classified cannot be identified, the method of the steps 407 to 410 may be continuously adopted, that is, the method of the first embodiment and/or the second embodiment is further adopted for fine identification. Therefore, the identification efficiency can be improved on the basis of ensuring the identification accuracy. The identification and classification method of steps 401 to 405 is specifically described below, and the implementation principle of steps 407 to 410 is similar to that of the first embodiment and the second embodiment, and is not described again in this embodiment. The image classification method of the embodiment specifically includes:
step 401, performing image preprocessing on the image to be classified to obtain the image to be classified after the image preprocessing.
The implementation manner of this step is the same as that of step 201, and is not described herein again.
Step 402, according to a preset target area, extracting a target subgraph corresponding to the preset target area from the image to be classified after image preprocessing.
In this step, the preset target area is an area that may contain category information identifying the image to be classified; for example, for an image whose image to be classified is a bill class, a seal identifying that the image is invoice information, such as a red seal of "national invoice consolidated invoice identification seal", may appear above the image composition and at the center of the image; by setting the region as a preset target region, information which can identify the identity of each image to be classified can be quickly extracted from the images to be classified. For example, the image of the bank card may have the identifier of the bank name at the position such as the upper left corner and the lower right corner of the image composition, and these regions may be set as the preset target regions. In the standard image preprocessed in step 401, a salient region of the image is selected to be segmented to extract a target sub-image corresponding to a preset target region, the preset target region generally includes salient identification information, and the identification information can be distinguished from other types of images explicitly, so that the efficiency and accuracy of subsequent image type recognition are improved by extracting the target sub-image corresponding to the preset target region.
And step 403, converting the target sub-image from an RGB color space to a gray map space.
In this step, the extracted target sub-image is converted from RGB color space to grayscale image space, and the conversion formula is shown as formula (7):
Gray=R*0.299+G*0.587+B*0.114 (7)
wherein, R, G, B respectively represent the values of red channel, green channel, blue channel on RGB color space, Gray represents the value of grey map space after conversion.
And step 404, based on the Laplacian enhancement operator, sharpening the target sub-image converted into the gray graph space.
In this step, the formula for sharpening the grayscale image by using the Laplacian enhancement operator may be:
Figure BDA0001509715520000111
equation (8) is expressed in a matrix space, which may be:
Figure BDA0001509715520000112
the method has the advantages that the Laplacian sharpening effect can be generated by sharpening the gray level image by adopting the Laplacian enhancement operator, meanwhile, the background information in the target sub-image can be reserved, the original image (the target sub-image after the gray level processing) is superposed to the processing result of the Laplacian transformation, the gray level in the target sub-image can be reserved, the contrast of the gray level mutation position can be enhanced, and the final result is that the details in the image are highlighted on the premise that the image background is reserved.
Step 405, recognizing the sharpened target sub-image based on an optical character recognition OCR model; if the image category of the image to be classified is identified, executing step 406; if the image category of the image to be classified is not identified, step 407 is executed.
Before the step is executed, binarization processing may be further performed on the target sub-image obtained in step 404, so as to further enhance the detail features in the sub-image. Preferably, the binarization processing may adopt a maximum inter-class variance method to perform binarization operation on the image and obtain a binarized target subgraph. Then, inputting the binarized target sub-image into a pre-trained Optical Character Recognition (OCR) model for recognition, where the OCR can recognize character information in the image, comparing the character information with a predetermined classification rule, for example, if the predetermined classification rule is that an image containing characters such as invoice, national tax, and tax is an invoice image, determining which classification rule the recognition result corresponds to, thereby determining the image category of the image to be classified, and storing the image category in a corresponding image library, and if the recognition result is not consistent with the type to be recognized, proceeding to step 407 for secondary classification.
Step 406, determining and outputting the image category of the image to be classified.
Step 407, at least one candidate subgraph is obtained from the image to be classified after image preprocessing.
Step 408, determining a brightness matrix and a gradient matrix for each candidate subgraph.
Step 409, determining the number of pixel points which simultaneously meet the preset brightness value and the preset gradient value according to the brightness matrix and the gradient matrix of each candidate subgraph, and forming a brightness-gradient co-occurrence matrix corresponding to each candidate subgraph.
And step 410, determining the image category of the image to be classified according to the brightness-gradient co-occurrence matrix corresponding to each candidate subgraph.
In the image classification method provided by this embodiment, a target sub-image is extracted from an image to be classified, and the target sub-image is subjected to gray level conversion, sharpening, binarization and other processing, so that feature information in the sub-image is highlighted, character identifiers included in the features are identified through OCR optical character identification, so that the identified character identifiers are matched with image categories, and thus category information of the image to be classified is obtained quickly; determining a brightness matrix and a gradient matrix of each candidate subgraph; determining the number of pixel points which simultaneously meet a preset brightness value and a preset gradient value according to the brightness matrix and the gradient matrix of each candidate subgraph to form a brightness-gradient co-occurrence matrix corresponding to each candidate subgraph; the method comprises the steps of determining the image category of an image to be classified according to a brightness-gradient co-occurrence matrix corresponding to each candidate sub-image, extracting brightness and gradient characteristic information of the image, performing statistical analysis on each pixel point in the image by integrating the brightness-gradient characteristic, accurately obtaining texture characteristic information of the image, and improving the accuracy of correct identification of the image type, wherein the image to be identified adopts a two-step identification method, so that the identification efficiency can be improved on the premise of ensuring the identification accuracy, and the sequence of the two-step identification can be exchanged, for example, the steps 402 to 405 are executed first, and then the steps 407 to 410 are executed; alternatively, step 407 to step 410 may be executed first, and then step 402 to step 405 may be executed, which is not limited in this embodiment.
Example four
Fig. 5 is a schematic structural diagram of an image classification apparatus according to an exemplary embodiment of the present invention, and as shown in fig. 5, the present embodiment provides an image classification apparatus for performing the image classification method according to the foregoing method embodiments. The image classification device specifically includes:
an obtaining module 51, configured to obtain at least one candidate subgraph in the image to be classified.
A determining module 52 for determining a luminance matrix and a gradient matrix for each candidate subgraph; determining the number of pixel points which simultaneously meet a preset brightness value and a preset gradient value according to the brightness matrix and the gradient matrix of each candidate subgraph to form a brightness-gradient co-occurrence matrix corresponding to each candidate subgraph; and determining the image category of the image to be classified according to the brightness-gradient co-occurrence matrix corresponding to each candidate subgraph.
Regarding the image classification apparatus in this embodiment, the specific manner in which each module performs operations has been described in detail in the foregoing method embodiments, and the implementation principles thereof are similar and will not be described again here.
The image classification device provided by the embodiment acquires at least one candidate subgraph from an image to be classified; determining a brightness matrix and a gradient matrix of each candidate subgraph; determining the number of pixel points which simultaneously meet a preset brightness value and a preset gradient value according to the brightness matrix and the gradient matrix of each candidate subgraph to form a brightness-gradient co-occurrence matrix corresponding to each candidate subgraph; and determining the image category of the image to be classified according to the brightness-gradient co-occurrence matrix corresponding to each candidate subgraph. According to the image classification method, the brightness and gradient characteristic information of the image is extracted, and the brightness-gradient characteristic is synthesized to perform statistical analysis on each pixel point in the image, so that the texture characteristic information of the image is accurately obtained, the accuracy of correct identification of the image type is improved, the method only performs characteristic information analysis on candidate sub-images, the data volume to be analyzed is small, and the efficiency of image type identification is effectively improved.
EXAMPLE five
Fig. 6 is a schematic structural diagram of an electronic device according to an exemplary embodiment of the present invention, and as shown in fig. 6, the electronic device includes: a memory 61, a processor 62 and a computer program stored on the memory 61 and executable on the processor 62, the processor 62 executing the method according to any of the above embodiments when executing the computer program.
EXAMPLE six
An embodiment of the present invention provides an electronic device readable storage medium, which includes a program, and when the program runs on an electronic device, the electronic device is caused to execute the method according to any of the above embodiments.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.

Claims (10)

1. An image classification method, comprising:
acquiring at least one candidate subgraph in an image to be classified;
determining a brightness matrix and a gradient matrix of each candidate subgraph;
determining the number of pixel points which simultaneously meet a preset brightness value and a preset gradient value according to the brightness matrix and the gradient matrix of each candidate subgraph to form a brightness-gradient co-occurrence matrix corresponding to each candidate subgraph;
determining the image category of the image to be classified according to the brightness-gradient co-occurrence matrix corresponding to each candidate subgraph;
determining the image category of the image to be classified according to the luminance-gradient co-occurrence matrix corresponding to each candidate subgraph, wherein the determining comprises the following steps:
converting the brightness-gradient co-occurrence matrix corresponding to each candidate subgraph into a feature vector of each candidate subgraph;
and identifying the feature vector of each candidate sub-image based on a Bayesian classifier, judging the identification result based on a voting mechanism, and determining the image category of the image to be classified.
2. The method of claim 1, wherein before obtaining at least one candidate sub-image in the image to be classified, further comprising:
carrying out image preprocessing on the image to be classified to obtain the image to be classified after the image preprocessing;
wherein the pre-processing comprises at least one of: size normalization adjustment, image position correction and image picture definition adjustment.
3. The method of claim 2, wherein before obtaining at least one candidate sub-image in the image to be classified, further comprising:
carrying out gray level conversion on the image to be classified after the image preprocessing to obtain the image to be classified after the gray level processing;
carrying out binarization processing on the image to be classified after the gray processing to obtain an image to be classified represented by binarization;
and acquiring at least one candidate subgraph in the image to be classified represented by the binaryzation.
4. The method of claim 3, wherein the obtaining at least one candidate subgraph in the image to be classified comprises:
determining at least one graph contour in the image to be classified represented by the binaryzation;
determining a minimum outline bounding rectangle surrounding the outline of the graph;
if the minimum outline circumscribed rectangle is smaller than a preset rectangle size, intercepting an image which meets the preset rectangle size and surrounds the graph outline from the image to be classified according to the center position of the image outline region corresponding to the center of the preset rectangle size to form the candidate subgraph;
and if the minimum outline bounding rectangle is larger than or equal to the preset rectangle size, intercepting the image surrounded by the minimum outline bounding rectangle from the image to be classified to form the candidate subgraph.
5. The method of claim 1, wherein determining the luminance matrix and the gradient matrix for each candidate subgraph comprises:
determining the brightness value of each pixel point in each candidate subgraph to form a brightness matrix of each candidate subgraph;
determining the gradient value of each pixel point in the transverse X direction and the gradient value in the longitudinal Y direction according to the brightness matrix of each candidate subgraph;
and forming a gradient matrix of each candidate subgraph according to the gradient value of each pixel point in the transverse X direction and the gradient value in the longitudinal Y direction.
6. The method of claim 5, wherein the determining, according to the luminance matrix and the gradient matrix of each candidate sub-graph, the number of pixel points that satisfy a preset luminance value and a preset gradient value at the same time to form a luminance-gradient co-occurrence matrix corresponding to each candidate sub-graph comprises:
according to a maximum preset brightness level V1Normalizing the brightness matrix of each candidate subgraph to obtain a brightness matrix F (x, y) after normalization;
according to a maximum preset gradient level V2Normalizing the gradient matrix of each candidate subgraph to obtain a gradient matrix G (x, y) after normalization;
wherein, (x, y) represents the position of a pixel point in the candidate subgraph; the preset brightness value is less than or equal to the maximum preset brightness level V1The preset gradient value is less than or equal to the maximum preset gradient level V2(ii) a The V is1Said V is2Is a positive integer;
determining the number of pixel points satisfying the preset brightness value and the preset gradient value simultaneouslyForming a luminance-gradient co-occurrence matrix [ V ] corresponding to each candidate subgraph1、V2](ii) a Or forming a luminance-gradient co-occurrence matrix [ V ] corresponding to each candidate subgraph2、V1]。
7. The method of claim 2, further comprising:
extracting a target sub-graph corresponding to a preset target area from the image to be classified after the image preprocessing according to the preset target area;
converting the target sub-image from an RGB color space to a gray scale image space;
based on a Laplacian enhancement operator, sharpening the target sub-image converted into a gray image space;
recognizing the sharpened target sub-image based on the optical character recognition OCR model;
determining the image category of the image to be classified according to the recognition result;
if the image category of the image to be classified is not identified, executing the step of obtaining at least one candidate subgraph in the image to be classified; determining a brightness matrix and a gradient matrix of each candidate subgraph; determining the number of pixel points which simultaneously meet a preset brightness value and a preset gradient value according to the brightness matrix and the gradient matrix of each candidate subgraph to form a brightness-gradient co-occurrence matrix corresponding to each candidate subgraph; and determining the image category of the image to be classified according to the brightness-gradient co-occurrence matrix corresponding to each candidate subgraph.
8. An image classification apparatus, comprising:
the acquisition module is used for acquiring at least one candidate subgraph from the image to be classified;
a determining module for determining a luminance matrix and a gradient matrix for each candidate subgraph; determining the number of pixel points which simultaneously meet a preset brightness value and a preset gradient value according to the brightness matrix and the gradient matrix of each candidate subgraph to form a brightness-gradient co-occurrence matrix corresponding to each candidate subgraph; determining the image category of the image to be classified according to the brightness-gradient co-occurrence matrix corresponding to each candidate subgraph;
the determining module is specifically configured to convert the luminance-gradient co-occurrence matrix corresponding to each candidate sub-image into a feature vector of each candidate sub-image; and identifying the feature vector of each candidate sub-image based on a Bayesian classifier, judging the identification result based on a voting mechanism, and determining the image category of the image to be classified.
9. An electronic device, comprising: a memory, a processor, and a computer program stored on the memory and executable on the processor,
the processor executes the computer program to execute the image classification method according to any one of claims 1 to 7.
10. An electronic-device-readable storage medium characterized by comprising a program that, when run on an electronic device, causes the electronic device to execute the image classification method according to any one of claims 1 to 7.
CN201711348128.7A 2017-12-15 2017-12-15 Image classification method and device, electronic equipment and readable storage medium Active CN108090511B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711348128.7A CN108090511B (en) 2017-12-15 2017-12-15 Image classification method and device, electronic equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711348128.7A CN108090511B (en) 2017-12-15 2017-12-15 Image classification method and device, electronic equipment and readable storage medium

Publications (2)

Publication Number Publication Date
CN108090511A CN108090511A (en) 2018-05-29
CN108090511B true CN108090511B (en) 2020-09-01

Family

ID=62176669

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711348128.7A Active CN108090511B (en) 2017-12-15 2017-12-15 Image classification method and device, electronic equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN108090511B (en)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110738603A (en) * 2018-07-18 2020-01-31 中国商用飞机有限责任公司 image gray scale processing method, device, computer equipment and storage medium
CN109447124B (en) * 2018-09-28 2019-11-19 北京达佳互联信息技术有限公司 Image classification method, device, electronic equipment and storage medium
CN109615536A (en) * 2018-12-13 2019-04-12 平安医疗健康管理股份有限公司 Settlement of insurance claim method, apparatus, equipment and readable storage medium storing program for executing based on OCR technique
CN109671079B (en) * 2018-12-25 2021-04-16 宁波智能装备研究院有限公司 Corrugated board intelligent detection method based on gray level co-occurrence matrix characteristics
CN109685079B (en) * 2018-12-26 2021-03-02 网易(杭州)网络有限公司 Method and device for generating characteristic image category information
CN111489246A (en) * 2020-04-09 2020-08-04 贵州爱信诺航天信息有限公司 Electronic integrated posting system for value-added tax invoice
CN111860657A (en) * 2020-07-23 2020-10-30 中国建设银行股份有限公司 Image classification method and device, electronic equipment and storage medium
CN114529771B (en) * 2022-02-23 2023-04-28 中国石油大学(华东) Shale large-view-area image classification method based on machine learning
CN115438702A (en) * 2022-10-18 2022-12-06 国网山东省电力公司营销服务中心(计量中心) Power line carrier channel noise detection method and system
CN116152361B (en) * 2023-04-20 2023-07-07 高视科技(苏州)股份有限公司 Method for estimating chromaticity, electronic device, and computer-readable storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101957313A (en) * 2010-09-21 2011-01-26 吉林大学 Method and device for computer visual inspection classification of quality of fresh corn ears
CN102663377A (en) * 2012-03-15 2012-09-12 华中科技大学 Character recognition method based on template matching
CN104215584A (en) * 2014-08-29 2014-12-17 华南理工大学 Hyper-spectral image technology-based detection method for distinguishing rice growing areas

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2003034335A2 (en) * 2001-10-11 2003-04-24 Koninklijke Philips Electronics N.V. Method and apparatus for discriminating between different regions of an image
TWI406571B (en) * 2010-01-29 2013-08-21 Corel Inc Image Processing Method for Enhancing Image Edge Resolution
JP5781743B2 (en) * 2010-06-28 2015-09-24 ソニー株式会社 Image processing apparatus, image processing method, and image processing program
CN105005989B (en) * 2015-06-30 2018-02-13 长安大学 A kind of vehicle target dividing method under weak contrast

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101957313A (en) * 2010-09-21 2011-01-26 吉林大学 Method and device for computer visual inspection classification of quality of fresh corn ears
CN102663377A (en) * 2012-03-15 2012-09-12 华中科技大学 Character recognition method based on template matching
CN104215584A (en) * 2014-08-29 2014-12-17 华南理工大学 Hyper-spectral image technology-based detection method for distinguishing rice growing areas

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
一种利用纹理特征和朴素贝叶斯分类器检测近景影像植被的方法;詹总谦等;《武汉大学学报·信息科学版》;20130630;第38卷(第6期);第665-668 *
基于灰度—梯度共生矩阵的图像型垃圾邮件识别方法;冯兵等;《通信学报》;20130930;第34卷(第Z2期);第1-4页 *

Also Published As

Publication number Publication date
CN108090511A (en) 2018-05-29

Similar Documents

Publication Publication Date Title
CN108090511B (en) Image classification method and device, electronic equipment and readable storage medium
CN111401372B (en) Method for extracting and identifying image-text information of scanned document
US8638993B2 (en) Segmenting human hairs and faces
CN110119741A (en) A kind of card card image information recognition methods having powerful connections
CN110569878A (en) Photograph background similarity clustering method based on convolutional neural network and computer
WO2022156178A1 (en) Image target comparison method and apparatus, computer device and readable storage medium
CN109740572A (en) A kind of human face in-vivo detection method based on partial color textural characteristics
CN111222433B (en) Automatic face auditing method, system, equipment and readable storage medium
CN110427972B (en) Certificate video feature extraction method and device, computer equipment and storage medium
CN108280190A (en) Image classification method, server and storage medium
CN112396050B (en) Image processing method, device and storage medium
CN111259891B (en) Method, device, equipment and medium for identifying identity card in natural scene
CN111860369A (en) Fraud identification method and device and storage medium
CN108830175A (en) Iris image local enhancement methods, device, equipment and storage medium
CN112507782A (en) Text image recognition method and device
CN110443184A (en) ID card information extracting method, device and computer storage medium
CN111680690A (en) Character recognition method and device
CN110991434B (en) Self-service terminal certificate identification method and device
CN111709305A (en) Face age identification method based on local image block
CN108877030B (en) Image processing method, device, terminal and computer readable storage medium
US20240127404A1 (en) Image content extraction method and apparatus, terminal, and storage medium
CN110569716A (en) Goods shelf image copying detection method
CN111027545A (en) Card picture mark detection method and device, computer equipment and storage medium
Nguyen et al. Using contextual information to classify nuclei in histology images
CN108090728B (en) Express information input method and system based on intelligent terminal

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant