Coder Social home page Coder Social logo

musselwhizzle / focus-points Goto Github PK

View Code? Open in Web Editor NEW
335.0 37.0 41.0 63.62 MB

Plugin for Lightroom to show which focus point was active in the camera when a photo was taken

License: Apache License 2.0

Lua 0.76% Perl 98.98% Shell 0.02% Raku 0.24%
lightroom lightroom-plugin camera nikon af-point photos cameras-support lua focus focuspoint

focus-points's Introduction

Focus Points

A plugin for Lightroom to show which focus point was active when the picture was taken.

Screenshot

Supported Cameras

  • Canon cameras
    • all EOS and point and shoots.
    • 7D Mark ii, 5D Mark iii, 5D Mark iv, 350D, 40D, 50D, 60D, 70D, 80D, 7D, 5D, etc,
    • Powershot G12, G16, G1X, G5X, IXUS 310 HS, SX30, SX40 HS
  • Nikon
    • D7100, D7200, D700, D800 (possibly D810 and D800E), D5500, D5300, D5200, D300
  • Sony E-Mount cameras
    • Full Frame
      • α7 III
      • α7R II, α7R III, α7R IV
      • α9, α9 II
    • APS-C
      • α6100, α6400, α6500, α6600
  • Fuji cameras
    • all recent X bodies (X-T2, X-T1, X-T10, X-Pro2, X-Pro1, X-A3, X-A2, X-A1, X-A10, X-E2S, X-E2, X-E1, X100T, X30, X70, etc)
  • Olympus cameras
    • (Should work on recent E-* bodies)
  • OM System cameras
    • OM-1, OM-5
  • Panasonic cameras
  • Pentax (full list)
    • Tested
      • K-50, K-S1, K-5 II, K-5 IIs, K-5, K-30, K-7, K20D, K-r, K200D, K10D, K110D, K100D Super, K100D, *ist DS2, *ist DS, *ist D
    • Working, but missing features
      • K-1, K-3, K-3 II
    • Untested, but should work:
      • KP, K-70, K-S2, K-500, K-x
  • iphone and ipad

Installing

Installation steps

  1. Use the green button in this webpage called "Clone or download".
  2. Extract the zip and (optionally) rename the folder from "focuspoints.lrdevplugin" to "focuspoints.lrplugin"
  3. Move this folder to where you'd normally kept your Lightroom plugins.
  4. Open Lightroom and go to File -> Plug-in Manager. Then click the "Add" button and select the folder
  5. Once installed, in Library mode with a photo selected go to "Library -> Plug-in Extras -> Focus Point" or alternatively (also in Develop mode) "File -> Plug-in Extras -> Focus Point".
  6. Windows only: Select the display scaling factor. Use the same or similar to the Windows configuration (Settings -> Display -> Scale). The default is 100%.

Screenshot

Supported AF-Points

Currently, 5 types of AF-points will be displayed :

  • AF selected in focus The AF-Point is selected and in focus
  • AF selected The AF-Point is selected
  • AF in focus The AF-Point is in focus
  • AF selected in focus The AF-Point is inactive
  • AF selected in focus A face was detected by the camera at this position

Screenshot

Please note that not all cameras save the needed information in the Exifs of the photo. Thus, the accuracy of the displayed points will greatly depend on whether or not your camera supports it.

Metadata viewer

The plugin also features a metadata viewer with live search. This comes in handy eg. for viewing information like FocusDistance from Maker Notes section, which Lightroom doesn't read and display via its UI. The information is fetched (by Phil Harvey's exiftool) directly from the image file on disk so that this gives the full picture of metadata written by the camera:

Screenshot Screenshot

Adding your own camera

It's very likely your camera is already supported. So try the plugin first before doing anything. :)

If your camera reports its focus points dynamically, adding support for you camera should be easy. Simply update or create a new CameraDelegate which extracts the focus points. Update the PointsRendererFactory so it knows about this new camera.

If your camera does not report its focus points dynamically, such as in the case of Nikons, this should be as painless as possible. You will need to map all of your camera's focus points to pixel coordinates. Refer to the "focus_points/nikon corporation/nikon d7200.txt" as an example.

-- 1st column
B1 = {810, 1550}
C1 = {810, 1865}
D1 = {810, 2210}

-- an so on

