How to generate/convertto 1 bit depth image
I am new to OpenCV, I am trying to generate a 1 bit image using OpenCV APIs. Is this possible? Can someone point me to right API.
Thank you
MB
I am new to OpenCV, I am trying to generate a 1 bit image using OpenCV APIs. Is this possible? Can someone point me to right API.
Thank you
MB
Are talking about thresholding?
cvThreshold(const CvArr* src, CvArr* dst, double threshold, double max_value, int threshold_type)
http://docs.opencv.org/2.4.5/modules/imgproc/doc/miscellaneous_transformations.html?highlight=threshold#void adaptiveThreshold(InputArray src, OutputArray dst, double maxValue, int adaptiveMethod, int thresholdType, int blockSize, double C)
Thank you Douglas, but when I write the Mat (the resultant Mat) object using imwrite to a file as PNG file, the file properties show the 'bit depth' as '8' rather than '1'.
Is there special way I need to use imwrite to accomplish this or some other technique exists.
Thanks
MB
I am trying to do the same thing. I tried saving as .pbm but that still outputs a 8 bit image. The original image I open is a 1 bit image, monchrome, which I can save to any graphics format I want and I can increase the bit depth. Just can't save as is, which is a bit depth of 1. Mat sourceImage = imread(inputFile, CV_LOAD_IMAGE_UNCHANGED) does not leave it unchanged as it implies. Any way to do it?
Asked: 2013-11-01 16:12:02 -0600
Seen: 2,302 times
Last updated: Nov 01 '13