melix / astro4j

Astronomy libraries for Java
Apache License 2.0
27 stars 4 forks source link

In batch mode, it would help if we can specify the crop size in pixels for easier workflow for stacking #352

Closed smart-underworld closed 1 month ago

smart-underworld commented 1 month ago

I typically use batch mode to pre-process my scans for stacking. However, I noticed the crop factors provided do not result in the same image dimensions. This becomes a pain point since I would like to stack these images to get better detail. One suggestion is to allow to define a pixel count for the length of the crop so that all cropped images can be processed easier by AS3 or AS4.

melix commented 1 month ago

You can already do this, by using a script. For example, the following script will perform auto-cropping then stacking of images automatically and generate several images (eclipse, doppler, ...):

dopplerShift=3.1
cropFactor = 1.2
alignment=64 # This makes sure that autocrop aligns widths on a multiple of 64

[outputs]
base=autocrop2(rl_decon(avg(range(-1;1;.5)));cropFactor;alignment)
red=autocrop2(rl_decon(img(-dopplerShift));cropFactor;alignment)
blue=autocrop2(rl_decon(img(dopplerShift));cropFactor;alignment)
cont=autocrop2(continuum();cropFactor;alignment)

[[batch]]
stacked=ellipse_fit(stack(base))
stacked_red=ellipse_fit(stack(red))
stacked_blue=ellipse_fit(stack(blue))
stacked_cont=linear_stretch(pow(stack(cont);1.8))
cst=sharpen(asinh_stretch(linear_stretch(pow(stacked;1.8));200;2))
eclipse=asinh_stretch(disk_fill(stacked);200;8)
doppler_base=linear_stretch(saturate(rgb(stacked_red;avg(stacked_red,stacked_blue);stacked_blue);1.1))

[outputs]
continuums=draw_text(draw_obs_details(stacked_cont);2400; 64; "Continuum")
jsolex=draw_obs_details(auto_contrast(stacked;1.5))
compo=draw_obs_details(max(eclipse;cst))
doppler=draw_obs_details(doppler_base)
eclipse_doppler=draw_obs_details(linear_stretch(disk_fill(doppler_base)))

Please refer to the docs for a list of possible options, in particular take a look at the autocrop2 function.

melix commented 1 month ago

and here's a video with an explanation: https://youtu.be/xxs2blZSJkY

melix commented 1 month ago

Closing. Feel free to reopen if you think I misunderstood.