The best way I found to do this was to set up a ruler/tape measure, get out my camera and I took a photo at each of the focus points lining it up exactly with the 1-inch mark. I then imported those pictures into Lightroom and ran this plugin so I could see the metadata. From the metadata, I could see the focus points name. I then took the image into photoshop and measured from the top left corner of the image to the top left corner of the focus point. I compared the preview from the camera to my photoshop selection and got as close as possible. Once you have done all of that, add the file to "focus_points/{camera_maker}/{camera_model}.txt" using all lowercase. Then all is done.

The camera model must only contain characters valid on all supported file systems. If a character is not valid (for example '*' in the model "PENTAX *ist D") it must be mapped to a valid character combination. The mapping is done in PointsUtils.readFromFile(): '*' -> '_a_'.

If 2 or more cameras share a common points mapping, simplying add that to the list of known duplicate as in the NikonDuplicates file. With this, both Nikon D7100 and Nikon D7200 will share the same mapping file.

Known Issues

  1. Not compatible if photo was edited in Photoshop. 3rd party tools often remove the necessary metadata from the image.

Contributing as a Developer

Please see the Contributing.md file before being any new work.

Special Thanks

There's been a lot of man-hours put into this effort so far. All volunteer. So help me in thanking the individuals who has worked hard on this. First off, thanks for Phil Harvey for providing the 3rd party library ExifTool. The following is a list of the individual contributors on this project. These guys have fixed bugs, added camera support, added face detection, added support for your iphone, and many other cool features. (If you are a dev and I've missed you, please feel free to update this file or add your real name):

rderimay, philmoz, project802, jandhollander, DeziderMesko, StefLedof, roguephysicist, ropma.

Full list can be seen here.

License

Copyright 2016 Whizzbang Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

focus-points's People

Contributors

amluk avatar andydragon avatar capricorn8 avatar jandhollander avatar jfitzell avatar marcisme avatar musselwhizzle avatar project802 avatar rderimay avatar ropma avatar rthochbe avatar stefledof avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

focus-points's Issues

Dialog window too tall - 'Ok' button is hidden in some cases.

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

Support for Sony NEX-6 and a6000

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.

Nikon AF Points Used (none) doesn't fall back correctly

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.

Expand the logger

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.

Canon 5D - focus box positions is not quite right

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:

  • 50D, 7D & 5D3 - can use either "Canon Image Width/Height" or "AF Image Width/Height"
  • 5D - need to use "Canon Image Width/Height"
  • 40D - need to use "AF Image Width/Height"

screen shot 2017-01-07 at 8 00 23 pm

Inconsistencies, question mark chars and truncated values

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)

Considerations if moving from Exif txt to json

Exiftools can output the metadata in a json format. Some things to consider

screen shot 2017-01-09 at 9 57 39 am

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.

Pentax K-1 support

Hi, to add support for the Pentax K-1, I suggest oyu do the following (I am not sure how to do this here):

  1. add a directory called "RICOH IMAGING COMPANY, LTD"
  2. add a file called "PENTAX K-1.txt" in that folder
  3. add the following text in that file:
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.

Plugin menu does not show up

The plugin is correctly recognized and activated but to menu item shows up in the Lightroom > Plugins - Extras menu :-(

Unknown key: "orientation"

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.

Not working on Mac

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.

Help Knubbel on windows

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.

Canon - Y axis revisited

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.

canon_powershot.txt

The plug-in description script (Info.lua) is missing

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.

Plugin Fails on Windows. An internal error has occurred.

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?

Panasonic GX85

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.

01-0922-P1010619.RW2.zip
screen shot 2017-11-01 at 9 25 28 am

R&D: Use command output instead of intermediary file

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.

Extra content in bin/exiftool directory

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.

  • arg_files
  • Changes
  • config_files
  • fmt_files
  • html
  • Makefile.PL
  • MANIFEST
  • META.json
  • META.yml
  • perl-Image-ExifTool.spec
  • t

Panasonic GX8

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.

FeatReq: AF-Point size and graphics type selectable in GUI

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)

Alphabetize "Show Metadata"

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.

Refactor metadata to be a table rather than a string

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"

Does not support live view contrast detect AF on Nikon

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.

Support for Canon 60D cameras

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.

photo:getRawMetadata("orientation") fallback for LR 5

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

Focus Points Plugin clips on Windows

The plugin mostly works on windows, minus this clipping issue (see screenshot). I'm not sure there's any way around this other than using imagemagick to bypass Lightroom rendering.

screen

Canon - Y Axis is inverted

Line 94 of CanonDelegates.lua should be:
local y = (imageHeight/2 - afAreaYPositions[key]) * yScale

Tested on images from 40D, 50D, 7D, 5D & 5D3.

Fuji focus point wanders during heavy crop

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.