Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenAthena will sometimes incorrectly use thermal camera intrinic values for color photos (and vice versa) #130

Closed
mkrupczak3 opened this issue Apr 20, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@mkrupczak3
Copy link
Member

mkrupczak3 commented Apr 20, 2024

To de-conflict between camera intrinsic values for drones which report the same make/model identifier for both their color and thermal camera, OpenAthena selects the intrinsic value of the nearest resolution width.

This causes an issue however when a scaled-down color image has a closer pixel width in linear terms to the thermal camera rather than the color one. E.g., a color image for this drone scaled down by 2x from the original sensor size (width 2672) would incorrectly match to the thermal camera rather than the color one:

Screenshot 2024-04-20 at 12 35 18 PM
        int smallestDifference = Integer.MAX_VALUE;
        JSONObject closestDrone = null;

        for (int i = 0; i < matchingDrones.length(); i++) {
            try {
                JSONObject drone = matchingDrones.getJSONObject(i);
                int droneWidth = drone.getInt("widthPixels");

                int difference = (int) Math.abs(droneWidth - targetWidth);
                if (difference < smallestDifference) {
                    closestDrone = drone;
                    smallestDifference = difference;
                }
            } catch (JSONException e) {
                return null;
            }
        }
        return closestDrone;
    }

The function getMatchingDrone in MetadataExtractor.java should be updated to use the drone of nearest width by ratio rather than linear difference. This would allow it to correctly select the color camera in scenarios such as described previously.

@mkrupczak3 mkrupczak3 added the bug Something isn't working label Apr 20, 2024
@mkrupczak3
Copy link
Member Author

Fixed in 17ac89d:

Screenshot 2024-04-20 at 1 01 28 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant