Overscan calibration script

Scripts and programs to automate Astroart
Post Reply
Forum_2017
Posts: 275
Joined: 10 Dec 2018, 16:23

Overscan calibration script

Post by Forum_2017 »

I am interested in adding an Overscan calibration function to my imaging script. It is easy to read the overscan mean inside a downloaded image which includes the overscan area. The following script can do the job :

Sub overscan_avg (xmin,xmax,ymin,ymax) ' Measure Overscan mean
oN=0 ' Pixel count
ovscAVG=0 ' Overscan mean value
for ox=xmin to xmax
for oy=ymin to ymax
ovscAVG=ovscAVG+Image.GetPixel(ox,oy)
oN=oN+1
next oy
next ox
ovscAVG=ovscAVG/oN
endsub

The number of pixels to be read is normally limited to a few thousands and the script is fast enough.

Now the problem I am facing is to update each single pixel in the image area subtracting the overscan mean just calculated in order to get an overscan calbrated image. Another subroutine can do the job:

Sub subtract_ovsc (x,y) ' Subtract overscan mean (+fixed offset)
for oix=1 to x
for oiy=1 to y
print oix, oiy
pxvalue=Image.GetPixel(oix,oiy)
pxvalue=pxvalue-ovscAVG+ovscOFFSET
Image.SetPixel(oix,oiy,pxvalue)
next oiy
next oix
Image.Update
endsub

But now the number of pixels are millions (10 millions for me) and the routine takes minutes to be completed being absolutely unusable in a full automatic imaging script.

Any idea or suggestion?
Is it possible to have a new script command capable of adding/subtracting a calculated value to the current image in a very fast way, like the native command present in tha Astroart Math menu?
Thanks
Emilio

Forum_2017
Posts: 275
Joined: 10 Dec 2018, 16:23

Re: Overscan calibration script

Post by Forum_2017 »

Hello, is the subtract_ovsc to be done to the full image? If yes, it could be done with a new single command.
What is a reasonable processing time?

Meanwhile, Printing every pixel is very slow, the following example is much faster (one minute).
(also, the Camera User Interface 6.2 is 2X faster than 6.0 in these kind of scripts).

Code: Select all

Sub subtract_ovsc (x,y) 
  for oiy = 1 to y
  print oiy
  for oix = 1 to x
    pxvalue = Image.GetPixel(oix,oiy)
    pxvalue = pxvalue - ovscAVG + ovscOFFSET
    Image.SetPixel(oix,oiy,pxvalue)
  next oix
  next oiy
  Image.Update
End Sub

Forum_2017
Posts: 275
Joined: 10 Dec 2018, 16:23

Re: Overscan calibration script

Post by Forum_2017 »

Thanks Fabio,
yes the full image is interested by the re-writing process. IMO a process time less than one minute is acceptable at least when the exposure time for the single sub-frames is a few minutes long. Furthermore the process time for subtract_ovsc subroutine, or better a specific single command, could be masked replacing some "pause(t)" command somewhere necessary in my script for HW/SW syncro.

Looking to the future it will be great if the overscan calibration will be included into the standard AA processing features both for manual and script processing.
Please let me know if you have any other idea.
Emilio

Post Reply