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

add new highlight tool #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

afontenot
Copy link

Hi, hope you don't mind receiving pull requests from a random user on Github.

I'm using colorist on Linux to generate simple visual reports on HDR images (as a quick way of seeing what parts of the image are out of gamut or overbright). You have a tool that can do this (Vantage), but it appears to rely on some Windows and Mac specific stuff so I couldn't get it running on Linux. Plus I didn't really want / need a GUI for this task. And from my brief testing on Mac, there didn't appear to be any way to save a PNG image to use as a static and easily sharable representation of the image.

Anyway, cribbing heavily from code I found elsewhere in Colorist, I added this capability as a new command, highlight. Because it doesn't generate a full report like Vantage it's very fast to run, handling a 4K input file in just a few seconds for me.

I'm sending this pull request in case you'd like to add this function to Colorist. I discovered Colorist through a Netflix blog post (which didn't mention it by name), but I suspect many others may do the same and generating static reports like this one with a command line tool seems like a useful function to me.

A follow up commit might print the highlight stats to the terminal. This depends on whether I have time to work on it.

@joedrago
Copy link
Owner

If you were curious, You can always try checking out a version of colorist prior to October 11th and building that. I used to have a "report" commands that generated a really cool HTML report that you probably would really enjoy. I could see resurrecting it if there was actually a need for it. It basically was the original vantage as far as HDR reports go, and just needed a browser.

@afontenot
Copy link
Author

That is really neat! I will probably play around with that a little. It's much more than I need most of the time, and there doesn't seem to be any easy way to get a PNG out of it, but it is nice to have the results in the browser.

@afontenot
Copy link
Author

Quick question: I'm using clImageMeasureHDR to create the image I'm saving with this code. Is there any way to get the same function to use the gamut from an arbitrary ICC profile to generate the report, instead of just sRGB? Or an easy way to modify it to allow for that?

@joedrago
Copy link
Owner

Interesting question.

The only two things this is really measuring is overbright luminance (over some arbitrary choice for SRGB luminance), of which the threshold is one of the arguments to clImageMeasureHDR(), and saturation. I'm currently using a hardcoded, static constant BT709 gamut named srgbPrimaries, but if you changed that plumbing to pass through everywhere I have srgbPrimaries to be another argument, I suppose that'd give you the data.

How "oversaturated" is a pretty weird concept. You might have figured this out already, but it might be worth explaining. I'm currently returning a range of 0-2 from calcSaturation(). A value between 0-1 means you're inside the "inner" gamut (currently hardcoded to be srgbPrimaries), and a value from 1-2 means you're past the inner gamut and on the way to the outer gamut's edge. a value of ~1.0 is right on the inner gamut's edge, and a value of ~2.0. If you were to generate a gradient that went from the white point to max saturation, you'd see it move in a straight line across the gamuts, and you'd see the saturation value progress from 0-2.

These distances are normalized twice; once from 0-1, and once from 1-2. This makes things a little bit odd as a saturation value of 1.5 as a wildly different "raw distance" in xyY space depending on the hue.

I guess as long as you understand what these values mean and you choose an inner gamut other than BT709 that is completely inside of the image gamut, it could still be interesting info.

image

saturation_green
saturation_magenta

@joedrago joedrago added the backlog Still in consideration; low priority label Mar 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Still in consideration; low priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants