public bool StartRecord1(CameraEquipment camera, IntPtr hWnd, String filePath, out string errMsg) { errMsg = ""; //1、SDK初始化 CameraClient.Init(); if (cameraClient == null || cameraClient.lLogin < 0) { //2、登录网络设备 cameraClient = new CameraClient(); int error = cameraClient.Login(camera.IP, ushort.Parse(camera.Port.ToString()), camera.UserName, camera.PassWord, 0, ""); if (error > 0) { errMsg = "登录失败"; } } if (cameraClient.lLogin > 0)//登录成功 { //FileHelper.CreateDirByFile(filePath); //3、启动实时监视或多画面预览(参数如何填写) myPlayHandle = cameraClient.RealPlay(1, hWnd, 0, 0); if (myPlayHandle >= 0) { videoRecord = cameraClient.StartRecord(myPlayHandle, filePath); } } return(videoRecord); }
public bool Initialize(ParameterBase Parameters) { CameraClient.Init(); this.cameraParameter = Parameters as IPCameraParameter; this.cameraClient = new CameraClient(); int error = this.cameraClient.Login(this.cameraParameter.Address, this.cameraParameter.Port, this.cameraParameter.UserName, this.cameraParameter.Password, this.cameraParameter.DeviceSpecification, this.cameraParameter.DeviceSN); return(error <= 0); }
public Form1() { InitializeComponent(); this.FormClosing += TestGUIForm_FormClosing; cam = new CameraClient("192.168.1.72", 8081, 8082, "MetriCam2.Cameras.Kinect2", "MetriCam2.Cameras.Kinect2"); panel3D = new Metri3D.Metri3DPanel(); panel3D.Dock = DockStyle.Fill; panel1.Controls.Add(panel3D); }
/// <summary> /// 关闭视频 /// </summary> private void closeVideo() { if (!videoRecord && !videoShow && cameraClient != null) { //1、停止实时监控 cameraClient.StopRealPlay(1); //2、退出登录 cameraClient.Logout(); //3、清空SDK CameraClient.Cleanup(); myPlayHandle = -1; } }
public bool Close() { if (!this.isRecording && !this.isPlaying && this.cameraClient != null) { //1、停止实时监控 cameraClient.StopRealPlay(this.cameraParameter.RealPlayChannelID); //2、退出登录 cameraClient.Logout(); //3、清空SDK CameraClient.Cleanup(); this.currentHandle = -1; } return(true); }
/// <summary> /// 开启视频 /// </summary> /// <param name="camera"></param> /// <param name="hWnd"></param> /// <param name="errMsg"></param> private bool openVideo(CameraEquipment camera, IntPtr hWnd, out string errMsg) { errMsg = ""; if (myPlayHandle >= 0) { return(true); } //1、SDK初始化 CameraClient.Init(); if (cameraClient == null || cameraClient.lLogin < 0) { try { //2、登录网络设备 cameraClient = new CameraClient(); int error = cameraClient.Login(camera.IP, ushort.Parse(camera.Port.ToString()), camera.UserName, camera.PassWord, 0, ""); if (error > 0) { errMsg = "登录失败"; } } catch (Exception ex) { errMsg = "登录失败"; } } if (cameraClient.lLogin >= 0)//登录成功 { //3、启动实时监视或多画面预览(参数如何填写) myPlayHandle = cameraClient.RealPlay(1, hWnd, 0, 0); if (myPlayHandle >= 0) { videoShow = true; } else { videoShow = false; } } return(videoShow); }
static async Task <List <Camera> > PopulateCameras(IEnumerable <Camera> cameras) { var resultList = new List <Camera>(); await CameraClient.DeleteAllCameras(); foreach (var camera in cameras) { Console.WriteLine($"Adding MLP {camera.Id}"); DumpItem(camera); try { resultList.Add(await CameraClient.InsertCamera(camera)); } catch { Console.WriteLine($"Add Failed!"); } Console.WriteLine($"Add success!"); Console.WriteLine(); } return(resultList); }
private void backgroundWorkerGetFrames_DoWork(object sender, DoWorkEventArgs e) { while (!backgroundWorkerGetFrames.CancellationPending) { // capture a new frame try { //cam.Invoke("StartStreams", null); cam.Update(); //cam.Invoke("StopStreams", null); } catch (Exception ex) { GC.KeepAlive(ex); cam = new CameraClient("192.168.1.72", 8081, 8082, "MetriCam2.Cameras.Kinect2", "MetriCam2.Cameras.Kinect2"); cam.Connect(); //cam.Invoke("StopStreams", null); } Point3fImage p3Image = null; if (channel3DName == ChannelNames.Point3DImage) { Point3fCameraImage image3D = (Point3fCameraImage)cam.CalcChannel(ChannelNames.Point3DImage); p3Image = new Point3fImage(ref image3D); } else if (channel3DName == ChannelNames.Distance || channel3DName == ChannelNames.ZImage) { FloatCameraImage image3D = (FloatCameraImage)cam.CalcChannel(channel3DName); p3Image = new Point3fImage(new FloatImage(ref image3D), projectiveTransformation, channel3DName == ChannelNames.ZImage); } FloatImage ir = ConvertToFloatImage(cam.CalcChannel(channel2DName).ToFloatCameraImage()); Bitmap bitmap = ir.ToBitmap(); //secondBitmap = zImage.ToBitmap(); // set the picturebox-bitmap in the main thread to avoid concurrency issues (a few helper methods required, easier/nicer solutions welcome). this.InvokeSetBmp(bitmap); MaskImage mask = new MaskImage(p3Image.Width, p3Image.Height); ir = ir.Normalize(); for (int y = 0; y < mask.Height; y++) { for (int x = 0; x < mask.Width; x++) { Point3f p = p3Image[y, x]; if (p.X > -99f && p.X < 99f && p.Y > -99f & p.Y < 99f && p.Z > 0 && p.Z < 99f) { mask[y, x] = 0xff; } } } p3Image.EliminateFlyingPixels(5, 0.005f, 0.2f); p3Image.Mask = mask; TriangleIndexList til = new TriangleIndexList(p3Image, false, true); if (renderTil == null) { renderTil = new Metri3D.Objects.RenderTriangleIndexList(til, Color.White); panel3D.AddRenderObject(renderTil); } else { renderTil.UpdateData(til, Color.White); } panel3D.Invalidate(); } }
// Start is called before the first frame update public void Start() { client = gameObject.GetComponent <CameraClient>(); _frameBreak = new WaitForEndOfFrame(); }