Ejemplo n.º 1
0
        /* Zoom
         * 1. 이벤트로 받은 포인트를 가져온다.
         * 2. 포인트를 정렬한다.
         * 3. ZoomData에 방금 구한 데이터들을 넣는다.
         * 4. 이제 위에서 구한 데이터로 매트릭스 리스트를 만든다.
         *
         */
        public async Task <BitmapSource> StartZoom(System.Windows.Point startPoint, System.Windows.Point endPoint)
        {
            if (ImgPathBox == null)
            {
                return(null);
            }
            else
            {
                try
                {
                    System.Windows.Point realstart = new System.Windows.Point();
                    System.Windows.Point realend   = new System.Windows.Point();
                    ZomClass.CalcRealWH(scalData.OriginalScale, ConData, startPoint, endPoint, out realstart, out realend); // 실제 이미지의 픽셀위치로 변환
                    ZomData = ZomClass.SetStartEndPoint(realstart, realend, ImgInfo.W, ImgInfo.H);                          // ZoomData 세팅
                    List <List <byte[, ]> > splitedmat = await asyList2ScaledmatList(ImgPathBox, ZomData);

                    Stm = new StitchMatrix();
                    byte[,] stitchedArr = Stm.StitchArr(splitedmat);
                    BitmapSource output = await Task.Run(() => CreateBitmapSourceClass.CreateBitmapSource(stitchedArr));

                    ZoomGray = output;
                    await Task.Run(() => ZoomRain = Arr2Source( stitchedArr, ColorCovMode.Rainbow ));

                    await Task.Run(() => ZoomHsv = Arr2Source( stitchedArr, ColorCovMode.HSV ));

                    return(output);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                    return(null);
                }
            }
        }
Ejemplo n.º 2
0
        BitmapSource Arr2Source(byte[,] input, ColorCovMode colomod)
        {
            ColorConvertMethod cv = new ColorConvertMethod();

            byte[]       flatMatrix = input.Flatten <byte>();
            Color[]      rainbowArr = cv.ConvertColor(colomod)(flatMatrix);
            ArrayToImage convertor  = new ArrayToImage(input.GetLength(1), input.GetLength(0));

            System.Drawing.Bitmap imgbit = new System.Drawing.Bitmap(input.GetLength(1), input.GetLength(0));
            convertor.Convert(rainbowArr, out imgbit);
            return(CreateBitmapSourceClass.ToWpfBitmap(imgbit));
        }
Ejemplo n.º 3
0
        BitmapSource CreateColoredImgVector(byte [] byteMatrix, int width, int height, ColorCovMode colormod)
        {
            ColorConvertMethod cv = new ColorConvertMethod();

            byte[]       flatMatrix = byteMatrix;
            Color[]      colorArr   = cv.ConvertColor(colormod)(flatMatrix);
            ArrayToImage convertor  = new ArrayToImage(width, height);

            System.Drawing.Bitmap imgbit = new System.Drawing.Bitmap(width, height);
            convertor.Convert(colorArr, out imgbit);
            return(CreateBitmapSourceClass.ToWpfBitmap(imgbit));
        }