Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在佳能sdk c中管理移动缩放视图#_C#_.net_Zooming_Canon Sdk - Fatal编程技术网

C# 如何在佳能sdk c中管理移动缩放视图#

C# 如何在佳能sdk c中管理移动缩放视图#,c#,.net,zooming,canon-sdk,C#,.net,Zooming,Canon Sdk,我可以使用codeproject中的这个库来使用canon sdk 除一项要求外,我已完成了所有要求。这是指上/下/左/右移动缩放的实时视图。我可以缩放,但我无法移动它以查看调整手动缩放的正确位置 我已经搜索过了,我来到了动物园,动物园合成,动物园协调。。。但我不知道它们到底是什么以及如何使用它们 任何建议,无论是否使用此库,代码块都会有很大帮助您可以使用属性Evf_ZoomPosition和点结构来设置缩放矩形的位置。请注意,您将此属性设置为摄影机,但可以从实时视图帧中获取/读取所有与实时视

我可以使用codeproject中的这个库来使用canon sdk

除一项要求外,我已完成了所有要求。这是指上/下/左/右移动缩放的实时视图。我可以缩放,但我无法移动它以查看调整手动缩放的正确位置

我已经搜索过了,我来到了动物园,动物园合成,动物园协调。。。但我不知道它们到底是什么以及如何使用它们


任何建议,无论是否使用此库,代码块都会有很大帮助

您可以使用属性Evf_ZoomPosition和点结构来设置缩放矩形的位置。请注意,您将此属性设置为摄影机,但可以从实时视图帧中获取/读取所有与实时视图相关的值

您设置的位置是缩放矩形的左上角,有效值介于
X:0,Y:0

X:CoordinateSystem.Width-ZoomRect.Width
Y:CoordinateSystem.Height-ZoomRect.Height


因为ZoomRect X和Y是相同的值,所以读取ZoomPosition实际上不是必需的。

您可以使用属性Evf_ZoomPosition和点结构来设置缩放矩形的位置。请注意,您将此属性设置为摄影机,但可以从实时视图帧中获取/读取所有与实时视图相关的值

您设置的位置是缩放矩形的左上角,有效值介于
X:0,Y:0

X:CoordinateSystem.Width-ZoomRect.Width
Y:CoordinateSystem.Height-ZoomRect.Height


没有必要读取缩放组合,因为缩放比例X和Y是相同的值。

我终于找到了答案。 我使用了zoomposition来更改缩放矩形。 为了得到缩放矩形的位置和大小,我使用了zoomRect。 我是这样做的

使用此方法可以设置摄影机的缩放位置。我已在库中的camera.cs中定义了此方法

    public void SetZoomPositionSetting(PropertyID propID, Point value, int inParam = 0)
    {
        CheckState();

        int size = Marshal.SizeOf(typeof(Point));
        ErrorCode err = CanonSDK.EdsSetPropertyData(CamRef, propID, inParam, size, value);
    }
   private Rectangle GetEvfZoomRect(IntPtr imgRef)
    {
        Rectangle rect = new Rectangle();

        ErrorCode err = CanonSDK.GetPropertyData(imgRef, PropertyID.Evf_ZoomRect, 0, out rect);
        if (err == ErrorCode.OK)
            return rect;
        else
            return rect = new Rectangle();

    }

    private Size GetEvfCoord_Size(IntPtr imgRef)
    {
        Size size = new Size();

        ErrorCode err = CanonSDK.GetPropertyData(imgRef, PropertyID.Evf_CoordinateSystem, 0, out size);
        if (err == ErrorCode.OK)
            return size;
        else
            return new Size();
    }
我已从代码中的任何位置将此数据发送到该方法,以更改缩放位置

MainCamera.SetZoomPositionSetting(PropertyID.Evf_ZoomPosition, p);
这里的p是EOSDigital.SDK.Point实例

