[go: up one dir, main page]

CN111242957A - Data processing method and device, computer storage medium and electronic equipment - Google Patents

Data processing method and device, computer storage medium and electronic equipment Download PDF

Info

Publication number
CN111242957A
CN111242957A CN202010026160.9A CN202010026160A CN111242957A CN 111242957 A CN111242957 A CN 111242957A CN 202010026160 A CN202010026160 A CN 202010026160A CN 111242957 A CN111242957 A CN 111242957A
Authority
CN
China
Prior art keywords
region
original
similarity
merging
region set
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.)
Withdrawn
Application number
CN202010026160.9A
Other languages
Chinese (zh)
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.)
Hefei Lianbao Information Technology Co Ltd
Original Assignee
Hefei Lianbao Information Technology 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 Hefei Lianbao Information Technology Co Ltd filed Critical Hefei Lianbao Information Technology Co Ltd
Priority to CN202010026160.9A priority Critical patent/CN111242957A/en
Publication of CN111242957A publication Critical patent/CN111242957A/en
Withdrawn legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/22Matching criteria, e.g. proximity measures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/23Clustering techniques
    • G06F18/232Non-hierarchical techniques
    • G06F18/2321Non-hierarchical techniques using statistics or function optimisation, e.g. modelling of probability density functions
    • G06F18/23213Non-hierarchical techniques using statistics or function optimisation, e.g. modelling of probability density functions with fixed number of clusters, e.g. K-means clustering
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/70Determining position or orientation of objects or cameras
    • G06T7/73Determining position or orientation of objects or cameras using feature-based methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10024Color image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20081Training; Learning

Landscapes

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

Abstract

The invention discloses a data processing method, a data processing device, a computer storage medium and electronic equipment, wherein the method comprises the following steps: performing primary segmentation on an original region image to obtain an original region set; calculating a similarity set corresponding to adjacent regions in the original region set; merging adjacent regions in the original region set according to the similarity set to obtain a candidate region set; and screening the candidate region set to obtain a label region. According to the data processing method and device, the computer storage medium and the electronic device, the original region image is firstly subjected to primary segmentation to obtain a plurality of relatively fine and scattered original segmentation regions to form an original region set, and then the information contained in each region in the original segmentation regions is utilized to combine the roughly segmented original regions to obtain a more correct image segmentation result, so that the accuracy of the label positioning result is improved.

Description

