Ask Your Question

mmecchia's profile - activity

2018-02-12 04:38:28 -0600 marked best answer Handling both 16bit and 8bit images in the same program.

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.

2018-02-12 04:38:28 -0600 received badge  Scholar (source)
2018-02-09 11:42:12 -0600 commented question Handling both 16bit and 8bit images in the same program.

I want, if possible, avoid ifs every time I have to access the pixel data.

2018-02-09 10:29:09 -0600 asked a question Handling both 16bit and 8bit images in the same program.

Handling both 16bit and 8bit images in the same program. Hello, here's my problem. I'm writing a program that shall hand