Preferred numeric type for image processing algorithms

Hey everyone,

I was just wondering, should one prefer something like uchar or float when doing a lot of heavy image processing?

I’ve been leaning towards using nothing but CV_F32 but was just wondering if this is considered an anti-pattern.

wouldn’t this be specific to your actual processing pipeline (which is ?) ?

i don’t think, that there’s a “general answer” to this

Ah, fair.

I’m working on some routine that lazily take 8-bit sRGB data and convert them to linear RGB data as floats.

To this end, it’s a lot easier to do things like white balance, convert to grayscale (I know OpenCV already has a function for this) and just other math in general.

Seems to weird people out to do this but maybe that’s because they’re used to libraries handling this for them.

since you’re working with gamma curves, I would stick with floats as well.

the pushback against floats you might be getting tends to come from people who have no idea that gamma mapping even exists, or that it matters when calculating on pictures (resampling as a particularly obvious case).