Jump to content

SkySurveyBanner.jpg.21855908fce40597655603b6c9af720d.jpg

Siril - convert RGB to grey scale?


Recommended Posts

Hello, wonder if anyone can point me in the opposite direction to most people. Just to be awkward, I would like to take a RGB image in Siril, and convert it to grey/mono so that I can save it as a FITS without it being a 3 dimensional FITS (ie RGB). Everything I can find online shows the opposite - converting to RGB.

Thank you!

Link to comment
Share on other sites

I'm interested in this too. Recently acquired an old Takumar 200mm f/4 lens that shows some nasty purple fringing in my first test shots. I'll preserve with adjusting f-stop and tweaking focus to see if I can beat it but in the meantime I thought I could take the imperfect colour images and convert to monochrome to hide the defect.

I have a canon 600d and use siril and startools to process. Currently use "off the shelf" processing script for OSC with bias, darks and flats for the calibration. Output is a colour fits file.

Link to comment
Share on other sites

32 minutes ago, KevinPSJ said:

I'm interested in this too. Recently acquired an old Takumar 200mm f/4 lens that shows some nasty purple fringing in my first test shots. I'll preserve with adjusting f-stop and tweaking focus to see if I can beat it but in the meantime I thought I could take the imperfect colour images and convert to monochrome to hide the defect.

I have a canon 600d and use siril and startools to process. Currently use "off the shelf" processing script for OSC with bias, darks and flats for the calibration. Output is a colour fits file.

Best way is to have the image be mono in the first place, and here i dont mean use a mono camera. I mean split debayering to separate each subexposure to their 4 constituent monochrome parts = 1 red, 1 blue, and 2 green monochrome subs. In fact this is how all colour cameras work anyway and the colours are the result of interpolation between the 4 pixels.

In Siril you can use the split_cfa console command in Siril to split a single frame. I recommend using the seqsplit_cfa (sequence-name here) command to run it on the entire opened sequence, for example after calibration of your files. You could easily modify the existing OSC_Preprocessing script and remove the debayering part from the lightframe portion of the script and remove the lines that stack the image in the end. This leaves you with a pp_light sequence that you can run the seqsplit_cfa pp_light command on and the result is 4 mono subs for each input sub. Scripts are found in your Siril installation folder in the scripts folder.

I have attached 2 modified scripts in .txt format below if you dont want to do it yourself.  Open with any text editor and save it as .SSF and put it in the folder and it will show up in the scripts menu in Siril. The scripts require you to have folders named "lights", "flats", "biases", and "darks" with their own files. If you dont have darks or biases you could modify the script to not have those.

Since you have some chromatic aberration you want to hide/get rid of you could choose to only use the colour channels that are not bloated. May be only green, or green+red/green+blue, depends on which side of focus you were in.

1 hour ago, iamjulian said:

Hello, wonder if anyone can point me in the opposite direction to most people. Just to be awkward, I would like to take a RGB image in Siril, and convert it to grey/mono so that I can save it as a FITS without it being a 3 dimensional FITS (ie RGB). Everything I can find online shows the opposite - converting to RGB.

Thank you!

If you are working with an already debayered (so not a raw) RGB file, you can use the Extraction - Split Channels function in the Image Processing menu to split the image into mono R G and B files. You could then just stack them with average and result in a mono synthetic luminance file afterwards. You can also choose to use only the green channel for example since that will have the highest SNR due to twice the amount of pixels and generally because the green channel is strongest in both daylight and broadband astrophotography images.

But if you have the raw files for whatever image you want to convert to mono i recommend the bayer split method above.

Another note from split debayering: It will half your resolution as the raw data is actually 4x half resolution mono images anyway. The typical OSC processed image with debayering is in fact just resampled by 200% and carries no real detail of its own, but will introduce interpolation errors and noise. If you must have the original resolution you can resample by 200% and get the same result as with "normal" processing. No difference in actual captured resolution because it was not there anyway.

