CN113724339A - Color separation method for few-sample ceramic tile based on color space characteristics - Google Patents

Color separation method for few-sample ceramic tile based on color space characteristics Download PDF

Info

Publication number
CN113724339A
CN113724339A CN202110503629.8A CN202110503629A CN113724339A CN 113724339 A CN113724339 A CN 113724339A CN 202110503629 A CN202110503629 A CN 202110503629A CN 113724339 A CN113724339 A CN 113724339A
Authority
CN
China
Prior art keywords
tile
color
image
hsv
feature
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.)
Granted
Application number
CN202110503629.8A
Other languages
Chinese (zh)
Other versions
CN113724339B (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.)
South China University of Technology SCUT
Original Assignee
South China University of Technology SCUT
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 South China University of Technology SCUT filed Critical South China University of Technology SCUT
Priority to CN202110503629.8A priority Critical patent/CN113724339B/en
Publication of CN113724339A publication Critical patent/CN113724339A/en
Application granted granted Critical
Publication of CN113724339B publication Critical patent/CN113724339B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • G06T5/92
    • 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
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/194Segmentation; Edge detection involving foreground-background segmentation
    • 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
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Abstract

The invention belongs to the technical field of image processing and machine learning, and relates to a color separation method for a small-sample ceramic tile based on color space characteristics. The method comprises the following steps: acquiring a first tile image in a preset environment; separating the tile area of the first tile image from the background by using a series of image processing technologies of angular point detection, affine transformation and image segmentation, and converting the separated pure tile area from an RGB color space to an HSV color space; dividing an HSV (hue, saturation, value) pure tile area into cell units, extracting tile color characteristics based on an HSV color space, and obtaining effective color characteristics of the tile through characteristic selection; constructing a data set according to the collected effective color characteristics of the first tile image with the label and the corresponding label, and finishing the training of the tile color separator; and performing color difference and color separation on the second tile image based on the tile color separator. The method solves the problems that the manual ceramic tile color separation difficulty is high, the time and the labor are consumed, and a large amount of data is needed for deep learning model training.

Description

