Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - knoodrake

#26
I think I may have understood but the exact opposite: start LV in the event handler context. Works ok, but we have to "wait" by checking (polling) if LV is on outside of the event handler (the opposite of what I said in my previous post).

Anyway, that doesn't change the problem: how to start the "pooling" elsewhere ?
#27
I think he means that the lv.start() should be done outside the event handler ( which I see as a "UI Thread" from my java mind :) )
So the idea would be that the keypress event just set a flag to says we want to start LiveView.

Somewhere else, we have a loop that checks every Xms if the flag is set. If so, we can start LV because we are within another "thread" (or whatever is called this Canon GUI Context ).

I hope I'm right up to this point :)

One thing I don't get, is how to start the "pooling" ? From my understanding I can't just write startPooling() at the end of the file, it won't be executed. On the other end, the only other "starting point" I have are camera events.. ( lens event, button event, ... )
I don't know how to "pool" automatically from the script loading ?
#28
Thanks @a1ex !

Dirty way (usually good enough if you don't need real-time response): global variable and polling.


I'm absolutely not used to dev on real small hardware such as a dslr (java dev). Pooling won't do much harm in term of CPU (battery life) ? if it's like 500ms ? I guess not ?..
#29
@garry23

maybe something to do with this sentence I read on the lua event api doc https://davidmilligan.github.io/ml-lua/modules/event.html
QuoteEvent handlers will not run if there's already a script or another event handler actively executing at the same time.
?

But yes, I hope A1ex or David will give us guidance.
#30
I remember however having tried to do something like you have

lv.start()
repeat
  msleep(200)
  until lv.enabled


but with the "fail-safe" counter ( something like )


local slept = 0
local threeshold = 3000
lv.start()
repeat
  slept = slept + 200
  msleep(200)
  until lv.enabled or slept >= threeshold


and the loop just stopped at he 3s threeshold without further bugs. Camera would work normaly after that (except the issue we'r discussing).
So it's just that lv.enabled was never updated or lv.start() did not start.

#31
@garry23

yep, I also had many strange behavior like the camera freeze or, semi-freeze (like I can still AF for instance) or other strange buggy behaviors, depending on how I tried things with code. But it was too hard to remember the steps to reproduce, and the exact camera behavior.
#32

event.keypress = function(key)
if key == KEY.RATE then
   if not lv.enabled then
lv.start()
lv.wait(1)
  end
return false
end
end



and

http://imgur.com/a/e0E64

I did something wrong ?
Need more code/infos ?
#33
Hello,

I tried to auto switch LV on before running the move() function and then auto switch it back to off (if it wasn't  already on) but I cannot..

basically, I check if lv.enabled, if not I lv.start().
My problem is that I cannot find a way to properly wait for LV to be really started before calling move().
For instance, if I do
lv.start()
lv.wait(1)

The console clearly tells me that the lv.wait fails because lv is stopped.

I tried the msleep way (with a repeat loop, and even with just a huge value of 10s) but msleep apparently blocks the execution of the lv.start().

I searched the API doc, looking for something like an "LV ready" event, but couldn't find.

Any hints ?  :o

Thanks.

EDIT: Please correct me if I'm wrong, but in the lua script, I'm single threaded, but the calls to ML/Canon API are asynchronous. I got this right ?
#34
@garry23
QuoteHave a read of the ground breaking work going on here: http://www.magiclantern.fm/forum/index.php?topic=4997.msg171205#msg171205
Yes, I have read this thoughtfully, and I do not understand yet very well the whole things with the lenses motors/steps but yes, and it looks very interesting and very promising ! Also still slowly learning the precise meaning of some of the domain-specific vocabulary used there !

QuoteI don't think SNR and DoF are linked in any real sense.
not directly, absolutely, I just meant that at the end, in the final picture, if the image is very very noisy, you won't be able to separate details, whether or not it should be optically acceptably sharp.
My thinking was that when relating to hyperfocal, if you can loose 5cm on the near end while going from 40m to infinity, and not being able to actually measure a difference in details in thoses 5cm, well, that can be usefull.

Not sure I made myself understandable :) ..Also, I may be completly wrong. But in such case I don't know where !

@dmilligan
Quotebut there's a nice wrapper for you
thank you ! perfect ! As long as the I/O part is abstracted, there is no problem using files from my side as user of the API !
#35
Please excuse me for the many posts, do you know if there is any way to know/test/log/whatever the length of an AF step ?
After some reading, I learned that those steps vary greatly from one lens to another.

So Can I "measure" (or find) that length for my lens ?

And Is there ways trough lua scripting to store that info associated with my lens ID/model other than doing dirty stuff with writing in some files ?
#36
Random (but kinda related) thought :

Could it be interesting/possible (probably possible at least) to estimate the SNR and correlate that to the CoC ?

What I mean is, the detail resolution in the final image is also heavily dependant on the noise. So let's say I'm at 12k ISO, is that still relevant to compute the DoF with the real CoC since anyway, the details won't be there. So couln't it be interesting to "adapt"  the maths with a fake, larger CoC than the real one when in high iso ?
That may be of little use for landscape photographers and crip D810 images, but when shooting in low light, 6400 ISO, I am not sure the blur will be visible as it would be in base iso.

Is that a stupid Idea ? And was that understandable ? (I struggle expressing myself in english sometimes :) )
#37
Thanks @garry23,
I was also just about to post that I found DoF calculation code http://a1ex.bitbucket.io/ML/5D/lens_8c_source.html#l00132
And I'm slowly getting a general sense of what ML does and does not :)
#38
Quoteyou may be able to optimize the move algorithm, ie I simply used single steps.
Good point. And I'm sure I can start by borrowing ideas from sorting algorithms for instance  :)
#39
@garry23 Awesome !
Thank you very much for the huge help.

Many things I didn't know like

  • Lens must report focus distance: seems obvious, but I thought most lenses did.
  • Must be in LV
  • we can't command the lens to move to a specific position

Anyway, I'll dig into the links you provided me.
Meanwhile, I tried you script, and it's awesome because:

  • It seems to work just fine !
  • I can understand it waay more easily than others since I know exactly what it does ! It's perfect

That's a very very helpfull starting (and already working) point, thanks again.

One last question thou, I don't get where does the API's lens.hyperfocal value comes from ?
since it depends on many factors, does that mean that ML already actually does the maths for me (CoC, current aperture, ..) ?

( BTW, the lens I'm using it with is a new Tamron 15-30 2.8 vc.  )
( BTW2, np++ is already my everyday text editor when not bothering with an IDE :) )
#40
Thank you very much garry.

Right now, I made my very first baby steps: updating ML to a new nighly that have lua scripting: Done.

And now I'm struggling to understand anything  :'(
First, I don't know lua. Maybe I should look at some tutos first.. But That's not my biggest problem.

Mostly, I don't yet get how the whole thing works. Don't understand when the console is supposed to be shown (I saw it some time)
I tried to debug and set some breakpoint (those red marks on the left are breakpoints right ?) from within the lua text editor, but.. no. nope. I don't understand anything :) I just am under the impression that I do some writting in (main) loop in the console, console that I cannot even get how to see !


My first goal was to do a hello world while showing lens infos instead of hello ( lens.focal_length for instance ).

I'm also struggling between coding stuff on computer, then popping the CF out and in the camera, and that is tedious, and trying to do some stuff with the build-in lua editor but I struggle to remember the buttons/shortcuts.

Since I'm only trying for less than an hour, I'm not yet desperate, but I would love to be able to at least grab a sense of the whole workflow, and be able to do my hello world :)

I'm used to code on java, so, all is nice, JVM, easy debug, easy IDE, everything documented, and here, I feel like I'm in the jungle, trying to find infos in various forum posts dating from 2015 I don't know if up to date, ...

If you please, have any insight for me to "kickstart" the whole stuff about making a module or a lua script. Please share :)


