PDA

View Full Version : Pixel Binning Software for CR2 files?



Geoff
01-21-2010, 10:12 PM
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="ProgId" content="Word.Document" />
<meta name="Generator" content="Microsoft Word 11" />
<meta name="Originator" content="Microsoft Word 11" />
<link rel="File-List" href="file:///C:\DOCUME~1\gwr\LOCALS~1\Temp\msohtml1\01\clip_fil elist.xml" />
<!--[if gte mso 9]><xml>




<w:WordDocument>




<w:View>Normal</w:View>




<w:Zoom>0</w:Zoom>




<w:PunctuationKerning />




<w:ValidateAgainstSchemas />




<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>




<w:IgnoreMixedContent>false</w:IgnoreMixedContent>




<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>




<w:Compatibility>




<w:BreakWrappedTables />




<w:SnapToGridInCell />




<w:WrapTextWithPunct />




<w:UseAsianBreakRules />




<w:DontGrowAutofit />




</w:Compatibility>




<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>




</w:WordDocument>




</xml><![endif]--><!--[if gte mso 9]><xml>




<w:LatentStyles DefLockedState="false" LatentStyleCount="156"]




</w:LatentStyles>




</xml><![endif]-->
<style><!--
&lt;!




/* Style Definitions */




p.MsoNormal, li.MsoNormal, div.MsoNormal




{mso-style-parent:"";




margin:0in;




margin-bottom:.0001pt;




mso-pagination:widow-orphan;




font-size:11.0pt;




mso-bidi-font-size:16.0pt;




font-family:"Times New Roman";




mso-fareast-font-family:"Times New Roman";




mso-bidi-font-family:Arial;}




@page Section1




{size:8.5in 11.0in;




margin:1.0in 1.25in 1.0in 1.25in;




mso-header-margin:.5in;




mso-footer-margin:.5in;




mso-paper-source:0;}




div.Section1




{page:Section1;}




&gt;
--></style>
<!--[if gte mso 10]>



<mce:style><!



/* Style Definitions */




table.MsoNormalTable




{mso-style-name:"Table Normal";




mso-tstyle-rowband-size:0;




mso-tstyle-colband-size:0;




mso-style-noshow:yes;




mso-style-parent:"";




mso-padding-alt:0in 5.4pt 0in 5.4pt;




mso-para-margin:0in;




mso-para-margin-bottom:.0001pt;




mso-pagination:widow-orphan;




font-size:10.0pt;




font-family:"Times New Roman";




mso-ansi-language:#0400;




mso-fareast-language:#0400;




mso-bidi-language:#0400;}



-->


<p class="MsoNormal"]Can anyone suggest software that could perform true binning
on Canon CR2 files?
<p class="MsoNormal"]<o:p></o:p>
<p class="MsoNormal"]This is my first &ldquo;substantial&rdquo; post to the forum.<span> Thus, I appreciate your patience if I haven&rsquo;t
followed the proper forum posting etiquette or if the answers have been posted
previously.
<p class="MsoNormal"]<o:p></o:p>
<p class="MsoNormal"]I&rsquo;ve been interested in pushing the ISO of my 50D for low
light applications and had read various posts on the web that mentioned that
the SRAW2 format did some type of pixel binning&hellip;presumably at the 2x2
size.<span>
<p class="MsoNormal"]<o:p></o:p>
<p class="MsoNormal"]So last night, I thought I would do a quick &ldquo;kitchen&rdquo; experiment.<span> I took two photos with the 50D mounted on a
tripod.<span> I used a 28-70 mm 2.8L lens
with at 1/200<sup>th</sup> f2.8 and 33 mm of focal length.<span> I took two pictures, one with the RAW setting
and the exact same scene with the SRAW2 setting.
<p class="MsoNormal"]<o:p></o:p>
<p class="MsoNormal"]I then converted the RAW (4752 x 3168 pixels) and SRAW2
(2376X1584 pixel) images to 16 bit tiff images using DPP.<span> (The RAW image made an 88 MB image!!).<span> I loaded the tiff file based on the RAW file
into MATLAB (scientific and engineering software), and did a 2x2 binning on
each color layer.<span> I then saved the
binned image as a tiff file.<span> This
software binned file was then the same dimensions as the SRAW2 file.
<p class="MsoNormal"]<o:p></o:p>
<p class="MsoNormal"]I then pulled up the SRAW2 tiff file and the software-binned
file that I had derived from the original RAW file in my favorite image viewer.<span> I found that the software binned file had
significantly less noise.<span> My conclusion
was that the SRAW2 wasn&rsquo;t truly binning the image down properly.<span> Thus, for applications where I need to push
the sensitivity but don&rsquo;t anticipate printing huge photos, I&rsquo;d shoot RAW and
bin the files down in post-processing.<span>
Apart from file size, I don&rsquo;t think that the SRAW2 has much
advantage.<span> Have others had similar
experiences?
<p class="MsoNormal"]<o:p></o:p>
<p class="MsoNormal"]I could embark on the long, hard project of writing binning
computer code myself, but if there is something out there that can handle the
cr2 files directly without having to go through a tif conversation, that would
be best.
<p class="MsoNormal"]<o:p></o:p>
<p class="MsoNormal"]Any thoughts on existing software packages in the market <span>that can truly bin down images?
<p class="MsoNormal"]<o:p></o:p>
<p class="MsoNormal"]Images:<span> 1) Full view
from RAW file.<span> Red box denotes area of
enlargement in second image
<p class="MsoNormal"]2) Comparison of SRAW2 and Binned RAW files at ~ 300%
magnification.
<p class="MsoNormal"]/cfs-file.ashx/__key/CommunityServer.Components.UserFiles/00.00.00.31.80/IMG_5F00_7229-_2D002D00_-full-view.jpg
<p class="MsoNormal"]/resized-image.ashx/__size/800x584/__key/CommunityServer.Components.UserFiles/00.00.00.31.80/sraw-vs-software-bin.jpg
<p class="MsoNormal"]<o:p></o:p>

