Jump to content

Debayering for photometry


Guest

Recommended Posts

I'm trying to decide which software to use for photometry with my DSLR. AAVSO publishes a document which has tutorials for various software for the purpose. I'm currently looking at maximdl.

In the AAVSO instructions the green 1 channel is extracted from the raw file and then the photometry is carried out on that. It seemed to me that I'm losing data since there are two green channels.  I had a look at the instructions for a couple of other pieces of software and it's done differently. In AIP4win for example you extract the colour by putting in a scaling factor for each colour red, green, blue. So for example to do the green you select a scaling factor of 0 for red, 0 for blue and 1 for green. But there is only a single scaling factor for green so I assume it combines the two green channels.

There is the same facility in maximdl  which only looks at a single green. I don't understand the difference between the two methods and I don't understand why AAVSO would pick a method which only uses the single green channel. If anyone has looked at this I'd be grateful for any information.

 

Cheers

Steve

 

Link to comment
Share on other sites

Both methods are the same.

If you end up with same number of pixels in you green channel as sensor size would suggest (like if you have 6000x4000 px sensor and you end up with 6000x4000 green channel) - you did not loose the data - you "added" the data.

Missing green values have been interpolated from green component of bayer matrix.

For photometry purposes - that is just fine as interpolation should preserve average pixel values (in simplest form, missing values are added by linear interpolation which is just average of two neighboring existing values - so average of the lot does not change).

 

  • Like 1
Link to comment
Share on other sites

Thanks Vlaiv,

What I was thinking was this. In the case where a scaling factor is used it is using the data from all of the green pixels.  The green values for the red and blue pixels are interpolated. So half the pixels have true measured values and the other half has estimated values by interpolation.

In the case where you extract the single green channel you have true measured values for those pixels and nothing at all for the others. You have one quarter as many pixels.

Suppose you are doing photometry on a star. Lets say the image of the star is square and is 10x10 pixels in the raw image. That's 100 pixels. In the first method you have true measured values for 50 of those pixels and estimated values for the remaining 50 pixels. In the second method that image of the star is reduced to 5x5 pixels. You only have measured values for 25 pixels. That seems to be not such a good method.

 

Link to comment
Share on other sites

Yes, that is correct - but when you use tools that extract green channel - they mostly do following:

- reconstruct R, G and B channels by using some sort of interpolation

- then you get to save G channel from that

If you want to get only green - and to get two sub frames from each image - you can easily do that, but it is a bit more involved.

Take any software that will convert camera raw data to fits format while still preserving bayer matrix (DCRaw will do that from command line, FitsWork will do that from GUI and supports batch processing) and I'll provide you with plugin for ImageJ that splits fields for you so you can extract only green channel data.

Link to comment
Share on other sites

I was following the AAVSO instructions for photometry using maximdl. In those instructions there is a point  where it asks you to "Extract bayer plane". At this point you have to select 1 of 4 channels R G1 G2 B. You cannot select more than one channel. I've attached a screen shot. I think I'm only extracting one of the two green channels. The resulting image is half the width and height of the original image.

In the other tutorials of the AAVSO guide it does exactly what you describe (for example AIP4WIN) but I think the one for maximdl really only looks at a single green channel.

2021-02-16_16-19-23.jpg

Link to comment
Share on other sites

4 minutes ago, woodblock said:

In the other tutorials of the AAVSO guide it does exactly what you describe (for example AIP4WIN) but I think the one for maximdl really only looks at a single green channel.

Then thing is rather easy - extract Plane number 2 and plane number 4.

This will give you two images that have half of pixels in height and width - and you treat those two images as two separate observations. If you've taken for example 16 images - you'll actually have 32 observations rather than 16 - just remember that each pair was recorded at the same time (if time is important in your further analysis).

Link to comment
Share on other sites

As a programmer I'm currently working on new the photometry routine in ASTAP. There are two methods  I'm considering for DSLR:

 1) One is to extract from raw the two green pixels of each 2x2 bayer matrix and combine them. But since you uses only 50% of the  of the image you have to assure that the star size (HFD, FWHM) is much larger then a pixel size. If the peek of the star is  at the blue or red sensitive pixel you will get an measuring error.  So having a slightly de focused image seems important.

2)  The second method is to de-bayer and then extract the green. Probably less reliable but at least the luminance channel is correct for sharp images

 

I assume 1) is the best as long your a little out of focus and the stars are over-sampeled. But up to now I could not find a proper evaluation

I your member of the AAVSO you can use the free online VPHOT tools . The videos are impressive but haven't worked with the online tool itself.  For automated photometry, the Lesvephotometry program works very well. But you have to buy a Pinpoint solver license. You can work/experiment 60 days or so using a Pinpoint trial license.

 

Han

 

 

Link to comment
Share on other sites

After so reading some discussions and guides, the most convenient method to process an DSLR image for photometry would be to combine each 4 raw Bayer pixels R, G1, G2, B into one RGB pixel.   But the combining should not happen as the normal Debayer method since the luminance is adjusted using the neighbour pixels. So the RGB green would be simple (G1+G2)/2 and R and B stay the same . That would halve the image dimensions in pixels but preserve the colour information for photometry.  This would intuitive be a better method then split an image in four seperate images called R, G1, G2, and B. But the software has to be able to process the RGB image and select the colour of interest, most likely green as TG.

Han

Later,

the only problem is these images while photometric correct look weird. Three method without halving the image dimensions or split them in four:

1) This is what you get when you when you spread the R,G,1, G2, B as RGB colours over each Bayer 2x2  matrix.  The stars colours tend to follow the Bayer matriz. So top-left & top-bottom =green, top-right=red, bottom-left=blue.

33364940_bayercombined.thumb.png.0b43d2afa8c8ff1c8425f7f8644b69e7.png

 

2) And this is what you get when you spread the R,G,1, G2, B  as RGB over 4 pixels in one direction:

723134784_astrosimple.thumb.png.442d9fa56f49ba5e600fa05846807809.png

 

3) An other possibility is to just to colour each pixel according the Bayer pattern. But that looks most weird and green is by definition twice as strong:

407427706_bayerdrizzle.thumb.png.4ec06ddd796fa0ec7a327476317bdd32.png

 

The advantage is that all information stays in one image and is photometric correct. But no standard software will be able to process it.

Probably it is better to split the raw images in three separate files raw red, raw green combined and raw blue at half dimensions of the original file and process them separately.

 

 

 

Edited by han59
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.