Summary: | Add Fujifilm focus-point extractor support to digiKam | ||
---|---|---|---|
Product: | [Applications] digikam | Reporter: | focus-point |
Component: | Metadata-Focus | Assignee: | Digikam Developers <digikam-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | CC: | caulier.gilles, metzpinguin |
Priority: | NOR | ||
Version First Reported In: | 8.7.0 | ||
Target Milestone: | --- | ||
Platform: | macOS (DMG) | ||
OS: | macOS | ||
Latest Commit: | https://invent.kde.org/graphics/digikam/-/commit/faa6c0afef9f98ba4b098d2ad07b3d8bff879892 | Version Fixed In: | 8.8.0 |
Sentry Crash Report: |
Description
focus-point
2025-08-11 09:27:14 UTC
The digiKam C++ focus point handler is mostly inspired of the LR LUA plugin from github. If you look at this one, Fuji is now supported: https://github.com/musselwhizzle/Focus-Points/blob/master/focuspoints.lrplugin/FujifilmDelegates.lua So we need a port of this LUA code to C++ for this support... Best Gilles Caulier Thank you for quick reply Gilles! I went through their LR code and only ~30 lines between 74-115 are relevant for digikam. Rest of the code is about extracting face frames, crop frames etc. as you can see here: https://github.com/musselwhizzle/Focus-Points/blob/dcb392eb3c70696e48b67ddf4500076d9c5d7ea4/focuspoints.lrplugin/FujifilmDelegates.lua#L74-L115 Fujifilm metadata only provides single absolute pixel location for focus (like Panasonic and Sony in your codebase). It doesn't provide width or height of focus areas or multiple focus frames. So already very short panasonic focus point extractor code (focuspoints_extractor_panasonic.cpp) can be copied and adapted to fujifilm without much changes. --- My attempted pseudo code of focuspoints_extractor_panasonic.cpp adapted from FujifilmDelegates.lua#L74-L115: width, height = get image width and height from exif x, y = get focus pixel position from MakerNote "Focus Point" or ExifTool "FocusPixel". Two integers absolute positions split by a space. // Scale x, y positions with regard to how much original image is scaled // (? I don't know we need this since I don't see we are doing any scaling of positions anywhere) orgWidth, orgHeight = get original width and height x, y = x*(orgWidth / width), y*(orgHeight / height) RATIO_POINT_IMAGE = 1/120 // (since af point doesn't have width and height, we assume it's 1/120 of the image size like we did in panasonic) af_width, af_height = width*RATIO_POINT_IMAGE, height*RATIO_POINT_IMAGE return a focus point (x, y, af_width, af_height) I did my best to help you on this issue of missing focus points of fujifilm I hope it's useful! Thank you! Important : we will need image samples to test of course. Please use cloud webservice to share files. Git commit 6d85eabd85c2315c9ad1464f766b338c77140575 by Maik Qualmann. Committed on 11/08/2025 at 20:54. Pushed by mqualmann into branch 'master'. first implementation for detection of Fujifilm focus point M +1 -0 core/libs/metadataengine/CMakeLists.txt M +7 -0 core/libs/metadataengine/focuspoint/focuspoints_extractor.cpp M +1 -0 core/libs/metadataengine/focuspoint/focuspoints_extractor.h C +27 -31 core/libs/metadataengine/focuspoint/focuspoints_extractor_fujifilm.cpp [from: core/libs/metadataengine/focuspoint/focuspoints_extractor_panasonic.cpp - 050% similarity] M +2 -2 core/libs/metadataengine/focuspoint/focuspoints_extractor_panasonic.cpp https://invent.kde.org/graphics/digikam/-/commit/6d85eabd85c2315c9ad1464f766b338c77140575 In addition to samples, we also need screenshots from other programs or from the camera display to show how large the focus point is displayed. Maik Thank you Maik for quick implementation! Tomorrow, I will provide set of photos (raw + jpeg + heic) covering many combination of focus settings (AF-C, AF-S, M VS Point, Zone, Full, Face, Subject). However, I will drop some combinations, if they all likely produce same focus metadata as AF-S single point (returning single pixel coordinate for focus area) To make it easier to test if we draw the focus frame in right place, I am planning to focus a distinct object with the same size as the focus point on the camera. About your request for understanding how large the frame around focus point is displayed, I will send you screenshots from camera. However, I did a small research for you to figure out what is best relative width x height for the frame around focus point. TLDR: If you take length of short side of the image and divide by 9, this will be equal to width=height of the square focus frame we need to draw around focus point (center of square is focus coordinates in the metadata). Basics: - Other than my own camera, I checked relevant specs and manuals of 50 fujifilm cameras released since 2010. - Each focus point is displayed as a square frame around focus point, not rectangle. - These squares makes a grid that covers photos almost entirely (with some exceptions that I will explain but they don't effect our calculations). - So, for example, if we take height of the image, and divide by how many squares are there vertically on the grid, we can find size of of each square relatively to height of the image! Aspect ratio -> width x height of grid of squares: 3:2 -> 13 square x 9 square 16:9 -> 13 square x 7 square 1:1 -> 9 square x 9 square 4:3 -> 11 square x 9 square 5:4 -> 11 square x 9 square Conclusion: - As you can see, ratio of grid dimension and aspect ratio of image almost matches. So squares almost covers the image. - Then for simplification, we can assume squares covers the image entirely. Then dividing size of the image by number of squares, we can find size of a square. - The for simplification of this, we can assume short side of the image is always equal to 9 squares (it's true with the exception of 13x7 but the smaller 1/9 is still ok there anyway) - So then size of square should be best estimated as following: width or height of square = min(image width, image height)/9 If you think this makes sense, let's take this as starting point and improve as we go through tests. Exceptions: - There is a setting to choose finer grids with half the size squares. For example 3:2 aspect ratio has 25x17 grid option in settings. However, then square focus frame we draw will be very small and not very meaningful to check focus areas by eye. - For first generation older cameras, grid doesn't cover image fully sometimes. However, it doesn't matter because square size is still same! For, example, they use 13x7 grid instead of 13x9 grid for 3:2 aspect ratio BUT each square is still approximately sized as 1/9 of shortest side of image. - I am sure there are other exceptions but this is how much I figured out by my research. Git commit 60e23f305b0c6e0aab868265b86768f748ab5e21 by Maik Qualmann. Committed on 12/08/2025 at 04:20. Pushed by mqualmann into branch 'master'. think better calculation of focus point size M +8 -6 core/libs/metadataengine/focuspoint/focuspoints_extractor_fujifilm.cpp M +1 -1 core/libs/metadataengine/focuspoint/focuspoints_extractor_panasonic.cpp https://invent.kde.org/graphics/digikam/-/commit/60e23f305b0c6e0aab868265b86768f748ab5e21 To focus-point@mailinator.com I currently rebuilt the MacOS PKG Intel and Silicon packages for the 8.8.0 version including last changes from Maik, Files will be online in on hour at this place : Silicon: https://files.kde.org/digikam/ Intel: https://files.kde.org/digikam/legacy/ Best regards Gilles Caulier I tried different combination of focus settings and reached following conclusions: TLDR whichever focus shape and size settings in camera I tried, fujifilm always returns single pixel location in metadata AND in playback screen camera always uses the same fixed sized square frame to indicate focus area. So we need to draw the same square around pixel location irregardless of focus settings highlights different size and shapes. Fujifilm has a feature called "focus check" that let you zoom into focused area in playback screen. This feature can help us to determine the size of the frame we need to draw around focus pixel. I first tried camera setting of focusing on "single point" only to determine focus frame size around the focus pixel. There is 3 sizes to choose for single point size settings. However, whichever size I choose in settings, "focus check" always zooms into middle size. This is the size I will assume best for drawing focus frame around focus pixel. I have tried many combination of focus settings to see how they effect area we need to draw frame around as well as metadata they return. However, all setting combinations returns single focus pixel location AND the size of the focused frame is the same in "focus check"! So, even if focus setting is "zone" or all screen "wide" with multiple green squares highlighted while shooting, fujifilm still returns single focus pixel location in metadata and still shows the same medium sized square focus frame in the "focus check" on playback screen! So, even if multiple green focus points highlighted while shooting, only one of them is selected focus point! There is some metadata about focus zone settings but they are irrelevant since we only need to draw single point, not bigger inactive zone. I also tried "AF-S", "AF-C", face/eye/subject AF focus settings with combination with these. They too only return single focus pixel location in metadata with the medium square sized focus frame in "focus check" in playback screen (except there is face/subject recognition frame but digikam has this feature). So after these metadata and size checks of combination of focus settings, I will only generate test samples with AF-S and single point focus area (with the same medium size as camera's "focus-check" feature frames) I will also send you raws but I checked heics has same metadata as jpeg, so I will only send jpegs. Thank you for building this for me to test. I will check samples I generate on 8.8 before sending them. Only warning from my initial test: when "Focus Mode" in MakerNote is "Manuel", focus pixel location has no meaning or function. Even if I place it on out of focus area, it just returns the pixel location of the marker (the one is used for AF-MF) but it has no relation about where camera is focused. We may still draw it or we can hide it on manuel focus. Thank you for your efforts until now! Test is ready! To pass the test, red ball should be completely inside the red frame we draw. Red frame shouldn't be touching the red ball! Since we don't want to cover focused area with lines of red frame that can hinder people seeing focused area fully, it's better to have larger frame that doesn't touch the ball at all than tighter frame. When I tested myself on 8.8 you sent me, my feedback is: - Well done! Red frame positioning is correct even with different aspect ratios and positions of focus point. - Frame size needs to be bigger! You only need to increase 1/12 ratio in the code until you pass the test. You can try from 1/10 to 1/6 until it passes. High likely 1/6 will work best! - Also, see my warning about manuel focus in my previous messages. To determine the size of our red frame, you can also see screenshot of the camera. My measurements of screen and photos says we should consider 1/7 or 1/6. Here is the link valid for 7 days until 19th: https://sendgb.com/8XHejD2Qldt How test is created: As I explained rationale in my previous messages, fujifilm's have a feature to zoom-in to the focused point in playback screen. I determined focus frame size exactly matching with this feature. Then all my test photos I fit this red ball exactly inside this frame. Also, I shoot each photo with shallow DOF where only red ball will be in focus. and zoomed in each photo in digikam to double check nothing else is in focus. Git commit faa6c0afef9f98ba4b098d2ad07b3d8bff879892 by Maik Qualmann. Committed on 14/08/2025 at 05:54. Pushed by mqualmann into branch 'master'. better calculation of the focus point size at Fujifilm FIXED-IN: 8.8.0 M +1 -1 NEWS M +5 -5 core/libs/metadataengine/focuspoint/focuspoints_extractor_fujifilm.cpp https://invent.kde.org/graphics/digikam/-/commit/faa6c0afef9f98ba4b098d2ad07b3d8bff879892 Thank you, I tested latest 8.8 build with my personal photos too and it works well but sometimes it's a bit smaller than focused area like ~10% To make it perfect before 8.8 release, I have last 2 small requests if you wish: 1. Replace "(width+height) * 5.5/100" formula "now" with "better" formula "min(width, height) * 15/100" - I measured screen with ruler to understand perfect relative proportions. - Focus frame is always 6x6mm square, more exactly 6.30 with the frame lines. - I measured screen size cropped for different aspect ratios - Here is square size NOW VS BETTER ~= Actual: 3:2 -> 62x41mm ---- 5.66 VS 6.15 ~= 6.30 1:1 -> 41x41mm ---- 4.51 VS 6.15 ~= 6.30 4:3 -> 55x41mm --- 5.28 VS 6.15 ~= 6.30 5:4 -> 52x41mm --- 5.11 VS 6.15 ~= 6.30 16:9 -> 62x35mm -- 5.33 VS 5.25 ~= 6.30 2. When "FocusMode" is "Manual", don't draw any AF frame - Because it's meaningless in all example manually focused photos I tried. It just show random location marker stays from auto modes. - Maybe add this to if statement on line 92 as an additional condition, so it doesn't add af point to list if it's manual focus. - It's still ok to keep it if you see some reason for this such as AF-MF Thank you until now and if you take time to perfect it, great thanks! Are you measuring the size of the focus points on the camera display? We used the calculation method you favored before, but I found it less accurate, for example, in the 16:9 format. That's why I used the current method. I can implement your suggestion again so you can compare. It's also conceivable to have a fixed size for each camera model; if the model isn't specified, it will be calculated. Maik Thank you so much for your time and attention on this issue! Yes I measured the proportions of screen since both camera display and sensor has the same aspect ratio 3:2. I am sure after tinkering many ways to give you best input. Let's try "min(width, height) * 15/100". I will be checking here today frequently to give you feedback quickly. I also noticed 16:9 is most problematic with any formula but this formula gives similar size as current formula. In my research going through manuals and specifications of 50 cameras in last 15 years, current calculations we do should be working fine with the almost all of them and some of them roughly. I guess if someone else raises issue about this in the future version of digikam, we can see what we can develop further. I found out that LR plugin also uses similar formula for cameras they don't put effort to measure exact size (such as fujifilm and panasonic). However, they let user choose generic ratios in settings (than our own measured one 15/100). `math.min(Width, Height) * prefs.focusBoxSize` For example, they have database of exact focus point sizes of many camera models (many specific models of nikon and pentax). Some other brands like canon gives focus point size in metadata (that I wish all brands do) So, after we finalize this soon, our implementation will support Fujifilm a lot better than Lightroom! Code: https://github.com/musselwhizzle/Focus-Points/blob/dcb392eb3c70696e48b67ddf4500076d9c5d7ea4/focuspoints.lrplugin/DefaultPointRenderer.lua#L461 Git commit 9e4516eaec71bd02810aa8fcd03bb6cbae10e211 by Maik Qualmann. Committed on 16/08/2025 at 10:25. Pushed by mqualmann into branch 'master'. use suggested calculation of focus point size at Fujifilm M +1 -2 core/libs/metadataengine/focuspoint/focuspoints_extractor_fujifilm.cpp https://invent.kde.org/graphics/digikam/-/commit/9e4516eaec71bd02810aa8fcd03bb6cbae10e211 Thank you so much for your efforts in last 5 days. Now it's working great! I tried with many of my private photos with shallow DOF today and everything is perfect now! We can now close the issue! Thank you so much again Maik and Gilles! |