Color separation method for few-sample ceramic tile based on color space characteristics
Technical Field
The invention belongs to the technical field of image processing and machine learning, and relates to a color separation method for a small-sample ceramic tile based on color space characteristics.
Background
In recent years, with the continuous development of the building industry and the vigorous development of the tile industry, a large number of tiles are used for indoor and outdoor decoration, and the requirements of people on the tile production process are increasingly improved. The problem of tile color difference and color separation is one of the important problems in tile production.
Tile color difference generally refers to the difference in color between one tile and another tile, or the difference in color between different portions of the same tile, in the same batch of tiles or different batches of tiles of the same model. If a batch of color-difference ceramic tiles are spliced in a large area, color difference can be generated under uniform illumination, the decoration effect is not influenced by attractiveness, and if a batch of products cannot see obvious color difference under uniform illumination, the products are regarded as colorless. The color difference of the ceramic tile is caused because a large amount of mineral raw materials containing different elements exist in the formula of the ceramic tile, the ceramic tile is formed by firing the mineral raw materials, and the mineral materials can show different colors under different temperatures and environments to form the color difference. Because the raw materials of the ceramic tile can not be kept constant, and the furnace temperature and the like can influence the change of the color environment parameters of the ceramic tile in the firing process, the color difference problem of the ceramic tile can not be eliminated. The existing solution is to separate the color of the produced ceramic tiles according to the degree of color difference after the ceramic tiles are produced in a ceramic tile factory, and the ceramic tiles with small color difference are sold in the same group, so that the problem of color difference of the ceramic tiles is solved.
At present, color difference and color separation of tiles are mainly carried out manually, a ring section for manually distinguishing the color difference is arranged on a production line, and color difference workers use naked eyes to carry out color difference comparison and need to put tiles suspected of having the color difference into a color comparison room with uniform illumination to carry out color comparison judgment with sample tiles. The disadvantage of this is that the manual discrimination of color difference not only consumes a lot of manpower and material resources, but also has a certain time lag. Moreover, human eyes are very easy to fatigue under a highly concentrated working state, and are interfered by a series of different environmental factors such as light, mental states and the like, so that the conditions of low color separation accuracy, large error and the like are easy to occur.
In recent years, machine vision technology and machine learning technology rise, under a stable preset collection environment, a camera can ensure that images with stable light are collected, the classification performance of a machine learning classification algorithm is superior on the premise of ensuring the quality of a data set, and development of the two technologies makes it possible to use the machine vision combined machine learning technology to replace artificial naked eyes to carry out tile color difference and color separation.
However, deep learning requires a large amount of data to train the model, but the change of the ceramic tile pattern and the actual production cannot collect a large amount of data, which is very disadvantageous for building the deep learning model, and the traditional machine learning model can better complete classification tasks only on the premise of good feature selection. And, on-line learning of models is required according to the currently produced tiles. However, a large amount of tile data cannot be collected in the actual production process, and the method is only suitable for collecting a small amount of first tile image samples for model construction. At present, it is urgently needed to select a suitable image feature and a classifier to perform model learning and training so as to accurately and efficiently complete the color separation task of tile color difference.
Disclosure of Invention
In order to overcome the defects of color difference and color separation of the existing ceramic tiles, the invention provides a color separation method of a ceramic tile with less samples based on color space characteristics.
The invention is realized by adopting the following technical scheme:
a few-sample tile color separation method based on color space features comprises the following steps:
acquiring a first tile image in a preset environment;
separating the tile area of the first tile image from the background by using a series of image processing technologies of angular point detection, affine transformation and image segmentation, and converting the separated pure tile area from an RGB color space to an HSV color space;
dividing an HSV (hue, saturation, value) pure tile area into cell units, extracting tile color characteristics based on an HSV color space, and obtaining effective color characteristics of the tile through characteristic selection;
constructing a data set according to the collected effective color characteristics of the first tile image with the label and the corresponding label, and finishing the training of the tile color separator;
and performing color difference and color separation on the second tile image based on the tile color separator.
Preferably, the preset environment is an environment with uniform illumination and capable of effectively reflecting the real color of the ceramic tile.
Preferably, the process of separating the tile region of the first tile image from the background comprises: and carrying out tile corner detection on the first tile image, carrying out affine transformation on the four detected corners to segment a pure tile area, and then converting the pure tile area from an RGB color space to an HSV color space.
Preferably, the corner detection and affine transformation comprises:
and detecting the corner points, namely detecting the tile corner points by using the fact that when the corner points of the detection window move, the gray scales of the corner point positions change in two edge directions forming the corner points.
Affine transformation, in order to unify the areas of all the tiles into m × n size and correct the rotation angle generated when the tiles are placed, is performed on the tile areas according to the four corner points of the tiles.
Preferably, the effective color feature extraction of the tile comprises:
firstly, dividing an HSV (hue, saturation, value) pure ceramic tile area into m small cell units for feature extraction;
then, respectively carrying out histogram statistics on H, S, V three channels of each cell unit, and taking the statistical histogram data as a preliminary feature;
then, performing feature dimensionality reduction on the preliminary features by a principal component analysis method to obtain features corresponding to each cell unit;
and finally, integrating the characteristics corresponding to the cell units to obtain the final characteristics containing the effective color information of the ceramic tile.
Preferably, the effective color feature extraction of the tile comprises:
dividing an HSV (hue, saturation, value) pure tile area image with the whole size of a, b into m and m2A single cell unit;
secondly, histogram statistics is carried out on H, S, V three channels of each cell unit, vectors with the size of 1 x 180 can be obtained for the H channel, and the vectors are normalized to vectors f with the size of 1 x 255HFor the S channel, a vector f of 1 x 255 is obtainedSFor the V channel, a vector f of 1 x 255 is obtainedVBy integration, a cell unit of size 3 x 255 can be characterized;
integrating the corresponding characteristics of each cell unit to obtain the initial characteristics of the whole image
Figure BDA0003057406580000031
Fourthly, the pair size is (3 x m)2) 255 preliminary feature vector FTAnd reducing the dimension of the characteristic by using a principal component analysis method.
Preferably, the principal component analysis method will be (3 m)2) 255 dimensional feature vector FTMapping to another vector space and constructing another group of k-dimensional feature vectors; the method comprises the following steps:
finding FTThe mean vector and the covariance matrix D, and the eigenvalue X and the eigenvector V corresponding to each eigenvalue are obtained according to the covariance matrix DxArranging the eigenvalues in the order from big to small, selecting the eigenvectors corresponding to the first k eigenvalues as column vectors to form an eigenvector matrix Vk. By eigenvector matrix VkProjection results in (3 × m)2) Characteristic vector of k
Figure BDA0003057406580000041
As a final feature containing valid color information for the tile.
Preferably, the tile color separator is an SVM classifier model obtained through low-sample training, and the low-sample training is performed on the color separator after the first tile image of the same production batch is labeled.
Preferably, the step of training the tile colour splitter comprises: determining the classification number n according to the color number types of the ceramic tiles to be classified, and finishing the training of the ceramic tile color separator by using a first ceramic tile image: firstly, the (3 m) obtained by the tile characteristic extraction2) Processing the k dimensional features to obtain 1 x (3 m)2K), constructing a data set according to the first tile image with the label, adding a column of vectors after the one-dimensional feature as the label to obtain 1 x (3 x m) for training the tile color separator2K +1) dimension carries the characteristics of the tagged information.
Training of the SVM classifier model is converted into solving an optimization problem with constraints:
for the data training set T { (x)1,y1),(x2,y2),…(xi,yi)…,(xq,yq) }, wherein: x is the number ofiAs a color feature, yiIs labeled information, q is the total number of labeled samples, and xi∈Rn,yi∈{+1,-1},i= 1,2,…q,RnRepresenting an n-dimensional real number set. Selecting a proper kernel function form K (x)i,xj) And punishment parameters C, constructing and solving a quadratic programming problem.
Figure BDA0003057406580000042
Figure BDA0003057406580000043
0≤αi≤C,i=1,2,…,q
Wherein: k (x)i,xj) Is composed ofKernel function, αi、αjFor unknown coefficients, α is the solution to the quadratic programming problem.
According to known (x)i,yi),(xj,yj) And a set penalty parameter C, solving the quadratic programming problem to obtain an optimal solution
Figure BDA0003057406580000051
Figure BDA0003057406580000052
To satisfy one solution component of the quadratic programming problem described above, p is the number of solution components.
Selection of alpha*In satisfy
Figure BDA0003057406580000053
A component of
Figure BDA0003057406580000054
Successively calculating parameter b of SVM model*And a classification decision function f (x):
Figure BDA0003057406580000055
Figure BDA0003057406580000056
and finishing the construction of the tile color separator model according to the classification decision function f (x).
Preferably, color separating the second tile image comprises: acquiring a second tile image under a preset condition; carrying out image preprocessing and feature extraction selection on the second tile image to obtain effective color features of the tile; and inputting the effective color characteristics of the ceramic tile into the ceramic tile color separator, and outputting the corresponding ceramic tile color number to finish the color difference and color separation of the second ceramic tile image.
Compared with the prior art, the invention has the following advantages and effects:
(1) the invention applies the image processing technology and the machine learning technology to the actual tile color separation problem, completes the tile area segmentation by using the image processing technology and the machine learning technology, extracts the accurate tile color characteristics based on the HSV color space, and is used for realizing the learning color separation classification of few samples. The invention solves the problems of high difficulty, complex steps, time and labor consumption of manual color separation; the problems that the training instantaneity of the deep learning model is not strong and a large amount of data is needed are solved.
(2) The invention designs a characteristic based on a color space, and the characteristic based on the color space can effectively embody the slight color difference among different color numbers of the ceramic tile through the conversion of the color space and the characteristic design. Based on the color characteristics, the training of the ceramic tile color separator model can be completed by collecting 50-100 first ceramic tile images and extracting the characteristics, a large amount of image data required by the ceramic tile color separator model learning is avoided, the actual production requirement that a large amount of samples are inconvenient to collect only by collecting a small amount of samples in the ceramic tile production process can be met, the training of the ceramic tile color separator can be completed by using few samples, and meanwhile, the manpower and material resources consumed in the ceramic tile production process are greatly reduced.
Drawings
FIG. 1 is an overall flow diagram of tile color difference separation in one embodiment;
FIG. 2 is a flow diagram of an image pre-processing unit in one embodiment;
FIG. 3 is a flow diagram of a feature extraction selection unit in one embodiment;
FIG. 4 is a diagram of specific feature extraction choices in one embodiment;
FIG. 5 is a flow diagram of a second tile image color difference separation in one embodiment.
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 obtained by a person skilled in the art without any inventive step based on the embodiments of the present invention, are within the scope of the present invention.
A few-sample tile color separation method based on color space features, as shown in fig. 1, includes:
s1, image acquisition: and acquiring a first tile image in a preset environment.
And acquiring images by using equipment such as a high-definition camera, a camera and the like in a preset environment to obtain a first tile image containing a front background and a rear background. Wherein: the preset environment refers to an environment with uniform illumination and capable of effectively reflecting the real color of the ceramic tile.
S2, image preprocessing: and separating the tile area of the first tile image from the background by utilizing a series of image processing technologies of corner detection, affine transformation and image segmentation, and converting the separated pure tile image from an RGB color space to an HSV color space.
The image preprocessing refers to completing the segmentation of the tile area and background area of the acquired tile image by an image processing technology and converting the tile image from an RGB color space to an HSV color space.
The input of the image preprocessing is a first tile image acquired under a preset condition, and the output is HSV color space representation of a pure and clean tile image without background. In a preferred embodiment, comprising: and carrying out tile corner detection on the first tile image, carrying out affine transformation on the four detected corners to segment a pure tile area, and then converting the pure tile area from an RGB color space to an HSV color space. The specific process is as follows:
and detecting the corner points, namely detecting the tile corner points by using the fact that when the corner points of the detection window move, the gray scales of the corner point positions change in two edge directions forming the corner points.
For a small amount of movement [ u, v ] of the detection window locally, the gray-scale change E (u, v) can be expressed approximately as:
Figure BDA0003057406580000071
where M is a 2x2 matrix, specifically:
Figure BDA0003057406580000072
wherein: i isx、IyThe derivatives of the image in the x-direction and y-direction respectively,
Figure BDA0003057406580000073
as a function of the moving window.
Calculating the eigenvalue of the M matrix to obtain two eigenvalues lambda1And λ2,λ1、λ2Embodying the gradient change of the pixels in the window. Using the eigenvalues lambda1、λ2The final corner response function R can be obtained:
R=λ1λ2-k(λ12)2
wherein: lambda [ alpha ]1、λ2Two eigenvalues of the M matrix are obtained, k is a set parameter, and k belongs to [0.04,0.06 ]]. And comparing the R value with a set corner threshold value to obtain corresponding corner coordinates.
Affine transformation, in order to unify the areas of all the tiles into m × n size and correct the rotation angle generated when the tiles are placed, is performed on the tile areas according to the four corner points of the tiles. The specific process is as follows:
for four corner points of the tile area obtained by corner point detection, using a known corner point set L { (x)a,ya),(xb,yb),(xc,yc),(xd,yd) Denotes that four corner points to be mapped to corresponding regions are set N { (u) as target corner pointsa,va),(ub,vb),(uc,vc),(ud,vd) Denotes for each set before and after transformation corresponding { (x)i,yi),(ui,vi) The following forms:
Figure BDA0003057406580000081
wherein: matrix array
Figure BDA0003057406580000082
Is the corresponding transformation matrix.
And after solving a transformation matrix according to the known angle point set L and the target angle point set N, carrying out affine transformation on all pixels in the tile area to obtain a new image area as a pure tile area.
HSV color space conversion, converting the clear tile area image from RGB color space to HSV color space, wherein: the H channel represents chroma, the S channel represents saturation, and the V channel represents luma. The coordinates (R, G, B) under the RGB color space represent the corresponding color space, R, G, B ∈ (0,255),
the specific formula for converting from RGB color space to HSV color space is as follows:
V=max(R,G,B)
Figure BDA0003057406580000084
Figure BDA0003057406580000085
the conversion from the RGB color space to the HSV color space is accomplished by the above equation.
S3, feature extraction and selection: the cell units are segmented in the tile region, tile color features are extracted based on HSV color space, and effective color features of the tile are obtained through feature selection.
The feature extraction selection unit selects the main features by utilizing a method for extracting features by dividing a large region into cell units and a principal component analysis method to complete the extraction and selection of the features.
The input of the feature extraction unit is a pure tile image of a lower background in an HSV color space, and the output is a final feature containing effective color information of a tile.
Firstly, dividing the divided HSV pure ceramic tile region into m small cell units for feature extraction by a feature extraction and selection unit; then, respectively carrying out histogram statistics on H, S, V three channels of each cell unit, and taking the statistical histogram data as a preliminary feature; then, performing feature dimensionality reduction on the preliminary features by a principal component analysis method to obtain final features corresponding to each cell unit; and finally integrating each cell unit to obtain the final characteristics containing the effective color information of the ceramic tile.
Dividing cell unit characteristic extraction: respectively counting HSV channel histogram construction regional features for each cell unit, wherein the process comprises the following steps:
firstly, dividing an HSV pure tile area image with the whole size of a, b into m and m2Individual cell unit (requirement)
Figure BDA0003057406580000091
Are all integers); then, histogram statistics were performed on H, S, V three channels of each cell unit, and vectors of 1 × 180 size were obtained for the H channel, and normalized to a vector f of 1 × 255 sizeHFor the S channel, a vector f of 1 x 255 is obtainedSFor the V channel, a vector f of size 1 x 255 is obtainedVBy integration, the characteristics of a cell unit of size 3 x 255 can be obtained
Figure BDA0003057406580000092
Finally, integrating the corresponding characteristics of each cell unit to obtain the initial characteristics of the whole image
Figure BDA0003057406580000094
The size obtained for the above procedure was then (3 × m)2) 255 preliminary feature vector FTAnd reducing the dimension of the features by using a principal component analysis method. Preliminary feature vector FTThere are a large number of repetitive features and principal component analysis methods may be used(3*m2) 255 dimensional feature vector FTMapping to another vector space and constructing another set of k-dimensional feature vectors (k)<(3*m2)*255). First, F is obtainedTThe mean vector and the covariance matrix D, and the eigenvalue X and the eigenvector V corresponding to each eigenvalue are obtained according to the covariance matrix DxArranging the eigenvalues in sequence from big to small, selecting the eigenvectors corresponding to the first k eigenvalues as column vectors to form an eigenvector matrix Vk. (3 m) by eigenvector matrix projection2) Characteristic vector of k
Figure BDA0003057406580000093
As a final characterization representation containing tile effective color information.
And S4, training a tile color separator, and constructing a data set according to the collected characteristics of 50-100 first tile images with labels and the corresponding labels to finish the training of a few-sample classifier.
In a preferred embodiment, the tile color separator is an SVM classifier model obtained by low-sample training, mainly by low-sample training of the color separator after labeling the first 50 first tile images of the same production lot. Specifically, the step of training the tile color separator comprises: and determining the classification number n according to the color number types of the tiles to be classified. Training of the color separator is completed using the first tile image, first for (3 m) m obtained by the feature extraction selection unit2) Processing the k dimensional features to obtain 1 x (3 m)2K), constructing a data set from the first tile image with the label, adding a column of vectors after the feature as the label, and obtaining 1 x (3 x m) for training the tile color separator2K +1) features the tag information.
Training of the SVM classifier model may be converted to solving an optimization problem with constraints.
For the data training set T { (x)1,y1),(x2,y2),…(xi,yi)…,(xq,yq) }, wherein: x is the number ofiAs a color feature, yiIn order to be the tag information,q is the total number of labeled samples, and xi∈Rn,yi∈{+1,-1},i= 1,2,…q,RnRepresenting an n-dimensional real number set. Selecting a proper kernel function form K (x)i,xj) And punishment parameters C, constructing and solving a quadratic programming problem.
Figure BDA0003057406580000101
Figure BDA0003057406580000102
Wherein: k (x)i,xj) Is a kernel function, αi、αjFor unknown coefficients, α is the solution to the quadratic programming problem.
According to known (x)i,yi),(xj,yj) And a set penalty parameter C, solving the quadratic programming problem to obtain an optimal solution
Figure BDA0003057406580000103
Figure BDA0003057406580000104
To satisfy one solution component of the quadratic programming problem described above, p is the number of solution components.
Selection of alpha*In satisfy
Figure BDA0003057406580000105
A component of
Figure BDA0003057406580000106
Successively calculating parameter b of SVM model*And a classification decision function f (x):
Figure BDA0003057406580000107
Figure BDA0003057406580000108
and finishing the construction of the tile color separator model according to the classification decision function f (x).
S5, tile color difference and color separation: and performing color difference and color separation on the second tile image by using a tile feature extraction method and a color separator.
And under the preset condition, acquiring a second tile image, inputting the second tile image into the image preprocessing unit and the feature extraction and selection unit to obtain the features containing the effective information of the tiles, inputting the features into the tile color separator, and outputting the corresponding tile color numbers to complete the color difference and color separation task of the second tile image. The method specifically comprises the following steps:
and S51, acquiring a second tile image under the set environment.
And S52, inputting the second tile image into the image preprocessing and feature extraction unit to obtain the effective color features of the tile.
S53, taking the effective color characteristics of the ceramic tile as the input of the ceramic tile color separator;
and S54, obtaining the output of the tile color separator as the color difference classification result of the second tile image.
Example (b):
a color separation method for a ceramic tile with few samples based on color space characteristics mainly relates to the following technologies: 1) Preprocessing a tile image: separating a tile region of the first tile image from a background region and converting to an HSV color space; 2) feature design extraction selection: extracting statistical characteristics of HSV color space and carrying out dimension reduction processing on the characteristics; 3) designing a color separator: constructing a data set according to the data labels and finishing classifier training; 4) and color separation of a second tile image: and performing characteristic extraction on the second ceramic tile data collected under the preset condition and inputting the second ceramic tile data into the color separator to finish classification.
The embodiment is based on a Pycharm development environment, an OpenCV computer vision library and a scimit-learn machine learning function library: OpenCV covers a large number of image processing-related encapsulation function interfaces, and can complete related image processing tasks. The scimit-leann machine learning function library covers relevant functions of machine learning, and can conveniently and quickly complete tasks such as feature dimension reduction, classifier design training and the like. The Pycharm development environment under the Windows platform is one of the currently preferred development environments for completing image processing and machine learning tasks.
A few-sample tile color separation method based on color space features mainly comprises the following processes: the method comprises a tile image preprocessing stage, a feature extraction and selection stage, a color separator training stage and a real-time tile color separation detection stage.
In the image preprocessing stage: fig. 2 is a flow chart of tile image preprocessing in one embodiment. The method comprises the following specific steps: firstly, preprocessing an existing tile image containing a background, and obtaining a forward tile area image through corner detection and affine transformation; then, the tile area is converted from the RGB color space to the HSV color space to obtain a pure tile image based on the HSV color space.
In the feature extraction and selection stage: FIG. 3 is a general flow diagram of feature selection extraction; fig. 4 is a specific feature extraction flowchart in this embodiment. The method comprises the following specific steps:
firstly, dividing a tile image of an HSV color space into 3 x 3 cell units; histogram statistics and normalization for the H, S, V space of each cell unit then yielded a feature F of 3 x 255n(ii) a The characteristics of the 9 cell units { F }1,F2,F3,…,F9Integration into a preliminary feature F of size 27 x 255; and then, reducing the dimension of the preliminary feature F by using a Principal Component Analysis (PCA), and taking out the k-dimensional features in the front column of the contribution degree to obtain the 27 x k-dimensional features after dimension reduction.
In the design training step of the color separator: fifty images are collected for each color number of the ceramic tile to construct a training set, and the features after dimension reduction are selected and extracted according to image preprocessing and feature extraction. To construct a labeled dataset for color separator training, one-dimensional features need to be labeled. In this embodiment, two color numbers are taken as an example, 100 images of color number 1 and color number 2 are taken, a polynomial kernel function is selected as a kernel function, and the form of the kernel function is as follows:
Figure BDA0003057406580000121
wherein: x is the number ofi、xjIs the input of the kernel function, r is a constant coefficient, and d is the degree of the polynomial kernel function.
And (4) completing design and parameter setting of the SVM classifier by using SVC functions in the scimit-leann machine learning function library.
The specific parameters are as follows:
1) the number n of each color number image is 50, and the pixel size of the preprocessed normalized image is 3000 x 3000.
2) The k characteristic values contributing to the first 98% are selected when the feature dimension of the PCA method is reduced.
3) Penalty parameter C of SVC function: for characterizing the degree of penalty for misclassification, the larger C, the less misclassification allowed. The penalty parameter C is set to 1.
4) Dimension parameter of SVC function, degree: the dimension of the expression polynomial function is set to 3.
5) Kernel function coefficient gamma of the SVC function: is arranged as
Figure BDA0003057406580000131
Depending on the final feature number k.
And (3) a real-time tile color separation detection stage: as shown in fig. 5, first, under a preset condition, a second tile image with uniform illumination is collected, and the second tile image is input into an image preprocessing unit to obtain a pure tile image output based on an HSV color space; then, carrying out feature extraction and selection on the pure tile image to obtain the color features of the output tile; and inputting the color characteristics of the ceramic tile into the color separator to obtain an output color number result as a color number result of the collected second ceramic tile image.
The above embodiments are preferred embodiments of the present invention, but the present invention is not limited to the above embodiments, and any other changes, modifications, substitutions, combinations, and simplifications which do not depart from the spirit and principle of the present invention should be construed as equivalents thereof, and all such changes, modifications, substitutions, combinations, and simplifications are intended to be included in the scope of the present invention.

