×

INDI Library v1.7.9 Released (23 Jun 2019)

INDI Library v1.7.9 is mostly a maintenance release to fix a few bugs in several drivers.

Question re FITS/CR2 conversion

  • Posts: 395
  • Karma: 2
  • Thank you received: 54

Question re FITS/CR2 conversion was created by Herrhausen

Pictures taken in Ekos can be stored in FITS or native format. During my most recent session I had saved all lights and darks in FITS format. Later I took a couple flats by hand so these were stored as CR2 files in the camera's memory card (I swear I'll never do this again!). Now I'm struggling to convert these CR2 files into FITS or TIFF in such a way that they preserve their original resolution in order to be accepted by Regim. I've tried several programs/converters. I always end up with files that have a resolution slightly different from the original. Unfortunately this prevents Regim from accepting them. Batch-conversion in Regim itself also lead to resolutions different from the original file regardless of whether jrawio or dcraw were used. I then tried to change the resolution to that of the lights and darks in showfoto, save the files and provide them to Regim as flats but that also failed.

I'd like to make KStars/Ekos convert given raw files (CR2 in my case) into FITS in the very same way it does this during a session. Would that be possible?
1 year 2 months ago #25398

Please Log in or Create an account to join the conversation.

  • Posts: 35
  • Thank you received: 8

Replied by LinuxUser on topic Question re FITS/CR2 conversion

Hi Herrhausen,
About a year ago I ran into a similar problem while using my Canon XTi (400D). I did a series of dark frames and saved them in the raw CR2 file type. The size of the CR2 files was just a little larger than the light frame FITS files from the same camera as saved by EKOS (I think this problem has been resolved - maybe?). The solution I came up with was to load the CR2 files into the open source image stacking and processing tool called Siril (a great program under active development) available from here:
free-astro.org/index.php/Siril
This tool will convert all the CR2 files to standard FITS files (all in one operation). I then downloaded AstroimageJ from here:
www.astro.louisville.edu/software/astroimagej/
I loaded the converted fits files with AstroimageJ and cropped the converted FITS files to the same size as my FITS files from EKOS. I had to do this one file at a time but it was worth it to me and it worked very well for the final image. AstroimageJ might be able to do this in a batch of files but I am not sure.

In any case this method did allow me to recover the dark frames for use with my image set which I stacked and processed with Siril. I hope this might be of some help to you in processing your files.
The following user(s) said Thank You: Herrhausen
1 year 2 months ago #25406

Please Log in or Create an account to join the conversation.

  • Posts: 45
  • Karma: 1
  • Thank you received: 16

Replied by Copello on topic Question re FITS/CR2 conversion

If you are on Linux, you can also try the excellent rawtran (http://integral.physics.muni.cz/rawtran/)rawtran (integral.physics.muni.cz/rawtran/) wrapper which is based on dcraw.
It is also available on Debian Stretch: (>apt show rawtran)

Cheers
Thomas
The following user(s) said Thank You: Herrhausen
1 year 2 months ago #25407

Please Log in or Create an account to join the conversation.

  • Posts: 395
  • Karma: 2
  • Thank you received: 54

Replied by Herrhausen on topic Question re FITS/CR2 conversion

Thank you so much LinuxUser and Copello! I'll try what you have suggested since the flats that I have taken tonight don't fit the lights from a couple days ago. So it will definetely be worth it. I'll report back what I have accomplished.
1 year 2 months ago #25418

Please Log in or Create an account to join the conversation.

  • Posts: 55
  • Thank you received: 5

Replied by Barker on topic Question re FITS/CR2 conversion

I also ran into similar issues with mixed image sizes during sessions which still persists. I understand it is a long standing bug in dcraw. It was a pain to resolve because I use also Siril, I wrote some python code to check and convert all session images into same size before using Siril.
see indilib.org/forum/general/2931-image-geo...rsus-fits.html#21889
The following user(s) said Thank You: Herrhausen
1 year 2 months ago #25428

Please Log in or Create an account to join the conversation.

  • Posts: 395
  • Karma: 2
  • Thank you received: 54

Replied by Herrhausen on topic Question re FITS/CR2 conversion

Obviously the cam doesn't send image data in FITS format but rather its own format. Ekos can store the data in FITS. Accordingly, Ekos has the ability to convert the cam data into FITS. And this is exactly what we need. The conversion of raw data into FITS as it is done by Ekos. We could feed an existing file instead of data comfing from the camera to the Ekos conversion process. This would make sure we get the exact same resolution and file format. Problem solved. Am I naive?
1 year 2 months ago #25440

Please Log in or Create an account to join the conversation.

  • Posts: 45
  • Karma: 1
  • Thank you received: 16

Replied by Copello on topic Question re FITS/CR2 conversion

Well I guess a simple hack would be as follows:
Copy one of your CR2 file to /tmp/myfile.CR2
Patch and recompile as shown below.
Start indiserver with gphoto2 driver take an image with EKOS or indi_setprop

Change in gphoto_ccd.cpp:
bool GPhotoCCD::grabImage()
{
...
if (read_libraw(tmpfile, &memptr, &memsize, &naxis, &w, &h, &bpp, bayer_pattern))                                                                                                                                           
to
bool GPhotoCCD::grabImage()
{
...
if (read_libraw("/tmp/myfile.CR2", &memptr, &memsize, &naxis, &w, &h, &bpp, bayer_pattern))                                                                                                                                           
The following user(s) said Thank You: Herrhausen
1 year 2 months ago #25441

Please Log in or Create an account to join the conversation.

  • Posts: 395
  • Karma: 2
  • Thank you received: 54

Replied by Herrhausen on topic Question re FITS/CR2 conversion

Sounds like an excellent way to do it. I'm not a coder but this looks like it was doable. Will try tonight and report back. Thank you!
1 year 2 months ago #25442

Please Log in or Create an account to join the conversation.

  • Posts: 395
  • Karma: 2
  • Thank you received: 54

Replied by Herrhausen on topic Question re FITS/CR2 conversion

AWESOME! Works like a charm. Got all my CR2 flats converted to FITS. Thank you so much!!!
1 year 2 months ago #25446

Please Log in or Create an account to join the conversation.

Time to create page: 0.582 seconds