Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

problem to load 32 bit img

Hello,

I have a problem to read a 32-bit image. Actually, I can read the image but I don't understand why, the image is a little bit different.

A snipped of my code :

#include <iostream>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>

int main() {
    int  heigh = 6004 ;
    int  width = 7920 ;
    float* imgDark = new float[heigh*width] ;
    float* imgDark = new float[heigh*width] ;
    cv::Mat imgDarkcv = cv::imread("/home/nl37/Desktop/0uA_no_binning.tif",2) ;
for(int i = 0 ; i<heigh ; i++)
{
        for(int j =0 ; j<width ; j++)
        {
            imgDark[i*width + j] = imgDarkcv.at<float>(i, j) ;
        }
    }
  cv::Mat *img_cp = new cv::Mat(heigh , width, CV_32FC1, imgDark) ;    
  cv::imwrite("/home/nl37/Desktop/LUT1.tif", *img_cp)  ;
  return 0 ;    
}

Then, with imagej, I calculate the difference between 0uA_no_binning.tif and LUT1. The is not 0. I do not understand my error here. Noticed that I need to convert the image in float*.

Thank you for your help !

problem to load 32 bit img

Hello,

I have a problem to read a 32-bit image. Actually, I can read the image but I don't understand why, the image is a little bit different.

A snipped of my code :

#include <iostream>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>

int main() {
    int  heigh = 6004 ;
    int  width = 7920 ;
    float* imgDark = new float[heigh*width] ;
    float* imgDark = new float[heigh*width] ;
    cv::Mat imgDarkcv = cv::imread("/home/nl37/Desktop/0uA_no_binning.tif",2) ;
for(int i = 0 ; i<heigh ; i++)
{
        for(int j =0 ; j<width ; j++)
        {
            imgDark[i*width + j] = imgDarkcv.at<float>(i, j) ;
        }
    }
  cv::Mat *img_cp = new cv::Mat(heigh , width, CV_32FC1, imgDark) ;    
  cv::imwrite("/home/nl37/Desktop/LUT1.tif", *img_cp)  ;
  return 0 ;    
}

Then, with imagej, I calculate the difference between 0uA_no_binning.tif and LUT1. The is not 0. I do not understand my error here. Noticed that I need to convert the image in float*.

Thank you for your help !

problem to load 32 bit img

Hello,

I have a problem to read a 32-bit image. Actually, I can read the image but I don't understand why, the image is a little bit different.

A snipped of my code :: (the image is saved in grayscale)

#include <iostream>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>

int main() {
    int  heigh = 6004 ;
    int  width = 7920 ;
    float* imgDark = new float[heigh*width] ;
    cv::Mat imgDarkcv = cv::imread("/home/nl37/Desktop/0uA_no_binning.tif",2) ;
for(int i = 0 ; i<heigh ; i++)
{
        for(int j =0 ; j<width ; j++)
        {
            imgDark[i*width + j] = imgDarkcv.at<float>(i, j) ;
        }
    }
  cv::Mat *img_cp = new cv::Mat(heigh , width, CV_32FC1, imgDark) ;    
  cv::imwrite("/home/nl37/Desktop/LUT1.tif", *img_cp)  ;
  return 0 ;    
}

Then, with imagej, I calculate the difference between 0uA_no_binning.tif and LUT1. The is not 0. I do not understand my error here. Noticed that I need to convert the image in float*.

Thank you for your help !