Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Instead, imagine running floating point processing on the image. When complete, convert back to CV_16U and save the image.

This does not appear to work either:

#include <stdio.h>

include <opencv2 opencv.hpp="">

using namespace cv;

int main(int argc, char** argv ) { if ( argc != 4 ) { printf("usage: DisplayImage.out <image_path>\n"); return -1; }

//read images from memory
Mat A;
A = imread( argv[1], CV_LOAD_IMAGE_UNCHANGED );
Mat B;
B = imread( argv[2], CV_LOAD_IMAGE_UNCHANGED );
Mat C;
C = imread( argv[3], CV_LOAD_IMAGE_UNCHANGED );

//create floating point images for image manipulation
Mat Aa;
A.convertTo(Aa,5);
Mat Bb;
B.convertTo(Bb,5);
Mat Cc;
C.convertTo(Cc,5);

if ( (!Aa.data) || (!Bb.data) || (!Cc.data) )
{
    printf("Missing image data \n");
    return -1;
}

//subtract dark field from source image
Mat D;
D = Aa - Bb;
Mat E;
E = Cc/D;
Mat Econvert;
E.convertTo(Econvert,CV_16U);
//save image
imwrite("Econverted.tiff",E);

return 0;

}

Please advise

Instead, imagine running floating point processing on the image. When complete, convert back to CV_16U and save the image.

This does not appear to work either:

#include <stdio.h>

include <opencv2 opencv.hpp="">

#include <opencv2/opencv.hpp> using namespace cv;

cv; int main(int argc, char** argv ) { if ( argc != 4 ) { printf("usage: DisplayImage.out <image_path>\n"); <Image_Path>\n"); return -1; }

}

    //read images from memory
 Mat A;
 A = imread( argv[1], CV_LOAD_IMAGE_UNCHANGED );
 Mat B;
 B = imread( argv[2], CV_LOAD_IMAGE_UNCHANGED );
 Mat C;
 C = imread( argv[3], CV_LOAD_IMAGE_UNCHANGED );

 //create floating point images for image manipulation
 Mat Aa;
 A.convertTo(Aa,5);
 Mat Bb;
 B.convertTo(Bb,5);
 Mat Cc;
 C.convertTo(Cc,5);

 if ( (!Aa.data) || (!Bb.data) || (!Cc.data) )
 {
     printf("Missing image data \n");
     return -1;
 }

 //subtract dark field from source image
 Mat D;
 D = Aa - Bb;
 Mat E;
 E = Cc/D;
 Mat Econvert;
 E.convertTo(Econvert,CV_16U);
 //save image
 imwrite("Econverted.tiff",E);

 return 0;
}

}

Please advise