Author Topic: How can I apply a pixel math transform based on 16bit integer  (Read 2538 times)

Offline gvanhau

  • PixInsight Old Hand
  • ****
  • Posts: 345
Hello
I have a formula I want to apply to a image, but the formula is based on 16bit integer math.
for instance y=0.0104x + 2032.

Since images are converted to 0-1 scale in PixInsight, I'm a little confused.

Regards
Geert
Geert Vanhauwaert

Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2172
  • Join the dark side... we have cookies
    • http://www.astrophoto.cl
Re: How can I apply a pixel math transform based on 16bit integer
« Reply #1 on: 2015 September 16 19:46:19 »
Just use:
y= (0.0104x + 2032)/65535
Regards,

Carlos Milovic F.
--------------------------------
PixInsight Project Developer
http://www.pixinsight.com

Offline mschuster

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1087
Re: How can I apply a pixel math transform based on 16bit integer
« Reply #2 on: 2015 September 16 20:59:42 »
Maybe x needs to be scale up to 16-bit?

(0.0104 * 65535 * $target + 2032) / 65535

Offline gvanhau

  • PixInsight Old Hand
  • ****
  • Posts: 345
Re: How can I apply a pixel math transform based on 16bit integer
« Reply #3 on: 2015 September 17 05:38:46 »
Thank you Juan and Mike.

After posting y thought it could be   y=0.0104x + 2032/65536 , very simmilar to what Mike posted (if simplified).

Is it 65535 or 65536 (2**16)

Regards
Geert
Geert Vanhauwaert

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: How can I apply a pixel math transform based on 16bit integer
« Reply #4 on: 2015 September 17 06:01:50 »
Hi Geert,

The PM expression that you need is probably:

0.0104*$T + 2032/65535

since 0.0104 looks like a scaling factor, and 2032 is an additive pedestal expressed in pixel units.

It is 65535, since you are rescaling from [0,216-1] to [0,1]. For a given number of bits n, 2n-1 is the largest n-bit unsigned integer.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline gvanhau

  • PixInsight Old Hand
  • ****
  • Posts: 345
Re: How can I apply a pixel math transform based on 16bit integer
« Reply #5 on: 2015 September 17 07:56:15 »
Many thanks for the clarification Juan

Regards
Geert
Geert Vanhauwaert