supplierdeeply

IXUS160/ELPH160 Porting attempt

  • 497 Replies
  • 110703 Views
Re: IXUS160/ELPH160 Porting attempt
« Reply #490 on: 17 / February / 2018, 21:39:02 »
Advertisements
Perhaps the subject distance override function for this particular ixus model (or others that suffer from this peculiar behaviour) could be overwritten to use MoveFocusLensWithPosition instead of MoveFocusLensToDistance?
Having spent a lot of time on getting SD override to sort of work on most CHDK cameras, I find this very interesting but not surprising.  The fact that SD override works at all for cameras without Canon manual focus is mostly just luck IMHO.

Do you have any thoughts on how to calibrate the position value against actual distance? I assume it would need to be done at each zoom step.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline Hacki

  • ****
  • 358
  • SX100
Re: IXUS160/ELPH160 Porting attempt
« Reply #491 on: 18 / February / 2018, 08:33:29 »
Third time i'm writing this post, this board software is annoying...  :lol




I started by mapping the set/get_focus values to GetFocusLensCurrentPosition. See attached file.
This creates just more confusion:

1. Between set_focus 0 and 10 the camera will assume the same focus position, get_focus returns a nonsensical 37 while GetFocusLensCurrentPosition returns 1352. This is already less than the cameras Autofocus in macro mode can achieve, which is about 1420 or about 1 cm in front of the lens.
I suppose nobody has noticed because the difference is negligible at that distance.

2. Between set_focus 10 and 16 GetFocusLensCurrentPosition changes as expected while get_focus returns more nonsense. Only at set_focus 17 do things start to make sense overall.

Since this only affects the very near field (below 1cm at zoom level 0, below ~1 meter at max zoom) it might be sufficient to map the area where GetFocusLensCurrentPosition correlates nicely with a subject distance and "guess" or extrapolate for the areas where it doesnt.
It wont be all too accurate, but i dont think anybody is expecting any level of accuracy from those crappy little cameras.

Besides, i dont get the need for setting a subject distance in cm anyways. I can only gauge the distance to the subject very roughly by eye and i wont get out my tape measure any time i set manual focus. So its something of a guessing game anyways.

What would be infinitely more helpful would be being able to force on the AF Zoom which magnifies a part of the frame in the middle to help confirm focusing.
Unfortunately on the ixus 160 that zoom thing is available, but only comes on after the camera has autofocused on its own successfully.






Re: IXUS160/ELPH160 Porting attempt
« Reply #492 on: 18 / February / 2018, 08:51:47 »
Besides, i dont get the need for setting a subject distance in cm anyways.
AFAIK, there are really only three reasons for wanting to set focus manually.

The first is the one you found - you know or can measure the subject distance accurately and want to always force the focus there.  Doing this accurately has proven to be a big challenge.

The second is for focus stacking - usually with a script.  Accuracy is not important here, you just need the focus to move through a range with each successive shot.  For most Powershots, the CHDK manual focus code works adequately for that use.

The third (and perhaps most common) is to be able to lock the focus at either Infinity or huperfocal distance.  Making this work was my original goal when I reworked all the SDO code in CHDK and I was only marginally successful in the end. 

But a calibration routine that takes sequential shots at increased focus lens position settings, and then at the different zoom positions, would let the user pick a suitable value for an infinity setting at any zoom step setting. It would be interesting to see if those values were the same for each camera model because, if so, we could add it to the base CHDK code.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline Hacki

  • ****
  • 358
  • SX100
Re: IXUS160/ELPH160 Porting attempt
« Reply #493 on: 18 / February / 2018, 11:14:19 »
Oh yeah, i get the need for manual focus, what i mean is why do we need to set it with a "tangible" value like centimeters.

It might as well just be an arbitrary scale, say from 1 to 1000 where 1 is the minimum und 1000 is infinity.
Thats essentially how it works on my powershots, you dont actually see any numerical value for the manual focus, just a horizontal bar that fills and indicates wether the focus is near or far. Dont know how it is on other canon compats with stock manual focus.




How about keeping the subject distance override thing as it is on this camera but adding the option to replace it with MoveFocusLensWithPosition instead, and allowing people to enter the full range from 0 to 1840, directly in there? That would be a whole lot more accurate, reproducible, and actually enables to use a wider focus range.


