Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Type issues

Hello,

Actually, I'm trying to sum images.

That is just a simple example, you're gonna understand my issue :

Mat src ;
Mat datasrc1 ;
src = imread("/home/jetson/Downloads/wd-wallhaven-r2g7rm.jpg", 0);
int size_reshape = src.cols * src.rows ;
datasrc1 = src.reshape(0,1) ;
unsigned char * A ;
unsigned char * B ;
float * E ;
A = datasrc1.data;
E = new float char[size_reshape];
for (int i = 0 ; i<size_reshape ; i++){
    E[i] = (float)A[i] ;
}
cv::Mat Result(src.rows, src.cols, CV_16FC1, E) ;
imwrite("/home/jetson/Desktop/blabla.jpeg", Result) ;

The image that I write is unreadable. I don't want to do a simple conversion, that is a sample of my work. I need to sum several image in 16bit images, and divide. As I don't have to loose informations, I need to use float Mat.

Thank you for your help,