Пример #1
0
        public void SetFormat(int index)
        {
            var selectFormat = camera.VideoFormats[index];

            Format = selectFormat;
            VideoPipe.SetVideoFormat(selectFormat.videoType, selectFormat.width, selectFormat.height);
            cbx_formatList.SelectedIndex = index;
            camera.SetFormat(index);
            camera.Open();

            displayDx11.Visible = VideoPipe.IsGpu;
            displayWF.Visible   = !VideoPipe.IsGpu;
            displayWF.Dock      = DockStyle.Fill;
            displayDx11.Dock    = DockStyle.Fill;
            displayDx11.NativeLoad(VideoPipe, selectFormat);
        }
Пример #2
0
    /// <summary>
    /// 设定摄像机的输出格式
    /// </summary>
    /// <param name="index"></param>
    private void SetFormat(int index)
    {
        selectFormat = oeipCamera.VideoFormats[index];
        //设定处理图像格式,图像宽度,图像长度
        VideoPipe.SetVideoFormat(selectFormat.videoType, selectFormat.width, selectFormat.height);

        oeipCamera.SetFormat(index);
        oeipCamera.Open();

        if (SourceTex == null || SourceTex.width != selectFormat.width || SourceTex.height != selectFormat.height)
        {
            SourceTex = new Texture2D(selectFormat.width, selectFormat.height, TextureFormat.RGBA32, false);
            SourceTex.Apply();
            //Unity 纹理作为输出
            cameraPipe.SetPipeOutputGpuTex(VideoPipe.OutGpuIndex, SourceTex.GetNativeTexturePtr());
        }
    }