public async Task <bool> TaskWorkImageProcessing() { m_tokenSource = new CancellationTokenSource(); CancellationToken token = m_tokenSource.Token; ComImgInfo imgInfo = new ComImgInfo(); ComBinarizationInfo binarizationInfo = new ComBinarizationInfo(); binarizationInfo.Thresh = (byte)sliderThresh.Value; imgInfo.CurImgName = m_strCurImgName; imgInfo.BinarizationInfo = binarizationInfo; bool bRst = await Task.Run(() => SelectGoImgProc(imgInfo, token)); return(bRst); }
public async Task <bool> TaskWorkImageProcessing() { m_tokenSource = new CancellationTokenSource(); CancellationToken token = m_tokenSource.Token; ComImgInfo imgInfo = new ComImgInfo(); BinarizationInfo binarizationInfo = new BinarizationInfo(); binarizationInfo.Thresh = (byte)sliderThresh.Value; imgInfo.CurImgName = ComFunc.GetStringApplicationDataContainer(ComInfo.IMG_TYPE_SELECT_NAME); imgInfo.BinarizationInfo = binarizationInfo; bool bRst = await Task.Run(() => SelectGoImgProc(imgInfo, token)); return(bRst); }
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); }