Claims (10)

1. A few-sample tile color separation method based on color space features is characterized by comprising the following steps:
acquiring a first tile image in a preset environment;
separating the tile area of the first tile image from the background by using a series of image processing technologies of angular point detection, affine transformation and image segmentation, and converting the separated pure tile area from an RGB color space to an HSV color space;
dividing an HSV (hue, saturation, value) pure tile area into cell units, extracting tile color characteristics based on an HSV color space, and obtaining effective color characteristics of the tile through characteristic selection;
constructing a data set according to the collected effective color characteristics of the first tile image with the label and the corresponding label, and finishing the training of the tile color separator;
and performing color difference and color separation on the second tile image based on the tile color separator.
2. The method according to claim 1, wherein the predetermined environment is an environment with uniform illumination and capable of effectively reflecting the real color of the tile.
3. The sample tile color separation method of claim 1, wherein separating the tile region of the first tile image from the background comprises: and carrying out tile corner detection on the first tile image, carrying out affine transformation on the four detected corners to segment a pure tile area, and then converting the pure tile area from an RGB color space to an HSV color space.
4. The sample tile color separation method of claim 3, wherein the corner detection and affine transformation comprises:
detecting the corner points, namely detecting the corner points of the ceramic tiles by using the fact that when the corner points of the detection window move, the gray scales of the positions of the corner points change in the two edge directions forming the corner points;
affine transformation, in order to unify the areas of all the tiles into m × n size and correct the rotation angle generated when the tiles are placed, is performed on the tile areas according to the four corner points of the tiles.
5. The sample tile color separation method of claim 1, wherein the effective color feature extraction of the tile comprises:
firstly, dividing an HSV (hue, saturation, value) pure ceramic tile area into m small cell units for feature extraction;
then, respectively carrying out histogram statistics on H, S, V three channels of each cell unit, and taking the statistical histogram data as a preliminary feature;
then, performing feature dimensionality reduction on the preliminary features by a principal component analysis method to obtain features corresponding to each cell unit;
and finally, integrating the characteristics corresponding to the cell units to obtain the final characteristics containing the effective color information of the ceramic tile.
6. The sample tile color separation method of claim 5, wherein the effective color feature extraction of the tile comprises:
dividing an HSV (hue, saturation, value) pure tile area image with the whole size of a, b into m and m2A single cell unit;
secondly, respectively carrying out histogram statistics on H, S, V channels of each cell unit, obtaining vectors with the size of 1 x 180 for the H channel, and normalizing the vectors to the vectors f with the size of 1 x 255HFor the S channel, a vector f of 1 x 255 is obtainedSFor the V channel, a vector f of 1 x 255 is obtainedVBy integration, a cell unit of size 3 x 255 can be characterized;
integrating the corresponding characteristics of each cell unit to obtain the initial characteristics of the whole image
Figure FDA0003057406570000021
Fourthly, the pair size is (3 x m)2) 255 preliminary feature vector FTAnd reducing the dimension of the features by using a principal component analysis method.
7. The sample tile color separation method of claim 6, wherein the principal component analysis method is (3 x m)2) 255 dimensional feature vector FTMapping to another vector space and constructing another group of k-dimensional feature vectors; the method comprises the following steps:
finding FTThe mean vector and the covariance matrix D, and the eigenvalue X and the eigenvector V corresponding to each eigenvalue are obtained according to the covariance matrix DxArranging the eigenvalues in the order from big to small, selecting the eigenvectors corresponding to the first k eigenvalues as column vectors to form an eigenvector matrix Vk(ii) a By a feature vector matrix VkProjection results in (3 × m)2) Characteristic vector of k
Figure FDA0003057406570000022
As a final feature containing valid color information for the tile.
8. The sample tile color separation method of claim 7, wherein the tile color separator is an SVM classifier model obtained by low sample training by labeling a first tile image of a same production lot.
9. The method of sample tile color separation according to claim 8, wherein the step of training the tile color separator comprises: determining the classification number n according to the color number types of the ceramic tiles to be classified, and finishing the training of the ceramic tile color separator by using a first ceramic tile image: firstly, the (3 m) obtained by the tile characteristic extraction2) Processing the k dimensional features to obtain 1 x (3 m)2K), constructing a data set according to the first tile image with the label, adding a column of vectors after the one-dimensional feature as the label to obtain 1 x (3 x m) for training the tile color separator2K +1) dimensionA characteristic of tagged information;
training of the SVM classifier model is converted into solving an optimization problem with constraints:
for the data training set T { (x)1,y1),(x2,y2),…(xi,yi)…,(xq,yq) }, wherein: x is the number ofiAs a color feature, yiIs labeled information, q is the total number of labeled samples, and xi∈Rn,yi∈{+1,-1},i=1,2,…q,RnRepresenting an n-dimensional real number set; selecting a proper kernel function form K (x)i,xj) And a penalty parameter C, constructing and solving a quadratic programming problem:
Figure FDA0003057406570000031
Figure FDA0003057406570000032
0≤αi≤C,i=1,2,…,q
wherein: k (x)i,xj) Is a kernel function, αi、αjIs an unknown coefficient, and alpha is a solution of a quadratic programming problem;
according to known (x)i,yi),(xj,yj) And a set penalty parameter C, solving the quadratic programming problem to obtain an optimal solution
Figure FDA0003057406570000033
Figure FDA0003057406570000034
In order to satisfy a solution component of the quadratic programming problem, p is the number of the solution components;
selection of alpha*In satisfy
Figure FDA0003057406570000035
A component of
Figure FDA0003057406570000036
Successively calculating parameter b of SVM model*And a classification decision function f (x):
Figure FDA0003057406570000037
Figure FDA0003057406570000041
and finishing the construction of the tile color separator model according to the classification decision function f (x).
10. The sample tile color separation method of claim 1, wherein color difference separating the second tile image comprises: acquiring a second tile image under a preset condition; carrying out image preprocessing and feature extraction selection on the second tile image to obtain effective color features of the tile; and inputting the effective color characteristics of the ceramic tile into the ceramic tile color separator, and outputting the corresponding ceramic tile color number to finish the color difference and color separation of the second ceramic tile image.
CN202110503629.8A 2021-05-10 2021-05-10 Color space feature-based color separation method for tiles with few samples Active CN113724339B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110503629.8A CN113724339B (en) 2021-05-10 2021-05-10 Color space feature-based color separation method for tiles with few samples

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110503629.8A CN113724339B (en) 2021-05-10 2021-05-10 Color space feature-based color separation method for tiles with few samples

