private void RunOffline(int x) { UiMainForm.LogMessage(string.Format("Ccd{0}开始离线运行", CcdId)); string vppHome = Path.GetDirectoryName(VppFileName); DirectoryInfo diImage = new DirectoryInfo(Path.Combine(vppHome, "image")); if (!diImage.Exists) { diImage.Create(); } int imageCount = 1; var toolBlock = MyCogToolBlock; VisionRoi roi = new VisionRoi(CcdId); int offlineImageCycle = x; if (offlineImageCycle == 0) { CogIPOneImageTool[] myCogIPOneImageTools = toolBlock.Tools.OfType <CogIPOneImageTool>().ToArray(); for (int i = 0; i < imageCount; i++) { CogImage8Grey inputImage = myCogIPOneImageTools[i].OutputImage as CogImage8Grey; var outputImage = roi.Trim(inputImage); CcdTerminalIn vtIn = new CcdTerminalIn(CcdId, outputImage, i); VtInBlock.Post(vtIn); } return; } else { for (int i = 0; i < imageCount; i++) { var imageName = string.Format("{0}-{1}-{2}.bmp", CcdId, offlineImageCycle, i + 1).Trim('-'); var imageFile = Path.Combine(diImage.FullName, imageName); if (File.Exists(imageFile)) { Bitmap bmpFile = new Bitmap(imageFile); CogImage8Grey inputImage = new CogImage8Grey(bmpFile); var outputImage = roi.Trim(inputImage); CcdTerminalIn vtIn = new CcdTerminalIn(CcdId, outputImage, i); VtInBlock.Post(vtIn); } } } }
public void Aquire(double exposure = 35) { int trigNum = 0; try { MyAcqFifo = MyCogAcqFifos[CameraIndex]; MyAcqFifo.OwnedExposureParams.Exposure = exposure; MyImage = (ICogImage)MyAcqFifo.Acquire(out trigNum); VisionRoi roi = new VisionRoi(CcdId); MyImage = roi.Trim(MyImage as CogImage8Grey); TrigNum = trigNum; } catch { UiMainForm.LogMessage(string.Format("CCD{0}相机未找到!", CcdId)); } }