示例#1
0
        public WriteableBitmap GetImage(string _strImgName)
        {
            WriteableBitmap bitmap = null;

            switch (m_strCurImgName)
            {
            case ComInfo.IMG_NAME_EDGE_DETECTION:
                EdgeDetection edge = (EdgeDetection)m_imgProc;
                if (edge != null)
                {
                    bitmap = edge.WriteableBitmap;
                }
                break;

            case ComInfo.IMG_NAME_GRAY_SCALE:
                GrayScale gray = (GrayScale)m_imgProc;
                if (gray != null)
                {
                    bitmap = gray.WriteableBitmap;
                }
                break;

            case ComInfo.IMG_NAME_BINARIZATION:
                Binarization binarization = (Binarization)m_imgProc;
                if (binarization != null)
                {
                    bitmap = binarization.WriteableBitmap;
                }
                break;

            case ComInfo.IMG_NAME_GRAY_SCALE_2DIFF:
                GrayScale2Diff gray2Diff = (GrayScale2Diff)m_imgProc;
                if (gray2Diff != null)
                {
                    bitmap = gray2Diff.WriteableBitmap;
                }
                break;

            case ComInfo.IMG_NAME_COLOR_REVERSAL:
                ColorReversal colorReversal = (ColorReversal)m_imgProc;
                if (colorReversal != null)
                {
                    bitmap = colorReversal.WriteableBitmap;
                }
                break;

            case ComInfo.IMG_NAME_GRAY_SCALE_DIFF:
                GrayScaleDiff grayDiff = (GrayScaleDiff)m_imgProc;
                if (grayDiff != null)
                {
                    bitmap = grayDiff.WriteableBitmap;
                }
                break;

            default:
                break;
            }

            return(bitmap);
        }
示例#2
0
        public bool SelectGoImgProc(ComImgInfo _comImgInfo, CancellationToken _token)
        {
            bool bRst = true;

            switch (_comImgInfo.CurImgName)
            {
            case ComInfo.IMG_NAME_EDGE_DETECTION:
                EdgeDetection edge = (EdgeDetection)m_imgProc;
                bRst = edge.GoImgProc(_token);
                break;

            case ComInfo.IMG_NAME_GRAY_SCALE:
                GrayScale gray = (GrayScale)m_imgProc;
                bRst = gray.GoImgProc(_token);
                break;

            case ComInfo.IMG_NAME_BINARIZATION:
                Binarization binarization = (Binarization)m_imgProc;
                binarization.Thresh = _comImgInfo.BinarizationInfo.Thresh;
                bRst = binarization.GoImgProc(_token);
                break;

            case ComInfo.IMG_NAME_GRAY_SCALE_2DIFF:
                GrayScale2Diff gray2Diff = (GrayScale2Diff)m_imgProc;
                bRst = gray2Diff.GoImgProc(_token);
                break;

            case ComInfo.IMG_NAME_COLOR_REVERSAL:
                ColorReversal colorReversal = (ColorReversal)m_imgProc;
                bRst = colorReversal.GoImgProc(_token);
                break;

            case ComInfo.IMG_NAME_GRAY_SCALE_DIFF:
                GrayScaleDiff grayDiff = (GrayScaleDiff)m_imgProc;
                bRst = grayDiff.GoImgProc(_token);
                break;

            default:
                break;
            }

            return(bRst);
        }