using System;
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Text;


namespace ImageRetrieval
{
    public class MSDCompute
    {
         
        public static void MSD_feature_extract(ref int[, ,] RGB, out double[] hist, int wid, int hei)
        {

            // RGB is the input original image datas in RGB color space

            int CSA = 72;  // the total color quantization  number of HSV color space
            int CSB = 6;   //the quantization number of edge orientation

            //--------------------------------------------
            int Cn1 = 8;   //the quantization number of H 
            int Cn2 = 3;   //the quantization number of S 
            int Cn3 = 3;   //the quantization number of V 

            hist = new double[CSA]; // the features vector of MSD 

            int[,] ori = new int[wid, hei];  // the orientation image
            int[,] ImageX = new int[wid, hei]; // the color index image

            double[, ,] HSV = new double[3, wid, hei];

            RGB2HSV.mat_color(ref RGB, out HSV, wid, hei); //transform RGB color space to  HSV color space 

            ori_cos.Mat_ori_HSV(ref HSV, out ori, CSB, wid, hei);  // edge orientation detection in HSV color space

            ColorIndex.Mat_color_HSV(ref HSV, out ImageX, Cn1, Cn2, Cn3, wid, hei);  //color quantization in HSV color space 

            int D = 1;

            int[,] micro = new int[wid, hei];  //micro-structure image

            Microstructuredetect.microstructure(ref ori, ref ImageX, out micro, wid, hei);   //micro-structure map extraction

            MSD.microdiscriptor(ref micro, out hist, CSA, wid, hei);    //micro-structure representation


        }

    }

}