Data processing method and device, computer storage medium and electronic equipment
Technical Field
The present invention relates to the field of information processing technologies, and in particular, to a data processing method and apparatus, a computer storage medium, and an electronic device.
Background
With the development of automation technology, the work of detecting product equipment in production is gradually replaced by an automation means, and the detection of the surface of a product is an important means for ensuring the quality of the product and acquiring information. For many products such as notebooks, product labels need to be detected, the types of the notebook labels including processor labels are many, the sizes of the labels are different, the sticking positions are not fixed, and how to accurately position the positions of the labels on the surface is an important step for detecting the notebooks.
The label positioning problem can be understood as an image segmentation problem, and the position of a label in a notebook palm rest area is determined by segmenting different objects in an image, such as a foreground (label) and a background (notebook palm rest area), into different areas. The image segmentation problem can be solved by adopting an image clustering technology, image clustering is carried out according to the similarity between each adjacent pixel in the image, and then different areas of the image are marked. The K-means (K mean value clustering) algorithm is a classic unsupervised learning image clustering algorithm, has simple principle and low calculation complexity, and is widely used.
However, when the K-means algorithm runs, an initial clustering center and a clustering number need to be specified, and the final segmentation result is influenced by the difference of the initial clustering center or the clustering number. The K-means algorithm is applied to the label positioning of the palm rest area of the notebook computer, the diversity of the label and the complexity of the background of the palm rest area make the initial clustering center and the clustering number difficult to be accurately determined in the clustering process, the clustering effect is locally optimal easily, the clustering result is unstable, and the accuracy is reduced. If the position of the label is determined by directly adopting the K-means algorithm to cluster the palm support area image, the label positioning effect is not ideal.
Disclosure of Invention
In order to effectively overcome the above-mentioned defects in the prior art, embodiments of the present invention creatively provide a data processing method, including: performing primary segmentation on an original region image to obtain an original region set; calculating a similarity set corresponding to adjacent regions in the original region set; merging adjacent regions in the original region set according to the similarity set to obtain a candidate region set; and screening the candidate region set to obtain a label region.
In an embodiment, the initially segmenting the original region image to obtain a plurality of original region sets includes: carrying out primary clustering on the original region images by adopting a K mean value clustering algorithm to obtain a primary clustering result; and merging adjacent pixel points belonging to the same clustering center in the primary clustering result to obtain an original region set.
In one embodiment, the calculating the similarity set corresponding to the neighboring regions in the original region set comprises: and calculating a similarity set according to one or more information of color histograms, color moments, sizes and overlapping proportions of adjacent regions in the original region set.
In an implementation manner, the merging the neighboring areas in the original area set according to the similarity set to obtain a candidate area set includes: merging two adjacent regions with the maximum similarity in the original region set according to the similarity set to obtain a candidate region and a candidate region set comprising the candidate region; and judging whether the adjacent regions meeting the merging condition exist in the candidate region set, if so, merging the adjacent regions meeting the merging condition and updating the candidate region set.
In one embodiment, the candidate region set is filtered according to the tag feature information.
Another aspect of an embodiment of the present invention provides a data processing apparatus, including: the rough segmentation module is used for carrying out preliminary segmentation on the original region image to obtain an original region set; the similarity calculation module is used for calculating a similarity set corresponding to adjacent regions in the original region set; the region merging module is used for merging adjacent regions in the original region set according to the similarity set to obtain a candidate region set; and the screening module is used for screening the candidate region set to obtain a tag region.
In one embodiment, the rough segmentation module comprises: the primary clustering unit is used for carrying out primary clustering on the original region images by adopting a K mean value clustering algorithm to obtain a primary clustering result; and the clustering and merging unit is used for merging adjacent pixel points belonging to the same clustering center in the primary clustering result to obtain an original region set.
In one embodiment, the similarity calculation module comprises: and the similarity operator unit is used for calculating a similarity set according to one or more information of color histograms, color moments, sizes and overlapping proportions of adjacent regions in the original region set.
In one embodiment, the region merging module comprises: a region merging unit, configured to merge two neighboring regions with the maximum similarity in the original region set according to the similarity set to obtain a candidate region and a candidate region set including the candidate region; and the region judgment unit is used for judging whether the adjacent regions meeting the merging condition exist in the candidate region set or not, and if so, merging the adjacent regions meeting the merging condition and updating the candidate region set.
Another aspect of the embodiments of the present invention provides a computer-readable storage medium, in which computer-executable instructions are stored, and when the instructions are executed, the computer-readable storage medium is configured to perform the data processing method described in any one of the above.
Another aspect of the present invention provides an electronic device, including a memory and a processor, where the memory stores computer program instructions, and the instructions are loaded and executed by the processor to implement the data processing method described in any one of the above.
According to the data processing method and device, the computer storage medium and the electronic device, the original region image is firstly subjected to primary segmentation to obtain a plurality of relatively fine and scattered original segmentation regions to form an original region set, and then the information contained in each region of the original segmentation regions is utilized to combine the roughly segmented original regions, so that a more correct image segmentation result is obtained, and the accuracy of the label positioning result is improved.
Drawings
The above and other objects, features and advantages of exemplary embodiments of the present invention will become readily apparent from the following detailed description read in conjunction with the accompanying drawings. Several embodiments of the invention are illustrated by way of example, and not by way of limitation, in the figures of the accompanying drawings and in which:
in the drawings, the same or corresponding reference numerals indicate the same or corresponding parts.
Fig. 1 is a schematic flow chart illustrating an implementation of a data processing method according to an embodiment of the present invention;
fig. 2 is a block diagram of a data processing apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the objects, features and advantages of the present invention more obvious and understandable, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. 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.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
Furthermore, the terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In the description of the present invention, "a plurality" means two or more unless specifically defined otherwise.
The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present specification. Rather, they are merely examples of methods, apparatus or devices consistent with certain aspects of the specification, as detailed in the claims that follow.
Referring to fig. 1, an embodiment of the present invention provides a data processing method, including:
step 101, performing primary segmentation on an original region image to obtain an original region set;
102, calculating a similarity set corresponding to adjacent areas in an original area set;
103, merging adjacent regions in the original region set according to the similarity set to obtain a candidate region set;
and 104, screening the candidate region set to obtain a label region.
In the embodiment of the present invention, an original region image including a labeled region is roughly segmented in step 101 to obtain an original region set, and a background and a foreground, that is, a background and a label, are preliminarily segmented, that is, roughly segmented, are realized. Then, the similarity of each adjacent region in the original region set is calculated through step 102, so as to obtain a similarity set, wherein the similarity of each adjacent region can be specifically calculated by calculating information such as a color space threshold value, a region scale and the like between the regions, and can also be calculated by using other region features. Then, combining adjacent regions in the original region set according to the similarity set obtained by calculation in step 103 to accurately and respectively combine scattered label regions and scattered background regions, and combining the scattered label regions into a relatively complete label region to improve the extraction accuracy of the label regions; finally, label area screening is carried out through the step 104 on the basis of the candidate area set obtained through combination, and then label areas which are accurately segmented can be obtained.
According to the embodiment of the invention, the original region image is firstly segmented to obtain a plurality of relatively fine and scattered original segmented regions to form an original region set, and then the information contained in each region in the original segmented regions is utilized to combine the roughly segmented original regions, so that a more correct image segmentation result is obtained, and the accuracy of the label positioning result is improved.
In an embodiment, the preliminary segmenting the original region image to obtain a plurality of original region sets includes:
carrying out primary clustering on the original region images by adopting a K mean value clustering algorithm to obtain a primary clustering result;
and merging adjacent pixel points belonging to the same clustering center in the primary clustering result to obtain an original region set.
In the embodiment of the invention, the original region images are subjected to primary clustering through a K-means algorithm, and the initial K value and the clustering center are selected according to the color rule, so that the certainty and the accuracy of the clustering result are improved. Wherein the image width is w, the image height is h, the clustering number is k, and k clustering center points Zj(I) (R, G, B), j ═ 1, 2, 3.., k, I, denotes the I-th iteration.
(1) First, the cluster number k can be set to 27, and the following pixels with R (red), G (green), and B (blue) pixel values are selected as the initial cluster center point Z1(1)(R,G,B),Z2(1)(R,G,B),Z3(1)(R,G,B),...,Zk(1)(R,G,B):
(0,0,0),(0,0,128),(0,0,255),
(0,128,0),(0,128,128),(0,128,255),
(0,255,0),(0,255,128),(0,255,255),
(128,0,0),(128,0,128),(128,0,255),
(128,128,0),(128,128,128),(128,128,255),
(128,255,0),(128,255,128),(128,255,255),
(255,0,0),(255,0,128),(255,0,255),
(255,128,0),(255,128,128),(255,128,255),
(255,255,0),(255,255,128),(255,255,255)。
These 27 initial cluster center points are evenly distributed over the original region image pixel RGB values.
(2) Then calculating pixel x of each original region image, such as palm region image of computeri(R, G, B) and initial clustering center Zj(I) Distance of (R, G, B)
Figure BDA0002362540790000061
Wherein,
if it satisfies
D(xi(R,G,B),Zj(I)(R,G,B))=min{D(xi(R,G,B),Zj(I) (R, G, B)), i ═ 1, 2, 3,., mxn }, then pixel point xiBelonging to a cluster center Zj(I)(R,G,B)。
(3) Then according to the cluster center Zj(I) (R, G, B) all PjA pixel point for calculating a clustering criterion function J (I)
Figure BDA0002362540790000071
Wherein x isp(R, G, B) is a number belonging to the clustering center Zj(I) (R, G, B), j ═ 1, 2, 3.
(4) After all the pixel points are reclassified, making I equal to I +1, and according to the fact that the pixel points belong to the clustering center Zj(I) (R, G, B) all PjCalculating new clustering center Z of each pixel pointj(I+1)(R,G,B)
Figure BDA0002362540790000072
Wherein j is 1, 2, 3.
(5) Then judging: if the difference value between J (I +1) and J (I) is less than a given threshold value or the iteration number I is equal to the given threshold value, finishing the algorithm to obtain a primary clustering result; otherwise, returning to the step (2) and continuing to execute until the difference value between J (I +1) and J (I) is less than a given threshold or the iteration number I is equal to the given threshold, and ending the algorithm to obtain a primary clustering result. After the initial clustering result is obtained, combining adjacent pixel points which belong to the same clustering center in the result into a region to obtain a rough segmentation region CiI 1, 2, 3., q, q denote the number of roughly divided regions, and roughly divided region C is divided intoiAdd to the original region set.
In one embodiment, calculating the set of similarities corresponding to the neighboring regions in the original region set comprises:
and calculating a similarity set according to one or more information of color histograms, color moments, sizes and overlapping proportions of adjacent regions in the original region set.
The embodiment of the invention calculates the similarity by calculating one or more information of the color histogram, the color moment, the similarity of the size and the overlapping degree of every two adjacent roughly-divided regions, and obtains the similarity set to fully utilize the region characteristic information in the original region set, thereby overcoming the uncertainty of the clustering result caused by the randomness of the initial k value and the clustering center, being difficult to realize the image division of all kinds of labels and being incapable of ensuring the reliability of the division result every time.
Specifically, when calculating the similarity of the color histogram, the region C is roughly dividediConverting into HSV color space, dividing H, S, V color channel into 20 small intervals, counting the number of pixels with color falling in 20 small intervals to obtain H, S, V color histogram, normalizing with L1 norm, and combining to obtain a 60-dimensional vector vi,hist’As region CiThe color histogram feature vector of (1). Calculating an adjacent area CiAnd CjColor histogram similarity of Scolor_hist(Ci,Cj)
Figure BDA0002362540790000081
Wherein,
Figure BDA0002362540790000082
indicates the ith area CiIs calculated from the k-th dimension value of the color histogram feature vector.
When calculating the color moment similarity, the coarse segmentation region C is subjected toiThe color moments of the RGB color space are calculated.
First order color moment mut,μtThe average value of all pixels on the t-th color channel is represented, and the brightness of the image is reflected:
Figure BDA0002362540790000083
second order color moment sigmat,σtRepresents the variance of all pixels on the t-th color channel, reflecting the image color distribution range:
Figure BDA0002362540790000084
third order moment of color st,stRepresents the slope of all pixels on the t-th color channel, reflecting the image color distribution symmetry:
Figure BDA0002362540790000085
wherein N represents the roughly divided region C in the original region setiTotal number of pixels, pt,kIndicating that the t-th color channel is at the k-th pixel value.
Roughly dividing the region C in the original region setiColor moment mu of image R channelR,σG,sGColor moments of R channels, the color moments of R channels being combined into a vector vi,moment=[μR,σG,sG,μG,σG,sG,μB,σB,sB]As a region CiThe color moment feature vector of (1). Calculating an adjacent area CiAnd CjColor moment similarity of (S)color_moment(Ci,Cj)
Figure BDA0002362540790000091
Wherein,
Figure BDA0002362540790000092
indicates the ith area CiIs calculated from the k-th dimension value of the color histogram feature vector.
When calculating the size similarity, according to the neighboring region CiAnd CjTo calculate the neighboring area CiAnd CjSize similarity of (S)size(Ci,Cj)
Figure BDA0002362540790000093
Wherein, size (C)i) Represents a region CiThe size (im) represents the area of the palm rest region.
When calculating the degree of overlap, the adjacent region C is constructed firstiAnd CjCircumscribed rectangle BB ofijCalculating the neighboring area CiAnd CjDegree of overlap of (c):
Figure BDA0002362540790000094
fusing the results of the four similarity measurements between the regions by adopting a linear combination mode, and calculating an adjacent region CiAnd CjSimilarity of (C)i,Cj):
S(Ci,Cj)=α1Scolor_hist(Ci,Cj)+α2Scolor_moment(Ci,Cj)+α3Ssize(Ci,Cj)
4fill(Ci,Cj)
When S (C)i,Cj) The more toward 0, the region CiAnd CjThe similarity is maximal.
The embodiment of the invention fully combines the image characteristics, not only adopts the image pixel value, but also integrates the characteristics of image color distribution, size, overlapping information and the like, solves the problem of instability of a k-means method, and effectively improves the accuracy of label positioning.
In an implementation manner, merging the adjacent regions in the original region set according to the similarity set to obtain the candidate region set includes:
merging two adjacent regions with the maximum similarity in the original region set according to the similarity set to obtain a candidate region and a candidate region set comprising the candidate region;
and judging whether the adjacent regions meeting the merging condition exist in the candidate region set, if so, merging the adjacent regions meeting the merging condition and updating the candidate region set.
After the similarity set is obtained, two adjacent regions corresponding to the maximum similarity value are found out from the similarity set and are combined to obtain a combined candidate region and a candidate region set comprising the candidate region and the region which is not combined; then deleting the similarity value from the similarity set, recalculating the similarity value in the candidate region set including the candidate region, judging whether the similarity value has a maximum value, and if so, merging the corresponding adjacent regions and updating the candidate region set; and then repeating the steps until the similarity maximum value does not exist in the similarity set, and at the moment, no region which can be merged exists, namely, the region merging is completed. According to the embodiment of the invention, the regions are merged according to the similarity values of the adjacent regions, so that the problems of unstable clustering result and reduced accuracy are solved, the regions which are not uniformly distributed in size in the original rough segmentation result are integrated, and the stability and accuracy of the label segmentation result are improved.
In one implementation, the candidate region set is filtered according to the tag feature information.
In the embodiment of the invention, on the basis of completing background and label segmentation, labels can be rapidly screened from a candidate area set according to label characteristic information, such as one or more label characteristic information, such as label size, label background color space value and the like; specifically, when the label size is used as the label feature information, the size of the label is positioned according to the need, an acceptable area size threshold is set, then the size of the label is deleted from the candidate area set and does not meet the acceptable area size threshold, the rest area is marked as the real position of the label, and the label positioning in the palm rest area of the notebook computer is completed. The screening method provided by the embodiment of the invention is simple and has high accuracy.
Referring to fig. 2, another embodiment of the present invention provides a data processing apparatus, including:
a rough segmentation module 201, configured to perform preliminary segmentation on the original region image to obtain an original region set;
a similarity calculation module 202, configured to calculate a similarity set corresponding to an adjacent region in the original region set;
the region merging module 203 is configured to merge neighboring regions in the original region set according to the similarity set to obtain a candidate region set;
the screening module 204 is configured to screen the candidate region set to obtain a tag region.
In the embodiment of the present invention, an original region image including a labeled region is roughly segmented by a rough segmentation module 201 to obtain an original region set, and the rough segmentation of a background and a foreground, that is, the background and the label, is realized, wherein the segmentation method may be a K-means algorithm or other methods capable of realizing the same effect. Then, the similarity of each adjacent region in the original region set is calculated by the similarity calculation module 202 to obtain a similarity set, where the similarity of each adjacent region may be specifically calculated by calculating information such as a color space threshold, a region scale, and the like between the regions, and may also be calculated by using other region features. Then, the region merging module 203 merges adjacent regions in the original region set according to the calculated similarity set so as to accurately merge scattered label regions and scattered background regions respectively, and merges scattered label regions into more complete label regions so as to improve the extraction accuracy of the label regions; finally, label area screening is carried out through the screening module 204 on the basis of the candidate area set obtained by combination, and label areas which are accurately segmented can be obtained.
According to the embodiment of the invention, the original region image is firstly segmented to obtain a plurality of relatively fine and scattered original segmented regions to form an original region set, and then the information contained in each region in the original segmented regions is utilized to combine the roughly segmented original regions, so that a more correct image segmentation result is obtained, and the accuracy of the label positioning result is improved.
In one embodiment, the rough segmentation module 201 includes:
the primary clustering unit is used for carrying out primary clustering on the original region images by adopting a K mean value clustering algorithm to obtain a primary clustering result;
and the clustering merging unit is used for merging adjacent pixel points belonging to the same clustering center in the primary clustering result to obtain an original region set.
In the embodiment of the invention, the initial clustering is carried out on the original region images through a K-means algorithm, and the initial K value and the clustering center are selected according to the color rule, so that the certainty and the accuracy of the clustering result are improved. Wherein, the image width is w and the height is h, the cluster number is k, and k cluster center points are Zj(I) (R, G, B), j ═ 1, 2, 3.., k, I, denotes the I-th iteration.
(1) The primary clustering unit may first set the number of clusters k to 27, and select the following pixels of R (red), G (green), and B (blue) pixel values as the primary clustersInitial clustering center point Z1(1)(R,G,B),Z2(1)(R,G,B),Z3(1)(R,G,B),...,Zk(1)(R,G,B):
(0,0,0),(0,0,128),(0,0,255),
(0,128,0),(0,128,128),(0,128,255),
(0,255,0),(0,255,128),(0,255,255),
(128,0,0),(128,0,128),(128,0,255),
(128,128,0),(128,128,128),(128,128,255),
(128,255,0),(128,255,128),(128,255,255),
(255,0,0),(255,0,128),(255,0,255),
(255,128,0),(255,128,128),(255,128,255),
(255,255,0),(255,255,128),(255,255,255)。
These 27 initial cluster center points are evenly distributed over the original region image pixel RGB values.
(2) Then calculating pixel x of each original region image, such as palm region image of computeri(R, G, B) and initial clustering center Zj(I) Distance of (R, G, B)
Figure BDA0002362540790000121
Wherein,
if it satisfies
D(xi(R,G,B),Zj(I)(R,G,B))=min{D(xi(R,G,B),Zj(I) (R, G, B)), i ═ 1, 2, 3,., mxn }, then pixel point xiBelonging to a cluster center Zj(I)(R,G,B)。
(3) Then according to the cluster center Zj(I) (R, G, B) all PjA pixel point for calculating a clustering criterion function J (I)
Figure BDA0002362540790000131
Wherein x isp(R, G, B) is a group belonging to the clustering center Zj(I) (R, G, B), j ═ 1, 2, 3.
(4) After all the pixel points are reclassified, making I equal to I +1, and according to the fact that the pixel points belong to the clustering center Zj(I) (R, G, B) all PjCalculating new clustering center Z of each pixel pointj(I+1)(R,G,B)
Figure BDA0002362540790000132
Wherein j is 1, 2, 3.
(5) Then judging: if the difference value between J (I +1) and J (I) is less than a given threshold value or the iteration number I is equal to the given threshold value, finishing the algorithm to obtain a primary clustering result; otherwise, returning to the step (2) and continuing to execute until the difference value between J (I +1) and J (I) is less than a given threshold or the iteration number I is equal to the given threshold, and ending the algorithm to obtain a primary clustering result. After the initial clustering result is obtained, the clustering merging unit merges adjacent pixel points which belong to the same clustering center in the result into a region to obtain a rough segmentation region CiI 1, 2, 3., q, q denote the number of roughly divided regions, and roughly divided region C is divided intoiAdd to the original region set.
In one embodiment, the similarity calculation module 202 includes:
and the similarity operator unit is used for calculating the similarity set according to one or more information of color histograms, color moments, sizes and overlapping proportions of adjacent regions in the original region set.
According to the embodiment of the invention, the similarity calculation operator unit calculates one or more information of the similarity and the overlapping degree of the color histogram, the color moment, the size of each two adjacent rough segmentation regions to calculate the similarity, and obtains the similarity set, so that the region characteristic information in the original region set is fully utilized, thereby overcoming the uncertainty of the clustering result caused by the randomness of the initial k value and the clustering center, being difficult to realize the image segmentation of all kinds of labels, and being incapable of ensuring the reliability of the segmentation result every time.
Specifically, when calculating the similarity of the color histogram, the region C is roughly dividediConverting into HSV color space, dividing H, S, V color channel into 20 small intervals, counting the number of pixels with color falling in 20 small intervals to obtain H, S, V color histogram, normalizing with L1 norm, and combining to obtain a 60-dimensional vector vi,histAs a region CiThe color histogram feature vector of (1). Calculating an adjacent area CiAnd CjColor histogram similarity of Scolor_hist(Ci,Cj)
Figure BDA0002362540790000141
Wherein,
Figure BDA0002362540790000142
indicates the ith area CiIs calculated from the k-th dimension value of the color histogram feature vector.
When calculating the color moment similarity, the coarse segmentation region C is subjected toiThe color moments of the RGB color space are calculated.
First order color moment mut,μtThe average value of all pixels on the t-th color channel is represented, and the brightness of the image is reflected:
Figure BDA0002362540790000143
second order color moment sigmat,σtRepresents the variance of all pixels on the t-th color channel, reflecting the image color distribution range:
Figure BDA0002362540790000144
third order moment of color st,stRepresents the slope of all pixels on the t-th color channel, reflecting the image color distribution symmetry:
Figure BDA0002362540790000145
wherein N represents the roughly divided region C in the original region setiTotal number of pixels, pt,kIndicating that the t-th color channel is at the k-th pixel value.
Roughly dividing the region C in the original region setiColor moment mu of image R channelR,σG,sGColor moments of R channels, the color moments of R channels being combined into a vector vi,moment=[μR,σG,sG,μG,σG,sG,μR,σB,sB]As a region CiThe color moment feature vector of (1). Calculating an adjacent area CiAnd CjColor moment similarity of (S)color_moment(Ci,Cj)
Figure BDA0002362540790000151
Wherein,
Figure BDA0002362540790000152
indicates the ith area CiIs calculated from the k-th dimension value of the color histogram feature vector.
When calculating the size similarity, according to the neighboring region CiAnd CjTo calculate the neighboring area CiAnd CjSize similarity of (S)size(Ci,Cj)
Figure BDA0002362540790000153
Wherein, size (C)i) Represents a region CiThe size (im) represents the area of the palm rest region.
When calculating the degree of overlap, the adjacent region C is constructed firstiAnd CjCircumscribed rectangle BB ofijCalculating the neighboring area CiAnd CjDegree of overlap of:
Figure BDA0002362540790000154
Fusing the results of the four similarity measurements between the regions by adopting a linear combination mode, and calculating an adjacent region CiAnd CjSimilarity of (C)i,Cj):
S(Ci,Cj)=α1Scolor_hist(Ci,Cj)+α2Scolor_moment(Ci,Cj)+α3Ssize(Ci,Cj)
4fill(Ci,Cj)
When S (C)i,Cj) The more toward 0, the region CiAnd CjThe similarity is maximal.
The embodiment of the invention fully combines the image characteristics, not only adopts the image pixel value, but also integrates the characteristics of image color distribution, size, overlapping information and the like, solves the problem of instability of a k-means method, and effectively improves the accuracy of label positioning.
In one embodiment, the region merging module 203 comprises:
the region merging unit is used for merging two adjacent regions with the maximum similarity in the original region set according to the similarity set to obtain a candidate region and a candidate region set comprising the candidate region;
and the region judgment unit is used for judging whether the adjacent regions meeting the merging condition exist in the candidate region set or not, and if so, merging the adjacent regions meeting the merging condition and updating the candidate region set.
After the similarity set is obtained, the region merging unit finds out two adjacent regions corresponding to the maximum similarity value from the similarity set, and merges the two adjacent regions to obtain a merged candidate region and a candidate region set comprising the candidate region and the region which is not merged; then deleting the similarity value from the similarity set, recalculating the similarity value in the candidate region set including the candidate region, judging whether the maximum similarity value exists in the candidate region set by the region judgment unit, and if so, merging the corresponding adjacent regions and updating the candidate region set; and then repeating the steps until the similarity maximum value does not exist in the similarity set, and at the moment, no region which can be merged exists, namely, the region merging is completed. According to the embodiment of the invention, the regions are merged according to the similarity values of the adjacent regions, so that the problems of unstable clustering result and reduced accuracy are solved, the regions which are not uniformly distributed in size in the original rough segmentation result are integrated, and the stability and accuracy of the label segmentation result are improved.
In one implementation, the candidate region set is filtered according to the tag feature information.
In the embodiment of the invention, on the basis of completing background and label segmentation, labels can be rapidly screened from a candidate area set according to label characteristic information, such as one or more label characteristic information, such as label size, label background color space value and the like; specifically, when the label size is used as the label feature information, the size of the label is positioned according to the need, an acceptable area size threshold is set, then the size of the label is deleted from the candidate area set and does not meet the acceptable area size threshold, the rest area is marked as the real position of the label, and the label positioning in the palm rest area of the notebook computer is completed. The screening method provided by the embodiment of the invention is simple and has high accuracy.
Another aspect of the embodiments of the present invention provides a computer-readable storage medium, in which computer-executable instructions are stored, and when the instructions are executed, the computer-readable storage medium is used for executing the data processing method of any one of the above.
Another aspect of the embodiments of the present invention provides an electronic device, which includes a memory and a processor, where the memory stores computer program instructions, and the instructions are loaded and executed by the processor to implement the data processing method in any one of the above.
Here, it should be noted that: the above two embodiments are similar to the above description of the method embodiments, and have similar advantages to the method embodiments, and for technical details not disclosed in the embodiments of the present invention, please refer to the description of the method embodiments of the present invention for understanding, so that details are not repeated.
In the embodiment of the present invention, the implementation order among the steps may be replaced without affecting the implementation purpose.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (11)

