An Introduction to the internal representation of Objects in JavaScript

This article is for people with a basic understanding of JavaScript language and wants to know-how Objects work in JS. We will take a closer look at their internal representation. So there’s a saying…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Integrate Emotion Analysis into Your Skype Calls

You only get one chance to make a good first impression. Our clients always ask how exactly our emotion analysis tech works, so we’ve decided to conduct a little Christmas experiment and have a bit of fun ourselves.

In this article, we’re going to look into how we have built a virtual webcam to construct the function of augmented reality (AR). Now when we skype our clients, they can see our emotional data in real time as a live demonstration of how our products work. We’ll briefly show you how you can build a virtual webcam of your own if you wish to impress your clients. Afterwards, you’ll be able to use this virtual webcam analytics with such applications as Skype, Zoom, etc. Have a look at this gif:

Let’s start with some basics. To software, any webcam is essentially a video file that only stores one current video frame. Thus, the development of a virtual webcam comes down to the creation of such a file where you could later store some relevant data. You can easily simulate a webcam in developer-oriented OSs such as Ubuntu: the only thing you need to do is to correctly create a `/dev/video1` file which will then be seen as a data source by any application interacting with webcams. However, you can also use Mac OSX or Windows OS.

Unlike Ubuntu, Mac OSX doesn’t leave you a hole to simulate the presence of a webcam. There is, however, an “official” way to do so but it requires the skill of writing long and complicated code in C++ and knowledge of AVFoundation library which is responsible for all video-processing in macOS. Keeping this in mind, we drew up an easier but also trickier way of creating a virtual webcam. It will allow you to add any AR element to the frame coming from the real webcam.

The method we propose consists of the following steps:

Note: An IP camera is a camera you can tap into using a special connection, and then read the video feed recorded by it. The simplest example of IP cams are CCTV cameras put in stores or apartment buildings that can be tapped into using any device (laptop or tablet) to observe what’s going on in real time.

4. Emulate the work of a virtual webcam using the IP camera.

As odd as it may seem, we’ll start with point 3 which will then naturally integrate point 1. After that, we’ll add the AR elements (see point 2) and then create the virtual webcam as described in point 4. We’ll perform additional verification for every step.

Attention!! This is a technical article heavy on code. Yet even a person who hasn’t written a line of code in their life will be able to follow these steps (read: copypaste our code while understanding the basic principles) and create their own virtual webcam.

Many macbooks automatically prohibit the use of an in-built webcam via the terminal. To lift the prohibition, type `python` in the terminal and then enter three lines in the interface:

The computer will ask for your permission to use the webcam via the terminal. After you click accept, exit the program using this command:

To simulate an IP camera, we’ll use OpenCV library to read the stream coming from the in-built webcam, gstreamer library to create the RTSP feed (a.k.a. that very connection established by IP cams), and ffmpeg library to validate intermediate results. (If you’re a newbie, you’ll need to create a file where you’ll write your code. In general we recommend using PyCharm framework for coding in python, but in this particular case any text editor will do).

To simulate the IP camera, we need to create two entities:

Let’s define these entities in the code as classes:

At the same time, we’ll write code to initiate the simulation. This code will create an infinite loop where the server will verify the requests received and return responses.

And now we are finally ready to run this script! Open the terminal, type:

Gstreamer will need some time for initialization (5 seconds at least). After it initializes, you’ll be able to open new tab in the terminal and type in this command:

If you follow our instructions and do everything right, a new window with your webcam streaming video will appear. This is exactly what we want — the IP camera simulation from webcam.

Authors: Andrey Belyaev, CTO; Francesca Del Giudice, PR Specialist.

Add a comment

Related posts:

7 Consejos para Mejorar la Calidad del Brote de Cannabis

1. Comenzar con Top-Shelf Genética- obtenga los efectos y la apariencia que desea. ¡Su habilidad de cultivo marca una gran diferencia, pero una planta no puede superar sus genes! Si quiere cogollos…

I will digital brochure annual report company profile proposal booklet ebook design

Are you looking for a Professional digital brochure annual report company profile proposal booklet ebook design service? You’ve come to the right place. I think your satisfaction is my happiness…