musselwhizzle / focus-points Goto Github PK
View Code? Open in Web Editor NEWPlugin for Lightroom to show which focus point was active in the camera when a photo was taken
License: Apache License 2.0
Plugin for Lightroom to show which focus point was active in the camera when a photo was taken
License: Apache License 2.0
The Y co-ordinate for Canon DSLR cameras is now correct (positive towards the top of the image).
However it seems for some (maybe all) Canon P&S cameras the Y co-ordinate goes the other way :(
Tested on G12, G1X & G5X raw images.
I've attached a patch that fixes this for the above 3 cameras only.
Hi,
I have D7200 and Lightroom and tried installing this plugin. However, whenever I try to view focus point or show metadata, I get this error:
An internal error has occurred. Couldn't open file "C:\users\username\pictures\dsc_2714-metadata.txt" for reading
This happens with all my NEF files. Is there something I'm doing wrong?
For the Olympus E-5 and also for E-M5 Mark II there are no error reports in the dialog windows but also no focus boxes shown in the last window shown by the plugin after calculation.
Currently the app only logs as logger.warn. make 4 methods
logVerbose, logInfo, logWarn, logError
and set a logLevel property as global.
logLevel = 1
logWarn(message)
if (logLevel >= 3) then
logger.warn(message)
end
end
if would be nice if logLevel was controlled by the plugin manager so clients could choose their log levels.
musselwhizzle 14 hours ago โข edited Owner
This method isn't available in LR 5. what are we going to do about LR 5 users? Just make the plugin work on LR 6 (current) and above?
Would be nice to check for the version and fall back to the metadata orientation at least so we can still support LR 5.
@rderimay 9 hours ago Contributor
Mh. I think in case getRawMetadata("orientation") returns NIL, we could simply default back to the old method of checking using the exifs.
I'll make an issue for that, please assign it to me and I'll take care of it
Pull request coming...
I've started some work on Canon support, but it probably should be a lot cleaner than what's currently in place. I found that all the information for the which focus points are selected, which are in focus, and the exact coordinates are all in the EXIF on my Canon 60D. Since that's not exactly the most modern Canon at this point, I would venture the same or better information can be found in newer ones.
I documented what the EXIF data looks like and created a map file for the Canon 60D coordinates in a branch, if someone is interested in using it to add broader Canon support based on this. It should be easy to generate maps of any Canon camera that has similar AF data to mine automatically.
See my branch at https://github.com/neilschelly/Focus-Points/tree/canon-60d
I'd be happy to answer any questions or supply any sample images if it would be helpful to someone motivated to continue this work.
Not sure, this is possible, but I will find it handy if the user could change the current image while leaving the Focus Point dialog open.
refactor
Hello.
Nice job, and as per subject, I'd like to see support for those cameras. If nobody has objections, I'd fork and try the patch myself.
Notes: I'm a very experienced programmer and in the past I've also done a lot of reverse engineering work with EXIF and RAW metadata manipulation. Unfortunately I don't have experience in LUA. So, while I'm willing to try it, I can't be sure I'll be good on that. My message is: if somebody else wants to start working on the Sony support, please don't be blocked supposing I'm already near to provide a solution.
The plugin is correctly recognized and activated but to menu item shows up in the Lightroom > Plugins - Extras menu :-(
Exiftools can output the metadata in a json format. Some things to consider
If using json, this will change the format display to the user in the metadata dialog. "AF Aperture" will now read as "AFAperture". This is not as user friendly. What does the real raw display as? Apparently exiftool is formatting it one way or another.
in json, it has strings and numbers. Will this parse well enough? In non-json, everything is treated like a string.
in json, it will output the binary chars \u000 chars which it seems the txt output doesn't handle. If this were to happen, would need to truncate the lines so it doesn't wrap or ideally just replace the entire line with (Binary data)
It was mentioned that if using json, could make a table of chars rather than looping over them. However, lua supports key names with spaces. This is perfectly legit code to lua
local t = {}
t["hello world"] = "hi"
t["another space"] = "spaces"
for key,value in pairs(t) do print(key,value) end
Using a table rather than loops would be a lot more efficient since multiple keys need to be found. This idea is independent of the format and only discussed here as it was brought up as a supporting point for json.
I just found and installed this plug-in this morning. The lightroom plug in manager says it's installed and running but it doesn't show up in Plug-In Extras like the documentation says. I'm running Lightroom CC 2015.12 release on a Late 2015 27" iMac running Sierra 10.12.6.
As far as the installation I downloaded the zip file, unzipped it, and found the folder called focuspoints.lrdevplugin and renamed it to focuspoints.lrplugin, moved it with the rest of my Lightroom plugins and used Plugin Manager to add it.
Not sure about the displayed Focus Points with the GX8. I have some samples where the Focus Point (based on Face Detection) was on the Eye. Most of the time I get a Focus Point displayed in the center of the Picutre.
See attached screen shot (LR at top, DPP at bottom). The scaling for the focus boxes is not correct, resulting in the boxes being displayed at the wrong place in the image.
Changing lines 31 & 32 in CanonDelegates.lua (new_ideas branch) as below fixes this.
local imageWidth = ExifUtils.findFirstMatchingValue(metaData, { "Canon Image Width", "Exif Image Width" })
local imageHeight = ExifUtils.findFirstMatchingValue(metaData, { "Canon Image Height", "Exif Image Height" })
I have also checked this for 40D, 50D, 7D and 5D3. For the 50D, 7D & 5D3, "Canon Image Width" == "AF Image Width" and "Canon Image Height" == "AF Image Height". For the 40D the "Canon Image Width" and "Canon Image Height" values are incorrect.
Results:
branch the code based upon the OS. the mac version is very wide for the first column
Nikon D7100 can use the points from the D7200. Allow the code to handle this.
During a heavy crop, the focus point wanders a little bit off. It's possible it's related to the focus point dimens not being the correct size, or that the focus box is treating the point at top,left rather than as the middle point which is probably is.
Hi, to add support for the Pentax K-1, I suggest oyu do the following (I am not sure how to do this here):
focusPointDimens = {300, 250}
-- numbers are makernotes:AFPointSelected (0x000e AFPointSelected)
-- top row
1 = {2787, 1832}
2 = {3235, 1832}
3 = {3672, 1832}
4 = {4120, 1832}
5 = {4565, 1832}
-- upper row
6 = {2361, 2145}
7 = {3235, 2145}
8 = {3672, 2145}
9 = {4116, 2145}
10 = {4565, 2145}
11 = {4990, 2145}
12 = {4990, 2145}
-- center row
13 = {1900, 2450}
14 = {2350, 2450}
15 = {2787, 2450}
16 = {3223, 2450}
17 = {3687, 2450}
18 = {4120, 2450}
19 = {4560, 2450}
20 = {4994, 2450}
21 = {5446, 2450}
--lower row
22 = {2346, 2780}
23 = {2787, 2780}
24 = {3231, 2780}
25 = {3664, 2780}
26 = {4120, 2780}
27 = {4560, 2780}
28 = {4986, 2780}
-- bottom row
29 = {2794, 3100}
30 = {3235, 3100}
31 = {3650, 3100}
32 = {4105, 3100}
33 = {4553, 3100}
I assume it is necessary to change/enhance the core code of the plugin dependend on manufacturer, since for Pentax cameras, the relevant focuspoint information is stored in the metadata called "makernotes:AFPointSelected" (0x000e). This is different from the Nikon metadata field.
Joshua, maybe you tried that before or you know the answer immediately.
For now, when we extract the Exif, we create a file "-metadata.txt" beside the original photo.
I feel this to be not ideal because of all possible problems we could get into like read only directory, shared folder, etc.
Maybe we can find a way to read directly from the command output instead of creating a temporary file.
I just installed it as instructed on OSX Sierra and it fails to run.
Plug-in error log for plug-in at: /Volumes/media/reagle/f/photo/lightroom/focuspoints.lrplugin
**** Error 1
An error occurred while attempting to load this plug-in.
The plug-in description script (Info.lua) is missing.
Sorry, but something is going backwards here. I do get the 3 day old error on windows again, which was solved before:
"An internal error has occurred. Couldn't open file "...-metadata.txt" for reading".
This happens with both packages mentioned above.
And I put both the plugin in a path without any blanks in it and put the image itself in C: root, so that can not be the cause.
Obviously I can not proceed to test any of the nice newer stuff you have done.
It would be nice if the show metadata was in abc order. Perhaps exif tool allows a -flag which controls the order. Perhaps it needs to be sorted in code.
Using photo https://github.com/project802/Focus-Points-Sample-Images/blob/master/Nikon/D800/D800-C9-90deg.NEF
when a user rotates the photo during a crop, the focus point is off. See screens for reference
Using latest windows-fix branch on windows.
Used test file http://216.18.212.226/PRODS/canon-80d/FULLRES/YIMG_1587-ISO100.JPG
Error:
"An internal error occured: [string "DefaultDelegates.lua"]:55: attempt to index local 'selectedFocusPoint' (a nil value)"
ShowMetaData.lua:98
maxLabelLength should be maxLabelsLength
On my D800 while using live view, you can select an arbitrary focus point for contrast detection instead of having to use the AF sensor points. In this case, the plugin doesn't parse the required metadata for displaying the AF point.
I recommend copying the default delegate parser into a Nikon delegate file and add this support to the getAfPoints() function.
Please assign to me so I can submit a PR on a feature branch for this issue.
is it actually possible to cancel the actions?
Wanted to test the plugin on windows. Metadata display works fine.
But impossible to show focus points, as there is an internal error pop-up "Unknown key: "orientation""
Used zip file from entry screen downloaded some minutes ago.
The calculation of the photo size in the dialog window (FocusPointsDialog.calculatePhotoDimensions), should check if the photo size fits in the calculated content size.
Depending on the aspect ratio of the LR window compared to the image dimensions this can result in the dialog being larger than the screen height, and the 'OK' button is not visible.
Patch attached, this also increases the content size slightly to use more of the screen.
windowsize.txt
The files/folders listed below aren't needed for the exiftool runtime in the bin directory. As far as I can tell there are no constraints/restrictions on including exiftool that would require these to be included. This would trim 10MB from the plugin.
There's a new bug that's been introduced with the new code. If a photo was shot at "Rotate 90 CW" and then cropped from what's the human bottom, left the focus point is wrong.
I assume this will be related to #128, but I just tried this on my GX85 and I'd think the focus point should be on my eye, given I used facial detection, but it is not. Unfortunately, I know nothing about this stuff, but I love the idea of this program.
The metadata dialog can be improved by using JSON as export format from exiftool and adapting a few methods.
I had already implemented in some PR but would separate it as feature in one PR so it is easier to merge :-)
(And with the sorting like the current master as I understood that the majority does not like the categories)
Line 94 of CanonDelegates.lua should be:
local y = (imageHeight/2 - afAreaYPositions[key]) * yScale
Tested on images from 40D, 50D, 7D, 5D & 5D3.
On image DSC_1332.NEF (the guardian) the AF Points Used is "(none)". Primary AF Point is the fallback but labeled as "C6 (Center)". The focus point is not found because "C6 (Center)" is not a real point. Strip out the word center.
This is not an issue, just a feature request (I did not know where else to put this):
The display of AF points in the viewfinder often does not realistically represent the size and coverage of where the camera does actually measure phase detection. Some people might prefer the rectangle shown in the viewfinder and others - especially for this plugin - might prefer to see what portion of the image was really covered by the chosen AF point in total (which usually is way more than what the viewfinder suggests).
For reference check the first blue graphics about the difference in this article: https://www.learn.usa.canon.com/resources/articles/2014/spot_AF.htmlp
Therefore I suggest to add the following two options in the plug-in's GUI in lightroom (the GUI you access under plugin manager):
a) provide the option to either choose a rectangular shape (similar to viewfinder display) or a cross-shape (actual cross type sensor coverage)
b) provide a percentage scaling factor for the size of the displayed graphics, so every user can choose to increase the size of the display to his liking (e.g. increase a cross AF display to cover the realistic area)
Currently the metadata is read from a file and returned as a string. Any method that then needs the metadata must create it's own table from it. Instead, in DefaultPointsRenderer, convert this string into a table of key, value pairs and store it. (Note, dont do this in the metadata viewer as converting to a table will throw out duplicate key names). The metadata table (and not string) should then be passed to methods and not the string metadata.
E.g.
local metadata = {}
metadata["AF Point"] = "C6"
metadata["Focal Length"] = "30mm"
Let's update the readme file to be more explicit about what canon cameras we support.
When an image is edited in photoshop and saved back out as a .tif, the focus point information is lost. Look for the original file and try to get the metadata off of that.
Whenever the user chooses to rotate his picture in the grid mode, the current algorithm ignores it.
I found a way to get the info from lightroom and would like to implement it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.