# ANN: VideoCaptureWrap.jl

**URL:** <https://discourse.julialang.org/t/ann-videocapturewrap-jl/45491>\
**Category:** Package Announcements\
**Tags:** package, application\
**Created:** [August 25, 2020, 7:11am UTC](https://discourse.julialang.org/t/ann-videocapturewrap-jl/45491 "2020-08-25T07:11:32Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![terasakisatoshi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/terasakisatoshi/32/9187_2.png) [@terasakisatoshi](https://discourse.julialang.org/u/terasakisatoshi)\
**Post date:** [August 25, 2020, 7:11am UTC](https://discourse.julialang.org/t/ann-videocapturewrap-jl/45491/1 "2020-08-25T07:11:32Z")

</div>

Hi there, I’m happy to announce the release of [VideoCaptureWrap.jl](https://github.com/terasakisatoshi/VideoCaptureWrap.jl). 🎉

- This application gives us an example of how to wrap OpenCV API via [CxxWrap.jl](https://github.com/JuliaInterop/CxxWrap.jl). It also demonstrates a demo that capture image from your Web/USB camera and display its result using [ImageInTerminal.jl](https://github.com/JuliaImages/ImageInTerminal.jl).

- It is tested on Ubuntu 18.04 or Mac(Catalina) with Julia v1.5.0.

- I know there are already existing great packages such as [https://github.com/JuliaIO/VideoIO.jl,https://github.com/Affie/Video4Linux.jl](https://github.com/JuliaIO/VideoIO.jl,https://github.com/Affie/Video4Linux.jl), but the more means the better. 😉

Hope it helps for those who like to utilize Julia, CxxWrap.jl, OpenCV, Image Processing etc… 😃

# Usage

## Running application locally

```console
$ make cli # display image on terminal using ImageInTerminal.jl
$ make gui # display image using OpenCV's API

```

## Running application inside of Docker container (Linux users only)

```julia-auto
$ bash run.sh

```

---

<div class="post-metadata">

**Author:** ![tim.holy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tim.holy/32/52_2.png) [@tim.holy](https://discourse.julialang.org/u/tim.holy)\
**Post date:** [August 25, 2020, 2:40pm UTC](https://discourse.julialang.org/t/ann-videocapturewrap-jl/45491/2 "2020-08-25T14:40:34Z")

</div>

FYI there’s a Google Summer of Code project which has made excellent progress in a generic OpenCV wrapper, see [https://github.com/archit120/opencv\_contrib](https://github.com/archit120/opencv_contrib). I think there will be a more expository update on the current state fairly soon.

---

<div class="post-metadata">

**Author:** ![terasakisatoshi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/terasakisatoshi/32/9187_2.png) [@terasakisatoshi](https://discourse.julialang.org/u/terasakisatoshi)\
**Post date:** [October 28, 2020, 11:53am UTC](https://discourse.julialang.org/t/ann-videocapturewrap-jl/45491/3 "2020-10-28T11:53:05Z")

</div>

I’ve updated this package. I’ve created JLL package named [OpenCVQt\_jll.jl](https://github.com/terasakisatoshi/OpenCVQt_jll.jl) which provide shared library of OpenCV `libopencv_xxx` (compiled with Qt for Linux). Then, I utilize/call this JLL package from this package. It enable us to use/install VideoCaptureWrap.jl easily even on Windows machine.

---

<div class="post-metadata">

**Author:** ![terasakisatoshi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/terasakisatoshi/32/9187_2.png) [@terasakisatoshi](https://discourse.julialang.org/u/terasakisatoshi)\
**Post date:** [October 31, 2020, 8:51am UTC](https://discourse.julialang.org/t/ann-videocapturewrap-jl/45491/4 "2020-10-31T08:51:57Z")

</div>

Regarding to [tim.holy’s comment](https://discourse.julialang.org/t/ann-videocapturewrap-jl/45491/2)

I could confirm [OpenCV: Introduction to Julia OpenCV Binding](https://docs.opencv.org/master/d8/da4/tutorial_julia.html) works on my Ubuntu 18.04 machine.

```julia
               _
   _ _ _(_)_ | Documentation: https://docs.julialang.org
  (_) | (_) (_) |
   _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` | |
  | | |_| | | | (_| | | Version 1.5.1 (2020-08-25)
 _/ |\ __'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |

julia> using OpenCV

julia> cap = OpenCV.VideoCapture(Int32(0))
OpenCV.VideoCaptureAllocated(Ptr{Nothing} @0x00000000030e4c90)

julia> OpenCV.read(cap)
(true, UInt8[0x0a 0x0a … 0x0d 0x0c; 0x01 0x01 … 0x1a 0x19; 0x00 0x00 … 0x00 0x00]

UInt8[0x0a 0x0a … 0x12 0x0f; 0x03 0x03 … 0x19 0x15; 0x00 0x00 … 0x00 0x00]

UInt8[0x06 0x06 … 0x10 0x11; 0x04 0x04 … 0x12 0x13; 0x00 0x00 … 0x00 0x00]

a...

UInt8[0x06 0x06 … 0x06 0x06; 0x00 0x00 … 0x01 0x01; 0x00 0x00 … 0x00 0x00]

UInt8[0x06 0x06 … 0x06 0x06; 0x00 0x00 … 0x00 0x00; 0x00 0x00 … 0x00 0x00]

UInt8[0x08 0x08 … 0x06 0x06; 0x00 0x00 … 0x00 0x00; 0x00 0x00 … 0x00 0x00])

(OpenCV) pkg> 

```

---

<div class="post-metadata">

**Author:** ![tim.holy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tim.holy/32/52_2.png) [@tim.holy](https://discourse.julialang.org/u/tim.holy)\
**Post date:** [October 31, 2020, 9:24am UTC](https://discourse.julialang.org/t/ann-videocapturewrap-jl/45491/5 "2020-10-31T09:24:28Z")

</div>

Just to clarify, your OpenCVQt\_jll.jl exploits that work, right? If so, this is an awesome contribution, and IMO the big remaining TODO to make that work really pay off. If so, have you thought about registering this package?

---

<div class="post-metadata">

**Author:** ![archit120](https://avatars.discourse-cdn.com/v4/letter/a/ebca7d/32.png) [@archit120](https://discourse.julialang.org/u/archit120)\
**Post date:** [October 31, 2020, 9:50am UTC](https://discourse.julialang.org/t/ann-videocapturewrap-jl/45491/6 "2020-10-31T09:50:16Z")

</div>

I went through this package briefly and this does not seem to use the wrappers I had built but instead repeats the work. There was a discussion some time ago about creating jll for the wrappers but I haven’t been able to devote much time to it because this semester is a bit heavier with the coursework. I have an approximate plan laid out in the discussion over here.

[https://github.com/JuliaPackaging/Yggdrasil/pull/1497](https://github.com/JuliaPackaging/Yggdrasil/pull/1497)

---

<div class="post-metadata">

**Author:** ![terasakisatoshi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/terasakisatoshi/32/9187_2.png) [@terasakisatoshi](https://discourse.julialang.org/u/terasakisatoshi)\
**Post date:** [October 31, 2020, 2:57pm UTC](https://discourse.julialang.org/t/ann-videocapturewrap-jl/45491/7 "2020-10-31T14:57:51Z")

</div>

OpenCVQt\_jll.jl is not related to [OpenCV: Introduction to Julia OpenCV Binding](https://docs.opencv.org/master/d8/da4/tutorial_julia.html).

It is just generated by [https://github.com/terasakisatoshi/OpenCVBuilder.jl/blob/main/qt/build\_tarball.jl](https://github.com/terasakisatoshi/OpenCVBuilder.jl/blob/main/qt/build_tarball.jl) and will be used in [here].([https://github.com/terasakisatoshi/VideoCaptureWrapBuilder.jl/blob/main/build\_tarball.jl#L53](https://github.com/terasakisatoshi/VideoCaptureWrapBuilder.jl/blob/main/build_tarball.jl#L53))

---

<div class="post-metadata">

**Author:** ![terasakisatoshi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/terasakisatoshi/32/9187_2.png) [@terasakisatoshi](https://discourse.julialang.org/u/terasakisatoshi)\
**Post date:** [October 31, 2020, 4:42pm UTC](https://discourse.julialang.org/t/ann-videocapturewrap-jl/45491/8 "2020-10-31T16:42:36Z")

</div>

Thank you for your advice. 🙏

I’ve confirmed we could try OpenCV.jl genreated by `opencv_contrib/modules/julia` with my gist.

[https://gist.github.com/terasakisatoshi/77e64396a5546338f606426d8d957706](https://gist.github.com/terasakisatoshi/77e64396a5546338f606426d8d957706)

I was wondering if we can build OpenCV.jl using BinaryBuilder.jl with [this script (but still WIP)](https://github.com/terasakisatoshi/OpenCVBuilder.jl/blob/main/wrapper/build_tarball.jl), if so it would be great.

---

<div class="post-metadata">

**Author:** ![terasakisatoshi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/terasakisatoshi/32/9187_2.png) [@terasakisatoshi](https://discourse.julialang.org/u/terasakisatoshi)\
**Post date:** [November 23, 2020, 3:48pm UTC](https://discourse.julialang.org/t/ann-videocapturewrap-jl/45491/9 "2020-11-23T15:48:52Z")

</div>

I could confirm VideoCaptureWrap.jl works on Raspberry Pi 4 (it also should run RPI3).

Just run `make gui` is OK

---

<div class="post-metadata">

**Author:** ![terasakisatoshi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/terasakisatoshi/32/9187_2.png) [@terasakisatoshi](https://discourse.julialang.org/u/terasakisatoshi)\
**Post date:** [December 1, 2020, 2:20am UTC](https://discourse.julialang.org/t/ann-videocapturewrap-jl/45491/10 "2020-12-01T02:20:05Z")

</div>

For those who like to use OpenCV.jl, the following gist might be helpful.

[https://gist.github.com/terasakisatoshi/4cd7f9f56018355f2f75d0f7da1169fd](https://gist.github.com/terasakisatoshi/4cd7f9f56018355f2f75d0f7da1169fd)

---

<div class="post-metadata">

**Author:** ![terasakisatoshi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/terasakisatoshi/32/9187_2.png) [@terasakisatoshi](https://discourse.julialang.org/u/terasakisatoshi)\
**Post date:** [January 20, 2021, 5:55pm UTC](https://discourse.julialang.org/t/ann-videocapturewrap-jl/45491/11 "2021-01-20T17:55:21Z")

</div>

This might be help

[https://github.com/terasakisatoshi/ImageProcessing.jl](https://github.com/terasakisatoshi/ImageProcessing.jl)