Publications (2)

Publication Number Publication Date
CN113724339A true CN113724339A (en) 2021-11-30
CN113724339B CN113724339B (en) 2023-08-18

Family

ID=78672684

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110503629.8A Active CN113724339B (en) 2021-05-10 2021-05-10 Color space feature-based color separation method for tiles with few samples

Country Status (1)

Country Link
CN (1) CN113724339B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114972336A (en) * 2022-07-26 2022-08-30 启东先和丝杠制造有限公司 Color segmentation-based lead screw thread burn detection image enhancement method and system
CN116090163A (en) * 2022-11-14 2023-05-09 深圳大学 Mosaic tile color selection method and related equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110728302A (en) * 2019-09-10 2020-01-24 武汉纺织大学 Method for identifying color textile fabric tissue based on HSV (hue, saturation, value) and Lab (Lab) color spaces
CN111160476A (en) * 2019-12-31 2020-05-15 佛山喀视科技有限公司 Color difference detection model generation method, tile color separation method and device
CN111339974A (en) * 2020-03-03 2020-06-26 景德镇陶瓷大学 Method for identifying modern ceramics and ancient ceramics

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110728302A (en) * 2019-09-10 2020-01-24 武汉纺织大学 Method for identifying color textile fabric tissue based on HSV (hue, saturation, value) and Lab (Lab) color spaces
CN111160476A (en) * 2019-12-31 2020-05-15 佛山喀视科技有限公司 Color difference detection model generation method, tile color separation method and device
CN111339974A (en) * 2020-03-03 2020-06-26 景德镇陶瓷大学 Method for identifying modern ceramics and ancient ceramics

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114972336A (en) * 2022-07-26 2022-08-30 启东先和丝杠制造有限公司 Color segmentation-based lead screw thread burn detection image enhancement method and system
CN116090163A (en) * 2022-11-14 2023-05-09 深圳大学 Mosaic tile color selection method and related equipment
CN116090163B (en) * 2022-11-14 2023-09-22 深圳大学 Mosaic tile color selection method and related equipment

