Пример #1
0
        public CompareSearchViewModel()
        {
            m_SearchPara.SearchType = SearchType.Compare;
            m_Pattern             = CompareSearchPattern.Blob;
            m_SearchPara.SortType = SortType.SimilarityDes;

            m_SearchPara[BOCOM.DataModel.SDKConstant.dwAlgorithmFilterType] = m_Pattern + 1;
            m_SearchPara[BOCOM.DataModel.SDKConstant.dwSearchObjType]       = E_MovingObjectType.All;

            m_SearchPara[BOCOM.DataModel.SDKConstant.dwColorSimilar] = m_colorSimilarity = E_ColorSimilarity.None;
            Framework.Container.Instance.EvtAggregator.GetEvent <SetCompareImageInfoEvent>().Subscribe(OnSetCompareImageInfo);
            Framework.Container.Instance.RegisterEventSubscriber(this);
        }
Пример #2
0
        private static uint GetCompareSimilarity(CompareSearchPattern compareSearchPattern, E_ColorSimilarity colorSimilarity)
        {
            uint nRet = 0;

            //if (compareSearchPattern == CompareSearchPattern.Texture)
            //{
            //    nRet = 800;
            //}
            //else if (compareSearchPattern == CompareSearchPattern.Blob)
            //{
            if (colorSimilarity == E_ColorSimilarity.High)
            {
                nRet = 800;
            }
            else if (colorSimilarity == E_ColorSimilarity.Middle)
            {
                nRet = 500;
            }
            else if (colorSimilarity == E_ColorSimilarity.Low)
            {
                nRet = 200;
            }
            else
            {
                nRet = 1;
            }
            // }
            // 临时调试用
            // nRet = 0;
            return(nRet);
        }
Пример #3
0
        private static uint GetColorSimilarity(Color color, E_ColorSimilarity similarity)
        {
            uint nRet = 0;

            double defaultRate = 0.8d;

            switch ((uint)color.ToArgb())
            {
            // Color.White
            case 0xFFFFFFFF: defaultRate = 0.5d;
                break;

            // Color.Silver
            case 0xFFC0C0C0: defaultRate = 0.8d;
                break;

            // Color.Black
            case 0xFF000000: defaultRate = 0.93d;
                break;

            // Color.Red
            case 0xFFFF0000: defaultRate = 0.8d;
                break;

            // Color.Puple
            case 0xFF800080: defaultRate = 0.8d;
                break;

            // Color.Blue
            case 0xFF0000FF: defaultRate = 0.7d;
                break;

            case 0xFFFFFF00: defaultRate = 0.77d;
                break;

            // Color.Green
            case 0xFF008000: defaultRate = 0.75d;
                break;

            // Color.Gray
            case 0xFF808080: defaultRate = 0.8d;
                break;

            // Color.Bule
            case 0xFFFFC0CB: defaultRate = 0.71d;
                break;

            default: defaultRate = 0.8d;
                break;
            }
            double retVal = 0;

            switch (similarity)
            {
            case E_ColorSimilarity.High:
                retVal = 0.6;     //defaultRate + 0.05;
                break;

            case E_ColorSimilarity.Middle:
                retVal = 0.5;     // defaultRate;
                break;

            case E_ColorSimilarity.Low:
                retVal = 0.1;     // defaultRate - 0.05;
                break;

            case E_ColorSimilarity.None:
                retVal = 0.001;
                break;

            default:
                retVal = 0.8d;
                break;
            }
            nRet = (uint)(retVal * 1000);
            return(nRet);
        }