DavidEccleston
01-22-2010, 01:28 AM
could embark on the long, hard project of writing binning
computer code myself, but if there is something out there that can handle the
cr2 files directly without having to go through a tif conversation, that would
be best.


I'm not sure what matlab considers "Binning", but the name to me it sounds like a basic sum and divide by 4, rather than any fancy image filtering. Whether you'd need to take gamma into account, etc, only the SDK can answer (I have no idea what their tools will give you).


If you're up for writing the software, Canon does offer an SDK (or a few... link to info ("http://www.usa.canon.com/consumer/controller?act=SDKHomePageAct&amp;keycode=Sdk_Lic&amp;fcat egoryid=314&amp;modelid=7474&amp;id=3464) ) for it's cameras for RAW processing, remote control, etc. You have to request and be approved to get the SDK, it's not a public download. I think they prefer applications to be non hobby developers. If your main line of work is somewhat related, you may have no issues getting your SDK application approved. They do have a "personal use" option on the SDK request form though, so who knows how restrictive they are.


If you're not feeling up to the task, I could consider looking into it. I have very little free time these days, but it doesn't sound terribly difficult,assuming the SDK is fairly straightforward to use. I wouldn't mind digging a bit deeper into the RAW file. I am a graphics programmer by day, so hopefully I'd stand a chance at being approved for the SDK... I could actually use the SDK for work purposes, as well as this image reduction tool.

Daniel Browning
01-22-2010, 01:48 AM
This is my first &ldquo;substantial&rdquo; post to the forum.


Welcome! We're glad to have you.



Can anyone suggest software that could perform true binning on Canon CR2 files?


ImageMagick (a commandline utility) is what I use. It does the best job of any that I've seen. Irfanview is a GUI program that also does very well. Most of the typical programs (Photoshop, Gimp, et al.) do a very poor job in comparison.

That said, I should point out that the term "binning" means something different to everyone. The definition you are using is something like "a certain simple method for resizing the image". Other people use "binning" to refer to "resizing the image by any method (specified or not)". It also can refer to on-chip binning (used e.g. on monochrome astrophotography sensors).

Resizing (i.e. resampling) image files is a well-studied area, and there are many other methods that are far superior to the simple 2x2 binning method. All the methods strike a balance between detail and artifacts. The best algorithm is used by ImageMagick above, which is why I recommended it.



I&rsquo;ve been interested in pushing the ISO of my 50D for low light applications and had read various posts on the web that mentioned that the SRAW2 format did some type of pixel binning&hellip;presumably at the 2x2 size.


It does a full-resolution demosaic, then it downsamples to the smaller size. Unfortunately, the downsampling algorithm is not that great, so the noise level and artifacts are worse than they could be with the ideal software. You can read more about sRAW in my post here on a separate forum:

