Page 1 of 1

Image Aberration Viewer

Posted: 22 Oct 2024, 12:12
by Rudi
A while ago, I asked Fabio if he could create a function in Astroart to generate 3x3 panels for analysis, including star shape analysis. Since I don't think Fabio has had time to work on it, and because he recently released a new version of Astroart with very fast GetPixel/SetPixel script functions, I implemented it myself.

Load the script into Astroart, select an image, and run the script.

Disclaimer: I'm not done testing AA9, so I'm not 100% sure, that the function isn't already in AA :oops:

ImageAberrationViewer.txt:
https://www.dropbox.com/scl/fi/bglukxgd ... 04ar&raw=1

https://youtu.be/xpFxJ4mzndw

Code: Select all

' Author: Rudi Bjørn Rasmussen, Svendborg, Denmark

' Set this value to the wanted width in the final analysis result image.
' The final height is automatically calcuated
resultWidth = 640  ' <=== only change this value if needed
'----------------------------------
' Script below, do not alter

if Image.Width < resultWidth then
  resultWidth = Image.Width
endif

' Work on a duplicate
Image.Duplicate

scaleFactor = resultWidth / Image.Width

' dimensions of the image to be analyzed
width = Image.Width
height = Image.Height


dx = width / 3
dy = height / 3

rDx = dx * scaleFactor
rDy = dy * scaleFactor


' copy bits for the 3x3 panels
'    px0       px1       px2
'     +----+    +----+    +----+
' rDy | Q02|    | Q12|    | Q22|
'     +----+    +----+    +----+  py2
'
'     +----+    +----+    +----+
' rDy | Q01|    | Q11|    | Q12|
'     +----+    +----+    +----+  py1
'
'     +----+    +----+    +----+
' rDy | Q00|    | Q10|    | Q11|
'     +----+    +----+    +----+  py0
'       rDx       rDx       rDx

' panel x coordinates
px0 = 0
px1 = (width - rDx) / 2
px2 = width - rDx

' panel y coordinates
py0 = 0
py1 = (height - rDy) / 2
py2 = height - rDy

' BitBlt panels
BitBlt(px0, rDx, py0, rDy, 0, 0)      '  Q00
BitBlt(px1, rDx, py0, rDy, rDx, 0)    '  Q01
BitBlt(px2, rDx, py0, rDy, rDx*2, 0)  '  Q02

BitBlt(px0, rDx, py1, rDy, 0, rdY)      '  Q10
BitBlt(px1, rDx, py1, rDy, rDx, rDy)    '  Q11
BitBlt(px2, rDx, py1, rDy, rDx*2, rDy)  '  Q12

BitBlt(px0, rDx, py2, rDy, 0, rdY*2)      '  Q10
BitBlt(px1, rDx, py2, rDy, rDx, rDy*2)    '  Q11
BitBlt(px2, rDx, py2, rDy, rDx*2, rDy*2)  '  Q12

Image.Zoom(100)

' Crop image to the 3x3 panels
Image.Crop(0,0,rDx*3,rDy*3)

' Grid lines
gridHalfWidth = 2

' Horizontal grid lines
for x = 0 to rDx * 3
  for dy = 0 to gridHalfWidth * 2
    Image.SetPixel(x, rDy - gridHalfWidth + dy, 0)
    Image.SetPixel(x, rDy*2 - gridHalfWidth + dy, 0)
  next dy
next x

' Vertical grid lines
for y = 0 to rDy * 3
  for dx = 0 to gridHalfWidth * 2
    Image.SetPixel(rDx - gridHalfWidth + dx, y, 0)
    Image.SetPixel(rDx*2 - gridHalfWidth + dx, y, 0)
  next dy
next x

' Update result image
Image.Update


' Copies bits from _x0 to _x0+dx ; _y0 to _t0 + _dy to _xDest ; _yDest
sub BitBlt(_x0, _dx, _y0, _dy, _xDest, _yDest)
  for _i = 0 to _dx
    for _j = 0 to _dy
      _red = Image.GetPixelR(_x0 + _i, _y0 + _j)
      _green = Image.GetPixelG(_x0 + _i, _y0 + _j)
      _blue = Image.GetPixelB(_x0 + _i, _y0 + _j)

      Image.SetPixel(_xDest + _i, _yDest + _j , _red, _green, _blue)
      
    next _j
  next _i
end sub

Re: Image Aberration Viewer

Posted: 01 Nov 2024, 10:39
by Deapsky
Hi Rudi,

very nice script for MSB-Astroart and I can confirm that it is working in AA9 as well.

With my best regards
Peter

Re: Image Aberration Viewer

Posted: 04 Dec 2024, 05:41
by Didier Vothy
Nice script Thx very much !
it work with success in AA9 i confirm
Didier

Re: Image Aberration Viewer

Posted: 05 Dec 2024, 05:23
by Rudi
Thanks for the feedback Peter and Dieder! I'm glad You find the script usefull.

What I meant by this:
Rudi wrote:
22 Oct 2024, 12:12
...
Disclaimer: I'm not done testing AA9, so I'm not 100% sure, that the function isn't already in AA :oops:
...
was that I asked Fabio for such a function, build in to Astroart, and that I hadn't had the time yet, to test if it was indeed already included in AA9.
It isn't, Fabio told me, so creating the script wasn't a waste of time (coding necer is btw, it's fun!)

Re: Image Aberration Viewer

Posted: 06 Dec 2024, 17:40
by AstroBernd
Hello rudi,
very nice and helpful. Is it also working with a color image (RGB)?
Appreciate you sharing this work!
Bernd

Re: Image Aberration Viewer

Posted: 09 Dec 2024, 05:27
by Rudi
Thanks Bernd - yes, I have tested the script with both color and monochrome images, seems to work fine with both, when your working on r, g and b channels.

Re: Image Aberration Viewer

Posted: 10 Dec 2024, 09:43
by AstroBernd
Re-tested today with both BW and RGB-images. Works well as it should.
Thanks again
Bernd