Skip to content

Commit

Permalink
rgb instead of rgba
Browse files Browse the repository at this point in the history
  • Loading branch information
gordinmitya committed Aug 2, 2020
1 parent e8f719c commit 9598cea
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class OpenCVConverter() : ImageConverter {
reuseBuffer = converted.buffer

val format = when (converted.type) {
Yuv.Type.YUV_I420 -> Imgproc.COLOR_YUV2RGBA_I420
Yuv.Type.YUV_NV21 -> Imgproc.COLOR_YUV2RGBA_NV21
Yuv.Type.YUV_I420 -> Imgproc.COLOR_YUV2RGB_I420
Yuv.Type.YUV_NV21 -> Imgproc.COLOR_YUV2RGB_NV21
}
val yuvMat =
Mat(image.height + image.height / 2, image.width, CvType.CV_8UC1, converted.buffer)
Expand All @@ -40,6 +40,7 @@ class OpenCVConverter() : ImageConverter {
val bitmap = Bitmap.createBitmap(rgbMat.cols(), rgbMat.rows(), Bitmap.Config.ARGB_8888)
Utils.matToBitmap(rgbMat, bitmap)


// don't forget to call image.close() here
// but as long as we have many converters
// we'll do it in CompositeConverter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import java.nio.ByteBuffer

class RenderScriptConverter(context: Context) : ImageConverter {
val rs = RenderScript.create(context)
val intrinsic = ScriptIntrinsicYuvToRGB.create(rs, Element.RGBA_8888(rs))
val intrinsic = ScriptIntrinsicYuvToRGB.create(rs, Element.RGB_888(rs))

private var reuseBuffer: ByteBuffer? = null

Expand Down

0 comments on commit 9598cea

Please sign in to comment.