/// <summary> /// 画像処理のオブジェクトからイメージの取得 /// </summary> /// <param name="_strImgName">画像処理の名称</param> /// <returns>Writeableなビットマップ</returns> public WriteableBitmap GetImage(string _strImgName) { WriteableBitmap bitmap = null; switch (_strImgName) { 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; default: break; } return(bitmap); }
/// <summary> /// 対象の画像処理オブジェクトを実行する /// </summary> /// <param name="_comImgInfo">画像処理の設定</param> /// <param name="_token">キャンセルトークン</param> /// <returns>画像処理の実行結果 成功/失敗</returns> 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; default: break; } return(bRst); }