question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

OpenCV implementations of adjust_hue and adjust_saturation

See original GitHub issue

Great repo. But it seems that adjust_hue and adjust_saturation functions are exactly the PIL implementations (PyTorch official implementations). I wonder are there OpenCV implementations for these two functions, since the adjust_hue is rather slow, and adjust_saturation is a little slow when compared with adjust_contrast and adjust_brightness functions.

In my testing cases, given one 224x224x3 input, adjust_contrast takes about 188 µs, adjust_saturation takes about 2.33 ms, and adjust_hue takes about 6.99 ms.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jbohnslavcommented, Jan 7, 2019

I’ve done a quick check, and the way in which PIL and OpenCV calculate HSV from RGB images is quite different. This will make a 1->1 conversion between adjust_hue in PIL and OpenCV not possible.

image

0reactions
yxchngcommented, Jul 5, 2019

@cleardusk I tried your solution and it is not as good as Pillow’s version. It gives a lot of bad artifacts like this:

Screenshot from 2019-07-05 09-46-02

Read more comments on GitHub >

github_iconTop Results From Across the Web

kornia.enhance.adjust
This implementation follows PIL convention. The input image and factor is ... [docs]class AdjustSaturation(Module): r"""Adjust color saturation of an image.
Read more >
Changing Colorspaces - OpenCV
In this tutorial, you will learn how to convert images from one color-space to another, like BGR \leftrightarrow Gray, BGR \leftrightarrow HSV, etc....
Read more >
Automatic color correction with OpenCV and Python
Implementing automatic color correction with OpenCV · The path to the --reference image contains the input scene in the “ideal” conditions to ...
Read more >
How to adjust Brightness, Contrast, Sharpness and Saturation ...
Example 2: How to adjust Contrast. ImageEnhance.Sharpness(). Example 3: How to adjust Sharpness. ImageEnhance.Color(). Example 4: How to adjust Saturation.
Read more >
Changing the contrast and brightness of an image using Python
In this article, we will see how we can implement our theory in a beautiful code using OpenCV Python,. Before starting let's try...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found