1. A data processing method, comprising:
performing primary segmentation on an original region image to obtain an original region set;
calculating a similarity set corresponding to adjacent regions in the original region set;
merging adjacent regions in the original region set according to the similarity set to obtain a candidate region set;
and screening the candidate region set to obtain a label region.
2. The method of claim 1, wherein the initially segmenting the original region image to obtain a plurality of original region sets comprises:
carrying out primary clustering on the original region images by adopting a K mean value clustering algorithm to obtain a primary clustering result;
and merging adjacent pixel points belonging to the same clustering center in the primary clustering result to obtain an original region set.
3. The method of claim 1 or 2, wherein the computing the set of similarities corresponding to the neighboring regions in the original region set comprises:
and calculating a similarity set according to one or more information of color histograms, color moments, sizes and overlapping proportions of adjacent regions in the original region set.
4. The method according to claim 1 or 2, wherein the merging the neighboring regions in the original region set according to the similarity set to obtain a candidate region set comprises:
merging two adjacent regions with the maximum similarity in the original region set according to the similarity set to obtain a candidate region and a candidate region set comprising the candidate region;
and judging whether the adjacent regions meeting the merging condition exist in the candidate region set, if so, merging the adjacent regions meeting the merging condition and updating the candidate region set.
5. The method according to claim 1 or 2, wherein the set of candidate regions is filtered according to tag feature information.
6. A data processing apparatus, comprising:
the rough segmentation module is used for carrying out preliminary segmentation on the original region image to obtain an original region set;
the similarity calculation module is used for calculating a similarity set corresponding to adjacent regions in the original region set;
the region merging module is used for merging adjacent regions in the original region set according to the similarity set to obtain a candidate region set;
and the screening module is used for screening the candidate region set to obtain a tag region.
7. The apparatus of claim 6, wherein the coarse segmentation module comprises:
the primary clustering unit is used for carrying out primary clustering on the original region images by adopting a K mean value clustering algorithm to obtain a primary clustering result;
and the clustering and merging unit is used for merging adjacent pixel points belonging to the same clustering center in the primary clustering result to obtain an original region set.
8. The apparatus of claim 6 or 7, wherein the similarity calculation module comprises:
and the similarity operator unit is used for calculating a similarity set according to one or more information of color histograms, color moments, sizes and overlapping proportions of adjacent regions in the original region set.
9. The apparatus of claim 6 or 7, wherein the region merging module comprises:
a region merging unit, configured to merge two neighboring regions with the maximum similarity in the original region set according to the similarity set to obtain a candidate region and a candidate region set including the candidate region;
and the region judgment unit is used for judging whether the adjacent regions meeting the merging condition exist in the candidate region set or not, and if so, merging the adjacent regions meeting the merging condition and updating the candidate region set.
10. A computer-readable storage medium having stored therein computer-executable instructions for performing the data processing method of any one of claims 1-5 when the instructions are executed.
11. An electronic device comprising a memory and a processor, the memory having stored therein computer program instructions that are loaded and executed by the processor to implement the data processing method of any of claims 1-5.
CN202010026160.9A 2020-01-10 2020-01-10 Data processing method and device, computer storage medium and electronic equipment Withdrawn CN111242957A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010026160.9A CN111242957A (en) 2020-01-10 2020-01-10 Data processing method and device, computer storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010026160.9A CN111242957A (en) 2020-01-10 2020-01-10 Data processing method and device, computer storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN111242957A true CN111242957A (en) 2020-06-05

