Jump to content

  •  

CNers have asked about a donation box for Cloudy Nights over the years, so here you go. Donation is not required by any means, so please enjoy your stay.

Photo

AstroImageJ software tutorial and macro to download

astrophotography dslr
  • Please log in to reply
14 replies to this topic

#1 Astrofriend

Astrofriend

    Vostok 1

  • -----
  • topic starter
  • Posts: 148
  • Joined: 12 Sep 2015
  • Loc: Stockholm, Sweden

Posted 06 June 2016 - 03:07 PM

Recently I came by the AstroImageJ (AIJ) software. I was looking for something that I could write my own functions in, as I did 20 years ago in Matlab. AIJ looks very promissing and I have now put together my first macros that let me batch load Canon EOS CR2 files and process them.

 

It take advantages of CR2 files overscan region to get an emulation of dark and bias levels. Because the image and dark comes from the same image they allways has a matched temperature and darkcurrent. But it's not induvidual pixel values it's an average value. It has some limtiations but if your camera is of late low noise type, especially the static pattern and you take your images with dithering technique it will works very well, at least in my case.

 

I have already before I started to do experiment with AIJ started to use dithering technique to get rid of those time consuming dark and bias images. Now I can refine this method and get even better result.

 

The macro I have put togehter also demosaic the cr2 file to rggb files and after that handle it more like rgb files from a monocrome camera.

 

Does it sound exiting?

 

See my tutorial here:

http://astrofriend.e...troduction.html

 

I'm in the beginning of AIJ so expect my macros have some bugs and use them by your own risk, have backup of your files!

 

I had or have the Canon EOS 350D, 5D and 6D which I have tested my macro on with positive result.

 

I hope you find it useful or at least interesting !

 

What's even more positive, AstroImageJ is free to download !

 

Follow the instructions in my tutorial where to download and how to install and setup.

 

/Lars

 

 


  • Dennis Sakva, Wford, whwang and 2 others like this

#2 lpn678

lpn678

    Vostok 1

  • -----
  • Posts: 190
  • Joined: 02 Feb 2014
  • Loc: The Jemez Mountains

Posted 04 September 2016 - 04:56 PM

Hi Lars,

I've started using ImageJ for technical image processing at work. I am planning to start experimenting with it for widefield astrophotography. Thanks for posting a link to your tutorial, it will be a handy starting place for me!

Cheers, Levi

#3 Astrofriend

Astrofriend

    Vostok 1

  • -----
  • topic starter
  • Posts: 148
  • Joined: 12 Sep 2015
  • Loc: Stockholm, Sweden

Posted 06 September 2016 - 02:46 AM

Hi Levi,

It will be interesting to hear what you like to work with the AIJ softeware, let us know. You are already working with ImageJ so it sounds promising.

 

I havn't practice very much with AIJ yet, we can't do any obeserving under summertime here in Sweden. But this weekend we got a clear and dark night when we visited a Star Party in Mariestad in Sweden. I took a widefield photo of M13 with my Sigma 150mm APO f2.8 lens, or maybe you mean even shorter focallength when you say widefield?

 

Here you can se the result of it (from date september 3, 2016):

http://astrofriend.e...ar-cluster.html

 

I used AstroImageJ to demosaic, calibrate, align and stack. After that I used Fitswork to combine the color channels. But you can do that as well in AIJ.

 

With my travel mount Star Adventurer I can't do dithering yet, but my polaralign wasn't perfect and that replaced the dithering and it was enough movement to get rid of all hot pixels. I don't do normal dark calibration, then I get a little bit lower random noise. And I don't have to take those boring darkimages that destroy my camera shutter life. For the moment it only works for Canon EOS cameras in my macro for AIJ, I have tested it on Canon EOS 5D, 6D and 350D. Sony and Nikon doesn't look to have that kind of overscan region I need to do this.

 

If you find it interesting you can read more about it here:

http://astrofriend.e...-dithering.html

 

But it's much more efficient when you use AIJ in that process instead of working with Fitswork or other software that do debayering first.

 

