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

namespace ImageRetrieval
{
    public class Microstructuredetect
    {
        public static void microstructure(ref int[,] ori, ref int[,] ImageX, out int[,] micro, int wid, int hei)
        {
            int[,] ColorA = new int[wid, hei];
            int[,] ColorB = new int[wid, hei];
            int[,] ColorC = new int[wid, hei];
            int[,] ColorD = new int[wid, hei];

            structureMap.Map(ref ori, ref ImageX, out ColorA, wid, hei, 0, 0);
            structureMap.Map(ref ori, ref ImageX, out ColorB, wid, hei, 0, 1);
            structureMap.Map(ref ori, ref ImageX, out ColorC, wid, hei, 1, 0);
            structureMap.Map(ref ori, ref ImageX, out ColorD, wid, hei, 1, 1);

            //=========the final micro-structure map===============
            micro = new int[wid, hei];

            for (int i = 0; i < wid; i++)
            {

                for (int j = 0; j < hei; j++)
                {

                    micro[i, j] = Math.Max(ColorA[i, j], Math.Max(ColorB[i, j], Math.Max(ColorC[i, j], ColorD[i, j])));
                }
            }

            //============================================
        }
    }
}
