Nokia Imaging SDK Gotchas – Hue Value Range

As mentioned in a previous post we recently switched our in-house made photo effect framework to the Nokia Imaging SDK.

The Nokia SDK provides a hue saturation adjustement.

The constructor has the following signature:

public HueSaturationFilter(
    double hue,
    double saturation
)

 

Both values have a [0,1] range, but are not further documented.

When I tested the filter, I used photoshop to make a hue adjustement on any image. Then I transferred the values from photoshop into my code, ran it with the same image and then compared the outputs.

The resulting images didn’t look the same at all!

So began my search for the problem…

The photoshop dialog for hue and saturation looks like this:

 

Untitled

 

The hue value range here is [-180,180]. So you would just need to divide by 180 to get a [-1,1] value range, right?

Wrong.

The hue value range for the Nokia filter is inverted.

A hue value of 180 in photoshop corresponds to a -1 for the Nokia SDK.

Use this formula to transform the photoshop hue into the one for the nokia filter:

nokiaSdkHue = photoShopHue / -180

For the saturation the photoshop value simply needs to be divided by 100, no negation needed.