Hello, here's my problem. I'm writing a program that shall handle both 8bit and 16 bit data. The problem is that every procedure to modify the data must use the template of the proper class. For example:
img = cv::imread(path, CV_LOAD_IMAGE_ANYDEPTH);
std::for_each(img.begin<?>(), img.end<?>(), cleanPixel);
? above being ushort in the case of 16bit and uchar in the case of 8bit data. I know that I can check the depth of the image using the method img.depth(), and check the equality with either CV_16U or CV_8U. Is that the only way? I was also thinking to use some preprocessor constant, and maybe compile two different version of the program (one only for 8bit images and one only for 16bit images).
Thanks in advance for your help.