Exemplo n.º 1
0
        protected CogImage8Grey RotateImage(CogImage8Grey img)
        {
            CogImage8Grey img1 = null;

            switch (ImageAngle)
            {
            case ImageAngle.角度0:
                img1 = img.Copy();
                break;

            case ImageAngle.角度90:
                img1 = img.Copy();    //RotateImage((double)90, "constant");img.
                break;

            case ImageAngle.角度180:
                img1 = img.Copy();    //.RotateImage((double)180, "constant");
                break;

            case ImageAngle.角度270:
                img1 = img.Copy();    //.RotateImage((double)270, "constant");
                break;

            default:
                break;
            }
            return(img1);
        }
Exemplo n.º 2
0
        private void 研究图像缝合ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CogImageFile imagefile_0 = new CogImageFile();

            imagefile_0.Open(Application.StartupPath + "/../../../street/street_0.bmp", CogImageFileModeConstants.Read);
            CogImage24PlanarColor image_24_0 = new CogImage24PlanarColor();

            image_24_0 = (CogImage24PlanarColor)imagefile_0[0];
            CogImage8Grey imageGray8_0 = CogImageConvert.GetIntensityImage(image_24_0, 0, 0, image_24_0.Width, image_24_0.Height);


            CogImageFile imagefile_1 = new CogImageFile();

            imagefile_1.Open(Application.StartupPath + "/../../../street/street_1.bmp", CogImageFileModeConstants.Read);
            CogImage24PlanarColor image_24_1 = new CogImage24PlanarColor();

            image_24_1 = (CogImage24PlanarColor)imagefile_1[0];
            CogImage8Grey imageGray8_1 = CogImageConvert.GetIntensityImage(image_24_1, 0, 0, image_24_1.Width, image_24_1.Height);


            CogImageFile imagefile_2 = new CogImageFile();

            imagefile_2.Open(Application.StartupPath + "/../../../street/street_2.bmp", CogImageFileModeConstants.Read);
            CogImage24PlanarColor image_24_2 = new CogImage24PlanarColor();

            image_24_2 = (CogImage24PlanarColor)imagefile_2[0];
            CogImage8Grey imageGray8_2 = CogImageConvert.GetIntensityImage(image_24_2, 0, 0, image_24_2.Width, image_24_2.Height);


            // 灰度图像
            //CogImage8Grey image8 = (CogImage8Grey)m_tb.GetScriptTerminalData("imageInput");
            CogImage8Grey image8 = (CogImage8Grey)m_tb.GetScriptTerminalData("OutputImage");

            image8 = imageGray8_0.Copy();
            CogToolCollection tbTc = m_tb.Tools;

            //tbTc.
            if (false)
            {
                image8 = (CogImage8Grey)((CogImageFileTool)tbTc["CogImageFileTool1"]).OutputImage;
            }



            CogImage8Grey image_002 = new CogImage8Grey();

            //image_002 = image8;
            image_002 = image8.Copy();
            CogImage8Grey image_003 = image8.Copy();



            // 将各个图像进行缝合组成一个完整的大图
            // 灰度图像
            //CogIPOneImageTool imageCtrl_02 = (CogIPOneImageTool)mToolBlock.Tools["CogIPOneImageTool2"];
            CogRectangle rt = new CogRectangle();

            rt.SetCenterWidthHeight(0, 0, image8.Width * 3, image8.Height * 3);
            CogImage8Grey m_gray = rt.CreateRLE(128, 0).CreateImage8Grey();
            //imageCtrl_02.InputImage = m_gray;



            //    CogImage8Grey inputImage = ( CogImage8Grey ) image8;
            //    tb.SetScriptTerminalData("Input", inputImage);
            CogImageStitch       stt = new CogImageStitch();
            CogTransform2DLinear rootFromBlending = new CogTransform2DLinear();

            //缩放,旋转,平移
            rootFromBlending.SetScalingsRotationsTranslation(1, 1, 0, 0, 0, 0);
            //    rootFromBlending.SetScalingsRotationTranslation();
            stt.AllocateBlendingBuffer(image8.Width * 3, image8.Height * 3, rootFromBlending);
            //stt.BlendImageIntoBuffer(image8, m_gray);
            stt.BlendImageIntoBuffer(imageGray8_0, imageGray8_0, m_gray, 0, 0);
            stt.BlendImageIntoBuffer(imageGray8_1, imageGray8_1, m_gray, image8.Width, image8.Height);
            stt.BlendImageIntoBuffer(imageGray8_2, imageGray8_2, m_gray, image8.Width * 2, image8.Height * 2);



            stt.FillDestinationImageFromBuffer(m_gray);
            //    BlendImageIntoBuffer(  CogImage8Grey, CogImage8Grey, CogImage8Grey, Int32, Int32 )


            //
            CogCopyRegionTool ccft = new CogCopyRegionTool();


            //switch (  true )
            //{
            //case :
            //    break;
            //}


            cogRecordDisplay1.Image = m_gray;
            cogRecordDisplay1.Fit();
        }