OSC_Preprocessing - bayer split no stacking.txt

OSC_Preprocessing - no stacking.txt

Edited by ONIKKINEN
Attached the wrong file, fixed
  • Thanks 2
Link to comment
Share on other sites

And forgot to mention, the output files are named CFA_0, CFA_1, CFA_2, and CFA_3. You need to figure out yourself which of these 2 are green and which is red and blue. For my camera CFA_0 and CFA_3 are green, CFA_1 is red and CFA_2 is blue. Your mileage may vary depending on the bayer pattern of your camera. Easiest way to test is to take an image of something that has strong reds, greens, and blues and inspect the images afterwards.

  • Like 1
Link to comment
Share on other sites

Thank you very much. That sounds really helpful and I will definitely give that a try because siril does look good.

I found another bit of software called fitswork which convert to monochrome luminance, then saves as FITS. Saving one image into a separate file for each channel seemed overkill for my needs but I can see how it would be useful.

Link to comment
Share on other sites

@ONIKKINEN really clear instructions and especially appreciate you providing the scripts! I'll try it in some of the test shots I've already taken.

I'm a software engineer so pretty comfortable around scripting just need to learn my way around siril API - you've saved me a bunch of googling and trawling through manuals.

  • Like 1
Link to comment
Share on other sites

In ASTAP you can convert colour files to mono, so single dimension. This menu can be found under main menu Tools (ctrl+M).

You can also normalise raw OSC images. This routine makes the mean value of the R,G,G and B pixels equal. See tab "stack method" (ctrl+A) button "test normalize" This removes the typical raw checker pattern of raw OSC images.  It is intended to normalize flats but can also be applied on lights.   This normalize will keep the final image sharper then converting the debayered image to mono.

Han.

  • Thanks 1
Link to comment
Share on other sites

If your images are oversampled (typical for small pixels these days) probably the cleanest result you will get when you bin2x2 the raw images . So the Red, Green,Green, Blue sensitive pixels will be averaged in one pixel. Image will get half dimensions and greyscale but you get best SNR and no artefacts or checker patterns.

Link to comment
Share on other sites

  • 6 months later...
On 19/10/2022 at 20:50, han59 said:

In ASTAP you can convert colour files to mono, so single dimension. This menu can be found under main menu Tools (ctrl+M).

You can also normalise raw OSC images. This routine makes the mean value of the R,G,G and B pixels equal. See tab "stack method" (ctrl+A) button "test normalize" This removes the typical raw checker pattern of raw OSC images.  It is intended to normalize flats but can also be applied on lights.   This normalize will keep the final image sharper then converting the debayered image to mono.

Han.

Hello Han.

I have been trying to figure out how to do this procedure but for the life of me cannot get my head around it. I have read the guide ASTAP, Astrometric Stacking Program (hnsky.org) but there is no mention or walkthrough to guide you through the process. Do you have anything that shows it step by step?

cheers

steve

Link to comment
Share on other sites

  • 2 weeks later...

Hi Steve,

There are two type files. 1) Files already in colour and 2) RAW colour files still in a mono format. See below.

 

1) Colour files which show already contain the image in the three base colours, red, green and blue (the image is debayered).  The same information you find in a jpeg file. 

To convert this type to mono, load the file in ASTAP and then use the viewer pull down menu TOOLS, "Convert to mono (ctrl+M)"

Example raw:

raw.thumb.png.d50228465b2166e11e29677f96aaaccc.png

 

Converted to colour (without smooth):

colour.thumb.png.75aa0450fffdd1899e92de4ff0733894.png

 

Converted to mono

colourtomono.thumb.png.16fa62e8bcdde2fccde79edcb15f9a50.png

 

Now again but just normalise the RAW file:

2) RAW OSC camera files. These file from an OSC=One Shot Colour camera are not converted to colour yet. They have pixels  which by filter are only sensitive to red, or green or blue. Often in a Bayer matrix  

