UVCCamera icon indicating copy to clipboard operation
UVCCamera copied to clipboard

How I draw a line on every frames ?

Open Student414 opened this issue 6 years ago • 2 comments

Same as titile. I want to get per frame when previewing, and do something with this frame(like face detection or recognize), finally render to UVCCameraTextureView. Can you give me a solution? I am very pleasure if you can reply my issue, thanks sincerely.

Student414 avatar Apr 11 '18 03:04 Student414

reply myself:

uvcCamera.setFrameCallback(new IFrameCallback() {
            private Bitmap finalBitmap;
            private byte[] bufferAvoidGC;

            @Override
            public void onFrame(ByteBuffer frame) {
                     // some operation
            }
        }, UVCCamera.PIXEL_FORMAT_RGBX);

Student414 avatar Apr 18 '18 06:04 Student414

Hi,

I would like to print a text in the shown video, but the function is never called. I also would like to have the additional text shown in the recorded video. Is the also done within this function ?

I am using the following code:

		private final IFrameCallback mIFrameCallback = new IFrameCallback() {
		@Override
		public void onFrame(final ByteBuffer frame) {
			frame.clear();
			synchronized (bitmap) {
				bitmap.copyPixelsFromBuffer(frame);
				Canvas c = new Canvas(bitmap);
				Paint p = new Paint();
				p.setColor(Color.rgb(61, 61, 61));
				p.setTextSize((int) (14 * 10));
				p.setShadowLayer(1f, 0f, 1f, Color.WHITE);
				c.drawText("Hello", 30, 210, p);
			}
		}
	};

The function is never call, because I set a break point which never reached.

Any hints ?

Best regards R.

ritchie-w avatar May 15 '18 18:05 ritchie-w