BR

/Lars


Edited by Astrofriend, 06 September 2016 - 06:34 AM.


#4 Astrofriend

Astrofriend

    Vostok 1

  • -----
  • topic starter
  • Posts: 148
  • Joined: 12 Sep 2015
  • Loc: Stockholm, Sweden

Posted 18 April 2017 - 05:25 AM

Now I have started next step on the develop of a new macro/function to AstroImageJ (AIJ).

 

This will be a Drizzle align tool. I'm not shure if this will work but I will do an attempt to do it. I have started to collect the mathematical tools that's needed to do this and you can follow it on my homepage if you find it interesting:
http://astrofriend.e...gn.drizzle.html

 

With a Drizzle tool you can get back the resolution you have lost by undersampled images, i.e. high resolution telescope and big size pixels. Google on NASA and Drizzle and you will se how they develop this method for Hubble Space telescope.

 

This is much about matrices and one problem is that AIJ doesn't handle matrices as Matlab do. I have to find a solution to this, nestled loops and other things.

 

/Lars



#5 Astrofriend

Astrofriend

    Vostok 1

  • -----
  • topic starter
  • Posts: 148
  • Joined: 12 Sep 2015
  • Loc: Stockholm, Sweden

Posted 29 April 2017 - 10:07 AM

Today it was a bad weather and I spent the day to collect more information how to do develop the Drizzle function and also wrote some examples how different number of reference points (stars) in the align procedur affect the stacked image.

 

If you find it interesting to read more, visit my homepage:
http://astrofriend.e...ion-matrix.html

 

/Lars


  • lambermo likes this

#6 lambermo

lambermo

    Viking 1

  • -----
  • Posts: 787
  • Joined: 16 Jul 2007
  • Loc: .nl

Posted 30 April 2017 - 05:54 AM

Today it was a bad weather and I spent the day to collect more information how to do develop the Drizzle function and also wrote some examples how different number of reference points (stars) in the align procedur affect the stacked image.

 

If you find it interesting to read more, visit my homepage:
http://astrofriend.e...ion-matrix.html

 

/Lars

Very nice to see this matrix writeup. I'm sure you're having fun with it. I never thought of doing stuff like this with AIJ.

We want More More :)

-- Hans



#7 Astrofriend

Astrofriend

    Vostok 1

  • -----
  • topic starter
  • Posts: 148
  • Joined: 12 Sep 2015
  • Loc: Stockholm, Sweden

Posted 01 May 2017 - 04:03 PM

Hi Hans,

Yes it's very fun to do this. But to transfer this to AIJ will be a challenge, AIJ is very primitive on the matrix side, on the other hand there is a lot of plugins that I maybe can solve part of the problems with, Warp plugins to name some of them.

 

I have updated and corrected where I have found faults since last time:

http://astrofriend.e...ion-matrix.html

 

/Lars


Edited by Astrofriend, 01 May 2017 - 04:06 PM.


#8 Astrofriend

Astrofriend

    Vostok 1

  • -----
  • topic starter
  • Posts: 148
  • Joined: 12 Sep 2015
  • Loc: Stockholm, Sweden

Posted 28 September 2017 - 02:10 PM

Hi,
I have done a small but significant update in my macro to the AstroImageJ editing software.

 

Earlier when creating files after the demosaicing process they very ordered in color order. That caused problem later when try to align comet images or images that moves because of bad polar align. Now the filenames creates so that they will sort by the time when they were taken. Hence just small movements between each image to be align. You can still have the old filename order, just set a parameter in the macro file.

 

This is important in this case because I'm not only align rgb images, I do demosaic rgb images and then them align r, g and b images against each other. This reduce the color aberation from lens optics and atmospheric aberration.

 

You find the new macro here to download and instrcuction how to used it:
http://astrofriend.e...own-macros.html

 

I have also updated the text in different places.

 

/Lars



#9 Astrofriend

Astrofriend

    Vostok 1

  • -----
  • topic starter
  • Posts: 148
  • Joined: 12 Sep 2015
  • Loc: Stockholm, Sweden