以下是获取zoomCoordinates、zoomRect的方法。我已经在库中的camera.cs中定义了这些方法

    public void SetZoomPositionSetting(PropertyID propID, Point value, int inParam = 0)
    {
        CheckState();

        int size = Marshal.SizeOf(typeof(Point));
        ErrorCode err = CanonSDK.EdsSetPropertyData(CamRef, propID, inParam, size, value);
    }
   private Rectangle GetEvfZoomRect(IntPtr imgRef)
    {
        Rectangle rect = new Rectangle();

        ErrorCode err = CanonSDK.GetPropertyData(imgRef, PropertyID.Evf_ZoomRect, 0, out rect);
        if (err == ErrorCode.OK)
            return rect;
        else
            return rect = new Rectangle();

    }

    private Size GetEvfCoord_Size(IntPtr imgRef)
    {
        Size size = new Size();

        ErrorCode err = CanonSDK.GetPropertyData(imgRef, PropertyID.Evf_CoordinateSystem, 0, out size);
        if (err == ErrorCode.OK)
            return size;
        else
            return new Size();
    }
您需要在camera.cs中的DownloadEvf()方法中调用这些方法。从
canosdk.EdsDownloadEvfImage(CamRef,evfImageRef)

在使用图像数据获取evfImageRef后,可以使用evfImageRef作为imgRef调用get方法。 您可以使用相同的方法获得缩放组合。
别忘了重建图书馆。

我终于找到了答案。 我使用了zoomposition来更改缩放矩形。 为了得到缩放矩形的位置和大小,我使用了zoomRect。 我是这样做的

使用此方法可以设置摄影机的缩放位置。我已在库中的camera.cs中定义了此方法

    public void SetZoomPositionSetting(PropertyID propID, Point value, int inParam = 0)
    {
        CheckState();

        int size = Marshal.SizeOf(typeof(Point));
        ErrorCode err = CanonSDK.EdsSetPropertyData(CamRef, propID, inParam, size, value);
    }
   private Rectangle GetEvfZoomRect(IntPtr imgRef)
    {
        Rectangle rect = new Rectangle();

        ErrorCode err = CanonSDK.GetPropertyData(imgRef, PropertyID.Evf_ZoomRect, 0, out rect);
        if (err == ErrorCode.OK)
            return rect;
        else
            return rect = new Rectangle();

    }

    private Size GetEvfCoord_Size(IntPtr imgRef)
    {
        Size size = new Size();

        ErrorCode err = CanonSDK.GetPropertyData(imgRef, PropertyID.Evf_CoordinateSystem, 0, out size);
        if (err == ErrorCode.OK)
            return size;
        else
            return new Size();
    }
我已从代码中的任何位置将此数据发送到该方法,以更改缩放位置

MainCamera.SetZoomPositionSetting(PropertyID.Evf_ZoomPosition, p);
这里的p是EOSDigital.SDK.Point实例

以下是获取zoomCoordinates、zoomRect的方法。我已经在库中的camera.cs中定义了这些方法

    public void SetZoomPositionSetting(PropertyID propID, Point value, int inParam = 0)
    {
        CheckState();

        int size = Marshal.SizeOf(typeof(Point));
        ErrorCode err = CanonSDK.EdsSetPropertyData(CamRef, propID, inParam, size, value);
    }
   private Rectangle GetEvfZoomRect(IntPtr imgRef)
    {
        Rectangle rect = new Rectangle();

        ErrorCode err = CanonSDK.GetPropertyData(imgRef, PropertyID.Evf_ZoomRect, 0, out rect);
        if (err == ErrorCode.OK)
            return rect;
        else
            return rect = new Rectangle();

    }

    private Size GetEvfCoord_Size(IntPtr imgRef)
    {
        Size size = new Size();

        ErrorCode err = CanonSDK.GetPropertyData(imgRef, PropertyID.Evf_CoordinateSystem, 0, out size);
        if (err == ErrorCode.OK)
            return size;
        else
            return new Size();
    }
您需要在camera.cs中的DownloadEvf()方法中调用这些方法。从
canosdk.EdsDownloadEvfImage(CamRef,evfImageRef)

在使用图像数据获取evfImageRef后,可以使用evfImageRef作为imgRef调用get方法。 您可以使用相同的方法获得缩放组合。 别忘了重建图书馆