Repository navigation
vectorscope variant for histogram - #8005
Conversation
|
A few other notes: The vectorscope is currently drawn to a pretty large (350x350 px x 1 byte alpha) buffer. This can probably be shrunk (and made a power of 2). But the buffer size doesn't make much of a difference for optimization. The buffer is square, hence very out-of-gamut colors will visibly clip on the left/right of the display unless the right panel is very narrow. It's possible to fix this, but I'm keeping things simple for now. Here's an example of a clipped display: The position of the "graticule" dots depends on the primaries of the histogram profile. So the image above is made with an sRGB histogram profile. For comparison, here is Adobe RGB: And here is Rec 2020: Also, in looking at the code, I realize that some of the waveform math can be moved from the drawing to the processing code. I added a comment about that, and will look into that after this PR. |
|
A few other notes:
|
|
This is some nice stuff. Perhaps my only thought is that it might be extremely useful to start from some of the more canonized plots such as 1976 perhaps? Even if something like JzAzBz proved to be useful beyond the crazy behavior it can exhibit at points, the more “standard” plots are likely hugely valuable? |
Thank you!
It should be trivial to do that, either as a view option via button (just to see the difference for now), or just to switch over. And it might even be faster! I'm happy to try this, for the sake of experimenting. I'm seeing this PR as a way to get baseline usable code (which would include a sensible colorspace), and there'll need to be follow-up refinements.
I didn't know about this! Are there good examples? I'm assuming crazy not in a positive sense. |
|
Because it is a nonlinear encoding, as values go downward things can go completely bonkers, especially in the case of non-physically plausible primaries. I think it goes bonkers high too. On the other hand, 1976 is a pretty decent baseline, and has familiar patterns such as where a ColorChecker 24 ends up etc. Easier to plot gamut triangles on as well! |
This makes a lot of sense. I added a commit with CIELUV space. It looks much better to me. Right now there's a button (with dummy icons) to switch between JzAzBz and CIELUV, but I wonder about dropping JzAzBz altogether. Also, it's over 2x faster to calculate in CIELUV (about 0.015 sec. vs. 0.040 sec. for JzAzBz). There are some other questions, for the future...
|
|
I added "icons" to differentiate CIELUV and JzAzBz plots, and re-re-oriented the JzAzBz plot to be as in the screenshots above. I do realize that at this point adding a CIE 1931 xy chromaticity view probably makes sense, as it's another well-known way to see color... Also probably worth thinking about whether to scale the vectorscope to fit the histogram primaries (as now) or use an "absolute" scale if this is a "canonized" plot. |
|
I'm seeing an OS X build error: Somewhat mystified as to what this means... |
|
It's from another recently merged PR. Really PRs shouldn't be merged with CI failures, that's the whole point of CI... |
Ah! Good to know. I see that 4f0b668 added the suspect line |
|
Nice work Dan. It might be worth drawing the spectral locus on 1976, given it holds meaningful horizon limits. Colour coding the locus?
Correct.
It’s one of the nice sides of 1976 is that it has a direct perceptual-like connectivity to 1931 / 2012; the spectral locus remains intact, as does any area gamut triangle. Be warned that the canonized CIE XYZ to xyY and likewise XYZ to 1976 Luv will fail with many contemporary camera virtual primaries due to negatives. To properly account for negatives, use the absolute, and return the sign after calculations. |
|
Thank you, helpful... It's nice to see the CIE 1931 xy plot with the spectral locus -- and indeed the xy coordinates do make a nice gamut triangle. I also appreciate that every bit of color math/data I need is already somewhere in the darktable source. It's nice to see how clipping works in the top image (w/Adobe RGB profile, in this case). These screenshots have a dot for the white point made by feeding (1,1,1) through the profile matrix to PCS. Unfortunately (presumably because that always emerges in D50) the white point is always calculated as D50, even with ProPhoto. So one piece is missing, and hence the graph is still suspect. |
|
Given you selected 1931 (2012 should also be an option, which I suspect @aurelienpierre may have added and has the corrected response in shorter wavelengths) it is worth putting an extremely wise quote from one of the colour deities here. From Giorgianni and Madden’s canonical tome:
|
Ah, but imagine seeing a wall decoration with color values from your very own image included on a canonical graph! But yes, it's a good caution... |
|
This is growing in scope (really, no pun intended), but perhaps the way to go is to split this into two varieties new modes:
A hope of these plots would be to give users a way to understand what sort of math/model is working on their image, not least with some of the newer tools (thinking of color balance rgb...). As an example: The curves tool has been so important not just because it runs fast and allows for subtle changes, but also because of how it can be visualized by a histogram -- such that histograms are often even drawn as part of the tool. Even if we're cautious about the scope being 1:1 with the image, it at least has a close relationship to tools which work on the image... |
|
@Nilvus Thank you for looking it over, and glad for the positive report. I think the code as-is is fine, with the code master..c1d1814 being the most stable. The two following (and most recent) commits add a new feature (chromaticity diagram with gamut plot) which still needs a bit more fleshing out and maybe some color math fixes. I'm not sure if I should roll back those two commits from this PR and work on them separately, or if they could be part of this PR with the caution that they're not-yet-for-precision-work. |
0fa78c1 to
8202aa4
Compare
|
This PR should be ready for further review. I rolled back two commits to get rid of the chromaticity diagram code, and added a commit with cleanups. The main user-visible change is that the cross-hair in the center of the vectorscope is brighter: I've some mixed feelings about this, as I don't want to make this seem a tool to get neutrals to a particular target... I'm also referring to the two views as I'll work on another branch to get the chromaticity diagram code right, but didn't want to be endlessly fiddling with this PR. |
|
Just ping when it's ready for review and one of janitors will remove "wip" label :) |
|
@johnny-bit Thank you! Yes, please do remove the "wip" label, whomever might do such work! (I think I finally cracked the whitepoint problem to make a "correct" chromaticity diagram. But I'm working on that in another branch. There's more than enough in this PR to look at, between UI code changes and adding the vectorscope view.) |
|
Great work Dan, thank you for bringing this functionality to DT. Would it be possible to get the skin tone line into this? It would be great to try this with a colorchecker card. |
Thank you! Still not merged -- or even fully review -- of course. This PR makes for a relatively big diff.
It's certainly a recurring discussion. See #4149 (comment) and #4149 (comment). It's deeply tricky territory: doesn't seem supported by color science, biology (is dermatology biology?), can get into rough political/cultural territory fast, and besides all that goes against what makes these scopes actually interesting. The more I get into this, the exciting thing about these scopes seems to be a visual representation of the mass of #'s which iops (especially recent additions) work on, which gives another angle onto what these tools can do, and how they can do the work.
Yes... See screenshots at #8005 (comment) (from a lousy JPEG), though the real interest will be to see it in a chromaticity diagram (not scaled to histogram profile) such as the second image in #8005 (comment). That code isn't in this PR, though, still working on getting into right. (It probably goes without saying, though, that the "calibrate with a color checker" section of the new "color calibration" iop appears to be pretty amazing and may subsume any external/visual tool.) |
Great! Thank you for testing.
It's a fair point. Histogram profile is also a factor -- a smaller gamut histogram profile such as sRGB will show more range to the graph. Sometimes the lack of deflection of the graph from the center actually is the useful piece of information, not least if the goal is to make something neutral.
I think so. It shouldn't be hard to implement. It's been on my list, so I'll try this.
I've been trying to think this out. My note on it back #8005 (comment) was: "The trick with log scale for radius is it edges into re-thinking CIELUV or JzAzBz...." I'm still not sure on this, but I'd like to try user-controllable (or auto?) scaling before shifting things to log. Here are some examples of what I see here with the current code and histogram profile in sRGB (which does exaggerates chroma). A photograph including an x-rite colorchecker: A landscape (grass, blue sky): And here are a couple which is pretty much lack saturation/chroma: |
|
Looking at the screenshots above also reminds me that I should lighten the backround, as per #8005 (comment):
|
|
Thinking about this a bit more. The "regular" histogram already scales the y axis automatically, and it's pretty seamless/natural. Perhaps that can be a guidepost for this. I'll work on it a bit.... I wouldn't want to lost the visualization of "maximum" chroma for each hue, though. |
Manually do scaling work (except for blitting the actual graph) to allow for future scaling code. Makes line widths in terms of display pixels rather than scope area. Slightly tuned up hue ring draw. Don't leave a dangling subpath. Fancier would be to realize that all indexes into hue ring arrays are sequential, but may run into all sorts of bounds condition trouble then. Also lighten histogram background for darker theme.
Not user/auto-controllable yet -- preset scale factor. Also doesn't yet handle the background gradient. Also, tidy vectorscope variable names: s/vectorscope_display/vectorscope_graph/ s/vectorscope_pt_x/vectorscope_pt[0]/ s/vectorscope_pt_y/vectorscope_pt[1]/ Also tidy comments.
- Shift-scroll changes scroll. - Shift-drag changes scale. - Shift double-click resets scale. Add tooltip to describe shift-scroll and shift-drag.
Add alternating thinner circles between current ones, so that there is some scale visible even when zoomed in. Draw vectorscope background with scale factor. Move vectorscope background drawing code into the main vectorscope draw function to simplify, and to avoid lagginess.
Previously would stroke border then fill background, which overdrew the border. Also: scale vectorscope point sample more cleanly, losing an extra division/multiplication. Also tidy code.
|
More updates, to try to address #8005 (comment) from @TurboGit:
The vectorscope is now scalable via shift-scroll or shift-drag (reset via shift+double-click). I thought about making "auto" scaling by always sizing the graph to fit, but it seems good to keep manual control so that the scale doesn't jump around from image to image. It wouldn't be hard, though, to convert this code to "auto" or add an "auto" option. It would also be possible to make the scope of higher resolution so it offers more detail at high scales. I also updated the vectorscope drawing code. The lines should be a bit more crisp (drawn in whole-pixel units rather than depending on a ratio). I realized that for all scopes (histogram, waveform, vectorscope) the border was never drawn, so I fixed this. I'm actually not sure how much I like it with the border -- this may be something good to turn off. I updated the background of scopes in the "darker" theme from grey_10 to grey_15 as per #8005 (comment) from @Nilvus. This affects all the scopes (histogram, waveform, vectorscope) as well as graphs in various iops: tonecurve, filmicrgb, toneequal, and colorbalancergb. |
The 1:1 scale will now place the edge of the hue ring at the bounds of the scope area. Previously, it placed the maximum radius of the hue ring at the edge, which in the general case of a wider-than-higher hue ring, resulted in a smaller-than-necessary scale with empty space at the top/bottom. Also, draw the border after drawing the rest of the scope, so that it isn't overwritten by the rest of the scope-drawing code. Note that the border in the code as written is effectively 0.5 px. A 1px border would require: cairo_rectangle(cr, 0.5, 0.5, width-1, height-1)
More pleasing automatic scale. Use hard limits for lower/upper scale. TODO: point sample and scaling interaction TODO: remove the manual scaling code
This gives context for the point sample by showing a dimmer version of the entire graph. It also makes more sense for an auto-scaling graph.
Just use the auto-scaling instead.
|
@dtorop : I'm still not 100% convinced by the auto-scaling which most of the time makes the outer colored circle (gamut) outside of the view and so not visible except for some little parts. But I think this can go as-is now. So if you have no more cooking changes on your side I'll merge today for more field testing. Is that ok with you ? |
|
the autoscale is ok, but in my opinion now the ability to rescale to see also the border is lacking. Reenabling the manual scaling mode might be a solution. |
|
And why not a log scale as proposed for standard histogram? A manual scaling will probably require adjustment for each image. |
|
my UseCase: In general the full view is ok to get a overview if colors seems to be ok - especially skin tones. |
I'm happy if this could merge, and then continue to work to improve! The code should be workable/stable. For reference, things on my mind still:
All of these can be subsequent work -- take this list as a roadmap for that.
Yes, losing the outer colored circle is a worry. The hope is to make a scope which "just works" -- for neutral images, the color of the graph and the concentric circle scale are adequate to understand hue/chroma, for more intensely colored images, the hue ring will be a further cue. The outer hue ring does provide a gamut warning, but not a great one, as depending on the lightness of an image color, it can be drawn within the hue ring but be out of gamut. Perhaps one of the inner concentric scale circles could show hue gradations as well, to aid legibility?
I'm open to a manual mode. I'm also happy if that's a further PR, to move this along.
The alternative would be to save the vectorscope scale/pan (for both Luv and JzAzBz mode!) in conf, so it's extra "sticky". Is there a case for someone who wants to work on multiple images viewing the same scope scale/pan? Maybe the scheme would be on new image to "auto" zoom. Then shift-drag can move center, shift-scroll can scale. (But does everyone have a mouse/trackpad which can scroll? Does there also need to be something like ctrl-shift-drag to scale?) Shift + doubleclick returns to auto mode, or maybe cycles: auto fit image graph -> manual -> auto fit hue ring. Perhaps the scale mode would be sticky between images, so it's possible to set up a scale/pan which is consistent between a series of images, but in auto mode, scale would remain auto between images? There are also three unused buttons in the top right, one of them could do this work. I also don't want to over-complicate the UI if there can really be a "just works" solution instead... |
Maybe, i'm also fine with keeping this setting in the session but doubt that needs to be persisted in darktablerc. Then a quick reset to full centered view might be a solution. so my opinion on the UX:
|
|
Ok, so let's merge this now and continue improving all this in separate PR. I'm sure field testing will bring some additional ideas. |
Fabulous! I'll work on interim documentation.
Do tag me @dtorop or link to this PR if (when...) there's a bug or feature request, as I may miss that otherwise.
This all makes sense. I'll give this a moment to see if there's a way to make "auto" is sufficient, but it should be trivial to bring the manual code back in. |
vectorscope variant for histogram














This is a first working pass at a vectorscope variant of the histogram:
Visible changes:
Changes to allow for this:
graph_cyan,graph_magenta,graph_yellow). The primaries use the extant CSS (graph_red,graph_green,graph_blue).Some improvements to make after this PR:
Closes #4149, though it would still be good to refer to all the good ideas in that discussion.