Posted 30 September 2017 - 05:37 PM

I did a new complement in the AIJ macro "Calibrated_object files from CR2 files", a flag that let the flat calibration to be on or off.

 

But the big new is that there is a new macro.
The: "Open_DSLR raw files and convert to cfa Tiff 16 bit" (Beta)

 

http://astrofriend.e...own-macros.html

All my three macros are included.

 

With that I hope you can open your files in AstroImageJ whatever DSRL camera you have. If DCRaw can handle the cameras raw file it should work. It opens in batch mode, you don't have to open the files one by one.

 

It opens raw files, and convert to cfa Tiff 16-bit and store under map CFA.

 

I have tested Nikon D3 nef files and Sony A7RII arw files. It looks to work.

 

Note:
You must edit the parameter to the filetype in the macro to your specific camera.

 

Let me know if you if you try this with a non Canon camera.

 

/Lars



#10 xiga

xiga

    Mariner 2

  • -----
  • Posts: 244
  • Joined: 08 Oct 2012

Posted 30 September 2017 - 07:18 PM

Hi Lars

This is great news. I have a Nikon D5300 and I've recently shot some Ha data, and I'm on the lookout for a program, other than DSS, to test calibrating and stacking just the Red pixels. Super Pixel mode in DSS works OK, but there is still some noticeable noise from the G and B pixels creeping in. Will your new macro allow for a way to do this? And if so, do you have any plans to do a tutorial for such a thing? 😉

#11 Astrofriend

Astrofriend

    Vostok 1

  • -----
  • topic starter
  • Posts: 148
  • Joined: 12 Sep 2015
  • Loc: Stockholm, Sweden

Posted 01 October 2017 - 08:49 AM

Hi Xiga,

With my macro:

 

"Open_DSLR raw files and convert to cfa Tiff 16 bit"

 

You should be able to convert your Nikon raw files to a Tiff format that AIJ can read. You do that even with your bias, flats and darks.

 

It has always be a big problem with AIJ that it couldn't read DSLR camera files, now I hope it's not only Canon CR2 files that can be read (converted), all DSLR camera files! Earlier I tried to convert raw files to Tiff files with other softwares, but it didn't always work and to my Canon files I wanted the overscan region wich is a bit special.

 

The other two macros I have made can not be used to Nikon files, only Canon.

 

But there is no need, AIJ have a lot of functions that you can use. I have rewrite part of my tutorial and did a complement with links that you maybe find useful.

 

http://astrofriend.e...own-macros.html

 

There is already built in function to demosaic cfa files in AIJ. I havn't use the built in functions very much myselfe because I wrote my own. Let me know if you came in trouble to demosaic out your red channel.

 

In my tutorial part 4 and 5 is special for Canon, the others should be useful to other's cameras as well.

 

/Lars



#12 Astrofriend

Astrofriend

    Vostok 1

  • -----
  • topic starter
  • Posts: 148
  • Joined: 12 Sep 2015
  • Loc: Stockholm, Sweden

Posted 02 October 2017 - 08:34 AM

These days I have done a Quantum Leap in my progress to have a tool that can give back lost resolution from under sampled images.

 

I tested a plugin that is developed to ImageJ and ImageJ is dedicated to the microscopic world. I didn't think this should work. But cells are a bit galaxy shaped, why not?

 

Plugins to ImageJ should also work in AstroImageJ.

 

I wrote to the developer of Parallel Super-Resolution plugin Piotr.

 

If you find it interesting you can read here what he answered and what I got from my simple test on undersampled M13 images.
http://astrofriend.e...resolution.html

 

Impressed? YES!

 

/Lars



#13 xiga

xiga

    Mariner 2

  • -----
  • Posts: 244
  • Joined: 08 Oct 2012

Posted 05 October 2017 - 07:11 PM

Hi Lars

 

When i try running your "Open_DSLR raw files and convert to cfa Tiff 16 bit" macro but i get the error message below.

