Ruchi Kothari
Ruchi Kothari

Reputation: 1

Apply Color lookup table on image using Lumia Imaging SDK

Is there any way to read color lookup table and apply it onto source image by using Lumia imaging sdk or any other alternative is available?

Thanks in advance!

Upvotes: 0

Views: 103

Answers (3)

Ruchi Kothari
Ruchi Kothari

Reputation: 1

Thanks for response!

Our problem statement and usecase is different, what we want to achieve is that we have a .png image which is a 3D lookup table having ARGB values which we want to apply pixel by pixel on to the target image.

PFA Lookup table image.

It would be a great help if you can suggest us or give a code sample or snippet to read a lookup table and apply the ARGB values on the target image.

Currently we are try the solution suggested by David of RGBMixerEffect and ARGBColorCurves. But we are not sure how to convert the lookup table png to ARGB so that we can use any of the above alternative suggested by David.

Upvotes: 0

Jayden
Jayden

Reputation: 3286

Is there any way to read color lookup table and apply it onto source image by using Lumia imaging sdk or any other alternative is available?

The UWP does not provides control to read color. You can use ColorPicker to pick the color that you want. The ColorPicker provides SelectedColor property to get the selected color.

The Lumia Imaging SDK provides many class to change the effect of the image. From the Lumia Imaging Effect table, it seems you want use ColorAdjustEffect to adjusts the RGB color composition of the image.

You can set the ColorAdjustEffect.Blue,ColorAdjustEffect.Green and ColorAdjustEffect.Red.The range of these properties is from -1.0 to 1.0. Also you can set the Color.R as a value between 0 and 255.

As a work round, you can convert the range from [-1,1] to [0,255] with a not accurate method.

For example:

In XAML:

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <Grid.RowDefinitions>
        <RowDefinition Height="*"/>
        <RowDefinition Height="3*"/>
        <RowDefinition Height="auto"/>
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="*"></ColumnDefinition>
    </Grid.ColumnDefinitions>
    <Image Name="OriginalImage" Grid.Row="0" Width="200" Height="200"></Image>
    <xc:ColorPicker Name="MyColor" SelectedColorChanged="ColorPicker_SelectedColorChanged"  Grid.Row="1" Grid.Column="1"></xc:ColorPicker>
    <SwapChainPanel x:Name="SwapChainPanelTarget" Grid.Row="1" />
    <Button Grid.Row="2" HorizontalAlignment="Center" Content="Button" Click="Button_Click"></Button>
</Grid>

In code behind:

private async void ColorPicker_SelectedColorChanged(object sender, EventArgs e)
{
    var r = MyColor.SelectedColor.Color.R * 2.0 / 255 - 1;
    var g = MyColor.SelectedColor.Color.G * 2.0 / 255 - 1;
    var b = MyColor.SelectedColor.Color.B * 2.0 / 255 - 1;
    _colorAdjustEffect.Red = r;
    _colorAdjustEffect.Green = g;
    _colorAdjustEffect.Blue = b;
    m_renderer = new SwapChainPanelRenderer(_colorAdjustEffect, SwapChainPanelTarget);
    await m_renderer.RenderAsync();
}

Screenshot(gif):

enter image description here

Upvotes: 0

David Božjak
David Božjak

Reputation: 17645

There is no Lookup table effect in Lumia Imaging SDK. That said, depending on your need you can probably achieve the effect you need by using RGBMixerEffect It uses a collection of ARGBColorCurves to map one color to another.

It might be some work to set up all the curves, but you should be able to achieve your desired effect.

Upvotes: 0

Related Questions