0

I'm trying to apply derivative based color constancy on images and I'm using opencv in c++ to do so. I'm using Sobel derivatives to calculate my gradients but I don't know what I should cast pixel values of gradient image to in order to be able to read and change them.

Sobel( gradr1, gradr1, gradr1.depth(), 1, 0, 3, 1, 0, BORDER_DEFAULT );
gradr1.at<char>(i,j)

What should I use instead of char?

ZdaR
  • 22,343
  • 7
  • 66
  • 87
Hadi Mz
  • 1
  • 2
  • 2
    what's gradr1.depth()? correct sobel (and tutorial) uses CV_16U or CV_32F typically which would be unsigned short or float. – Micka May 07 '17 at 17:36
  • and if you are in doubt, call gradr1.type() after Sobel computation and compare it to the standard opencv types like CV_8UC1, CV_16UC1, CV_32FC1, CV_64FC1, etc. – Micka May 07 '17 at 20:34
  • get user readable opencv types with: https://stackoverflow.com/questions/10167534/how-to-find-out-what-type-of-a-mat-object-is-with-mattype-in-opencv/17820615#17820615 – chloelle May 07 '17 at 21:37

0 Answers0