NHMDenmark / EntomoloGUI

Pinned Insect Digitization GUI for interfacing with Pi-Eyes and Canons
0 stars 1 forks source link

Implementing focus bracketing for images taken with the canon cameras #7

Open Baeist opened 1 year ago

Baeist commented 1 year ago

Issue

Implementing the focus bracketing feature of the cameras into the entomology gui.

Detailed description of the issue.

It could include examples,reference to similar issue and clear boundaries of the issue.

The canon camera has a setting that allows for multiple photos to be taken with
a changing focus of the target. This setting is currently only available through 
the manual setting of the camera. 

It is not incorporated in the gphoto2 library. There are configurable options available
through the gphoto2 library that looks like they should be referring to the focus bracketing 
setting but our attempts to configure this has so far been fruitless(an issue query has been
 made https://github.com/gphoto/gphoto2/issues/608 ). 

This means that the focus bracketing mode is disabled when the camera is switched off and has to be manually set again when switched on.

Focus bracketing is part of canons own sdk which is c based and not immediately
implementable for our python based apps. We would likely need to create our own 
c library/program and then implement that into our python code or make changes 
to the gphoto2 library. 

The way focus bracketing works does not allow for there to be a set specific amount 
of difference between each photo- the bracketing difference is chosen depending on
the targets size, distance and possible other factors. There is however a general setting,
focus increment, that allows to tell how large steps we want between each photo- this is
a setting between 1-10, however it is just a general setting and not perfectly configurable. 
This setting is from what i have gathered best set at 1 since our targets are small and close by.
Testing of the "exif" photo data so far does not show any relevant differences for each photo 
in a stack of photos. There is no output that tells how the focus bracketing was set up or how 
much it changed for each photo. 

When taking a photo with the focus bracketing setting enabled the camera will take up to a
predetermined number of photos.

This will break the entomology guis import of the photos, since it is set to just get 1 photo for each "shot".

There are shell commands available that captures and downloads all the images in one go
however these commands are not implemented in the gphoto2 library. We cant have access 
to each camera through more than 1 instance at a time, meaning that we cant immediately have
 the gui running and then go through a shell script to use the capture+download mode. 

Why is it needed/relevant ?

A photo combined through stacking removes blurring that would normally occur through depth
 differences in a photo.
It will also helping hi def pics which will help in fancy features like species detection, etc. 

Estimate level of effort required.

It requires a lot of technical knowledge and understanding of what the setting actually does
 in order to implement it correctly. It likely requires combining a c library with our python code. 
It requires refactoring the entomology gui.

hard

What is the expected acceptable result.

A functioning gui application that allows for taking focus bracketed captures and can transfer the images seamlessly to the host computer.

Give a clear approach/potential solution on how to resolve it.

Figure out if/how the data we need for each photo is available. Build our own c library from
 canons sdk. Implement that with our python code. Refactor and implement everything into 
the entomology gui.

What could be the challenges ?

Lack of necessary knowledge and experience with the required technologies. Mainly c, 
combining gphoto2/canon and using the camera settings correctly. 

What test are required ?

      As of now we are not able to figure out how the stack images differ from each other in 
      regards to their focal length.

      So, Manual testing of how the camera behaves when using the focus bracketing is required. 
      From this test, We would like to know 

Using gphoto2 from a CLI: http://www.gphoto.org/doc/manual/ref-gphoto2-cli.html

gphoto2 api: http://www.gphoto.org/doc/api/

gphoto github: https://github.com/gphoto/

bhsi-snm commented 1 year ago

@chelseagraham is it possible for you to do some manual testing to figure out the if the camera reverts back to original focal length after the focus bracketing shot for the next shot.

Baeist commented 1 year ago

Found this little piece of information, from canons sdk faq: Q) Is it possible to get the current focus position using SDK? A) No. EDSDK is not able to obtain the focus position of lens.