gphoto2 icon indicating copy to clipboard operation
gphoto2 copied to clipboard

[cli] Capture Image without Autofocus

Open kohlerdominik opened this issue 5 years ago • 21 comments

This is maybe more like question than an issue:

Is it possible to "capture-image-and-download" without triggering AF first. I think, capture-preview does somethink like this, altough, i'm not really sure what's exactly the difference between these two.

If there's no possibility for this, i would love if this can be added.

Controller: Raspberry Pi 3 Camera: Canon 4000D

kohlerdominik avatar Sep 04 '18 13:09 kohlerdominik

capture-preview just takes the liveview viewfinder.

you probably can do something similar to

gphoto2 --set-config eosremoterelease=Immediate --set-config eosremoterelease="Release Full" --wait-event-and-download=5s

this controls the shutter directly and bypasses the half-press focusing state

msmeissn avatar Sep 06 '18 05:09 msmeissn

Thanks very much for this valuable input, it helped me a lot to develop the solution. I'd like to provide some feedback. Please notice, this answer is Canon specific!

i solved it like:

gphoto2 \
        --set-config eosremoterelease="Immediate" \
        --set-config eosremoterelease="Release Full" \
        --wait-event-and-download=ObjectRemoved

At least on the 4000D, when the image is sucessfully downloaded, it sends the "ObjectRemoved" Event, which then identicates to end the command. This allows long and short exposure times without unnecessary long waiting time.

For other people who also need to separate autofocus from the capturing process, this might be helpfull as well. It allows to use of contrast autofocus from live view to specify a specific spot in the image (in the example the center of the image, but make sure this coordinates are working for your model as well) and then try to focus on it. Badly, i have not found any event which tells the success or not, so it's necessary to control the image manually after sending this command.

gphoto2 \
        --set-config viewfinder=1 \
        --wait-event=1s \
        --set-config eoszoomposition=2075,1375 \
        --set-config autofocusdrive=1 \
        --wait-event=10s

kohlerdominik avatar Sep 09 '18 14:09 kohlerdominik

Does someone know how to capture without prior autofocus on a Nikon D80.

I am using the --trigger-capture command because I want to take several images as fast as possible one after another with different aperture values. I already tried setting the autofocusdrive=0, but the autofocus was still performed. Ideally I would like to use one command, to perform AF and AE, then use these settings for all subsequent capture commands with different aperture values. Does someone know how to solve this?

ai2ys avatar Jan 02 '20 19:01 ai2ys

Altough i'm Nikon Photographer, I use gphoto only for Canon. But i think i remember Nikon having more settings available for this matter. Try gphoto2 --list-all-config and look for autofocus relevant settings. you might be able to disable it temporary like

gphoto2 \
        --set-config <some config to disable af> \
        --capture-image-and-download \
        --set-config <some config to reenable af>

About your HDR-capture:

You could try to use the "exposure compensation" setting. there you can over- and undercompensate for +3/-3 exposure levels. The camera compensates depending on the selected mode (e.g. if you use Aperture Priority (Mode A), it increases and reduces the exposure time accordingly to the measured brightness and your compensation).

This function is also available as automatic feature called bracketing and supported out of the box by Nikon cameras for many years now. My D800 from 2012 supports this. You might get used a D5000 for less than 100€ supporting it. It might be easier than doing manual setting changes. Depending on the Model, however, different sets of customization and amount of pictures might be possible, so check if the functionality you need is available on the model you'd like to buy.

kohlerdominik avatar Jan 03 '20 11:01 kohlerdominik

I already tried config settings for disabling the AF, but it did not work out, the camera always does the AF drive prior to the capturing process.

gphoto2 --set-config autofocus=Off --trigger-capture

Bracketing would only be an option if Aperture Bracketing would be available, because I need different aperture values. As far as I know the Nikon D80 does support Aperture Bracketing.

Any other suggestions?

ai2ys avatar Jan 04 '20 21:01 ai2ys

can you check if the setting has stuck?

gphoto2 --get-config autofocus

should show it to be off.

If yes, can you capture a debug trace of this?

msmeissn avatar Jan 05 '20 08:01 msmeissn

Capturing without prior AF drive (Nikon D80). I found out how to solve this problem.

$ gphoto2 --set-config controlmode=1 #1: PC mode, 0: camera mode
$ gphoto2 --set-config focusmode2="MF (selection)" # not able to to this when not in control mode = 1
$ gphoto2 --set-config f-number=f/2.8 --trigger-capture
$ gphoto2 --set-config f-number=f/8 --trigger-capture
$ gphoto2 --set-config focusmode2="AF-S"
$ gphoto2 --set-config controlmode=0

Setting gphoto2 --set-config autofocus=Off had no effect, although the value was "Off" when checking afterwards with gphoto2 --get-config autofocus.

