-
|
I've been looking but haven't been able to find a function that would increase the contract of an Image, is that possible? |
Beta Was this translation helpful? Give feedback.
Replies: 18 comments 5 replies
-
|
@tielur I'm just about to release 0.34 that includes |
Beta Was this translation helpful? Give feedback.
-
|
Perfect, can't wait to use it! |
Beta Was this translation helpful? Give feedback.
-
|
Actually I had a few minutes and committed an initial implementation so you are welcome to try it out if you configure |
Beta Was this translation helpful? Give feedback.
-
|
You might find |
Beta Was this translation helpful? Give feedback.
-
|
@kipcole9 thanks for the mention of autolevel/1, I'll have to give that a try. I did test out Image.contrast. It seems similar to what brightness does at least with my white background with black text. I'm not sure how other tools work but I think they may be using the hisogram when considering what the "max" contrast is? For example if you open up an image in macos preview and grab the constrat to max it doesn't turn the whole image white |
Beta Was this translation helpful? Give feedback.
-
|
I'm also not entirely sure what may be happening but I noticed if I increase the For example: |
Beta Was this translation helpful? Give feedback.
-
|
The implementation is based upon the "standard" contrast calculation which is to multiply the pixels by a contrast factor and then clamp them to the range of the original image format (8 bits per channel for sRGB). This is documented, for example, at https://docs.opencv.org/2.4/doc/tutorials/core/basic_linear_transform/basic_linear_transform.html Given the naive implementation, large contrast factors will definitely push everything to white. A better solution will be to use vips_tonelut which is a curves-based contrast adjustment and much more useful. I'm thinking that:
|
Beta Was this translation helpful? Give feedback.
-
|
I could implement a very RGB specific contrast function but I'm wary of ending up with too much implementation tied to that colourspace. On the other hand, if the naive contrast function isn't useful that's no good either. I'll be curious how |
Beta Was this translation helpful? Give feedback.
-
|
I will implement Contrast Limited Adaptive Histogram Equalization on the train to work this morning. That might be a good solution for "auto" contrast too. |
Beta Was this translation helpful? Give feedback.
-
|
After some more review I'm thinking of the following family of functions:
My main concern is that these functions are hard to comprehend unless the user has some knowledge of image processing. I'd welcome any suggestions on how to improve cognition and maybe refactor the functions to be more approachable. |
Beta Was this translation helpful? Give feedback.
-
|
Maybe they could be called:
That seems more digestible to me. Thoughts? (sorry for lots of commentary on my Monday morning). |
Beta Was this translation helpful? Give feedback.
-
|
How about:
|
Beta Was this translation helpful? Give feedback.
-
|
As of now on
Unless you have a better alternative I will go ahead and refactor these functions into a single Feedback and suggestions most welcome. |
Beta Was this translation helpful? Give feedback.
-
|
I have added one more function and I think it's the one you'll find most useful: I don't plan any more contrast related functions for now unless you see a particular requirement. I'm going to work on creating histogram images now and then release - hopefully by the end of week. I suspect you'll find the histogram imaging useful in your work. Exampleiex> i = Image.open! "./test/support/images/Singapore-2016-09-5887.jpg"
%Vix.Vips.Image{ref: #Reference<0.3121742381.1532100637.44636>}iex> {:ok, i2} = Image.apply_tone_curve i, shadows: -10, highlights: 10
{:ok, %Vix.Vips.Image{ref: #Reference<0.3121742381.1532100637.44650>}} |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for all your hard work @kipcole9, I'm going to be getting back into updating our image processing pipeline soon so I'll let you know! Looks like a lot of new functions to play with though! |
Beta Was this translation helpful? Give feedback.
-
|
Since you are a print shop I will also add, for the release next week:
|
Beta Was this translation helpful? Give feedback.
-
|
I've added |
Beta Was this translation helpful? Give feedback.
-
|
In summary, all the new "toys" you can play with. They aree primarily contrast, or contrast-related (from the changelog): Enhancements
|
Beta Was this translation helpful? Give feedback.


@tielur I'm just about to release 0.34 that includes
Image.brightness/2andImage.saturation/2.Image.contrast/2is targeted for the next release (currently on about a bi-weekly release schedule). Hope that's ok for you? I'll update here with I pushed a commit with an implementation.