Canon sRAW considered harmful ("http://photography-on-the.net/forum/showthread.php?t=730030)



My conclusion was that the SRAW2 wasn&rsquo;t truly binning the image down properly.


That is the same conclusion I get from my tests.



Thus, for applications where I need to push the sensitivity but don&rsquo;t anticipate printing huge photos, I&rsquo;d shoot RAW and bin the files down in post-processing.


Keep in mind that downsampling should not be used for noise reduction. It is very bad at it because it throws away noise and detail at the same rate. Of course, if you're printing a certain size, you will have to downsample. But if you don't have to, it is always better not to. The ideal solution is to use good noise reduction algorithms, because they reduce noise faster than they reduce detail. (Using no noise reduction at all is also a valid choice.)



Apart from file size, I don&rsquo;t think that the SRAW2 has much advantage. Have others had similar experiences?


Yes, I agree. The only other additional advantage is that sRAW can be processed faster since the demosaic and resample is already completed.



I could embark on the long, hard project of writing binning computer code myself, but if there is something out there that can handle the cr2 files directly without having to go through a tif conversation, that would be best.


Just process the raw files normally and resample with a quality program (like the above) when you're done. The lower quality programs (like what Canon uses in-camera for sRAW) cause aliasing -- which means higher spatial frequencies (i.e. smaller input pixels) with their correspondingly higher noise power contaminates the lower spatial frequencies (large output pixels), which results in more noise than the ideal resampling program.



Any thoughts on existing software packages in the market that can truly bin down images?


No, because software already has far better algorithms than "true binning". On-chip binning, on the other hand, often has an advantage over any software binning: it may have as much as half the read noise (in the case of 2x2). But it's difficult to pull off with Bayer sensors (artifacts), so aside from one MFDB (Medium Format Digital Back), I'm not aware of any that are doing it yet.



2) Comparison of SRAW2 and Binned RAW files at ~ 300%
magnification.


The difference in noise between your two comparisons is far greater than it should be. It looks like something in the raw conversion of the full raw file (e.g. noise reduction setting) did not match the sRAW. Can you post the raw files? (Yousendit.com is a free file hosting service - put in any email address and it will give you a link that can be posted here.) If you post them I can do a comparison using other raw conversion software and downsampling algorithms for your comparison.

Geoff
01-22-2010, 10:25 PM
I'm not sure what matlab considers "Binning", but the name to me it sounds like a basic sum and divide by 4, rather than any fancy image filtering.


Yes, this is what I did in a quick 'n dirty program. Matlab itself has plenty of image processing/analysis capability...but my code was the simple mean of a 2x2 block.



If you're up for writing the software, Canon does offer an SDK (or a few... link to info ("http://www.usa.canon.com/consumer/controller?act=SDKHomePageAct&amp;keycode=Sdk_Lic&amp;fcat egoryid=314&amp;modelid=7474&amp;id=3464) ) for it's cameras for RAW processing, remote control, etc


Thanks for the heads up on this! Alas, I'm a mere hobbyist. If you do try the SDK, I'd be curious to hear how easy it was to integrate their code.

Geoff
01-22-2010, 10:52 PM
Daniel -- Thanks much for the very informative and careful reply.



The difference in noise between your two comparisons is far greater than it should be. It looks like something in the raw conversion of the full raw file (e.g. noise reduction setting) did not match the sRAW


I was a bit surprised by the difference in the files myself! I've gone back and looked at the original RAW file from which I derived the binned image. In DPP I had the luminance noise reduction set to 5 and the chrominance noise reduction set to 9. These were the default values out of the camera. Similarly I looked at the settings for the SRAW2 image. For this file, DPP grayed out the luminance adjustment (at 5), and the chrominance was set the the default of 9.


Net, I'll follow your advice. I'll be shooting straight RAW and when needed reduce the noise in DPP. Final step would be to down sample the image. Still, I'm a bit disappointed in the SRAW2...I was hoping for better.

Daniel Browning
01-22-2010, 10:58 PM
You're very welcome, and thank you for overlooking my sometimes indelicate manner.



Still, I'm a bit disappointed in the SRAW2...I was hoping for better.


Me too. Hopefully Canon will find a way to implement on-chip binning in the future that does yield lower read noise as some of the astrophotography sensors do.

scalesusa
03-18-2010, 12:39 AM
The question has been asked of canon already, and sraw does not reduce noise, just creates smaller file sizes.





http://digitaljournalist.org/issue0902/tech-tips.html ("http://digitaljournalist.org/issue0902/tech-tips.html)