Can Canon cameras support pixel binning? - RAW Shooting and Processing - CHDK Forum supplierdeeply

Can Canon cameras support pixel binning?

  • 13 Replies
  • 38692 Views
Can Canon cameras support pixel binning?
« on: 15 / March / 2016, 13:45:11 »
Advertisements
I get great results from my Canon ELPH using CHDK but the problem that keeps me thinking of getting a mirrorless or DSLR is dynamic range.
Is there any part of the Canon low level hardware interface that allows for pixel binning to to increase dynamic range?
Sigma uses this technique in the Quattro cameras and it lets them gain an f-stop. If it could be used in my ELPH running CHDK it would be a great thing.
I'd be happy to get 4MP photos with an additional f-stop than the current 16MP with blown highlights etc.
Thanks.

*

Offline reyalp

  • ******
  • 14110
Re: Can Canon cameras support pixel binning?
« Reply #1 on: 15 / March / 2016, 14:16:31 »
Is there any part of the Canon low level hardware interface that allows for pixel binning to to increase dynamic range?
The special scene modes like "low light", "ISO 3200" etc generally use some kind of binning. We don't directly control this, but using CHDK, you can force the ISO back to normal levels. However, binning on a bayer filter sensor hurts quality in other ways, and CHDK currently doesn't have the ability to save the binned raw data in these modes. If the subject allows, doing regular multi-exposure HDR or median stacking is probably a better option. Just using CHDK raw will let you salvage highlights that are blown out in the jpeg.

Don't forget what the H stands for.

Re: Can Canon cameras support pixel binning?
« Reply #2 on: 15 / July / 2016, 11:39:25 »
I found a good explanation of binning there
http://www.photometrics.com/resources/learningzone/binning.php

Basically it means averaging pixels before digitization, which reduces read noise, but not dark current noise.

Simply resizing the images to half does almost the same thing.  Noise is reduced by the square root of the number of pixels averaged, resizing to half averages 4 pixels, so noise is reduced by sqrt(4)=2. 

The read noise is only a small amount anyhow (some cameras are even called ISO invariant).  Best dynamic range is usually the lowest ISO. Use high quality noise reduction as well.

Re: Can Canon cameras support pixel binning?
« Reply #3 on: 02 / August / 2016, 12:27:59 »
There are some great articles over on magic lantern about pixel binning. This one talks about methods for getting greater sensitivity out of your camera:
http://www.magiclantern.fm/forum/index.php?topic=12045.0

A solution is to average the pixels together to get you a stop or two, but it doesn't look to be really effective.





Re: Can Canon cameras support pixel binning?
« Reply #4 on: 07 / August / 2016, 12:35:27 »
Just a quick note, I think you could do what you want with imagemagick, that is averaging are groups of pixels.  It automatically calls dcraw for raw files as well.  I'll try to develop the command line for this if I can remember.

Re: Can Canon cameras support pixel binning?
« Reply #5 on: 11 / August / 2016, 20:26:12 »
-Updated with proper colour balance values-
-Update 2 with fixed dcraw-

Ok, you wanted pixel binning in software?  I'm working on it.  It turns out you can develop pictures quite nicely in imagemagick.

using this RAW sample:
http://img.photographyblog.com/reviews/canon_powershot_sx50_hs/sample_images/canon_powershot_sx50_hs_08.cr2

first process to greyscale with:
Code: [Select]
dcraw64 -D -T -t 0 -j -g 1 1 canon_powershot_sx50_hs_08.cr2
Code: [Select]
magick canon_powershot_sx50_hs_08.tiff ^
( -clone 0 -define sample:offset=25,75 -sample 50%x50% ) ^
( -clone 0 -define sample:offset=25,25 -sample 50%x50% ) ^
( -clone 0 -define sample:offset=75,75 -sample 50%x50% ) ^
( -clone 2-3 -evaluate-sequence mean ) ^
-delete 2-3 ^
( -clone 0 -define sample:offset=75,25 -sample 50%x50% ) ^
-delete 0 ^
-channel RGB -combine ^
-color-matrix "1.233998 0 0 0 1 0 0 0 3.209864" ^
-gamma 1.5 ^
binned.jpg

This separates the pixels representing the R,G,B colours, then averages the two greens, then converts to colour.  This isn't going to help a lot.  To do decent binning in colour, you'd need to make a quarter sized image.

Compare to the dcraw version
Code: [Select]
dcraw64 -w -T canon_powershot_sx50_hs_08.cr2
« Last Edit: 13 / August / 2016, 19:02:13 by jmac698 »

Re: Can Canon cameras support pixel binning?
« Reply #6 on: 14 / August / 2016, 16:11:32 »
Here's a more simplified approach. We can let dcraw do more of the work (multiplying the raw values by the camera WB, auto-levelling, and adjusting the gamma (sRGB by default, 2.22 with toe 4.5))

