How to manipulate on the fly YUV Camera frame efficiently in Android?

后端 未结 2 771
既然无缘
既然无缘 2021-01-27 03:26

I\'m adding a black (0) padding around Region of interest (center) of NV21 frame got from Android CameraPreview callbacks in a thread.

To avoid overhead of

2条回答
  •  南笙
    南笙 (楼主)
    2021-01-27 03:59

    Obviously, the most efficient way to pass image for detection would be to pass the ROI rectangle to detector. All our image processing functions accept bounding box as a parameter.

    If the black margin is used for display, consider using a black overlay mask for preview layout instead of pixel manipulation.

    If pixel manipulation is inevitable, check if you can limit it to Y OK, you already do this!

    If your detector works on a downscaled image (as my face recognition engine does), it may be wise to apply black out to a resized frame.

    At any rate, keep your loops clean and tidy, remove all recurring calculations. Using Arrays.fill() operations may help significantly, but not dramatically.

提交回复
热议问题