Testing set/get subject distance firmware functions - General Discussion and Assistance - CHDK Forum

Testing set/get subject distance firmware functions

  • 12 Replies
  • 6823 Views
Testing set/get subject distance firmware functions
« on: 16 / April / 2015, 06:22:15 »
Advertisements
Greetings to all!

To begin, I want to ask you testing the subtleties of the focus of your cameras (especially sx50 owners and similar), using my script CheckSD.lua
The script creates a file checkSD.cvs (checkSD01.cvs, etc.), which I'd like to post here.

Initial conditions: Zoom=min; Dof Calculator: Canon Subj. Dist. as Near Limit = Off, Use EXIF Subj. Dist. (PC65) = Off.

Code: (CheckSD.lua) [Select]
--[[
@title Check subject distance
@param a autonumber filename (y/n)
@range a 0 1
@default a 1

--]]
autonumber = (a==1)
if autonumber then
local nameBegin = 'A/checkSD'
for i=0,99 do
local fn = string.format('%s%02d.csv',nameBegin,i)
if not os.stat(fn) then
filename = fn
break
end
end
if not filename then
error('No available filenames!')
end
else
filename = 'A/checkSD.cvs'
end

bi=get_buildinfo()
log,err=io.open(filename,"wb")
--sleep(100)
if not log then
error('failed to open '..tostring(filename)..': ' .. tostring(err))
end
log:write(bi.platform, "\n", os.date(), "\n\n")
log:write("Write SD:  Canon SD:\n\n")

set_mf(1)
SD_in = 0
SD_out = 0
maxSD = 25000
-- max value to achieve infinity
-- for SX50 (zoom = min) enough 15000
for i = 1, maxSD, 1 do
set_focus(i)
--sleep(100)
tmp = get_focus()
if tmp ~= SD_out then
SD_in = i
SD_out = tmp
log:write(string.format("%8d", SD_in)," ; ", string.format("%8d", SD_out),"\n")
cls()
print("Currend SD: "..i)
if tmp == -1 then
break
end
end
end
log:close()
set_mf(0)
P.S. The script is running long enough, please do not be afraid.  ::)

Thanks in advance.
« Last Edit: 16 / April / 2015, 09:56:41 by Malysh-ok »
Camera is SX50hs

Re: Testing set/get subject distance firmware functions
« Reply #1 on: 19 / April / 2015, 03:06:05 »
So Nobody wants to help?


I would like to know more about the functions of the family MoveFocusPosition  and GetFocusLensCurrentPosition.
While it is known that:
"MoveFocusLensWithPosition" has 3 arguments: 1) signed halfword 2) halfword 3) word
"MoveFocusLensToPosition" has two: 1) halfword 2) word
"MoveFocusPosition" has only one (halfword)

If less arguments are provided, the eventproc will get junk for the remaining arguments.
Camera is SX50hs

Re: Testing set/get subject distance firmware functions
« Reply #2 on: 19 / April / 2015, 08:59:33 »
So Nobody wants to help?
There are only a small number of people currently active on this forum.  They all tend to be busy people with a lot of projects that they already have no time to start. I suggest that without a better idea of what you hope to accomplish,  you will not get their attention.

That being said,  I've attached dumps from four cameras for you to look at.   I have other cameras but it would take some time to set them up and I'm not sure why I need to do that?

Notes :
  • The S100 and A1200 ran the script to completion.
  • The G10 ran for a while and then just stopped doing anything. I pressed the shutter button to abort.
  • The A560 stopped right away.
  • In general,  I'd suggest putting a little code at the start of any testing script to put the camera into the mode it needs to run (i.e. into shooting mode) rather than rely on the user to do that.   Just as a courtesy to them
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Testing set/get subject distance firmware functions
« Reply #3 on: 19 / April / 2015, 16:55:45 »
Great thanks!!!

Found a1200, G10, s100 use a good algorithm to set the focus , unlike (my) SX50hs.
It would be good to compare with other SX50hs. If the results are as bad as my camera, then one solution is to rewrite frimware function MoveFocusLensToDistance().  :'(
Camera is SX50hs

Re: Testing set/get subject distance firmware functions
« Reply #4 on: 20 / April / 2015, 19:06:44 »
It would be good to compare with other SX50hs.
Here you go.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Testing set/get subject distance firmware functions
« Reply #5 on: 22 / April / 2015, 06:43:34 »
I have run the script 2 times at elph300hs (ixus220) and here it is:

Re: Testing set/get subject distance firmware functions
« Reply #6 on: 23 / April / 2015, 04:57:19 »
Thanks!
It would be good to compare with other SX50hs.
Here you go.
The values are slightly different (oddly enough), but in general, my fears were confirmed: lousy algorithm in SX50HS.>:(
Camera is SX50hs

Re: changelog of trunk including comments / devtalk
« Reply #7 on: 23 / April / 2015, 15:00:09 »
Hello. Think writing in this topic.

Who programmed DOF?
Looked (core/shooting.c) function shooting_get_subject_distance_():
Quote
int shooting_get_subject_distance_()
{
   if (!conf.dof_subj_dist_as_near_limit) return shooting_get_canon_subject_distance();
   else return shooting_get_far_limit_f(shooting_get_canon_subject_distance(),
                                         shooting_get_min_real_aperture(),
                                         get_focal_length(lens_get_zoom_point()));
}
Shouldn't it be:
Quote
else return shooting_get_near_limit_f...
???
    
And check the correct operation in these modes (with the fix described above):
1) Use EXIF Subj. Dist. (PC65):
Code: (normal mode, SD=1) [Select]
SD: .001
NL: .001
FL: .000
- Ok (though why FL=0?).

Code: (mode Use EXIF Subj. Dist. (PC65), SD=1 (didn't change)) [Select]
SD: .098
NL: .081
FL: .122
- How could it be near the limit to be closer lenses?

2) Canon Subj. Dist. as Near Limit
Code: (normal mode, SD=1.49) [Select]
SD: 1.49
NL: .612
FL: Inf
- Ok.

Code: (mode Canon Subj. Dist. as Near Limit, SD=1.49 (didn't change)) [Select]
SD: .619
NL: .619
FL: 1.52
- NL=SD, but should be smaller than SD. And FL was Inf and was very small.
« Last Edit: 23 / April / 2015, 15:30:16 by Malysh-ok »
Camera is SX50hs

Re: Re: changelog of trunk including comments / devtalk
« Reply #8 on: 23 / April / 2015, 18:50:45 »
Hello. Think writing in this topic.
This same subject matter is now spread across three threads.  This is confusing now and will certainly be hard to follow in a year or two if someone comes searching.

@reyalp : Can you move it here: Testing set/get subject distance firmware functions as it does not really belong in this thread or the SX50 HS porting thread.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 14126
Re: Testing set/get subject distance firmware functions
« Reply #9 on: 24 / April / 2015, 00:20:31 »
Moved.

As for the origin of the DOF calculator, svn log and blame may provide some hints. The original code predates my involvement in CHDK.

Searching the forum may also provide some insight.
Don't forget what the H stands for.

 

Related Topics


SimplePortal © 2008-2014, SimplePortal