Shifting a set of images by a given shift (dX,dY) depending on image

Scripts and programs to automate Astroart
Post Reply
christian viladrich
Posts: 3
Joined: 11 Feb 2024, 19:30

Shifting a set of images by a given shift (dX,dY) depending on image

Post by christian viladrich » 11 Feb 2024, 19:43

Hi,

I am at the very beginning of my leaning curve about scripts. So, I have a number of questions ...

I would like to shift a set of images (image-1.fit, image-2.fit, image-3.fit, ..., image-i.fit) by a given shift (X, Y)(i), the value of each shift (X,Y) dependant on the image number i.

I know how to read and write images using : Image.Open() and Image.Save()

I have seen it is possible to shift an image by calling Image.Macro(n) with Macro (n) calling the Shift function.

But I don't know how to use different (X,Y) values for the different images. In other words, is it possible to call a "Image.Shift" function with a given (X,Y) parameter depending on the image number i ?

Thanks for your help !

Christian

Dunmunro
Posts: 232
Joined: 10 Jan 2019, 01:11

Re: Shifting a set of images by a given shift (dX,dY) depending on image

Post by Dunmunro » 12 Feb 2024, 15:32

christian viladrich wrote:
11 Feb 2024, 19:43
Hi,

I am at the very beginning of my leaning curve about scripts. So, I have a number of questions ...

I would like to shift a set of images (image-1.fit, image-2.fit, image-3.fit, ..., image-i.fit) by a given shift (X, Y)(i), the value of each shift (X,Y) dependant on the image number i.

I know how to read and write images using : Image.Open() and Image.Save()

I have seen it is possible to shift an image by calling Image.Macro(n) with Macro (n) calling the Shift function.

But I don't know how to use different (X,Y) values for the different images. In other words, is it possible to call a "Image.Shift" function with a given (X,Y) parameter depending on the image number i ?

Thanks for your help !

Christian
Are you trying to make a mosaic?

einari
Posts: 46
Joined: 28 Jan 2019, 10:46

Re: Shifting a set of images by a given shift (dX,dY) depending on image

Post by einari » 13 Feb 2024, 09:34

Would be interesting to know what you are trying to achieve.

christian viladrich
Posts: 3
Joined: 11 Feb 2024, 19:30

Re: Shifting a set of images by a given shift (dX,dY) depending on image

Post by christian viladrich » 13 Feb 2024, 21:29

Indeed, I fogot about the context. So, here are some information. It is about processing solar eclipse images.

Basically, processing total solar eclipse images involves three steps :
(1) - registration of images with respect to the solar corona (and not lunar disk, because of the relative motion Sun/Moon),
(2)- "optimal" stack,
(3)- "visualisation" of the HDR stack.

These operations can be more of less elaborated (see for example PhD thesis of Hanna Druckmuller).

I am currently trying to have step (1) semi-automatic. The approach is the following :
- a : registration of images with respect to the lunar disk = Sobel filter in AA (= detection of contour) + Hough transform (for finding position X, Y of lunar disk) : this part is already largely automatic,
- b : calculation of the relative shift X(i),Y(i) to be applied to each image i accordingly to ephemerids (to compensate Moon/Sun relative motion)
=> this means reading the header of each file(i) to get acquisition time and run the appropriated calculation : this is done in EXCEL (for now),
- c : shift each file (i) by the proper amount X(i), Y(i) : this is the part I want to make automatic, using scripts in AA
=> inputs : list of files and list of X(i), Y(i) shifts to be applied to each file (i).

As I am at the very begining of the leaning curve about AA scripts, I surely make good use of some helps :-)

Thanks guys !
Last edited by christian viladrich on 14 Feb 2024, 20:05, edited 1 time in total.

fabdev
Posts: 495
Joined: 03 Dec 2018, 21:43

Re: Shifting a set of images by a given shift (dX,dY) depending on image

Post by fabdev » 14 Feb 2024, 16:23

Hello, the script command is Image.Shift(dx,dy) . On a group of images there could be three solutions:

1) A script which opens, process and saves images, maybe using FindFiles(...)
2) A script from a template: menu Templates / Selected images, (menu from the script window).
3) A script to be applied with the Apply Script Window, see the attached screenshot:

christian viladrich
Posts: 3
Joined: 11 Feb 2024, 19:30

Re: Shifting a set of images by a given shift (dX,dY) depending on image

Post by christian viladrich » 14 Feb 2024, 20:04

Great ! Thanks for the directions Fabio.
Christian

Post Reply