c# - Opencv: Working with 16bit image, Uint16 -
i have 12bit image want work in opencv, such detecting blobs etc.
the image uint16 array. , want convert opencv mat or iplimage. need inorder threshold , detect blobs.
what im doing convert ushort array bitmap, , mat using opencv extensions, see below.
ushort[,] red = new ushort [480,640]; //grab image in ushort array //.. bmpred = u16arraytobitmap(red); mat redmat = new mat(); redmat = opencvsharp.extensions.bitmapconverter.tomat(bmpred); now redmat, mat image u8c4, understand 4 chanel unsigned 8 bit. wont work me, because want use of 12 bits!
is possible convert ushort array or bitmap 16bit grayscale mat or iplimage?
thanks!
you can use mat constructor directly:
var mat = new mat(red.getlength(0), red.getlength(1), mattype.cv_16uc1, red); or use matofushort:
var mat = new matofushort(red.getlength(0), red.getlength(1), red); note mat using pointer red array. clone mat if want use copy:
var clone = mat.clone(); for more information check mat - basic image container opencv documentation page , opencvsharp wiki.
Comments
Post a Comment