martin-marek / hdr-plus-swift

📸Night mode on any camera. Based on HDR+.
https://burst.photo
GNU General Public License v3.0
208 stars 11 forks source link

[Feature request] Detect sharpest image in the burst and use it as the reference image #8

Closed chris-rank closed 1 year ago

chris-rank commented 1 year ago

Instead of choosing the mid image in the burst as reference image, I would suggest to use the sharpest image as the reference image instead. As all images in the burst are very similar (except noise and motion), I believe that application of simple methods would work for detection of the sharpest image. I already started implementing this functionality, but have not yet figured out how to transfer back the float value (return value) of your mean_average() function into Swift. If you can help with this little task, I would be more than happy to contribute (provided that my function works well in the end).

PythonNut commented 1 year ago

Would do you think it would be useful to let the user manually choose the reference image?

martin-marek commented 1 year ago

@PythonNut, in theory this would be great but I don't know how to make it work well with the current graphical user interface. Do you have any suggestions?

Chris' idea is simpler in that we wouldn't need to modify the GUI at all.

If you really want more control, please feel free to download the source code and process bursts using the command line interface (requires Xcode). It's very basic and much less user friendly than the GUI but it technically lets you choose the reference frame.

Alex-Vasile commented 1 year ago

@PythonNut, in theory this would be great but I don't know how to make it work well with the current graphical user interface. Do you have any suggestions?

Chris' idea is simpler in that we wouldn't need to modify the GUI at all.

If you really want more control, please feel free to download the source code and process bursts using the command line interface (requires Xcode). It's very basic and much less user friendly than the GUI but it technically lets you choose the reference frame.

A starting point for the UI could be something like what Helicon Focus has:

But these kinds of changes have to be based on a concrete idea of how the app is meant to be used. For example:

I personally am in favour of both the last two options. The last one from the pragmatic point of view that having the two separated will make it easier to work on each independently.

martin-marek commented 1 year ago

I think that a more advanced GUI (that shows a live output and lets you tweak it) would be awesome. The only reason I created the current GUI was that it was simpler to implement.

If anyone wants to implement a GUI with the above features (and it works well), I'd be happy to put it into a future release.

I agree that the backend / frontend should be largely independent. For this reason, there's already two different build targets in the Xcode project: "CLI" and "GUI". But I guess the way this is implemented might not be ideal.

PythonNut commented 1 year ago

Chris' idea is simpler in that we wouldn't need to modify the GUI at all.

I guess the thing I would be worried about is that if it chooses a frame near the beginning or end then it potentially doubles the displacement due to motion, so I can see why you would want to pick an image near the middle of the burst, sharpness being equal.

I haven't used this software enough to really understand the trade-offs though.

chris-rank commented 1 year ago

After gaining more experience with the app, this feature may not be needed anymore. With release version 1.4, bursts with bracketed exposure are supported where typically only one frame can be chosen (darkest frame). For bursts with uniform exposure, many factors may be relevant for choosing the reference frame, e.g. sharpness, position of frame within burst, people smiling, people not having eyes closed, etc... With the current solution for bursts with uniform exposure (middle image as reference), you get the optimal choice if there is strong linear motion (e.g. driving car or moving stars). For other cases, you can manually re-order your images by changing file names as you prefer. A more user-friendly solution would probably require an improved UI where preview images are shown and the user can choose the reference frame.