I find that I am making many calls to convertTo () in my opencv c ++ code. This is somewhat confusing, and I'm not sure when I need to convert the image depth until I get an error message.
For example, I have Mat representing an image equal to 16U. Then I try to call matchTemplate () and get an assertion error that it expects 8U or 32F. Why shouldn't the template work on 16U? Similar problems arise when displaying an image (although restrictions on bit depth make more sense when displaying images). I am in a game with convertTo () and scaling factors and trying to display images correctly using imshow (), and I would like to do it more elegantly (maybe I'm ruined by the matlab imagesc function).
Am I missing something fundamental in that OpenCV expects to use bit depth? How to deal with opencv library function requirements for bit depth in a cleaner way?
source share