Skip to content

Command line utility to convert bayer grid data to rgb data. Integrates with ImageMagick.

License

Notifications You must be signed in to change notification settings

DavidObfuscator/bayer2rgb

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bayer2rgb
=========

bayer2rgb will convert naked (no header) bayer grid data into rgb data. There are several choices of interpolation (though they all look essentially the same to my eye). It can output tiff files, and can integrate with ImageMagick to output other formats. 

I borrowed the bayer.c from the libdc1394 project [1], it is licensed under LGPL.

This is an implementation of the idea I stumbled upon on ImageMagick's mailing list while searching for a bayer grid converter. The thread can be found at [2].The interpolation algorithms used are described at [3].

I have tested it both on Linux and in under Cygwin on WinXP.


Installation
------------

    make
    cp bayer2rgb /usr/bin/
    cp delegates.xml ~/.magick/delegates.xml


Running
-------

    usage: ./bayer2rgb
       --input,-i     input file
       --output,-o    output file
       --width,-w     image width (pixels)
       --height,-v    image height (pixels)
       --bpp,-b       bits per pixel
       --first,-f     first pixel color: RGGB, GBRG, GRBG, BGGR
       --method,-m    interpolation method: NEAREST, SIMPLE, BILINEAR, HQLINEAR, DOWNSAMPLE, EDGESENSE, VNG, AHD
       --tiff,-t      add a tiff header
       --swap,-s      if bpp == 16, swap byte order before conversion
       --help,-h      this helpful message


Links
-----

[1] http://sourceforge.net/projects/libdc1394
[2] http://www.imagemagick.org/pipermail/magick-developers/2008-May/002953.html
[3] http://scien.stanford.edu/class/psych221/projects/99/tingchen/main.htm


ImageMagick Integration
-----------------------

A delegates.xml file is included. Add the entries from it to your delegates.xml and you should be able to do:

convert -size 1328x498 -depth 8 RGGB_BAYER:./tests/SV0030.RAW ./SV0030.jpg

Of course if you just need to get a look at the image it is much faster to simply use this program directly (probably with the -t flag).


About

Command line utility to convert bayer grid data to rgb data. Integrates with ImageMagick.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 98.8%
  • Other 1.2%