MaximDL - Extracting colour channels

Affiliation
American Association of Variable Star Observers (AAVSO)
Fri, 02/12/2021 - 14:20

I'm getting to grips with Maxim DL and I'm following the instructions from the AAVSO document with tutorials on DSLR photometry software. The instructions are very clear and I've run through once but I wondered about the way the green channels are used. I'm using raw files from my canon DSLR. The instructions tell you how to extract the G1 channel and only one channel can be extracted at a time. There are two green channels in the canon's raw files and I wondered if we are losing data by only using the one green channel. Is there any way of extracting both green channels separately and then combining them when we do the photometry? If we could would that be a good thing? Does it matter that we are only looking at just one channel?

 

Cheers

Steve

 

Affiliation
American Association of Variable Star Observers (AAVSO)
Maxim script for extracting Bayer channels

Here is a script that will extract the bayer channels from a dslr image into separate fits.
It will create 3 TG files, one for each green channel and then one with the channel combined; you can choose which one you want.

This should be saved as a .vbs file.

<code>

'  Bayer Extract
' It operates on all the images currently selected in MaximDL
' It creates 4 new images from the Bayer channels, prefixing the names with the color
' It does not save the files; you do that
' George Silvis  SGEO@GASilvis.net


'Option Explicit
Set MaximApp= CreateObject("Maxim.Application")    
Set AllDocs = MaximApp.Documents

For I = 1 To AllDocs.Count

  Set targetDoc= AllDocs.Item(I)

  targetName= targetDoc.DisplayName
  'wscript.echo targetName
  'wscript.echo targetDoc.FilePath

  targetDoc.Duplicate ' copy it
  Set dupDocR=  MaximApp.CurrentDocument
  dupDocR.DisplayName= "R_" & targetName
  dupDocR.ExtractBayerPlane(1)
  call dupDocR.SetFITSKey("FILTER", "TR")
  dupDocR.Modified= true

  targetDoc.Duplicate ' copy it
  Set dupDocG1=  MaximApp.CurrentDocument
  dupDocG1.DisplayName= "G1_" & targetName
  dupDocG1.ExtractBayerPlane(2)  
  call dupDocG1.SetFITSKey("FILTER", "TG")
  dupDocG1.Modified= true

  targetDoc.Duplicate ' copy it
  Set dupDocG2=  MaximApp.CurrentDocument
  dupDocG2.DisplayName= "G2_" & targetName
  dupDocG2.ExtractBayerPlane(3)
  call dupDocG2.SetFITSKey("FILTER", "TG")
  dupDocG2.Modified= true

  ' combine G's
  dupDocG1.Duplicate
  Set dupDocG=  MaximApp.CurrentDocument
  dupDocG.DisplayName= "G_" & targetName
  dupDocG.Add(dupDocG2)
  call dupDocG.SetFITSKey("FILTER", "TG")
  dupDocG.Modified= true
 
  targetDoc.Duplicate ' copy it
  Set dupDocB=  MaximApp.CurrentDocument
  dupDocB.DisplayName= "B_" & targetName
  dupDocB.ExtractBayerPlane(4)
  call dupDocB.SetFITSKey("FILTER", "TB")
  dupDocB.Modified= true


Next
 
wscript.echo  Done

</code>

 

Affiliation
American Association of Variable Star Observers (AAVSO)
Thank you so much for that…

Thank you so much for that. No one had answered my question and I hadn't checked for a while so I was late getting to it.

As it happens I worked out exactly what you have here except I was doing it the long winded way so thanks for the script.

Just one question.  When you extract a single channel from the raw image you end up with an image half the width and height. This means that a star image which was 10 pixels across in the raw image is now only 5 pixels across. When you add the two green channel images together that doesn't change - it's still only 5 pixels across.  I'm pretty sure this doesn't matter because all the counts from the raw image pixels are still accounted for in the reduced size image.  However I'd be grateful if you could just confirm that for me.

All the best

Steve

 

Affiliation
American Association of Variable Star Observers (AAVSO)
extracted bayer channels

You have it right. It's kinda of like 2x2 binning. The image is half the size. But in this case the TB and TR channels only get counts from 1 of 4 squares and the TG channel, if you are adding G1 and G2, get the counts from 2 of 4 squares.

Affiliation
American Association of Variable Star Observers (AAVSO)
Which Bayer has which number

George,

Thanks for the script, nice work.  I am wondering if this accounts for which color is in which position?

 dupDocR.ExtractBayerPlane(1)
  call dupDocR.SetFITSKey("FILTER", "TR")
 

I've read that the sequence of color plane my vary with manufacturer.  Or does MaxIm do some rearranging so plane 1 is R and 4 is B?

 

Bill