1

Using LiveView on EOS is fun and helps getting objects in focus (in case of objectives which do not offer autofocus). Magnification of the LiveView image (stream) really helps focusing.

On camera site, you may magnify that LiveView image 5x and 10x using the button with magnifying glass icon. That works well for my 600D.

Programming using EDSDK I got a problem: It is possible to set the 5x zoom mode for LiveView programmatically. But I did not succeed for 10x mode.

Did anyone succeed in doing zoomed LiveView and zoom that LiveView image more than 5x ?

For successful 5x LiveView zoom I used following code for my 600D:

// Start LiveView wait for the stream apearing on the screen and then do:

_iZoomStage= 5;

bool Success=_CameraHandler.SetSetting(EDSDK.PropID_Evf_Zoom,(UInt32) _iZoomStage);

That works fine, BUT: If you try to get higher zoom factors that fails. Success is returned true, but no effect is visible on screen. If you do LiveView zooming on the camera itself 10x works fine pressing the "magnifier" button. But programmatically I did not succeed in values greater than 5.

Any idea to that topic?

  • Can you please add some more info as to how it fails? Any error? The correct values should be 1(=Fit), 5(=x5 zoom), 10(=x10 zoom). However, I had problems with it as well. I only get one zoom stage with either value. – Johannes Bildstein Jul 26 '15 at 12:03
  • Same with me. I do not get a crash or false or whatever. No all seems to be fine, except that there is no difference in zoom regarding 5x or 10x. Hmmm I really cannot understand that, either. Here we are: bool Success=_CameraHandler.SetSetting(EDSDK.PropID_Evf_Zoom,5); // Success is true bool Success=_CameraHandler.SetSetting(EDSDK.PropID_Evf_Zoom,10); // Success is true But, as mentioned, no difference in the output to be seen on screen. If you do a bool Success=_CameraHandler.SetSetting(EDSDK.PropID_Evf_Zoom,1); then you get your "normal" (non zoomed image) Strange, isn't it? Kind regards – user3856307 Jul 26 '15 at 17:19
  • yeah I have exactly the same behavior. I suspect it's either a bug or a limitation of the SDK (more likely a bug) and I'm afraid I have no workaround. We'll have to live with just one zoom rate. – Johannes Bildstein Jul 26 '15 at 22:33
  • Well, ok. That seems to be sad. I'd give it another try: Perhaps "cropping" helps (defining a "cropping rectangle" and apply it to the LiveView. I do not exactly know how to do that or whether it helps. I will see. Another chance is to pass the problems to Windows: Doing a cropped zoom at Bitmap level. I don't know if that slows down performance. In case I get some working code, I'll share it here :-) – user3856307 Jul 27 '15 at 05:52

2 Answers2

2

Well, thanks a lot for your answers.

Meanwhile I did the following workaround, which seems to solve the problem. I simply crop and zoom the bitmap during LiveView streaming:

if(_zoomFactorOfEdskd == true)   // That is 1 and 5
 g.DrawImage(_LiveViewStreamedBmp,_LvOutput);
else  // Our own ones which do not work with EDSDK
 { 
  Int32 newWidth=  (Int32)(_LiveViewStreamedBmp.Width  / _zoomFactor);
  Int32 newHeight= (Int32)(_LiveViewStreamedBmp.Height / _zoomFactor);

  // Cropping around the center of the original bitmap
  Int32 xOffset= (_LiveViewStreamedBmp.Width-newWidth)/2;
  Int32 yOffset= (_LiveViewStreamedBmp.Height-newHeight)/2;

  Rectangle rectSource=new Rectangle(xOffset, xOffset, newWidth,newHeight);
  Rectangle rectTarget=new Rectangle( 0,  0, _LiveViewStreamedBmp.Width, _LiveViewStreamedBmp.Height);            

// Do the zoomed output...
g.DrawImage(_LiveViewStreamedBmp,rectTarget,rectSource,GraphicsUnit.Pixel);           
}

Please take care that "really good" results will appear with _zoomFactor below 5x (means something between 2.0 and 3.0). If you use too strong zoom values here, you get "pixels" and the image is much too big in size (you may not see anything).

Perhaps it is a good idea to define the _zoomFactor value otherwise, so that it fits better to Canon's understanding of "5x" or "10x". But for the moment this workaround may serve.

Kind regards Gerhard Kauer

1

I have stumbled into the same problem (on 5D Mark IV) - only the 5x zoom is actually possible and for 10x zoom you are supposed to zoom the returned bitmap by yourself.

HOWEVER: It doesn't seem to be a bug, but a very badly documented feature (i.e. not documented at all). The SDK actually gives out additional data to hint you that you should do a software zoom and also gives precise coords. So this is how I understand it:

Say we have a sensor with a resolution of 1000 x 1000 pixels and we want to zoom-in 10x in the center. Then this happens in my tests:

  • Reading the kEdsPropID_Evf_ZoomRect returns the position 450:450 and size 100x100 - all as expected.
  • Reading the kEdsPropID_Evf_ZoomPosition returns 450:450 - expected too.
  • But you will receive a bitmap of 200 x 200 pixels - "incorrectly", because this is for x5 zoom... you would expect 100 x 100, but this was observed on various cameas, so probably a normal thing.
  • But by reading the kEdsPropID_Evf_ImagePosition you can tell, where this bitmap actually lies. This will return 400:400 position and so can be used to calculate the final crop and enlargement of the returned bitmap.

So while the code of user3856307 should work, there might be some limitations of the camera (such as returning bitmaps on position divisible by 32), so incorporating the kEdsPropID_Evf_ImagePosition should give more precise results in my opinion.

Vit Kovalcik
  • 436
  • 3
  • 12