A menu option for engaging the focus lock on those cameras would be a very nice touch as well.




By the way; theres some shenanigans with the subject distance override value anyways. I think its due to this function in shooting.c:


Code: [Select]
int shooting_get_subject_distance_override_value()
{
    if (conf.subj_dist_override_koef != SD_OVERRIDE_INFINITY)
        return (conf.subj_dist_override_value < shooting_get_lens_to_focal_plane_width()?0:(conf.subj_dist_override_value - shooting_get_lens_to_focal_plane_width()));
    else
        return INFINITY_DIST;
}


Both shooting_get_lens_to_focal_plane_width() and shooting_get_lens_to_focal_plane_width() return garbage when the lens is moving or even just when you press the shutter button and take a picture, so your sd override value changes on its own.
This is not unique to the ixus 160, i tested it on my powershot sx110 and observed the same behaviour.


Unfortunately any more testing on my sx110 is impossible since i bricked it yesterday during a repair of the battery compartment. Fragile ribbon cables..  ::)





Re: IXUS160/ELPH160 Porting attempt
« Reply #494 on: 18 / February / 2018, 13:13:35 »
How about keeping the subject distance override thing as it is on this camera but adding the option to replace it with MoveFocusLensWithPosition instead, and allowing people to enter the full range from 0 to 1840, directly in there?
If we go down that route, it would make sense to allow either to be used.  But it would be nice to know a lot more about how it works across a reasonable selection of cameras (I have at least seven to start with) before adding it to the build. Is 1840 the same limit on all cameras? Do they all crash at 1841?  How much does zoom position affect things?  How would you explain this to the average user?

You get the idea.

For now, adding it to scripts to learn more makes some sense. I assume you are using a script for your book scanner?

Quote
A menu option for engaging the focus lock on those cameras would be a very nice touch as well.
Setting an SDO value essentially does this. But I see your point.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline Hacki

  • ****
  • 358
  • SX100
Re: IXUS160/ELPH160 Porting attempt
« Reply #495 on: 18 / February / 2018, 17:06:34 »
Yeah, i get it.


I dont know yet how exactly i will control the two cameras.
The thing i'm building is inspired by https://www.diybookscanner.org/, they have some raspberry pi control unit for the Ixus 160. ( https://github.com/Tenrec-Builders/pi-scan )


But i think i'll just control them via the chdkptp tool and my computer via a script indeed.




One more observation: The 2nd parameter for MoveFocusLensWithPosition takes a maximum value of 7400.
7401 will crash the camera.
0 will set the focus at maximum speed, same as 7400.


Max speed will set the focus from the near to far limit in less than half a second and you can clearly hear the focus motor working, no idea how healthy that is.


Zoom level does not appear to change any of those limits, it works within the same range and speed at any zoom levels.




By the way, i just triggered that Lens error that was reported earlier.
I could reproduce it once by crashing the camera when the lens was extended fully, but then not even after 10 tries.
First time around it fixed itself and the second time i could fix it with some force.


The camera is trying to move the lens but cant for some reason, grabbing in applying some force counter clockwise (viewed from the front) to the base ring of the lens fixes it after a couple of powercycles. What happens when you do that is that the lens is trying to wiggle back and forth but because you apply that force it can only rotate towards the retracted position. Once its retracted a little bit it'll retract itself and work normally after another powercycle.


It does not appear to have any connection to the focus commands, other than being triggered by a crash.
« Last Edit: 18 / February / 2018, 17:08:28 by Hacki »

*

Offline reyalp

  • ******
  • 11592
Re: IXUS160/ELPH160 Porting attempt
« Reply #496 on: 04 / March / 2018, 16:32:53 »
Report of two bricked ixus160 using recent (as of March 2018) stable builds: https://chdk.setepontos.com/index.php?topic=13372.0
Don't forget what the H stands for.

*

Offline srsa_4c

  • ******
  • 3728
Re: IXUS160/ELPH160 Porting attempt
« Reply #497 on: 17 / July / 2018, 17:24:01 »
Found and corrected a typo that made CHDK LED signals inoperable (and may have caused other trouble).
Stable builds starting from revision 5084 and unstable builds starting from revision 5074 no longer have this bug.


 

Related Topics