Anyway, thank you for your link, I'll get a look and maybe that'll help me understand some stuff.
#41
Thanks a lot a1ex, I will look into all that :)
( and I completely forgot the support for lua scripts !  )

( by the way, also thank you for everything else you do arround here / ML  :) )
#42
Hello all.  :)

Ability to register AF focus distances and set them to buttons. ..is what I need.

The goal is quite simple: having a quick way to switch to an acceptable "hyperfocal" focus distance for that lens/aperture/..

I have a 5dIII. This is not a feature request since I need it quickly ( in 20 days ) but couple of question:


  • Is that doable ? I mean, by starting with something simple, like juste focus to something, register it somehow, and then set that focus distance to a button.
    Maybe later add some nice stuff like embeded DoF calculation regarding to lens, aperture, ...  But to keep it simple, it is at least doable ? 
  • Do you think it is doable by someone who never touched ML development that quickly ? and where to start ? ( I mean, I am a java dev at work, so I can find my way arround languages I don't know yet but I won't be efficient ) 
  • Again, please, where to start ? I just noticed this post http://www.magiclantern.fm/forum/index.php?topic=7189.0 and maybe I can grab a few hints in this code
  • does writing new modules require to recompile ML ?

Thanks for any tips or directions !

Sorry if I miss obvious posts that already answered my questions. I gave a look in the forum but didn't find.