These RWA files are still mono but the best way to use them is to equalize the  red, green and blue sensitive pixels. This is what I call normalise.  It adjust the levels such that the mean red, green, green and blue levels are the same assumiing the light received is about white.   By doing so it eliminates the typical checker pattern.  Note that this option  has moved to the pixelmath tab in the latestes ASTAP version.

 

Example the raw again. The checker pattern is visible (for some cameras it is worse):

raw.thumb.png.d50228465b2166e11e29677f96aaaccc.png

 

Now the raw normalised. Note the sharper stars. The noise pattern is cleaner. This is the best way to use a colour camera as if it is a mono camera:

normalised.thumb.png.788799adc37b623c81d6546f42590536.png

 

You could also bin2x2 the raw image but you will loose resolution. So do this only if the image is oversampled:

rawbinned.thumb.png.662d84d17f0ba8d5090fd7d6d2403da2.png

 

In the latest ASTAP the normalise menu option has been moved from tab "stack method" to tab "pixel math 2" (CTRL+A). It normalises the RAW image in the viewer. This by making the mean value of RGGB sensitive pixels the same:

normalise.thumb.png.b3cb5d2021baf96f9cec0866e5190a4d.png

 

 

 

Han

 

 

Edited by han59
  • Thanks 1
Link to comment
Share on other sites

5 hours ago, han59 said:

Hi Steve,

There are two type files. 1) Files already in colour and 2) RAW colour files still in a mono format. See below.

 

1) Colour files which show already contain the image in the three base colours, red, green and blue (the image is debayered).  The same information you find in a jpeg file. 

To convert this type to mono, load the file in ASTAP and then use the viewer pull down menu TOOLS, "Convert to mono (ctrl+M)"

Example raw:

raw.thumb.png.d50228465b2166e11e29677f96aaaccc.png

 

Converted to colour (without smooth):

colour.thumb.png.75aa0450fffdd1899e92de4ff0733894.png

 

Converted to mono

colourtomono.thumb.png.16fa62e8bcdde2fccde79edcb15f9a50.png

 

Now again but just normalise the RAW file:

2) RAW OSC camera files. These file from an OSC=One Shot Colour camera are not converted to colour yet. They have pixels  which by filter are only sensitive to red, or green or blue. Often in a Bayer matrix  

These RWA files are still mono but the best way to use them is to equalize the  red, green and blue sensitive pixels. This is what I call normalise.  It adjust the levels such that the mean red, green, green and blue levels are the same assumiing the light received is about white.   By doing so it eliminates the typical checker pattern.  Note that this option  has moved to the pixelmath tab in the latestes ASTAP version.

 

Example the raw again. The checker pattern is visible (for some cameras it is worse):

raw.thumb.png.d50228465b2166e11e29677f96aaaccc.png

 

Now the raw normalised. Note the sharper stars. The noise pattern is cleaner. This is the best way to use a colour camera as if it is a mono camera:

normalised.thumb.png.788799adc37b623c81d6546f42590536.png

 

You could also bin2x2 the raw image but you will loose resolution. So do this only if the image is oversampled:

rawbinned.thumb.png.662d84d17f0ba8d5090fd7d6d2403da2.png

 

In the latest ASTAP the normalise menu option has been moved from tab "stack method" to tab "pixel math 2" (CTRL+A). It normalises the RAW image in the viewer. This by making the mean value of RGGB sensitive pixels the same:

normalise.thumb.png.b3cb5d2021baf96f9cec0866e5190a4d.png

 

 

 

Han

 

 

Thank you very much indeed @han59 for this. I shall give this a go and see if it achieves what I am aiming to do. 

Noob question again. If, after I remove the checker pattern I then convert the RAW files to FITS say using PIPP, what will I get out assuming I don't tick any debayer options in the programme. I assume B&W.

cheerrs

steve

Edited by bomberbaz
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. By using this site, you agree to our Terms of Use.