Error in the header of Fits file, ZWO ASI 071 camera

A place to report problems and bugs in SharpCap
Forum rules


If you have a problem or question, please check the FAQ to see if it already has an answer : https://www.sharpcap.co.uk/sharpcap-faqs

Please also read about Troubleshooting USB Issues before posting.

*** Please do not post license keys - please report any problems with licensing to 'admin' by private message ***

Please include the following details in any bug report:

* Version of SharpCap
* Camera and other hardware being user
* Operating system version
* Contents of the SharpCap log after the problem has occurred.
[If SharpCap crashes, please send the bug report when prompted instead of including the log]
Post Reply
db48
Posts: 21
Joined: Mon Feb 27, 2017 1:24 pm

Error in the header of Fits file, ZWO ASI 071 camera

#1

Post by db48 »

Hi,
When I save Bayered Fits files from my ZWO ASI 071 camera the Bayer parameters included in the Fits header are wrong. In fact, the file is reported to be of the GBRG type, while the correct path is RGGB. I enclose a view of the wrong header obtained using the most recent version of SC. For comparison, an old (correct) header is shown. It was produced by a previous version of SC.
Attachments
New_Header.PNG
New_Header.PNG (19.45 KiB) Viewed 2771 times
Old_Header.PNG
Old_Header.PNG (17.37 KiB) Viewed 2771 times
User avatar
admin
Site Admin
Posts: 13177
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Error in the header of Fits file, ZWO ASI 071 camera

#2

Post by admin »

Hi

Actually the new code is correct - the old code didn't take account of the fact that FITS files are considered to start at the bottom left instead of the top left, so the bayer pattern is flipped (RGGB -> GBRG) compared to the bayer pattern we normally thing about for the camera. Using the 'Flip' option for the ZWO cameras also flips the bayer pattern, but SharpCap 3.0 handles this correctly in all cases as far as I know too.

I have just tested to be sure, and both AstroArt and PIPP require me to use the GBRG bayer pattern encoded in the file to give correct colour output for the ASI071.

cheers,

Robin
bh23
Posts: 2
Joined: Tue Aug 01, 2017 1:29 pm

Re: Error in the header of Fits file, ZWO ASI 071 camera

#3

Post by bh23 »

I'm not sure SharpCap is correctly handling the bayer pattern when the "Flip" option is used. I was live stacking M27 the other night using my ASI071. I captured 9 frames then had to do a mount flip because I hit the meridian. I paused the stack, flipped the mount and set the Flip option in SharpCap to "Both" in order to line up the new frames with the previous frames, then I resumed the live stack.

The colours in the live stack were correct but when I went to stack the raw frames in DSS the colours were all wrong. I then examined some of the individual raw frames in Nebulosity4 and discovered that the first 9 frames taken before I used the Flip option in SharpCap had correct colour and all the ones taken with Flip set to "Both" had the colour channels mixed up. I looks to me that the red and blue channels are reversed.

Here are two raw frames (I cropped them to reduce their size), one with Flip None and the other with Flip Both.

Flip None:
Flip_None.JPG
Flip_None.JPG (39.41 KiB) Viewed 2722 times
Flip Both:
Flip_Both.JPG
Flip_Both.JPG (50.01 KiB) Viewed 2722 times
I'm running SharpCap 3.0
User avatar
admin
Site Admin
Posts: 13177
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Error in the header of Fits file, ZWO ASI 071 camera

#4

Post by admin »

Hi,

so the bayer pattern does actually change when you flip the image and SharpCap deals with this fore previewing and for capturing (writing the correct pattern into the header of SER or FITS files). This should work as long as you set up the flip *before* starting each capture and don't change it during capture.

To explain further, if your sensor is RGGB then the pattern is...

Code: Select all

RGRG....RGRG
GBGB....GBGB
....
....
RGRG....RGRG
GBGB....GBGB
So you read your bayer pattern from the first two characters of the first two rows - hence RGGB. However, if you flip both ways the pixel that is normally bottom right becomes top left, so your first two rows will be

Code: Select all

BGBG....BGBG
GRGR....GRGR
So now your pattern is BGGR.

In terms of the header data written to FITS files, I have yet to find any software that seems to take any notice of the bayer pattern header fields - everything I've tried seems to need you to set the pattern manually. Quite how you do that if you have some files in one pattern and some in another might be tricky - it may be best to debayer the frames individually in something like PIPP and then stack in RGB format?

cheers,

Robin
bh23
Posts: 2
Joined: Tue Aug 01, 2017 1:29 pm

Re: Error in the header of Fits file, ZWO ASI 071 camera

#5

Post by bh23 »

Thanks for the explanation Robin. I'll keep that in mind for the next time.

What I did to resolve the problem of my 142 frames with incorrect bayer pattern is to stack them as is in Deep Sky Stacker, then edit the final resulting image in GIMP where I reversed the red and blue channels using the channel mixer. I discarded the first 9 frames with correct bayer pattern since I really didn't need them. The final stacked and processed image came out like this:
M27 stack of 142.jpg
M27 stack of 142.jpg (60.69 KiB) Viewed 2703 times
Brad.
User avatar
admin
Site Admin
Posts: 13177
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Error in the header of Fits file, ZWO ASI 071 camera

#6

Post by admin »

Good to hear that you got a result from those frames - nice image.

cheers,

Robin
Post Reply