CHDK Forum

Using CHDK => Script Writing => Topic started by: guyfisher on 29 / September / 2015, 16:16:17

Title: Using set_zoom causes pincushion distortion on S100
Post by: guyfisher on 29 / September / 2015, 16:16:17
I'm having a problem with the set_zoom command on a PowerShot S100. When I use the set_zoom command, the resulting image has severe pincushion distortion. This only happens when I use the set_zoom command from a CHDK script. If I set the zoom manually and then take a photo with the shoot command there is no distortion. If CHDK is not in ALT mode, there is no distortion.

I've updated the S100's firmware, and I've tried setting different zoom speeds with set_zoom_speed, but it hasn't helped.

I used set_zoom without a problem on my previous cameras, an SD400 and an SD1100, but the S100 is giving me fits!

Any suggestions would be appreciated. Thank you!
Title: Re: Using set_zoom causes pincushion distortion on S100
Post by: reyalp on 29 / September / 2015, 16:39:43
Unfortunately this is a known problem with many recent cameras, the method CHDK uses to set the zoom doesn't update the values used by Canon's distortion correction code. What Canon firmware does your s100 have? There is an alternate zoom method we can use which may help.

Another alternative is to use repeated click() key press calls to set the zoom. However, this is slow, and it can be difficult to get a precise zoom level.
Title: Re: Using set_zoom causes pincushion distortion on S100
Post by: guyfisher on 30 / September / 2015, 12:24:01
Thank you for the explanation. The firmware version on my S100 is 1.02A, and I have CHDK version 1.3.0-4218 installed.
Title: Re: Using set_zoom causes pincushion distortion on S100
Post by: reyalp on 30 / September / 2015, 22:31:10
Here's a test build with CAM_USE_ALT_PT_MoveOpticalZoomAt defined. This may help, but may still give different results from setting the zoom using the camera buttons.
Title: Re: Using set_zoom causes pincushion distortion on S100
Post by: guyfisher on 07 / October / 2015, 15:29:06
The test build appears to eliminate the distortion when I use set_zoom. Thank you!
Title: Re: Using set_zoom causes pincushion distortion on S100
Post by: guyfisher on 19 / October / 2015, 16:31:20
Upon further review, I would add this caveat: The test build works if the S100 is in full auto mode. When I try to use set_zoom in Program AE or aperture priority modes, the camera freezes up and shuts down.
Title: Re: Using set_zoom causes pincushion distortion on S100
Post by: reyalp on 01 / November / 2015, 18:36:33
Upon further review, I would add this caveat: The test build works if the S100 is in full auto mode. When I try to use set_zoom in Program AE or aperture priority modes, the camera freezes up and shuts down.
Thanks for the report. Can you confirm that the regular autobuild does not crash with the same settings?

A romlog from the crash that may provide useful information. See http://chdk.wikia.com/wiki/Debugging#Camera_crash_logs_.28romlog.29 (http://chdk.wikia.com/wiki/Debugging#Camera_crash_logs_.28romlog.29)

Also, check whether you have continuous AF or Server AF enabled in the canon menus.
Title: Re: Using set_zoom causes pincushion distortion on S100
Post by: srsa_4c on 02 / November / 2015, 14:37:08
I think CAM_NEED_SET_ZOOM_DELAY needs to be more than 1 (it also defines the delay in milliseconds).
Title: Re: Using set_zoom causes pincushion distortion on S100
Post by: guyfisher on 08 / November / 2015, 12:02:25
Quote
Also, check whether you have continuous AF or Server AF enabled in the canon menus.

After reading this suggestion, I checked the Servo AF menu setting and found that it was turned off. When I turned Servo AF on, I was able to use the set_zoom command in all of the camera modes without any problems!

Title: Re: Using set_zoom causes pincushion distortion on S100
Post by: reyalp on 08 / November / 2015, 15:24:26
Quote
Also, check whether you have continuous AF or Server AF enabled in the canon menus.

After reading this suggestion, I checked the Servo AF menu setting and found that it was turned off. When I turned Servo AF on, I was able to use the set_zoom command in all of the camera modes without any problems!
Thanks. I suspect you will find this means that the camera doesn't re-focus correctly after you use set_zoom. Normally, after you use set_zoom CHDK will attempt to re-focus, but CHDK focus functions are known to have problems with servo AF, so the re-focus won't be attempted when it's on.

Per srsa's post above, here's a build with CAM_NEED_SET_ZOOM_DELAY set to 150. Please test this with Servo AF (and continuous AF, it it's available on your camera) turned off.
Title: Re: Using set_zoom causes pincushion distortion on S100
Post by: guyfisher on 11 / November / 2015, 16:42:05
Quote
I suspect you will find this means that the camera doesn't re-focus correctly after you use set_zoom.

I have a shoot command following the set_zoom command after a short delay, so I didn't notice that the camera wasn't refocusing. I increased the delay, and can clearly see that the camera doesn't refocus after zooming, although it does refocus when the shoot command is carried out.

I'll try the new test build with Servo AF off and see what happens.
Title: Re: Using set_zoom causes pincushion distortion on S100
Post by: guyfisher on 22 / November / 2015, 18:25:21
Quote
Per srsa's post above, here's a build with CAM_NEED_SET_ZOOM_DELAY set to 150. Please test this with Servo AF (and continuous AF, it it's available on your camera) turned off.

I have tested the second build on my S100 with Servo AF off, and the camera refocuses after set_zoom in Auto, Program AE, Scene and aperture priority modes. I have not had any problems with the camera shutting down.
Title: Re: Using set_zoom causes pincushion distortion on S100
Post by: reyalp on 22 / November / 2015, 19:06:41
Quote
Per srsa's post above, here's a build with CAM_NEED_SET_ZOOM_DELAY set to 150. Please test this with Servo AF (and continuous AF, it it's available on your camera) turned off.

I have tested the second build on my S100 with Servo AF off, and the camera refocuses after set_zoom in Auto, Program AE, Scene and aperture priority modes. I have not had any problems with the camera shutting down.
Thanks, I've checked this in for both 1.3 and 1.4.
Title: Re: Using set_zoom causes pincushion distortion on S100
Post by: guyfisher on 23 / November / 2015, 14:48:46
Quote
Thanks, I've checked this in for both 1.3 and 1.4.

Does that mean I can install CHDK using STICK from now on?
Title: Re: Using set_zoom causes pincushion distortion on S100
Post by: reyalp on 23 / November / 2015, 15:54:33
Does that mean I can install CHDK using STICK from now on?
Yes.