I am able to use canon sdk using this library found in codeproject Canon EDSDK Library
I have done all of my requirements except one. It is that moving the zoomed live view up/down/left/right. I can zoom but I cant move it to see the right place to adjust the manual zoom.
I have searched and I have come to zoomRect, zoomPosition, zoomCoordinates... but I dont know what they are actually and how to use them.
any advice, code block will help a lot with or without using this library
I have finally found an answer. I have used zoomposition in order to change zoom rectangle. I have used zoomRect in order to get zoom rectangle location and size. Here is how I did that
Use this method to set zoom position of camera . I have defined this method in camera.cs in library
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);
}
I have send this data to the method from anywhere in your code in order to change the zoomPosition
MainCamera.SetZoomPositionSetting(PropertyID.Evf_ZoomPosition, p);
p in here is EOSDigital.SDK.Point instance.
Here are the methods to get zoomCoordinates, zoomRect. I have defined these methods in camera.cs in library
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();
}
You need to call these methods within DownloadEvf() method in camera.cs. just after getting evfImageRef from
CanonSDK.EdsDownloadEvfImage(CamRef, evfImageRef);
after you get the evfImageRef with image data you can call the get methods using evfImageRef as imgRef. you can get the zoomposition using the same way. Dont forget to rebuild the library.