I am trying to convert the photo I take into one bit per pixel Bitmap in Android (Kotlin).
Imgproc.threshold(tmp,tmp, bwThreshold.toDouble(),255.0,Imgproc.THRESH_BINARY)
Utils.matToBitmap(tmp,bitmapCropped)
This is the code block im trying to use, but this results in 8 bit per pixel Bitmaps. I searched OpenCV library to see if I can fix this, but only thing I’ve found was THRESH_BINARY gives MAX_VAL if the value is above threshold, which is 255 in 8 bit image.
I am creating Bitmap as follows;
Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888)
But Bitmap.Config does not contain any config for 1 bit per pixel bitmaps.
Is there a way to achieve one bit per pixel Bitmap?
I tried to understand how Bitmaps work by reading the following link; https://en.wikipedia.org/wiki/BMP_file_format but this looks way to complicated for what I’m trying to achieve.
I tried to search every topic related to one bit per pixel bitmap topic on Stackoverflow but I couldn’t find any solutions.
trafon31 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.