Family

ID=70873097

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010026160.9A Withdrawn CN111242957A (en) 2020-01-10 2020-01-10 Data processing method and device, computer storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN111242957A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111950538A (en) * 2020-06-23 2020-11-17 合肥联宝信息技术有限公司 Label detection method and device and computer readable storage medium
CN111985480A (en) * 2020-06-29 2020-11-24 联宝(合肥)电子科技有限公司 Multi-label detection method and device and storage medium
CN112084433A (en) * 2020-09-14 2020-12-15 周盛 Method for carrying out drought resisting operation of artificially influencing weather according to regional division
CN114463351A (en) * 2022-02-14 2022-05-10 深圳市医未医疗科技有限公司 Brain image data processing method and system

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111950538A (en) * 2020-06-23 2020-11-17 合肥联宝信息技术有限公司 Label detection method and device and computer readable storage medium
CN111950538B (en) * 2020-06-23 2022-02-08 合肥联宝信息技术有限公司 Label detection method and device and computer readable storage medium
CN111985480A (en) * 2020-06-29 2020-11-24 联宝(合肥)电子科技有限公司 Multi-label detection method and device and storage medium
CN111985480B (en) * 2020-06-29 2022-04-15 联宝(合肥)电子科技有限公司 Multi-label detection method and device and storage medium
CN112084433A (en) * 2020-09-14 2020-12-15 周盛 Method for carrying out drought resisting operation of artificially influencing weather according to regional division
CN112084433B (en) * 2020-09-14 2024-04-16 周盛 Method for carrying out weather modification drought-resistant operation according to regional division
CN114463351A (en) * 2022-02-14 2022-05-10 深圳市医未医疗科技有限公司 Brain image data processing method and system
CN114463351B (en) * 2022-02-14 2023-01-31 深圳市医未医疗科技有限公司 Brain image data processing method and system

