Author Topic: PSJR Reading pixels values from image  (Read 2584 times)

Offline dave_galera

  • PixInsight Addict
  • ***
  • Posts: 261
    • QDigital Astro
PSJR Reading pixels values from image
« on: 2019 July 31 10:58:04 »
Hi,

I am playing with PSJR and want to scan an image pixel-by-pixel, process the pixel value and then create a new image with the processed pixel values.

I am using this to read line to read the pixel values from the source image:
        target_img.setSample( parseFloat( r_value ), x, y, 0);
        target_img.setSample( parseFloat( g_value ) ), x, y, 1);
        target_img.setSample( parseFloat( b_value ), x, y, 2);

I am reading the source image pixel value using the line:
        source_img.sample(x,y)

BUT......this only returns a single value like 0.12549019607843137, so my question is how do I get the distinct R, G and B values using the sample() method as there is no way to specify which channel the sample is refering to, or exactly is this value for an RGB image.

I have looked in the documentation, on the web and in other scripts but cannot find the answer, I am probably approaching the problem from the wrong direction so any help would be appreciated.

Thanks in advance.....
Dave

Offline dave_galera

  • PixInsight Addict
  • ***
  • Posts: 261
    • QDigital Astro
Re: PSJR Reading pixels values from image
« Reply #1 on: 2019 July 31 12:42:54 »
OK think I have sorted it, sample has a channel parameter i.e. sample(x,y,c)
Dave

Offline Niall Saunders

  • PTeam Member
  • PixInsight Jedi Knight
  • *****
  • Posts: 1456
  • We have cookies? Where ?
Re: PSJR Reading pixels values from image
« Reply #2 on: 2019 August 01 13:26:14 »
Check my Batch DeBayer script for MeadDSI i cameras (frim many years ago) - specifically the comments that I added throughout.

Even if the code is no lonfer appropriate, those comments may help you to develop your own PJSR iideas.
Cheers,
Niall Saunders
Clinterty Observatories
Aberdeen, UK

Altair Astro GSO 10" f/8 Ritchey Chrétien CF OTA on EQ8 mount with homebrew 3D Balance and Pier
Moonfish ED80 APO & Celestron Omni XLT 120
QHY10 CCD & QHY5L-II Colour
9mm TS-OAG and Meade DSI-IIC