Code: [Select]
dcraw64.exe -d -w -T canon_powershot_sx50_hs_08.cr2or
Code: [Select]
dcraw64.exe -6 -d -w -T canon_powershot_sx50_hs_08.cr2 (if you want to do it in 16bit)

Then process with IM in a more simplified way. I found that dcraw increases the saturation a lot, so I included an approximate match

Code: [Select]
magick canon_powershot_sx50_hs_08.tiff ^
( -clone 0 -define sample:offset=25,75 -sample 50%x50% ) ^
( -clone 0 -define sample:offset=25,25 -sample 50%x50% ) ^
( -clone 0 -define sample:offset=75,75 -sample 50%x50% ) ^
( -clone 2-3 -evaluate-sequence mean ) ^
-delete 2-3 ^
( -clone 0 -define sample:offset=75,25 -sample 50%x50% ) ^
-delete 0 ^
-combine ^
-modulate 100,180,100 ^
binned.jpg

I can tell you, the result is noisier and more pixellated than the dcraw version though.

This is only for GB/RG pixel order. I'm getting a weird bug, where the bottom half of the pic seems to be in RG/GB order.
« Last Edit: 14 / August / 2016, 16:20:23 by jmac698 »

Re: Can Canon cameras support pixel binning?
« Reply #7 on: 14 / August / 2016, 17:21:16 »
Now if you really want to see how much binning reduces noise, yep it does work, here's two examples.

The first is with superpixels made by averaging each Bayer pattern, it includes two green, the red and blue.
The next is the average of 4 superpixels, with 8xG, 4xR and 4xB.

This follows on nicely from the simplified workflow I made above, because the WB and gamma are already done, it's in a proper greyscale image ready to average.

Made with
Code: [Select]
dcraw64.exe -d -w -T canon_powershot_sx50_hs_08.cr2
magick canon_powershot_sx50_hs_08.tiff -scale 50%x50% grey2.jpg
magick canon_powershot_sx50_hs_08.tiff -scale 25%x25% -resize 200%x200% grey4.jpg

The -scale command is nicely supplied by IM already:
https://www.imagemagick.org/script/command-line-options.php#scale

Quote
If when shrinking (minifying) images the original image is some integer multiple of the new image size, the number of pixels averaged together to produce the new pixel color is the same across the whole image. This is a special case known as 'binning' and is often used as a method of reducing noise in image such as those generated by digital cameras, especially in low light conditions.

I can also add that the standard deviation of the noise (assuming it has a normal distribution, which the read noise does as that's a thermal noise (but not the light itself which has Poisson distribution), will be reduced by
Code: [Select]
sqr(8) = 2.8x, on the green channel, or approximately the luminence noise.

So for this camera where I have measured standard deviation as 54.1 for ISO6400 (after black level subtraction), it would be reduced to 19.3, which is about the level of ISO3200.

Put another way, binning of 4 superpixels lowers noise by one stop.

I need to think about this further, because it's kinda complicated.
« Last Edit: 14 / August / 2016, 17:38:16 by jmac698 »


Re: Can Canon cameras support pixel binning?
« Reply #8 on: 14 / August / 2016, 17:45:31 »
For comparison, here's how noise the equivalent of just one green pixel is.  It turns out lighter, because it's not being averaged with the other colours.  Kinda hard to make fair comparisons.  Have to think about this.

Re: Can Canon cameras support pixel binning?
« Reply #9 on: 15 / August / 2016, 21:07:20 »
-Updated: fixed bug-
Finally, the colour version of 4x4 superpixel binning.

1. Using http://www.photographyblog.com/reviews/canon_powershot_sx50_hs_review/sample_images/ (under "Sample RAW Images", "1/320s · f/4 · ISO 6400")
Code: [Select]
dcraw64.exe -6 -d -w -T canon_powershot_sx50_hs_08.cr2
2.
Code: [Select]
magick canon_powershot_sx50_hs_08.tiff -set option:dim "%wx%h" ^
( -size 2x2 xc:black -fill white -draw "point 0,0 point 1,1" -write mpr:g +delete ) ^
( -size 2x2 xc:black -fill white -draw "point 1,0" -write mpr:b +delete ) ^
( -size 2x2 xc:black -fill white -draw "point 0,1" -write mpr:r +delete ) ^
( -clone 0 -size "%[dim]" ( tile:mpr:r -transparent White ) -composite ) ^
( -clone 0 -size "%[dim]" ( tile:mpr:g -transparent White ) -composite ) ^
( -clone 0 -size "%[dim]" ( tile:mpr:b -transparent White ) -composite ) ^
-delete 0 ^
-scale 25%x25% ^
-combine -color-matrix "4 0 0 0 2 0 0 0 4" ^
binned4.jpg

Change
Code: [Select]
-scale 25%x25% to any reciprical of a power of 2 (1/2, 1/4, 1/8...), to bin more or less pixels, for example
Code: [Select]
-scale 50%x50% for less pixels.
« Last Edit: 15 / August / 2016, 23:32:49 by jmac698 »

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal