Camera4Kivy Android Video Capture - Include OpenCV Lines/Circles/Text

259 views
Skip to first unread message

Rahul

unread,
Feb 14, 2023, 4:08:24 PM2/14/23
to Kivy users support
Hi,

I am working on an Android application integrating Camera4Kivy and when running the video capture function, I would like to capture additional lines and text I am overlaying on the video with OpenCV. I am overlaying these graphics within the canvas_instructions_callback function and the preview is being displayed on screen to the user. I essentially want to video capture the Rectangle I am outputting to the screen.

Hopefully this makes sense? If any details need clarifying please ask :)

Thank you! 

Robert

unread,
Feb 14, 2023, 6:58:54 PM2/14/23
to Kivy users support
See the examples  https://github.com/Android-for-Python/Camera4Kivy#tested-examples the qr example is the simplest that writes boxes to a screen.

(the opencv example changes the whole preview image, the other examples annotate the preview image with boxes, but analysis and display are independent -  https://github.com/Android-for-Python/Camera4Kivy#image-analysis )

Rahul

unread,
Feb 15, 2023, 4:38:45 AM2/15/23
to Kivy users support
I understand how to use OpenCV to annotate the frames, however, on Android I am using the video capture function to record video and save it to the users camera roll. I want to include the OpenCV annotations in the saved video but for some reason it doesn't default to doing this?

This must be a potential feature so I am wondering how to implement it.

Thank you :)

Robert

unread,
Feb 15, 2023, 12:17:12 PM2/15/23
to Kivy users support
> This must be a potential feature

Only in your imagination.

Rahul

unread,
Feb 15, 2023, 1:29:29 PM2/15/23
to Kivy users support
Ah right, ok no worries. That is unfortunate to hear but I will think of something to work around this. 

Thanks for your help :)

Rahul

unread,
Feb 15, 2023, 2:07:20 PM2/15/23
to Kivy users support
I have realised there is a capture_screenshot function and was wondering if it is possible to somehow take several screenshots and string them together to form a video which can then be saved to the Android device? Is this possible? This is essentially what I need to do.

Thank you.

Robert

unread,
Feb 15, 2023, 4:23:06 PM2/15/23
to Kivy users support
You should first test what frame rate you would get.

generally the desktop tool would be ffmpeg, running that on Android would be a challenge. You might look at ffpyplayer, the api isn't well documented but there are some examples (not a user myself).
Reply all
Reply to author
Forward
0 new messages