# OpenCVLink insight?

**URL:** <https://community.wolfram.com/t/opencvlink-insight/13113>\
**Category:** Questions\
**Tags:** image-processing, external-interfaces\
**Created:** [September 21, 2018, 6:08pm UTC](https://community.wolfram.com/t/opencvlink-insight/13113 "2018-09-21T18:08:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![flip](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/flip/32/33701_2.png) [@flip](https://community.wolfram.com/u/flip)\
**Post date:** [September 21, 2018, 6:08pm UTC](https://community.wolfram.com/t/opencvlink-insight/13113/1 "2018-09-21T18:08:51Z")

</div>

Recent versions of Mathematica contain OpenCVLink, presumably for support of image processing routines in WL. Its internal nature means that it is, understandably, relatively incomplete and undocumented.

I have some optic flow calculations to do, and, indeed, I see that two CUDA implementations are available,

```
$OpticalFlowFarneback

```

and

```
$OpticalFlowDualTVL1

```

but their parameters are not as easily decipherable as some of the other implementations (`$Dilation` for example).

I was wondering if anyone out there had successfully parsed the unparsable or, barring that, someone has a `.mc` link that uses OpenCV that I can just steal as a template.Maybe even WRI could think of releasing some of these incomplete undocumented links to the GitHub-o-verse where the public could enhance and refine them?

---

<div class="post-metadata">

**Author:** ![shadi](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/shadi/32/18759_2.png) [@shadi](https://community.wolfram.com/u/shadi)\
**Post date:** [September 21, 2018, 7:32pm UTC](https://community.wolfram.com/t/opencvlink-insight/13113/2 "2018-09-21T19:32:28Z")

</div>

Hi Flip.

I understand it would be useful to add usage to our OpenCVLink functions and we’ll consider putting some effort in doing so. But, keep in mind that we have them so that we use them one way or the other with WL functions.

`$OpticalFlowFarneback` is the method used in `ImageDisplacements`. You can access `$OpticalFlowDualTVL1` using the undocumented Method-\>“TotalVariation”, but our tests show that this method is not giving results of consistent quality and that’s why we haven’t exposed it.

---

<div class="post-metadata">

**Author:** ![flip](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/flip/32/33701_2.png) [@flip](https://community.wolfram.com/u/flip)\
**Post date:** [September 21, 2018, 10:20pm UTC](https://community.wolfram.com/t/opencvlink-insight/13113/3 "2018-09-21T22:20:19Z")

</div>

Hi Shadi!

OK great, thank you- good to know about the Dual TVL 1… I know precisely what you’re talking about re: consistency, seems that things have to be ‘just right’ for it to work. Also, I didn’t know the Farneback is presently used in `ImageDisplacements` so I’ll play around there also.

Thanks for getting back on this-

---

<div class="post-metadata">

**Author:** ![ghorbani](https://avatars.discourse-cdn.com/v4/letter/g/6a8cbe/32.png) [@ghorbani](https://community.wolfram.com/u/ghorbani)\
**Post date:** [July 29, 2024, 2:09pm UTC](https://community.wolfram.com/t/opencvlink-insight/13113/4 "2024-07-29T14:09:58Z")

</div>

Salam Shadi,

I hope everything is going well for you.  
I tried to use the OpticalFlow for a small project and did something. I’m not sure whether I went the right way or not. May I get your help.?

All the best,  
Mohammad

---

<div class="post-metadata">

**Author:** ![shadi](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/shadi/32/18759_2.png) [@shadi](https://community.wolfram.com/u/shadi)\
**Post date:** [July 29, 2024, 2:10pm UTC](https://community.wolfram.com/t/opencvlink-insight/13113/5 "2024-07-29T14:10:32Z")

</div>

Sure. Please feel free to comment here or create a new post with your question. Either the community or myself should be able to help.

---

<div class="post-metadata">

**Author:** ![ghorbani](https://avatars.discourse-cdn.com/v4/letter/g/6a8cbe/32.png) [@ghorbani](https://community.wolfram.com/u/ghorbani)\
**Post date:** [July 29, 2024, 7:09pm UTC](https://community.wolfram.com/t/opencvlink-insight/13113/6 "2024-07-29T19:09:40Z")

</div>

Thank you, Shadi.

I came across this [post](https://community.wolfram.com/groups/-/m/t/3032397) that shows how optical flow is used in the tracking cell’s motion.

As I am a hydrologist, I decided to use the optical flow for measuring river  
flow velocity. I recorded a short video (10 seconds) from the Sumida River, Japan.  
I did something and got the initial results. Please have a look at the enclosed  
notebook and the video.  
The main aim of this notebook is the extraction of velocity components.

[Sumida River.nb](https://community.wolfram.com/uploads/short-url/2yurr1U2AA9LahcZh0MDiRSmuIE.nb) (2.48 MB)
