-
Notifications
You must be signed in to change notification settings - Fork 267
Description
Is your feature request related to a problem? Please describe.
I made a tool that reports the tenengrad* metric for a central region of interest in a captured frame, and plots that information for use when tuning camera focus. It's written in python, but I'd like to add it to PV because PV has capabilities around camera settings that I cannot easily setup.
code: https://gist.github.com/jlmcmchl/676c4a4b86b9e2dec164a3930b2b46bf
Describe the solution you'd like
PhotonVision adds a block on the cameras page for focus, with the following controls:
- export siemens star pdf <-- pattern common to lens focusing
- should we actually do this or should we encourage users to focus on a field
- choose region of interest <-- tbd how to do this
- run focus pipeline <-- run some derivative of the above code
Describe alternatives you've considered
This could probably be its own page, I just happen to use it immediately before running camera calibration.
tenengrad metric may not be the best metric to use for image sharpness, I chose something I've seen used elsewhere and haven't reviewed other options.
I have not tested the effects of calibrating at shorter distances vs testing at longer distances (ie - calibrate focus in pit vs detect tags on the field), but it would appear that the ideal strategy would be to configure focus at the same distance you would like to have the best tag detection from.
Design Details
Settings relevant to measuring focus metrics:
- Region of Interest
- 4-dimensional (size in x and y, center point in x and y) region of the camera feed evaluated via focus metric
- 40-60% seems like an appropriate default
- Sampling History duration
- How long to remember a focus measurement before it is discarded
- 6 seconds seems fine
- Draw Graph
- whether or not the graph should be drawn on the processed frame
- unnecessary?
- Chosen focus metric
- long term potential: Support selecting other focus metrics in the linked paper or elsewhere
Additional context
Future work - try other focus metrics to see what's best?