Image Aberration Viewer

Scripts and programs to automate Astroart
Post Reply
User avatar
Rudi
Posts: 160
Joined: 08 Jan 2019, 04:47

Image Aberration Viewer

Post by Rudi » 22 Oct 2024, 12:12

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
/Rudi

Deapsky
Posts: 4
Joined: 24 Apr 2019, 14:21

Re: Image Aberration Viewer

Post by Deapsky » 01 Nov 2024, 10:39

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

Didier Vothy
Posts: 2
Joined: 25 Dec 2023, 19:43

Re: Image Aberration Viewer

Post by Didier Vothy » 04 Dec 2024, 05:41

Nice script Thx very much !
it work with success in AA9 i confirm
Didier

Post Reply