This directory contains several plugins for the popular ImageJ image processing program to work with the images acquired with Elphel cameras. You may unzip them into "plugins" folder of ImageJ to make them accessible through this program.

JP46Reader.tar.gz contains two files: JP46_Reader.java and JP46_Reader_noscale.java. This plugin allows to open images compressed as JP46 - format designed for the raw Bayer mosaic images from the cameras. You may find more details about this format in the LinuxDevices article - http://www.linuxfordevices.com/c/a/Linux-For-Devices-Articles/Elphel-camera-under-the-hood-from-Verilog-to-PHP/ . Plugin makes use of Elphel MakerNote field in Exif header that contains per-channel values of the camera sensor analog gains, black levels and gamma, it takes decompressed 8 bpp images and um-applies gains and gammas resulting in the 32bpp (float) values that are very close to the amount of light that each pixel acquired. 

For the best performance you may acquire images with the gamma set to 0.5 (sensor noise matched value) and analog gains set for the white balance (automatic or manual), so pixels of each color will use all the output range of 8 bits (compressed).

Crosstalk_Deconv.java.tar.gz is designed for experimenting with correction of inter-pixel crosstalk. It does not include automatic crosstalk measurement, that values have to be entered to the program in "Configure" menu. It is possible create test images, apply and un-apply crosstalk - all the modern sensors have significant amount of such crosstalk that both degrades resolution and colors in the digital images.

MTF_Bayer.java.tar.gz - plugin for measuring camera resolution. It started from the SE_MTF plugin for ImageJ (http://rsbweb.nih.gov/ij/plugins/se-mtf/index.html), with added functionality focused on measuring Bayer mosaic images. It accepts such images as monochrome  and processes multiple edges in the selected rectangular area accumulating results from both black-to-white and white-to-black edges (separately). And as the camera resolution can be different in different directions, the plugin can accept near-horizontal slanted edges also. When the "Calculate MTF" button is pressed it detects (and counts) near-vertical edges that run all the selection height, then does the same in the horizontal direction. After that it selects the direction that has more edges (if any) running all the selection height/width.

With the edges are detected plugin approximates each edge by a quadratic (A*x^2+B*X+C) parabola as straight edges on the target become curves because of the lens distortions. Those edges approximations are calculated either individually for each color component (if "Monochromatic" mode is not selected) or together (useful when the camera had color band-pass filter so all the light that reached pixels was approximately the same wavelength and the chromatic aberrations of the lens can be neglected.

With the approximated edges multiple sensor rows/columns are binned with each bin being 1/4 of the pixel size (similarly to ISO-16067-1), the result of the binning is shown in edge-spread function (ESF)  plots and/or tables - separately for each color and edge direction. Green lines on the plot shows green pixels in red rows of Bayer pattern, while cyan color is used for green in blue rows). The derivative of the ESF is line spread function (LSF) that also can be displayed - both in the same scale as the input pixel values or normalized to [0.0..1.0] interval for every color. The result modulation transfer function (MTF) is calculated as the absolute value of the Fourier transform of the LSF.

Some sample files that can be used with the plugins are available here - http://community.elphel.com/files/ImageJ_plugins/sample_files/ The images include shots of nearly-vertical (and nearly-horizontal) black/white stripes, acquired with red, blue, green filters (and no filter at all). These images can be opened with JP46_Reader.java plugin, them processed with MTF_Bayer.java  (you need to select rectangular area on the image that includes stripes and press "Calculate MTF" button). 

The most recent versions of these programs are available for download from the Git repository - http://elphel.git.sourceforge.net/git/gitweb.cgi?p=elphel/ImageJ-Elphel