Android OpenCV - Take Mat object from VideoView/SurfaceView

asked 2017-10-12 08:04:03 -0500

chrichri gravatar image

updated 2017-10-12 08:21:20 -0500


In my Android app there is a VideoView (I can also use a SurfaceView) where display a livestream from an udp url (it is the live stream from a GoPro and it work well).

I need to take, when I click on a button, the actual frame displayed in the VideoView and save it in a Mat object.

How can I do this?

Thank you very much!

Best Regards!

edit retag flag offensive close merge delete


is this running in the same app ?

if so, you should try to get the image before you take it to the VideoView, not try to copy it from there.

if it's not the same app, it's doubtful, if this possible (or legit) at all.

(it seems, you did not think this though to the end)

berak gravatar imageberak ( 2017-10-12 09:20:45 -0500 )edit

Thank you very much! Yes it is the same app!

But I use a vlc library that take the udp stream from a GoPro and display it to the videoView. I have tried to take a screenshot of the screen with this code: .... View v1 = getWindow().getDecorView().getRootView(); v1.setDrawingCacheEnabled(true); Bitmap bitmap = Bitmap.createBitmap(v1.getDrawingCache()); ...... but it take the screenshot without the status bar and the videoview is black.. If I use the classic key combination in the tablet, the screenshot display the videoview correctly and the status bar etc... Can I use some java command, to take the screenshot of the display (with the videoview content)? If so, I can cut the screenshot etc...


chrichri gravatar imagechrichri ( 2017-10-12 09:54:15 -0500 )edit

" that take the udp stream from a GoPro and display it to the videoView" -- and that's where you probably should try to intercept it, not afterwards.

please, add code to your question (not in a comment), showing, how you do that, maybe someone has an idea.

berak gravatar imageberak ( 2017-10-12 09:58:56 -0500 )edit