Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dependency on OpenCV for capture and encoding #9

Open
dzhoshkun opened this issue Jul 13, 2018 · 12 comments
Open

Remove dependency on OpenCV for capture and encoding #9

dzhoshkun opened this issue Jul 13, 2018 · 12 comments

Comments

@dzhoshkun
Copy link
Contributor

dzhoshkun commented Jul 13, 2018

GIFT-Grab uses OpenCV for:

However OpenCV depends on FFmpeg, presumably for these tasks. FFmpeg is already used in GIFT-Grab as well. And OpenCV is quite a heavy-weight dependency in this regard. So it might be worth removing it in favour of using FFmpeg for all that OpenCV is needed for in GIFT-Grab.

With this, the OpenCV dependency will become optional, and for the time being confined to #10

@tvercaut
Copy link
Member

That makes sense. One thing we discussed a long time ago though was to be able to decorate/adapt a VideoFrame (https://github.com/gift-surg/GIFT-Grab/blob/master/src/api/videoframe.h) to present it as an OpenCV image if OpenCV is specified as a dependency. This would ease integrating GIFT-Grab in processing pipelines.

@dzhoshkun
Copy link
Contributor Author

dzhoshkun commented Jul 16, 2018

@dzhoshkun
Copy link
Contributor Author

A more thorough search, which:

  • should be revisited (for repo items to be updated) before closing this issue,

has revealed that OpenCV is also used for capturing BGRA frames from Epiphan frame grabbers.

  • so BGRA captures from Epiphan should be supported by an appropriate alternative.

For instance Epiphan SDK provides the V2U_GRABFRAME_FORMAT_ARGB32 flag (i.e. BGRA in reverse order). I reckon libVLC will provide an equivalent as well. However BGRA does not seem to be available. Maybe:

  • check how this is implemented in OpenCV (as OpenCV uses video4linux under the hood, AFAIK).

@dzhoshkun
Copy link
Contributor Author

@tvercaut I'm going to address OpenCV compatibility in a separate issue #10

@dzhoshkun
Copy link
Contributor Author

This thread might be useful for supporting BGRA capture with libVLC.

@dzhoshkun
Copy link
Contributor Author

A video-4-linux example https://linuxtv.org/downloads/v4l-dvb-apis/uapi/v4l/v4l2grab.c.html potentially useful for #9 (comment)

@dzhoshkun
Copy link
Contributor Author

There's OpenCV color conversion involved in the current implementation, so we could as well use the Epiphan SDK's V2U_GRABFRAME_FORMAT_ARGB32 (#9 (comment)) and do the conversion manually!

@dzhoshkun
Copy link
Contributor Author

@dzhoshkun
Copy link
Contributor Author

  • run CI up to above commit with an Epiphan device!
  • more restructuring is needed e.g. in CMake configuration

@dzhoshkun
Copy link
Contributor Author

FFmpeg seems to nail it:

[0] % ./tests/rgbswap/argb_to_bgra_profiler     
Profiling ARGB => BGRA conversion for 1920 x 1080 image
Loop (success) took: 11333 usec
memcpy took: 3739 usec
Function (success) took: 35876 usec
FFmpeg (success) took: 10 usec

@tvercaut
Copy link
Member

tvercaut commented Nov 1, 2018

As per #10, OpenCV compatibility is an important feature for many (but not all) users. Should we rename this issue as "Make OpenCV dependency optional" or "Remove mandatory core dependency on OpenCV"?

@dzhoshkun dzhoshkun changed the title Remove OpenCV dependency Remove dependency on OpenCV for capture and encoding Nov 1, 2018
@dzhoshkun
Copy link
Contributor Author

@tvercaut Agreed, I've updated the title and the description to make this issue more specific.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants