Research Article

A Fast SVM-Based Tongue’s Colour Classification Aided by k-Means Clustering Identifiers and Colour Attributes as Computer-Assisted Tool for Tongue Diagnosis

Algorithm 1: Pseudocodes of training input setting in SVM.

width=200; height=200;
DataSet = cell([], 1);
%list and returns a character vector containing the full path to the file
for i=1:length(dir(fullfile(Dataset2,'*.png')))
      % Training set process
      k = dir(fullfile(Dataset2,'*.png'))
%Reading image and its information
      for j=1:length(k)
     tempImage = imread(horzcat(Dataset2,filesep,k{j}))
     imgInfo = imfinfo(horzcat(Dataset2,filesep,k{j}))
     %Image conversion to grayscale and using intensity as classification parameter in SVM
     if strcmp(imgInfo.ColorType,'grayscale')
         DataSet{j} = double(imresize(tempImage,[width height]))
     else
    DataSet{j}= double(imresize(rgb2gray(tempImage),[width height])); %we only use the colour intensity of grayscale picture to classify the images, we did measure the classification using hue (chromatic pixels), but tongue intensity provide better classifications.
Algorithm 1: Pseudocodes of training input setting in SVM.