Similar Documents

Publication Publication Date Title
CN113781402B (en) Method and device for detecting scratch defects on chip surface and computer equipment
CN111242957A (en) Data processing method and device, computer storage medium and electronic equipment
CN109522908B (en) Image Saliency Detection Method Based on Region Label Fusion
US20180357768A1 (en) Automated tattoo recognition techniques
US8086041B2 (en) Pattern evaluation method, pattern matching method and computer readable medium
CN115082419A (en) Blow-molded luggage production defect detection method
US20110158535A1 (en) Image processing apparatus and image processing method
CN114612469B (en) Product defect detection method, device and equipment and readable storage medium
US20090279778A1 (en) Method, a system and a computer program for determining a threshold in an image comprising image values
Sulaiman et al. Denoising-based clustering algorithms for segmentation of low level salt-and-pepper noise-corrupted images
CN107305691A (en) Foreground segmentation method and device based on images match
Galsgaard et al. Circular hough transform and local circularity measure for weight estimation of a graph-cut based wood stack measurement
US20170178341A1 (en) Single Parameter Segmentation of Images
CN117437406A (en) Multi-target detection method and device
CN111325728B (en) Product defect detection method, device, equipment and storage medium
CN108171683B (en) Cell counting method adopting software for automatic identification
CN116580397A (en) Pathological image recognition method, device, equipment and storage medium
CN112037230B (en) A Forest Image Segmentation Method Based on Superpixels and Supermetric Contour Maps
CN113840135B (en) Color cast detection method, device, equipment and storage medium
CN113112471B (en) Target detection method based on RI-HOG characteristics and rapid pyramid
Ma et al. UP-CrackNet: unsupervised pixel-wise road crack detection via adversarial image restoration
Gunawan et al. Fuzzy region merging using fuzzy similarity measurement on image segmentation
Dai et al. Robust and accurate moving shadow detection based on multiple features fusion
CN115797344B (en) Machine room equipment identification management method based on image enhancement
CN111898408A (en) Rapid face recognition method and device

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
WW01 Invention patent application withdrawn after publication

Application publication date: 20200605

WW01 Invention patent application withdrawn after publication