How to directly process ROI of preview data and display the processed data on screen?
I am processing the frame data in onPreviewFrame()
function. I would like to change the left-top 1/4 part of the preview data to gray while keep the other part as colorful image. Because I am a beginner of OpenCV I don't know what is the best method. So I use a workaround:
- change the data parameter of
onPreviewFrame
from yuv to rgb, then usematToBitmap()
function to convert it to a bitmap. - change the ROI data to a gray bitmap (
COLOR_GRAY2RGBA
, and thenmatToBitmap()
). - draw the gray bitmap onto the first bitmap I get
- draw the bitmap on canvas.
Although this method works, I still want to know whether there is a better method: can I directly process the ROI of original data and convert new whole data to a bitmap, and draw the bitmap on canvas. Is there any way I can do it?