I am new to C#, now using Canon's EDSDK having a live-view of the camera in a pictureBox. How is it possible to rotate the live-view image by 180°?
I tried rotating the image after the liveView is established
MainForm.cs
Camera MainCamera; // is instanciated elsewhere
public void startLiveView() {
MainCamera.StartLiveView();
// at this point, live-view is working and LiveViewPicBox contains the live-view
// this code has no effect:
Image img = LiveViewPicBox.Image;
img.RotateFlip(RotateFlipType.Rotate180FlipY);
LiveViewPicBox.Image = img;
}
Camera.cs
public void StartLiveView()
{
CheckState();
if (!IsLiveViewOn) SetSetting(PropertyID.Evf_OutputDevice, (int)EvfOutputDevice.PC);
}
public void SetSetting(PropertyID propID, object value, int inParam = 0)
{
CheckState();
MainThread.Invoke(() =>
{
int propsize;
DataType proptype;
ErrorHandler.CheckError(this, CanonSDK.EdsGetPropertySize(CamRef, propID, inParam, out proptype, out propsize));
ErrorHandler.CheckError(this, CanonSDK.EdsSetPropertyData(CamRef, propID, inParam, propsize, value));
});
}
SDKMethods.cs (CanonSDK)
[DllImport(DllPath)]
public extern static ErrorCode EdsGetPropertySize(IntPtr inRef, PropertyID inPropertyID, int inParam, out DataType outDataType, out int outSize);
[DllImport(DllPath)]
public extern static ErrorCode EdsSetPropertyData(IntPtr inRef, PropertyID inPropertyID, int inParam, int inPropertySize, [MarshalAs(UnmanagedType.AsAny), In] object inPropertyData);
The Live-View is working but no rotation is applied.
Note: The pictureBox has property WaitOnLoad=false
I assume there's some kind of image-stream which I'd need to rotate instead, though I do not understand much of the code in the SDK. Can anyone assist me, telling me where to start?