opencv - Is there any easy way to find the maximum (i.e. white) value for a given Open CV type? -
if have open cv matrix , don't know type (e.g. 8 bit unsigned, 32 bit float), there easy function give me value used represent white (so 255 8 bit unsigned, 1.0 32 bit float, etc)?
on opencv 2.x, take @ mat::depth retrieve (quoting docs):
the identifier of matrix element depth (the type of each individual channel)
from there can calculate value represent white color switch:
switch (image.depth()) { case cv_8u: white = scalar(255,255,255); break; case cv_8s: ... }
Comments
Post a Comment