OpenCV Tutorial Source Code

Ask software engineering and SDK questions for developers working on Mac OS X, Windows or Linux.
  • Author
  • Message
Offline

jmeldrum

  • Posts: 1
  • Joined: Wed May 08, 2019 11:39 pm
  • Real Name: Joe Meldrum

OpenCV Tutorial Source Code

PostWed May 08, 2019 11:42 pm

I appreciate the video tutorial for live video processing with OpenCV that was posted recently on the Support page. Is the full source code available for the tutorial?
Offline

GlennNZ

  • Posts: 2
  • Joined: Sat Sep 28, 2019 11:37 pm
  • Real Name: Glenn Hawken

Re: OpenCV Tutorial Source Code

PostSun Sep 29, 2019 11:09 pm

+1
Me to!
Thanks
Offline

tautin

  • Posts: 45
  • Joined: Thu Oct 18, 2018 3:11 pm
  • Real Name: Tim Autin

Re: OpenCV Tutorial Source Code

PostTue Mar 17, 2020 10:59 am

For what it's worth, +1 ;)
Offline

Cameron Nichols

Blackmagic Design

  • Posts: 294
  • Joined: Mon Sep 04, 2017 4:05 am

Re: OpenCV Tutorial Source Code

PostWed Mar 18, 2020 10:19 pm

Hi Tim,

The Live Video Processing with OpenCV tutorial source is available on the Blackmagic Developer site:

https://www.blackmagicdesign.com/develo ... d-playback

Under heading: Presentations and Sample Code

Regards
Cameron
Offline

tautin

  • Posts: 45
  • Joined: Thu Oct 18, 2018 3:11 pm
  • Real Name: Tim Autin

Re: OpenCV Tutorial Source Code

PostFri Mar 20, 2020 3:26 pm

Hi Cameron,

Thank you so much :)!
I ran the program and would like to know if there's something we can do to improve the latency when simply looping through, or this the best we can get with Decklink cards (I'm evaluating AR directly with Decklink vs with ATEM + green background / keying)?

Thanks again!

EDIT: you might want to know that the code requires some minor updates to run with a DeckLink 8K Pro.
Offline

giorgi3092

  • Posts: 6
  • Joined: Fri Jul 10, 2020 1:45 pm
  • Real Name: Giorgi Aptsiauri

Re: OpenCV Tutorial Source Code

PostFri Jul 10, 2020 1:56 pm

tautin wrote:Hi Cameron,

Thank you so much :)!
I ran the program and would like to know if there's something we can do to improve the latency when simply looping through, or this the best we can get with Decklink cards (I'm evaluating AR directly with Decklink vs with ATEM + green background / keying)?

Thanks again!

EDIT: you might want to know that the code requires some minor updates to run with a DeckLink 8K Pro.


Hey, can you elaborate on what changes are required to run the OpenCV example with DeckLink 8K Pro?
I am having trouble running it. The output is:
Code: Select all
StartDeckLinkCapture
Capture failed: Could not enable video input


I examined the code quickly and have set the mode to bmdModeHD1080i50 as the camera connected is set to 1080i50 as SDI video output.
I get the same error when I run the program.

I also ran the sample programs which auto-detect the camera mode and they also choose this mode (bmdModeHD1080i50) automatically.

But, again, I can't get it to work with the given OpenCV example.

Can you help on this?
Offline

tautin

  • Posts: 45
  • Joined: Thu Oct 18, 2018 3:11 pm
  • Real Name: Tim Autin

Re: OpenCV Tutorial Source Code

PostThu Jul 16, 2020 3:45 pm

Hey, can you elaborate on what changes are required to run the OpenCV example with DeckLink 8K Pro?
I am having trouble running it. The output is:


Hello,

I don't remember what I changed exactly, but I attached the working project (tested on Ubuntu 16.04 LTS with a DeckLink 8K Pro).

Step I followed:
- plug your camera in the 1st input (the one next to the ref input)
- plug your screen in the 3rd input
- open BlackMagic Desktop Video Setup and:
-> set DeckLink 8K Pro (1) connector to SDI 1 In or Out
-> set DeckLink 8K Pro (2) connector to SDI 3 In or Out
- update the BuildLinux.sh script to put your OpenCV & DeckLink SDK paths
- update the LiveVideoWithOpenCV.cpp at line 552 to set your camera's video mode (4K, Full HD, etc)
- cd into the project folder
- run ./BuildLinux.sh
- run ./build/LiveVideoWithOpenCV

By default you should get a video with a green rectangle around your face when you smile.

Have fun ;)
Attachments
Blackmagic Live Video Processing with OpenCV.zip
(22.33 KiB) Downloaded 31 times
Offline

giorgi3092

  • Posts: 6
  • Joined: Fri Jul 10, 2020 1:45 pm
  • Real Name: Giorgi Aptsiauri

Re: OpenCV Tutorial Source Code

PostMon Jul 20, 2020 8:19 am

tautin wrote:
Hey, can you elaborate on what changes are required to run the OpenCV example with DeckLink 8K Pro?
I am having trouble running it. The output is:


Hello,

I don't remember what I changed exactly, but I attached the working project (tested on Ubuntu 16.04 LTS with a DeckLink 8K Pro).

Step I followed:
- plug your camera in the 1st input (the one next to the ref input)
- plug your screen in the 3rd input
- open BlackMagic Desktop Video Setup and:
-> set DeckLink 8K Pro (1) connector to SDI 1 In or Out
-> set DeckLink 8K Pro (2) connector to SDI 3 In or Out
- update the BuildLinux.sh script to put your OpenCV & DeckLink SDK paths
- update the LiveVideoWithOpenCV.cpp at line 552 to set your camera's video mode (4K, Full HD, etc)
- cd into the project folder
- run ./BuildLinux.sh
- run ./build/LiveVideoWithOpenCV

By default you should get a video with a green rectangle around your face when you smile.

Have fun ;)


Thank you so much! I am developing on Windows but your modifications immensely helped me to gain insight into the flow of the program and what functions really do.

I have modified the DeviceManager class according to yours and it works now!
The problem was that the program only kept enabling the device which arrived last, which was DeckLink subdevice 4 which was not correctly configured in Video Setup software. Your code kept those device pointers in an array and enabled me to enable each device separately and choose the device properly.

Also, credits to Cameron Nichols who gave me valuable insight through email exchange.
Thanks!

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 2 guests