Check if a data buffer can be decoded
Is there an OpenCV function that allows us to do an initial check whether a given data buffer can be decoded by cv::imdecode() without fully decoding it?
Looking through the source for imdecode(), I do see that it utilizes a helper function findDecoder() to identify the correct decoder, but that helper is a static function. I'm wondering if there is public version of this function to do a quick initial check.
If there is no such public function, I should be able to write one utilizing the cv::ImageCodecInitializer container and following the code of findDecoder(), correct?
why do you need it ? what would you do, if a buffer can be decoded ?
before trying to hack anything on your own, i guess you want to see the outcome of this
in my case an encoded buffer may be a photographic or a medical image. i want to determine which image it is efficiently so that i can skip a photographic buffer if i'm expecting a medical image. thanks for the link - the changes there should address my need.