Page 1 of 2

Request for a new FITS keyword

Posted: Sat Jul 11, 2020 12:36 pm
by lock42
Hello,
I'm one of the developer of Siril software.
We recently wrote a short document explaining why we've had added a new FITS keyword and why we would like that every FITS data producers do the same.
The document: http://free-astro.org/index.php?title=S ... rientation

In addition to this (we will add this to the doc soon), from https://ui.adsabs.harvard.edu/abs/2002A ... G/abstract :

5.1. Image display conventions
It is very helpful to adopt a convention for the display of images transferred via the FITS format. Many of the current image processing systems have converged upon such a convention. Therefore, we recommend that FITS writers order the pixels so that the first pixel in the FITS file (for each image plane) be the one that would be displayed in the lower-left corner (with the first axis increasing to the right and the second axis increasing upwards) by the imaging system of the FITS writer. This convention is clearly helpful in the absence of a description of the world coordinates. It does not preclude a program from looking at the axis descriptions and overriding this convention, or preclude the user from requesting a different display. This convention also does not excuse FITS writers from providing complete and correct descriptions of the image coordinates, allowing the user to determine the meaning of the image. The ordering of the image for display is simply a convention of convenience, whereas the coordinates of the pixels are part of the physics of the observation.


Do you think it would be possible to introduce this keyword in sharpcap ? EKOS/INDI has just introduced it.

My best regards,
Cyril

Re: Request for a new FITS keyword

Posted: Sat Jul 11, 2020 3:44 pm
by admin
Hi Cyril,

yes, no problem. Makes a lot of sense.

Robin

Re: Request for a new FITS keyword

Posted: Sat Jul 11, 2020 4:01 pm
by admin
Hi,

I created a test file with the header in without changing anything else in SharpCap's FITS writing

https://drive.google.com/file/d/1tK289i ... sp=sharing

Any observations on flaws in the headers welcome - The problem I have found is that different processing applications interpret FITS images in different ways, so no single way of writing the BAYERPAT/COLORTYP/BAYOFFX/BAYOFFY headers makes sense for all applications. Actually though, I don't recall finding any application that actually takes notice of those headers :(

The image is GBRG as far as the camera is concerned (counting from top-left).

Robin

Re: Request for a new FITS keyword

Posted: Sat Jul 11, 2020 6:45 pm
by lock42
Hello, thanks for having a look.
I can debayer your FITS image with the correct pattern, only with BOTTOM-UP information. Not with TOP-DOWN as it is written, where color are wrong.

Code: Select all

The problem I have found is that different processing applications interpret FITS images in different ways, so no single way of writing the BAYERPAT/COLORTYP/BAYOFFX/BAYOFFY headers makes sense for all applications
In Siril we do not use COLORTYP (dont think it is used either by EKOS/INDI). For BAYOFFX and BAYOFFY we are doing something like that (but we use, like INDI, XBAYROFF and YBAYROFF):

Code: Select all

	if (xbayeroff == 1) {
		switch (*pattern) {
		case BAYER_FILTER_RGGB:
			*pattern = BAYER_FILTER_GRBG;
			break;
		case BAYER_FILTER_BGGR:
			*pattern = BAYER_FILTER_GBRG;
			break;
		case BAYER_FILTER_GBRG:
			*pattern = BAYER_FILTER_BGGR;
			break;
		case BAYER_FILTER_GRBG:
			*pattern = BAYER_FILTER_RGGB;
			break;
		default:
			return 1;
		}
	}

	/* y offset
	 * or bottom-up debayer
	 */
	if ((ybayeroff == 1)
			|| ((com.pref.debayer.use_bayer_header
					&& !g_strcmp0(fit->row_order, "BOTTOM-UP"))
					|| !com.pref.debayer.top_down)) {
		switch (*pattern) {
		case BAYER_FILTER_RGGB:
			*pattern = BAYER_FILTER_GBRG;
			break;
		case BAYER_FILTER_BGGR:
			*pattern = BAYER_FILTER_GRBG;
			break;
		case BAYER_FILTER_GBRG:
			*pattern = BAYER_FILTER_RGGB;
			break;
		case BAYER_FILTER_GRBG:
			*pattern = BAYER_FILTER_BGGR;
			break;
		default:
			return 1;
		}
	}

Re: Request for a new FITS keyword

Posted: Sat Jul 11, 2020 7:44 pm
by admin
Ah, Ok... And which setting of the top-down/botton-up is required for the image to be the right way up?

I may need to change how the bayer info is written out and it would be best to get all the changes needed done in one go.

thanks,

Robin

Re: Request for a new FITS keyword

Posted: Sat Jul 11, 2020 7:57 pm
by lock42
Maybe I could give you these test files: https://filesender.renater.fr/?s=downlo ... ac4b5a78e5
Does it help you?

Re: Request for a new FITS keyword

Posted: Mon Jul 13, 2020 6:36 am
by lock42
Do not hesitate to ask if you want me to test something.

Re: Request for a new FITS keyword

Posted: Mon Jul 13, 2020 7:46 pm
by admin
How about this file – https://drive.google.com/file/d/1Bv8YOJ ... sp=sharing

I believe that should be consistent – if you interpret it as starting from the top down, the required Bayer pattern is GB RG and the images the right way up.

Cheers, Robin

Re: Request for a new FITS keyword

Posted: Mon Jul 13, 2020 9:17 pm
by lock42
Yes looks good to me.

Here the result I have:
Capture d’écran du 2020-07-13 23-14-23.jpg
Capture d’écran du 2020-07-13 23-14-23.jpg (123.19 KiB) Viewed 2653 times

Re: Request for a new FITS keyword

Posted: Tue Jul 14, 2020 5:06 pm
by lock42
Your next update will contain this change?
Many thanks for that. It will be very useful I think