GetDiffStats
Calculates the min, max, mean, variance, standard deviation and saturated pixel count for each image as well as the difference mean, variance and standard deviation over the specified image memory rows and cols. The two images MUST be the same size or the methods behavior is undefined as this cannot be verified using the given parameters.

The first method calculates the statistics over a sub-area, while the second method calculates the statistics over the entire image.
Syntax
CImgDifStats GetDiffStats( pMem1, pMem2, lRow1, lRow2, lCol1, lCol2, lCols, bpp );
CImgDifStats GetDiffStats( pMem1, pMem2, lRows, lCols, bpp );
Parameters
void* pMem1
A void pointer to the first image buffer.
void* pMem2
A void pointer to the second image buffer.
long lRow1
The start row, in pixels, of the sub-image area to use in calculating the statistics.
long lRow2
The end row, in pixels, of the sub-image area to use in calculating the statistics.
long lCol1
The start column, in pixels, of the sub-image area to use in calculating the statistics.
long lCol2
The end column, in pixels, of the sub-image area to use in calculating the statistics.
long lRows
The row size of the full image ( in pixels ).
long lCols
The column size of the full image ( in pixels ).
int bpp
[optional] The bits-per-pixel used in the image. Default: CImage::BPP16
Returns
CImgDifStats class object
Required Headers
CImage.h
Namespace
arc
Throws
std::runtime_error
Remarks
This method is primarily used for generating photon transfer curves ( PTC ).
Example
        // This code demonstrates how to print out the difference
        // stats for two flat field images over the entire image.

        #include <iostream>
        #include "CImage.h"

        using namespace std;
        using namespace arc;

        int main()
        {
            unsigned short *pBuf1 = NULL;
            unsigned short *pBuf2 = NULL;

            //
            // Assign pBuf1/2 pointers to image data that
            // can be directly from a camera or from an
            // existing FITS file, etc.
            //
            // .....

            try {
                CImage cImg;
     
                //
                // pBuf1 & 2 represent image buffers that contain
                // 1024x1200 pixel images.
                //
                CImage::CImgDifStats cDifStats = cImg.GetDiffStats( pBuf1,
                                                                    pBuf2,
                                                                    1024,
                                                                    1200 );

                cout << "pBuf1 min: " << cDifStats.cImg1Stats.gMin
                     << "pBuf1 max: " << cDifStats.cImg1Stats.gMax << endl;

                cout << "pBuf2 min: " << cDifStats.cImg2Stats.gMin
                     << "pBuf2 max: " << cDifStats.cImg2Stats.gMax << endl;
 
                cout << "Diff min: " << cDifStats.cImgDiffStats.gMin
                     << "Diff max: " << cDifStats.cImgDiffStats.gMax << endl;
            }
            catch ( std::exception &e )
            {
                cerr << "Exception Occurred: " << e.what() << endl;
            }
        }

© Astronomical Research Cameras, Inc.