ai2ys avatar Jan 12 '20 21:01 ai2ys

I am lookin for a Solution for my Canon EOS 1200D - nothing works to Disable the AF. The Camera is mounted on a High Roof, so i cant easily change it manuelly to MF. Id Like to set the Focus once and keep it. But everytime i Take a Picture it will set a new focus :(. What doing i wrong. Sorry, for my bad english :(

So i call the Camera to take a Picture:

gphoto2 --set-config autofocusdrive=0 \
        --set-config eosremoterelease=5 \
        --wait-event=5s \
        --set-config eosremoterelease=4 \
        --capture-image-and-download \
        --filename "webcam.jpg" \
        --capture-tethered=70

So i set the Focus once:

gphoto2 --set-config viewfinder=1 \
        --wait-event=5s \
        --set-config eoszoomposition=5050,2109 \
        --set-config autofocusdrive=1 \
        --wait-event=10s \        
        --capture-image-and-download  \
      --filename "test.jpg"

Thank you for your Help. IMG_2948

thomasst1012 avatar Apr 28 '20 06:04 thomasst1012

@thomasst1012 can't you turn off autofocus from the lens?

nice picture by the way, it reminds me of Innsbruck where I lived one semester, shouldn't be so far :D

simontorres avatar Apr 28 '20 13:04 simontorres

@thomasst1012 can't you turn off autofocus from the lens?

nice picture by the way, it reminds me of Innsbruck where I lived one semester, shouldn't be so far :D

@simontorres - thats not so easy, the picture is from the installation last year. And i think it is maybe helpful to set a new Focus remote.

Thank You :) - it's not far away from Innsbruck - it´s in Vorarlberg, Montafon, Bartholomäberg. ;)

thomasst1012 avatar Apr 28 '20 13:04 thomasst1012

Hi @thomasst1012

i think your issue is, that you use --capture-image-and-download which will always trigger autofocus. try my solution from above.

kohlerdominik avatar Apr 28 '20 13:04 kohlerdominik

Hi @thomasst1012

i think your issue is, that you use --capture-image-and-download which will always trigger autofocus. try my solution from above.

Hei @kohlerdominik

I think I solved it that way:

gphoto2 \
        --set-config eosremoterelease=5 \
        --set-config eosremoterelease=4 \
        --capture-image-and-download \
        --filename "webcam.jpg" \
        --capture-tethered=70

I was confused by this error message:

FEHLER: Konnte Bild nicht aufnehmen. Warte auf 70 Ereignisse von der Kamera. Drücke Ctrl-C zum abbrechen. Speichere Datei als webcam.jpg CAPTURECOMPLETE UNKNOWN PTP Property d102 changed UNKNOWN PTP Property d101 changed

Despite the error message, the picture is taken.

I'll watch it now and report to you tomorrow.

Thank You

thomasst1012 avatar Apr 28 '20 14:04 thomasst1012

usually you do not need to mix eosremoterelease and captureimage.

eosremoterelease is basically same as pressing the shutter (half / full / releasing... depending on number), a following capture-tethered or wait-ervent-and-download will download its image.

I see that with eosremoterelease=5 should be "Immediate" and eosremoterelease should be "Release Full"

If this does not work, check if you set "focusmode" to Manual after autofocusing once.

msmeissn avatar Apr 29 '20 06:04 msmeissn

On Nikon...

On the D80 the selectioon via "autofocus" was not yet working correctly.

I have now changed the code to also honor the "autofocus" property in current libgphoto2 git master.

msmeissn avatar Apr 29 '20 06:04 msmeissn

@msmeissn When i change capture-image-and-download to wait-event-and-download the AF is still refocusing.

gphoto2 \
        --set-config eosremoterelease=5 \
        --set-config eosremoterelease=4 \
        --wait-event-and-download=5s \
        --filename "test.jpg"

When i change focusmode (set-config autofocusmode=0) the camera is also still refocusing.

With eosremoterelease & capture-image-and-download it works.

Addendum to yesterday:

Yesterday in the Evening the Camera has stopped making pictures. I think it was a trouble with the exponsure time. After a few hours of try i fixed it (added --capture-tethered):

gphoto2 \
         --set-config eosremoterelease=5 \
         --set-config eosremoterelease=4 \
         --capture-image-and-download --capture-tethered=70 \
         --filename "webcam.jpg" 

thomasst1012 avatar Apr 29 '20 07:04 thomasst1012

I wrote "focusmode".

3 different things to check / try:

  1. What does gphoto2 --get-config focusmode report?

  2. Can you try other eosremoterelease options... I think these are the ones without autofocus.

gphoto2 --set-config eosremoterelease=8 --set-config eosremoterelease=7 --wait-event-and-download=5s

  1. I think you might need to inject a --wait-event=200ms between the eosremoterelease calls. UIf you press the vshutter and release it too fast in "low light" conditions, it will not have time to take a picture.

msmeissn avatar Apr 29 '20 07:04 msmeissn

I have tried this with multiple eosremorelease options, it always triggers the Autofocus.

The Result:

gphoto2 --get-config focusmode Label: Fokusmodus
Readonly: 0 Type: RADIO Current: AI Fokus Choice: 0 Einzel AF Choice: 1 AI Fokus Choice: 2 AI Servo END

thomasst1012 avatar May 04 '20 12:05 thomasst1012

Hi. Is it possible to trigger only Auto-Focus without Capture-Image.

I tried this below, but did not work.

gphoto2 --set-config eosremoterelease="Press Half" --wait-event=5s --set-config eosremoterelease="Release Half"

Thanks.

sakibnaz avatar May 17 '20 19:05 sakibnaz

Hi @sakibnaz

did you try my solution from above?

kohlerdominik avatar May 17 '20 19:05 kohlerdominik

Hi @kohlerdominik .. I see, great. I missed that. Just tried and its exactly what I am looking for.

gphoto2 --set-config autofocusdrive=1 --wait-event=5s

I tried only autofocusdrive=1 before and did not work. So the clue is need to use wait-event.

This autofocusdrive should be a global command for Canon and Nikon ... right?

Also one more ques ... in manualfocus drive ... what is the step difference between Near and Far? Like, how many "Near 1" equals to 1 "Near 2" and 1 "Near 3" .. same for Far. Is there any relation calculation? Actually, I wanted to do Timelaspe Focus Ramping.

Thanks.

sakibnaz avatar May 17 '20 19:05 sakibnaz

Thanks very much for this valuable input, it helped me a lot to develop the solution. I'd like to provide some feedback. Please notice, this answer is Canon specific!

i solved it like:

gphoto2 \
        --set-config eosremoterelease="Immediate" \
        --set-config eosremoterelease="Release Full" \
        --wait-event-and-download=ObjectRemoved

At least on the 4000D, when the image is sucessfully downloaded, it sends the "ObjectRemoved" Event, which then identicates to end the command. This allows long and short exposure times without unnecessary long waiting time.

For other people who also need to separate autofocus from the capturing process, this might be helpfull as well. It allows to use of contrast autofocus from live view to specify a specific spot in the image (in the example the center of the image, but make sure this coordinates are working for your model as well) and then try to focus on it. Badly, i have not found any event which tells the success or not, so it's necessary to control the image manually after sending this command.

gphoto2 \
        --set-config viewfinder=1 \
        --wait-event=1s \
        --set-config eoszoomposition=2075,1375 \
        --set-config autofocusdrive=1 \
        --wait-event=10s

I know this is an old thread, but this is exactly the issue that I'm running into. I don't need the camera/lens autofocusing on every capture with --capture-image-and-download --interval -1 and using the -SIGUSR1 signal to trigger the capture process.

Right now I have to set the physical switch on the lens to "AF", otherwise --capture-image-and-download will freeze the camera and everything goes haywire with gphoto2 and the entire capture sessions fails.

Once I focus the camera/lens with the exposure settings I want, I want everything locked (exposure settings and the focus point locked) until I want them changed.

Note: Shutter speed is always 1/200s, IS0 is always 100, I only change the aperture slightly depending on environmental conditions...... I manually focus the lens/camera with a half press of the shutter targeted at the capture target. Then I want all the exposure settings and also the lens focus locked under --capture-image-and-download --interval -1 - until I need to change the aperture and/or re-focus the lens again (because I physically changed something, such as cleaning the lens, moving the camera, different target, etc.), but I will always do that lens re-focus and lockdown step myself.

What settings/parameters via gphoto2 would accomplished this goal on a Canon EOS 5DS R using --capture-image-and-download --interval -1 using a kill -SIGUSR1 PIDXXX signal to remotely trigger the --capture-image-and-download every 2 to 3 seconds via USB3?

Note: I'm not even sure --capture-image-and-download is fast enough with RAW image files to operate consistently at this 2 to 3 second remote trigger/shutter release interval. I find --capture-tethered was much faster in terms of execution, but I can't figure out a way to use --capture-tethered without an external remote trigger cable, which we are hoping to avoid.

Right now the lens/camera "focusmode" are set to "One Shot", which when I'm able to lock the focus (set the lens to MF) works very well for us with our high performance flashes. But that is not available to me when using --capture-image-and-download as I mentioned (gphoto2 --capture-image-and-download will only work with the lens in the AF setting).

I don't see any --get-config --autofocus command in the list of commands that indicates whether or not autofocus is on or off.

Continuous AF is currently "Off".

Thanks for you help and time. Greatly appreciated.

vepicurean avatar Aug 29 '21 18:08 vepicurean