Also Published As

Publication number Publication date
CN113724339B (en) 2023-08-18

Similar Documents

Publication Publication Date Title
US11669971B2 (en) Colony contrast gathering
CN107506703B (en) Pedestrian re-identification method based on unsupervised local metric learning and reordering
CN103518224B (en) Method for analysing microbial growth
CN106295124B (en) The method of a variety of image detecting technique comprehensive analysis gene subgraph likelihood probability amounts
CN110033007B (en) Pedestrian clothing attribute identification method based on depth attitude estimation and multi-feature fusion
CN112288706A (en) Automatic chromosome karyotype analysis and abnormality detection method
CN101833749A (en) Device and method for detecting shadow in image
CN106960182B (en) A kind of pedestrian&#39;s recognition methods again integrated based on multiple features
CN113724339B (en) Color space feature-based color separation method for tiles with few samples
Caetano et al. A probabilistic model for the human skin color
CN106023257A (en) Target tracking method based on rotor UAV platform
CN109598681B (en) No-reference quality evaluation method for image after repairing of symmetrical Thangka
CN109087330A (en) It is a kind of based on by slightly to the moving target detecting method of smart image segmentation
CN104657980A (en) Improved multi-channel image partitioning algorithm based on Meanshift
CN112906550A (en) Static gesture recognition method based on watershed transformation
CN108230313B (en) SAR image target detection method based on component adaptive selection and discrimination model
CN116559111A (en) Sorghum variety identification method based on hyperspectral imaging technology
CN111274964A (en) Detection method for analyzing water surface pollutants based on visual saliency of unmanned aerial vehicle
CN109815957A (en) A kind of character recognition method based on color image under complex background
CN109308464A (en) A kind of rice tassel recognition methods based on digital camera images
CN116665051B (en) Method for rescreening metals in garbage based on RGB image reconstruction hyperspectral image
CN108765426A (en) automatic image segmentation method and device
Istiadi et al. Identification of tempe fermentation maturity using principal component analysis and k-nearest neighbor
CN109816629B (en) Method and device for separating moss based on k-means clustering
Dhanuja et al. Areca nut disease detection using image processing technology

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