I'm newbie in OpenCV. My program reads image data in 16 bit signed int, with some benefit from 16 bit signed int The image data must be multiplied. Therefore, the resulting data should be kept in 32 bit image file. I tried the following, but I get 8 bit all white image Please help.
Mat inputData = Mat (size (width, height), CV_16U, input data); InputData.convertTo (Input1 data, CV_32F); Input 1 data = input 1 data * profit; // Benefits of USATort
As seen in Mika's comment, firstly let us scalarize the input data Passing the factor requires a value between 0.0f and 1.0f:
inputData.convertTo (input1Data, CV_32F, 1.0 / 65535.0f); // Since we have values between 0 and 65535 in inputData //, the result of all values will be between 0.05f and 1.0f
and now with multiplication :
input 1 data = input1 data * profit * (1.0 f / 65535.0 f); // Benefits obviously, // will be automatically put to float / so the resulting factor will be worth the value of // 0 to 1, // then also input1 data!
And I think it should be compiled by:
input1Data * = gain * (1.0f / 65535.0f);
Customizing the first version by not creating temporary data.
Comments
Post a Comment