I am trying it with my Nikon D5300 .NEF files. I'm able to convert the files ok in IRIS, so i must have the latest version of DCRaw installed.

Any idea what is causing the error?

 

Untitled-1.jpg



#14 Astrofriend

Astrofriend

    Vostok 1

  • -----
  • topic starter
  • Posts: 148
  • Joined: 12 Sep 2015
  • Loc: Stockholm, Sweden

Posted 06 October 2017 - 03:51 AM

Hi Xiga,

 

I'm not sure what the problem is, I don't have a Nikon camera, only tested on raw photos I found on internet.

 

Check if you have the DCRaw IJ plugin installed.

 

See here at the end were to find it:

http://astrofriend.e...stallation.html

 

But if I remeber correct it's already installed from the beginning.

 

Have you edit my macro to use Nikon NEF files?

 

The file:

Open_DSLR raw files and convert to cfa Tiff 16 bit.txt

 

If not, use notepad and change this line:

 

From:

 

filetype = ".cr2";

 

To:

 

filetype = ".nef";

 

Or maybe:

 

filetype = ".NEF";

 

I have never tested if it's sensitive to capital letters.

 

Don't forget the dot "." !

 

I have this because it try to open all files in the directory, even if not a raw file that DCRaw support.

 

It shall show in the log which you have a screendump of, but that part is blocket of the other window so I can't see it.

 

My macro is a bit primitive, so it's a little hand work to get it to adapt for different system. But when done it works mostly by automatic.

 

Your error message say something about CygWin, that's something I use when runnning Linux program on my Windows machine. Do you have a Windows machine and the Windows version of AIJ?

 

Hope it works now, you can always test with the DCRaw plugin direct, it only opens one image, but you shall see if it works. My macro call that DCRaw plugin when doing batch work.

 

/Lars


Edited by Astrofriend, 06 October 2017 - 03:58 AM.


#15 xiga

xiga

    Mariner 2

  • -----
  • Posts: 244
  • Joined: 08 Oct 2012

Posted 06 October 2017 - 08:52 AM

H

 

Hi Xiga,

 

I'm not sure what the problem is, I don't have a Nikon camera, only tested on raw photos I found on internet.

 

Check if you have the DCRaw IJ plugin installed.

 

See here at the end were to find it:

http://astrofriend.e...stallation.html

 

But if I remeber correct it's already installed from the beginning.

 

Have you edit my macro to use Nikon NEF files?

 

The file:

Open_DSLR raw files and convert to cfa Tiff 16 bit.txt

 

If not, use notepad and change this line:

 

From:

 

filetype = ".cr2";

 

To:

 

filetype = ".nef";

 

Or maybe:

 

filetype = ".NEF";

 

I have never tested if it's sensitive to capital letters.

 

Don't forget the dot "." !

 

I have this because it try to open all files in the directory, even if not a raw file that DCRaw support.

 

It shall show in the log which you have a screendump of, but that part is blocket of the other window so I can't see it.

 

My macro is a bit primitive, so it's a little hand work to get it to adapt for different system. But when done it works mostly by automatic.

 

Your error message say something about CygWin, that's something I use when runnning Linux program on my Windows machine. Do you have a Windows machine and the Windows version of AIJ?

 

Hope it works now, you can always test with the DCRaw plugin direct, it only opens one image, but you shall see if it works. My macro call that DCRaw plugin when doing batch work.

 

/Lars

Hi Lars

 

The default AstroImageJ installation puts a cygwin1.dll file in the DC Raw folder. When i removed it and replaced it with libdcraw.dll things seem to go better, there's a momentary pause, but then i get the error below.

 

ps - I had already changed the filetype to .nef and i'm running Windows 8.1 (no Linux or VM)

 

Untitled-1.jpg




CNers have asked about a donation box for Cloudy Nights over the years, so here you go. Donation is not required by any means, so please enjoy your stay.






Also tagged with one or more of these keywords: astrophotography, dslr



Cloudy Nights LLC
Cloudy Nights Sponsor: Astronomics