I'm using opencv version 1.0.0
(unfortunately can not use newer one) for basic image operations like addition, division etc.
Data structures i'm using are defined like so:
CvMat m1 = cvCreateMat(w, h, CV_16U);
CvMat m2 = cvCreateMat(w, h, CV_16U);
CvMat m3 = cvCreateMat(w, h, CV_16U);
and contain 16bit unsigned grayscale raw images.
Operations like addition, substraction are working just fine. On the other hand, operation cvDiv(m1, m2, m3);
produces Division by zero
exception.
It seems like mats have to be converted to CV_32F
, but i could not find a way how to properly convert them using opencv.
If i convert them manually (by my own function) i'm getting Violation reading location
exception.
My questions are following:
How to convert
CvMat
fromCV_16U
toCV_32F
How to correctly divide two images using
cvDiv
function