Next Article in Journal
Acoustic Negative Refraction and Planar Focusing Based on Purely Imaginary Metamaterials
Previous Article in Journal
A Data-Knowledge Hybrid Driven Method for Gas Turbine Gas Path Diagnosis
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Video Processing from a Virtual Unmanned Aerial Vehicle: Comparing Two Approaches to Using OpenCV in Unity

by
Andrés Bustamante
1,
Lidia M. Belmonte
1,2,
Rafael Morales
1,2,
António Pereira
3,4 and
Antonio Fernández-Caballero
1,5,6,*
1
Instituto de Investigación en Informática de Albacete, 02071 Albacete, Spain
2
Departamento de Ingeniería Eléctrica, Universidad de Castilla-La Mancha, Electrónica, Automática y Comunicaciones, 02071 Albacete, Spain
3
Polytechnic Institute of Leiria, Computer Science and Communications Research Centre, School of Technology and Management, 2411-901 Leiria, Portugal
4
INOV INESC INOVAÇÃO, Institute of New Technologies—Leiria Office, 2411-901 Leiria, Portugal
5
Departamento de Sistemas Informáticos, Universidad de Castilla-La Mancha, 02071 Albacete, Spain
6
Biomedical Research Networking Centre in Mental Health (CIBERSAM), 28016 Madrid, Spain
*
Author to whom correspondence should be addressed.
Appl. Sci. 2022, 12(12), 5958; https://doi.org/10.3390/app12125958
Submission received: 27 April 2022 / Revised: 7 June 2022 / Accepted: 10 June 2022 / Published: 11 June 2022

Abstract

:
Virtual reality (VR) simulators enable the evaluation of engineering systems and robotic solutions in safe and realistic environments. To do so, VR simulators must run algorithms in real time to accurately recreate the expected behaviour of real-life processes. This work was aimed at determining a suitable configuration for processing images taken from a virtual unmanned aerial vehicle developed in Unity using OpenCV. To this end, it was focused on comparing two approaches to integrate video processing in order to avoid potential pitfalls such as delays and bottlenecks. The first approach used a dynamic link library (DLL) programmed in C++, and the second an external module programmed in Python. The native DLL ran internally on the same Unity thread, as opposed to the Python module that ran in parallel to the main process and communicated with Unity through the Message Queue Telemetry Transport (MQTT) protocol. Pre-transmission processing, data transmission and video processing were evaluated for a pair of typical image-processing tasks like colour and face detection. The analysis confirmed that running the Python module in parallel does not overload the main Unity thread and achieves better performance than the C++ plugin in real-time simulation.

1. Introduction

Image and video processing [1,2] have made it possible to create solutions that promote the surveillance of people in need of assistance [3,4,5]. In recent times, progress has been made in home monitoring using small unmanned aerial vehicles (UAVs). However, incorporating autonomous flying vehicles requires excessively costly and hazardous testing in real environments. For this reason, some proposals are directed towards simulation using virtual and augmented environments [6,7,8], allowing scaled prototyping, evaluation and testing at a much lower cost and with no physical risk to people. Our research group is working in this line, developing a virtual reality (VR) simulation platform for small UAVs as future social robots for monitoring dependent people in the home [9,10]. One should note that any VR platform intended to evaluate the performance of robots prior to the live experience must operate with real-time accuracy. Any such platform also allows one to tailor the design to the preferences of potential end users, so virtual environments and simulations must be as realistic as possible, which certainly can be computationally expensive [11].
Unity is one of the most widely used graphics engines for creating virtual simulators. This Unity game engine is widely used for simulation projects and for quickly generating 3D environments [12]. Therefore, the proposed platform uses Unity to recreate home environments where a virtual UAV monitors a dependent person’s avatar, simulating the behaviour of the future aerial assistant. The operation of the UAV will rely heavily on visual information processing. Using the onboard camera as the main sensor, the aerial robot would know where the person is for the monitoring process, determining his or her status and assistance needs [13]. It would also detect and avoid obstacles in the flight path to ensure safe operation. The VR platform will be paramount to programming the computer vision algorithms and evaluating their performance in a safe environment before the physical assistance UAV advances to the next design stage. Therefore, this work aims to study the video-processing capabilities in Unity, even though this engine was originally developed to create and develop video games, and not for image processing. Currently there are several solutions to this interoperability problem, such as client–server architectures, subscribe/publish communication [14] or the development of native libraries for use without the need to adapt external communication [15]. Although they are only usable in the operating systems they were developed for, native plugins allow the generation of functionalities that cannot be realised in the C# language or through the Unity framework.
In this paper, we considered it appropriate to evaluate two approaches to video processing from Unity using OpenCV (Open Source Computer Vision Library), which are summarised as follows. (1) Using a DLL programmed in C++, and (2) programming an external module in Python that communicates through MQTT with the main program. The way of implementing video processing using OpenCV may affect the final performance of the simulator, so it is important to compare and determine the best option to avoid technical problems such as delays and bottlenecks derived from data transmission and/or processing. Therefore, the main contribution of this work is to compare and evaluate the two approaches.
The remainder of this paper is structured as follows. Section 2 introduces some related works. Section 3 presents an overview of the study conducted concerning the integration of OpenCV in Unity and illustrates the two compared approaches, a native C++ DLL and an external Python module communicated via MQTT. It also details the hardware and software used, discusses the main differences between both approaches and describes how images are converted and transferred from Unity. Next, Section 4 details the results of the study, which are divided into the analysis of the processing prior to data transmission, the transmission of the data and finally the processing of the videos using C++ and Python. The colour and face detection algorithms, programmed in both languages, are evaluated in isolation and jointly (sequentially and also in parallel in the case of Python). Finally, Section 5 presents the discussion of the results obtained and the main conclusions of the study.

2. Related Works

Simulation through extended reality is gaining more and more attention in manifold domains requiring computer vision like robotic manufacturing [16,17,18], the automotive industry [19,20], video games [21], fitting rooms [22], mulsemedia setups [23], and IoT-ready WebApps [24], among others. In fact, by creating virtual environments, synthetic training datasets can be generated in a controllable and customizable manner for further solving common computer vision tasks and avoiding the challenges of collecting and annotating data in the real world [25,26]. For instance, such synthetic images have been used in Unity in vision-based detection tasks (e.g., human body parts [27], 3D markers [28]). In the proper context of UAV research, a framework has been developed for accelerating computer vision performance in data collection, detection, passive ranging, and human–robot teaming [29]. Moreover, in a recent a project, a robot with a soft gripper was aimed at grasping a drone in mid-air [30]. The soft hand was featured with a unique colour-based force estimation technology based on computer vision.
In recent times, some comparisons between C++ and Python programming languages have been performed. For example, a recent article reviewed and discussed various applications of object-oriented programming languages, where emphasis mainly was given to differentiating C++, Python and Java [31]. According to this article, C++ offers facility for low-level memory manipulation and efficient management of memory space. However, it does not support dynamic memory allocation, garbage pickup and threads for built-in facilities. On the other hand, the dynamic nature of Python makes it a slow language due to its higher execution time, and hence not suitable for faster applications. Moreover, it is not suitable for memory-optimised processes, and it is also vulnerable for run-time errors and faces problems while accessing huge databases. Another study concluded that the Python programming language is less complex than the C++ programming language [32]. The results offered by a comparative analysis in terms of memory and time indicated that C++ is faster than Python in execution speed but Python serves as a better language for beginners due to its simplicity [33]. The authors concluded that the language should be selected according to the type of project looking for the best results.
OpenCV is one of the most important and productive libraries for implementing computer vision algorithms [34,35,36]. Studies have shown that in terms of time consumption it outperforms other libraries like dlib [35] and tools like MATLAB. OpenCV is written in C++ and its primary interface is in C++. Therefore, the use of OpenCV natively from C++ facilitates the incorporation of video processing. Hence, a first approach to image processing from Unity would be to develop a native C++ dynamic link library (DLL) for use in OpenCV. OpenCV as a reference library for image processing provides bindings in Python, Java and MATLAB/OCTAVE. Although  C++ is itself the most widely used programming language in OpenCV, Python stands out for its ease of use [37]. In this sense, an external module programmed in Python would be a second approach to Unity image processing using OpenCV algorithms. In this way, the external program communicates with Unity to receive the images from the virtual camera and returns the results of video processing.
Among the possible communication options is the Message Queue Telemetry Transport (MQTT) protocol. MQTT is a broker-based publishing/subscribing instant messaging protocol; it is open, lightweight, easy to implement and does not need a big band weight [38]. MQTT has been selected in our approach as it has already shown excellent results in our previous works for MATLAB/Simulink integration [9,39]. Moreover, the combination of an external module programmed in Python for image processing and communicated via MQTT has recently been implemented to evaluate emotion recognition as part of ongoing research [40,41].

3. Materials and Methods

3.1. General Description of the Study

As described before, the objective of this study was to compare and evaluate two approaches to integrating video processing using OpenCV in a VR simulator developed in Unity. Thus, this study confronted two programming languages and two modes of communication with the main Unity process. The C++ DLL ran internally in the same Unity thread as a native plugin that received and sent the information via a static function (see Figure 1a), whereas the Python module ran parallel to the main process and exchanged the data using the MQTT broker (see Figure 1b).
All comparisons were conducted on the same computer, operating system Windows 10 Home edition ×64, with an AMD Ryzen 7 2700× 8-core processor (16 threads), 16 GB of RAM and a Radeon RX Vega 56 video card. The software used was Unity 2020.3.22f1, Visual Studio 2022 community edition and Visual Studio Code. The version of Unity employed was the stable one during the period of the tests performed. All testing was done directly in the Unity editor to ease the modification of the running parameters and debugging of the code. The virtual environment built in Unity corresponded to a simple indoor (home) scenario where a camera monitored a human avatar moving around (see Figure 2). The visual information was obtained through a render texture and images were captured at different time intervals, the most commonly being every 0.2 s (5 frames per second). The Visual Studio 2019 community edition was used for the development of the class library in C++. Visual Studio Code was employed for the development of the program in Python with MQTT. Both languages, C++ and Python (version 3), used the OpenCV version 4.5.2 to implement computer vision algorithms. Finally, Mosquitto was used as the MQTT broker.

3.2. Assessment Approaches

The scenarios or configurations evaluated in this study represent two completely different approaches to integrating computer vision processing into a simulator developed in Unity, as they face different modes of communication between the main program and the computer vision process, different modes of execution and, of course, different programming languages, with all of the pros and cons that this implies.
The first approach takes advantage of one of the functionalities offered by Unity and its C# language, namely the possibility of adapting libraries that implement extra functionalities that run from the C# code independently of the language the library was developed in. Since all the experiments are carried out on the Windows 10 operating system, the native library has been implemented in the programming language that best suits it, so it has been done in C++. It should be mentioned here that the native plugin serves only as a means of information exchange, since video processing would always run on the same Unity thread. In contrast, the second approach uses the MQTT message protocol to exchange information with an external Python program that also runs in parallel to Unity. In this case, an MQTT broker is needed to link the two programs and manage the communication between them.
As for the differences between the programming languages themselves, C++ is a cross-platform compiled language, while Python is also cross-platform but is an interpreted language. The former is widely used thanks to its high performance in real-time applications [42] and also in embedded systems processing images [43]. In addition, C++ allows a better native integration with OpenCV libraries than Python. However, the latter is characterised by its significant number of compatible libraries and its ease of use. In this regard, it is worth noting that, although OpenCV was developed entirely in C and C++, it is much easier to implement OpenCV in Python than in C++. Moreover, there are many OpenCV-based libraries in Python with ready-to-use advanced processing functions that are not available in C++.

3.3. Development

The study analysed the differences in processing the images generated in the Unity environment by using OpenCV via a C++ plugin or an external Python program. In both cases, the images were identical and corresponded to the human avatar moving around the virtual environment presented above (see Figure 2). The images were converted to the appropriate format to be transmitted to both processing alternatives.
We evaluated the implementation of a native DLL plugin for use in Unity for image processing in C++. This approach received the images received from Unity via an external static function that allowed communication between C++ and the DLL compiled in C++. The images were delivered as a pointer to an RGBA pixel structure, so C++ took care of processing the structure directly with OpenCV. The use of the MQTT protocol for transmitting images from Unity, encoded in base64 and submitted as an array of bytes, was evaluated for data processing in Python. In this way, Python received the images through the MQTT event and subsequently processed them using OpenCV. The MQTT protocol has already been evaluated with particularly good results in some Internet of Things (IoT) architectures on remote servers via the cloud [44,45]. However, in this study, the implementation was performed on the same machine to avoid inconsistencies based on network latency. The communication and processing flows of both scenarios are depicted in Figure 3.

3.3.1. Development of the Native C++ Plugin

A native plugin in Unity is a class library developed and compiled externally to Unity but used from within Unity to add extra functionality to the platform that cannot be operated from within the Unity framework itself. In the present case, this was a DLL to run on the Windows 10 × 64 operating system. The native plugin received a pointer to an array of pixels of the captured image along with its width and length values (see Algorithm 1).
Algorithm 1: C++ external function and pixel colour structure.
int process(Color32* raw, int width, int height);
struct Color32 {
    uchar r;
    uchar g;
    uchar b;
    uchar a;
};

3.3.2. Development of the Python Program

For this case, the Python program was run independently of Unity to process the images received via the MQTT protocol. Since all tests were performed locally, the Mosquitto broker was used. The broker managed messages between MQTT clients, so that once it received information about a particular topic, it forwarded it to all subscribing clients. Python used the paho.mqtt.client module and Unity the uPLibrary.Networking.M2Mqtt library for this communication.
For the performance tests that will be detailed below, Unity was not required to receive any results from Python, as the detection results of the different algorithms were directly represented in a window that OpenCV generated natively. That is, the processed image was not returned from Python to Unity. However, it was implemented to send a json file from Python to Unity to return some additional processing details or information in the future, e.g., distance estimation. The data exchange process was as follows. The Unity client continuously published (at a specified frame rate) the base64 encoded images in a specific topic the Python client (or clients in the case of a distributed run) was subscribed to. In this way, the Python client(s) received the images via the MQTT event and then processed them using OpenCV. In turn, the Unity client subscribed to those threads into which the Python client(s) published the json file once the processing of a received image was concluded.

4. Results

This section details the results of the different tests carried out to numerically compare the performance of the two options considered for the use of OpenCV in Unity. Initially, the processing requirements needed before transmitting the data were evaluated. In other words, the conversion of an image to the appropriate format for subsequent transmission and processing in C++ and Python was evaluated. Subsequently, the transmission of the previously transformed information was evaluated. Afterwards, the performance of processing with OpenCV in C++ and Python was analysed with two image processing algorithms, one for colour detection and the other for face detection. Finally, a fully featured simulator running both computer vision algorithms was implemented. The results were evaluated in a sequential execution and also in parallel in the case of Python and MQTT.
It should be noted that the two computer vision algorithms presented in this paper were evaluated to determine the maximum rate of frames per second (FPS) that could be processed without failure in the execution of the simulator. The maximum limits for each of the options considered were up to 20 FPS in the case of the native C++ DLL and up to 50 FPS using Python and MQTT. Thus, the use of Python via MQTT, which significantly offloads the processing load of the simulator, has made it possible to achieve a much higher frame rate. Nevertheless, a common and conservative frame rate of 5 FPS was considered for both approaches in the tests detailed below. First of all, we chose to process 5 FPS since this number stresses the simulator very little. In addition, the detection of a person walking through a scene does not require more than 5 FPS for a correct tracking and subsequent activity recognition, if required. On the other hand, for possible future implementations comprising computer vision algorithms using OpenCV with higher computational load, 5 FPS would guarantee no system bottleneck [46]. This number would also allow working with simpler hardware.

4.1. Processing Prior to Transmission

First, the processing time required to adapt each image obtained in Unity to the appropriate format for further processing using the two options studied (DLL C++ and Python with MQTT) was calculated.

4.1.1. Data Conversion in C++

C++ requires to send a structure containing the colour of each pixel, so that the process is as follows:
  • The image is taken from the active TextureRender and stored in a Texture2D.
    •     RenderTexture.active = cameraTexture,
    •     tex.ReadPixels(source.Rect, 0, 0);
  • The pixel array is extracted from the Texture2D object.
    •     Color32[] RawImg = tex.GetPixels32();
  • Red and blue colours are inverted so that the image comes out with the exact colours and the same orientation as seen in the simulator. The GetPixels32() function returns an arrangement of its own Unity Color32 structure. When it is sent as a pointer to C++, it receives the image with the inverted colours and inverted image orientation.
    •     for (int i = 0; i < rawImg.Lenght; i++) {
    •         byte r = rawImg[i].r;
    •         byte g = rawImg[i].g;
    •         byte b = rawImg[i].b;
    •         rawImg[i].r = b; 
    •         rawImg[i].b = r; 
    •         rawImg[i].a = 255;
    •     }
    •     Array.Reverse(rawImg);
  • The arrangement is sent as a pointer and also the length and width of the image.
    •     int result = process(rawImg, width, height);

4.1.2. Data Conversion in Python

Python is required to deliver the image in base64 format, but as an array of bytes. The process is as follows:
  • The image is taken from the active TextureRender and stored in a Texture2D.
  • It is encoded in PNG format and converted to base64 text.
    •     byte[] bytes = tex.EncodeToPNG();
    •     string base64String = Convert.ToBase64String(bytes,
    •                                        0, bytes.Lenght);
  • The base64 text is converted to a byte array.
    •     bytes = Encoding.ASCII.GetBytes(base64String);
  • The byte array is sent over the MQTT protocol.
    •     client.Publish(topic, bytes);

4.1.3. Performance Analysis of Processing Prior to Transmission

The process of adapting the original image in Unity to the appropriate format for further processing by computer vision algorithms in C++ and Python demands different processing times. The time from capturing the rendered image to obtaining the image in the appropriate format was measured to calculate these pre-transmission processing times. The result of this test is graphically shown in Figure 4.
The figure shows the time spent to convert 300 images to the required format in C++ (represented in blue) and Python (represented in orange). As can be observed, the processing time required to convert the image in Unity into the appropriate format for submission to the C++ processing option was much longer than that required for the Python option in all cases. With much more variable processing times ranging from 35 to 57 ms, the data conversion process for C++ consumed on average about 40 ms. In the case of Python, more regular behaviour was observed with minimum processing time of 4 ms and maximum time of 17 ms, and an average of just over 6 ms.

4.2. Data Transmission

After the conversion process, each transformed image was passed to C++ and Python for further processing. In order to evaluate the two transfer methods from Unity to the video processing algorithms, a test was carried out to measure the time elapsed from sending the converted image in Unity to receiving it in the native C++ plugin or in the Python program via MQTT. The results of the test conducted for sending 300 images are shown in Figure 5.
In this case, irregular behaviour with fluctuations in transmission time was observed for both options, although an upper limit of about 2 ms is apparent in both approaches. The MQTT Unity-to-Python transmission method was slightly superior to the option of forwarding internally to the native plugin. Although it took more extreme minimum and maximum values, 0.14 and 1.99 ms, respectively, passing to Python took about 1 ms on average, compared to almost 1.20 ms for sending to the native DLL.

4.3. Image Processing with OpenCV

Image processing with OpenCV is optimised for fast execution. However, the processing time is highly dependent on the type of algorithm used. Therefore, bottlenecks may occur during processing. In this case, the processing time consumption was evaluated for C++ and Python languages without considering the previously evaluated data transmission time. As described above, two computer vision algorithms with different computational loads were selected, one that limits itself to filtering colours (low computing load) and a second one that uses a human face detection programme (high computing load).

4.3.1. Colour Detection Algorithm

The low-load processing algorithm consisted of recognising a given colour in each image delivered from Unity. For this case, the blue colour was detected in each frame. The algorithm in both languages was the same (see Algorithms 2 and 3). OpenCV provides a mask filter on the hue-saturation-value (HSV) model to obtain only the matched colour to detect. Contours were obtained and a green rectangle was drawn around the detected colour. The processing results were the same in C++ and Python, as shown in Figure 6. Both colour detection algorithms correctly identified the avatar’s blue trousers in all frames over time.
Algorithm 2: Colour detection algorithm in C++.
findContours(redOnly, contours, hierarchy,
    cv::RetrievalModes::RETR_TREE,
    cv::ContourApproximationModes::CHAIN_APPROX_SIMPLE);
vector<Rect> boundRect(contours.size());
 
int x0 = 0, y0 = 0, w0 = 0, h0 = 0;
 
for (int i = 0; i < contours.size(); i++) {
    float area = contourArea((Mat)contours[i]);
    if (area > 300) {
        bpundRect[i] = boundingRect((Mat)contours[i]);
        x0 = boundRect[i].x;
        y0 = boundRect[i].y;
        w0 = boundRect[i].width;
        h0 = boundRect[i].height;
        rectangle(frame, Point(x0, y0),
            Point(x0 + w0, y0 + h0),
            Scalar(0, 255, 0), 2, 8);
    }
}
Algorithm 3: Colour detection algorithm in Python.
contours, hierarchy = cv2.findContours(blue_mask,
                                       cv2.RETR_TREE,
                                       cv2.CHAIN_APPROX_SIMPLE)
for pic, contour in enumerate(contours):
    area = cv2.contourArea(contour)
    if (area > 300):
        x, y, w, h = cv2.boundingRect(contour)
        img = cv2.rectangle(img, (x,y), (x + w, y + h),
                            (0, 255, 0), 2, 8)
Three-hundred images of the Unity virtual environment were processed at 5 FPS using the two implemented colour algorithms to measure the differences in processing time between C++ and Python. The processing time of each algorithm is plotted in Figure 7.
On the basis of the results, the colour detection algorithm implemented in C++ was found to have a shorter processing time. On average, it took 0.7 ms as compared to more than 2.5 ms for the Python algorithm. In both cases, fluctuations in processing time were observed, something more evident in Python.

4.3.2. Face Detection Algorithm

The Haar cascade algorithm [47] was used for face detection. The particular algorithm adopted [48] made use of an XML file containing the information from previous training for object detection. The methods implemented in C++ and Python are shown in Algorithms 4 and 5, respectively. Figure 8 shows the faces detected in an image in a green circle. Again, the processing time was evaluated in a test with 300 Unity images at 5 FPS. The results are shown in Figure 9.
Algorithm 4: Face detection algorithm in C++.
cvtColor(img, gray, COLOR_BGR2GRAY);
cascade.detectMultiScale(gray, faces, 1.2, 3, 0 |
                         CASCADE_SCALE_IMAGE, Size(30, 30));
vector<Rect> boundRect(faces.size());
int detected = 0;
 
for (size_t i = 0; i < faces.size(); i++) {
    Rect r = faces[i];
    Mat smallImgROI;
    vector<Rect> nestedObjects;
    Point center;
    Scalar colour = Scalar(0, 255, 0);
    int radius;
    double aspect_ratio = (double)r.width / r.height;
    if (0.75 < aspect_ratio && aspect_ratio < 1.3) {
        center.x = cvRound(r.x + r.width * 0.5) * scale);
        center.y = cvRound(r.y + r.width * 0.5) * scale);
        radius = cvRound((r.width + r.height)* 0.25 * scale);
        circle(img, center, radius, colour, 3, 8, 0);
        detected = 1;
    }
}
Algorithm 5: Face detection algorithm in Python.
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
faces = faceCascade.detectMultiScale(gray, scaleFactor = 1.1,
                                     minNeighbors = 3,
                                     minSize = (30, 30))
x1=0
y1=0
 
for (x, y, w, h) in faces:
    aspect_ratio = w / h
    if 0.75 < aspect_ratio and aspect_ratio < 1.3:
        x1 = round((x + w * 0.5) * 1)
        y1 = round((y + h * 0.5) * 1)
        radius = round((w + h)* 0.25 * 1);
        cv2.circle(img, (x1, y1), radius, (0, 255, 0), 3, 8, 0);
In all processed frames, both algorithms correctly identified the avatar’s face. However, Figure 9 shows that C++ offers slightly faster processing times, but with greater fluctuations. C++ took between 5 and 12 ms per image, while Python did it between 7 and 12 ms. The average run difference for this algorithm was 2.38 ms faster in C++.

4.3.3. Simultaneous Run of Both Algorithms

As a final evaluation, the two computer vision algorithms described above were implemented in a whole simulator run aimed at detecting both the blue colour and the face of a moving avatar. For it, the two possible ways of operating with various types of image processing algorithms on the same image were implemented. The first consisted of running the algorithms sequentially, either from C++ or Python. The second option was to run the image processing algorithms in parallel in different programs. The latter option would have a great advantage in terms of performance, although, in this case, it could only be implemented using MQTT. Indeed, thanks to the use of MQTT, several programs can run at the same time, all receiving the same image but processing it in different threads. However, with the native C++ plugin, each algorithm would necessarily have to run after the other (sequentially) in the same Unity simulator thread.

Both Algorithms Running in the Same Program

Figure 10 describes how the colour and face detection algorithms were executed sequentially in C++ and Python.
Image processing occurs in the native plugin through a call to a DLL function within the execution flow of the simulator. Metrics are evaluated from the time an image is captured until the function returns the processing result. In contrast, data are sent to and received in Python through the MQTT protocol without interfering with the execution flow of the simulator. As can be seen in Figure 10, the function call is synchronous. Therefore, the simulator cannot continue processing until the function returns a value. On the other hand, MQTT provides an asynchronous communication flow, and this means that Python processes the incoming images independently of Unity’s execution flow. This will result in faster communication, processing and data feedback time.
The significant difference between a plugin and MQTT is shown in Figure 11. Although the times were individually quicker in C++, the interoperability offered by MQTT demonstrates better performance in the communication, processing and value returning flow. C++ showed performance in the range of 40 to 65 ms, while MQTT with Python exhibited performance of 13 to 26 ms. This is almost three times faster than the native plugin processing synchronously on the same thread. This finding is also confirmed when comparing the average processing time in the conducted test. The processing time given for Python is 16.30 ms on average versus more than 43.38 ms for C++.

Both Algorithms Running in Different Programs (MQTT Only)

MQTT allows work to be distributed across separate programs providing asynchronous and independent communication. Figure 12 shows a diagram of how a distributed processing system would work in this study. The colour and face detection algorithms ran in two independent programs to evaluate that distributed system (see Figure 13). The two algorithms were executed in separate Python scripts, each exclusively performing its own processing and transmitting the results via MQTT to Unity. It was necessary to add an additional listening channel to differentiate the messages from each of the programs.
The graph of the total processing time revealed a higher computational load of the face detection algorithm compared to the colour detection algorithm, which is obvious. What is relevant in this case is the advantage that Python offers in being able to distribute the load between two programs (or even more if necessary in other more complex developments). In contrast, in C++, it is not possible to build a distributed system through the communication of native plugins. Even if several native plugins were to be developed, each with different processing, function calls would be synchronous.

5. Discussion

In the quest for solutions that enable in-home surveillance of dependent people, we are focused on the use of small assistive UAVs. However, incorporating UAVs indoors requires costly and potentially dangerous testing in real indoor environments. This article has laid out the groundwork for the simulation and evaluation of the capabilities of real-time video processing within a virtual reality environment based on Unity and OpenCV. It was decided to experiment with C++ as the most widely used programming language in OpenCV and Python given its ease of use [37]. In this regard, two approaches to implementing OpenCV-based computer vision algorithms have been studied in this paper. One approach was to use a native DLL written in C++ and the other was to program an external module in Python that communicated with the Unity process through the MQTT protocol.
From the experiments conducted, it can be concluded that interoperability between Unity and other languages is improved in terms of data flow by using a subscribe/publish communication protocol such as MQTT rather than creating a native plugin as this is dependent on running on the same thread as Unity. MQTT had already been used by our research team in recent applications related to simulated UAV indoors (e.g., [9,39,41]). All video processing was done externally with MQTT, allowing more FPS to be processed. Here, the external approach supported 50 FPS compared to only 20 FPS for the native plugin. Considering the tests performed with a common frame rate, it has also been shown that processing time prior to data transmission is significantly faster in Python than in C++.
On the other hand, a slight increase in image processing performance has been found in the C++ language. Although the difference in terms of milliseconds is practically nil compared to Python, it is worth noting that the version of OpenCV used is the same in both languages. Therefore, the difference may be due to language and execution, in line with recent studies comparing both programming languages [31,33]. In Python, the program is executed in an interpreted form, whereas C++ is a compiled class library, which improves access and processing times.
Thus, when a simulator launches a single process that cannot run in a distributed fashion, the use of C++ would be recommended. However, for simulators that require multiple processes that can run in parallel in a distributed manner, it would be recommended to use MQTT to take advantage of multi-threading. Indeed, in the whole run described above, the advantages of MQTT over a native C++ plugin have become apparent. Python via MQTT has proven to offer the best performance, with processing times up to three times shorter.

Author Contributions

Conceptualisation, A.B., A.P., R.M. and A.F.-C.; methodology, A.B., L.M.B. and R.M.; software, A.B. and L.M.B.; writing—original draft preparation, A.B., L.M.B. and A.F.-C.; writing—review and editing, A.B., L.M.B., R.M., A.P. and A.F.-C. All authors have read and agreed to the published version of the manuscript.

Funding

Grants PID2020-115220RB-C21 and EQC2019-006063-P funded by MCIN/AEI/10.13039/ 501100011033 and by “ERDF A way to make Europe”. Grant SBPLY/21/180501/000030 funded by Junta de Comunidades de Castilla-La Mancha. This work has also been partially supported by the Portuguese Fundação para a Ciência e a Tecnologia—FCT, I.P. under the project UIDB/04524/2020 and by Portuguese National funds through FITEC—Programa Interface, with reference CIT “INOV—INESC Inovação—Financiamento Base”. This work was also partially supported by CIBERSAM of the Instituto de Salud Carlos III.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Not applicable.

Conflicts of Interest

The authors declare no conflict of interest.

Abbreviations

The following abbreviations are used in this manuscript:
DLLDynamic-Link Library
FPSFrames Per Second
MQTTMessage Queuing Telemetry Transport
UAVUnmanned Aerial Vehicle
VRVirtual Reality

References

  1. Mercado-Ravell, D.A.; Castillo, P.; Lozano, R. Visual detection and tracking with UAVs, following a mobile object. Adv. Robot. 2019, 33, 388–402. [Google Scholar] [CrossRef]
  2. Prathaban, T.; Thean, W.; Sazali, M.I.S.M. A vision-based home security system using OpenCV on Raspberry Pi 3. AIP Conf. Proc. 2019, 2173, 020013. [Google Scholar] [CrossRef]
  3. Gómez-Reyes, J.K.; Benítez-Rangel, J.P.; Morales-Hernández, L.A.; Resendiz-Ochoa, E.; Camarillo-Gomez, K.A. Image Mosaicing Applied on UAVs Survey. Appl. Sci. 2022, 12, 2729. [Google Scholar] [CrossRef]
  4. Bouassida, S.; Neji, N.; Nouvelière, L.; Neji, J. Evaluating the Impact of Drone Signaling in Crosswalk Scenario. Appl. Sci. 2021, 11, 157. [Google Scholar] [CrossRef]
  5. Islam, S.; Huang, Q.; Afghah, F.; Fule, P.; Razi, A. Fire Frontline Monitoring by Enabling UAV-Based Virtual Reality with Adaptive Imaging Rate. In Proceedings of the 2019 53rd Asilomar Conference on Signals, Systems, and Computers, Grove, CA, USA, 3–6 November 2019; pp. 368–372. [Google Scholar] [CrossRef]
  6. Ribeiro, R.; Ramos, J.; Safadinho, D.; Reis, A.; Rabadão, C.; Barroso, J.; Pereira, A. Web AR Solution for UAV Pilot Training and Usability Testing. Sensors 2021, 21, 1456. [Google Scholar] [CrossRef] [PubMed]
  7. Selecký, M.; Faigl, J.; Rollo, M. Communication Architecture in Mixed-Reality Simulations of Unmanned Systems. Sensors 2018, 18, 853. [Google Scholar] [CrossRef] [PubMed]
  8. Lan, G.; Sun, J.; Li, C.; Ou, Z.; Luo, Z.; Liang, J.; Hao, Q. Development of UAV based virtual reality systems. In Proceedings of the 2016 IEEE International Conference on Multisensor Fusion and Integration for Intelligent Systems, Baden-Baden, Germany, 19–21 September 2016; pp. 481–486. [Google Scholar] [CrossRef]
  9. Belmonte, L.M.; García, A.S.; Segura, E.; Novais, P.; Morales, R.; Fernández-Caballero, A. Virtual Reality Simulation of a Quadrotor to Monitor Dependent People at Home. IEEE Trans. Emerg. Top. Comput. 2021, 9, 1301–1315. [Google Scholar] [CrossRef]
  10. Górriz, J.M.; Ramírez, J.; Ortíz, A.; Martínez-Murcia, F.J.; Segovia, F.; Suckling, J.; Leming, M.; Zhang, Y.D.; Álvarez Sánchez, J.R.; Bologna, G.; et al. Artificial intelligence within the interplay between natural and artificial computation: Advances in data science, trends and applications. Neurocomputing 2020, 410, 237–270. [Google Scholar] [CrossRef]
  11. Jie, L.; Jian, C.; Lei, W. Design of multi-mode UAV human-computer interaction system. In Proceedings of the 2017 IEEE International Conference on Unmanned Systems, Beijing, China, 27–29 October 2017; pp. 353–357. [Google Scholar] [CrossRef]
  12. Vukić, M.; Grgić, B.; Dinčir, D.; Kostelac, L.; Marković, I. Unity based Urban Environment Simulation for Autonomous Vehicle Stereo Vision Evaluation. In Proceedings of the 2019 42nd International Convention on Information and Communication Technology, Electronics and Microelectronics (MIPRO), Opatija, Croatia, 20–24 May 2019; pp. 949–954. [Google Scholar] [CrossRef]
  13. Belmonte, L.M.; Morales, R.; Fernández-Caballero, A. Computer vision in autonomous unmanned aerial vehicles—A systematic mapping study. Appl. Sci. 2019, 9, 3196. [Google Scholar] [CrossRef]
  14. Arévalo, F.; Sunaringtyas, D.; Tito, C.; Piolo, C.; Schwung, A. Interactive Visual Procedure using an extended FMEA and Mixed-Reality. In Proceedings of the 2020 IEEE International Conference on Industrial Technology (ICIT), Buenos Aires, Argentina, 26–28 February 2020; pp. 286–291. [Google Scholar] [CrossRef]
  15. Tredinnick, R.; Boettcher, B.; Smith, S.; Solovy, S.; Ponto, K. Uni-CAVE: A Unity3D plugin for non-head mounted VR display systems. In Proceedings of the 2017 IEEE Virtual Reality (VR), Los Angeles, CA, USA, 18–22 March 2017; pp. 393–394. [Google Scholar] [CrossRef]
  16. Diachenko, D.; Partyshev, A.; Pizzagalli, S.L.; Bondarenko, Y.; Otto, T.; Kuts, V. Industrial Collaborative Robot Digital Twin integration and Control Using Robot Operating System. J. Mach. Eng. 2022, 22, 148110. [Google Scholar] [CrossRef]
  17. Yun, H.; Jun, M.B. Immersive and interactive cyber-physical system (I2CPS) and virtual reality interface for human involved robotic manufacturing. J. Manuf. Syst. 2022, 62, 234–248. [Google Scholar] [CrossRef]
  18. Caiza, G.; Bonilla-Vasconez, P.; Garcia, C.A.; Garcia, M.V. Augmented Reality for Robot Control in Low-cost Automation Context and IoT. In Proceedings of the 2020 25th IEEE International Conference on Emerging Technologies and Factory Automation, Vienna, Austria, 8–11 September 2020; pp. 1461–1464. [Google Scholar] [CrossRef]
  19. Kuzmic, J.; Rudolph, G. Comparison between Filtered Canny Edge Detector and Convolutional Neural Network for Real Time Lane Detection in a Unity 3D Simulator. In Proceedings of the 6th International Conference on Internet of Things, Big Data and Security, Online, 23–25 April 2021; Volume 1, pp. 148–155. [Google Scholar] [CrossRef]
  20. Wang, Z.; Han, K.; Tiwari, P. Digital Twin Simulation of Connected and Automated Vehicles with the Unity Game Engine. In Proceedings of the 2021 IEEE 1st International Conference on Digital Twins and Parallel Intelligence, Beijing, China, 15 July–15 August 2021; pp. 1–4. [Google Scholar] [CrossRef]
  21. Mohammadzadeh, M.; Khosravi, H. A Novel Approach to Communicate with Video Game Character using Cascade Classifiers. J. AI Data Min. 2021, 9, 227–234. [Google Scholar] [CrossRef]
  22. Ileperuma, I.; Gunathilake, H.; Dilshan, K.; Nishali, S.; Gamage, A.; Priyadarshana, Y. An Enhanced Virtual Fitting Room using Deep Neural Networks. In Proceedings of the 2020 2nd International Conference on Advancements in Computing, Malabe, Sri Lanka, 10–11 December 2020; pp. 67–72. [Google Scholar] [CrossRef]
  23. Adão, T.; Pinho, T.; Pádua, L.; Magalhães, L.G.J.; Sousa, J.; Peres, E. Prototyping IoT-Based Virtual Environments: An Approach toward the Sustainable Remote Management of Distributed Mulsemedia Setups. Appl. Sci. 2021, 11, 8854. [Google Scholar] [CrossRef]
  24. Fleck, P.; Schmalstieg, D.; Arth, C. Creating IoT-Ready XR-WebApps with Unity3D. In Proceedings of the The 25th International Conference on 3D Web Technology, Virtual Event, 9–13 November 2020. [Google Scholar] [CrossRef]
  25. Borkman, S.; Crespi, A.; Dhakad, S.; Ganguly, S.; Hogins, J.; Jhang, Y.; Kamalzadeh, M.; Li, B.; Leal, S.; Parisi, P.; et al. Unity Perception: Generate Synthetic Data for Computer Vision. arXiv 2021, arXiv:2107.04259. [Google Scholar]
  26. Kerim, A.; Aslan, C.; Celikcan, U.; Erdem, E.; Erdem, A. NOVA: Rendering Virtual Worlds with Humans for Computer Vision Tasks. Comput. Graph. Forum 2021, 40, 258–272. [Google Scholar] [CrossRef]
  27. Saviolo, A.; Bonotto, M.; Evangelista, D.; Imperoli, M.; Menegatti, E.; Pretto, A. Learning to Segment Human Body Parts with Synthetically Trained Deep Convolutional Networks. arXiv 2021, arXiv:2102.01460. [Google Scholar]
  28. Numata, S.; Jozen, T. A 3D Marker Recognition Method for AR Game Development. In Proceedings of the 2021 IEEE 10th Global Conference on Consumer Electronics, Kyoto, Japan, 12–15 October 2021; pp. 553–554. [Google Scholar] [CrossRef]
  29. Alvey, B.; Anderson, D.T.; Buck, A.; Deardorff, M.; Scott, G.; Keller, J.M. Simulated Photorealistic Deep Learning Framework and Workflows to Accelerate Computer Vision and Unmanned Aerial Vehicle Research. In Proceedings of the 2021 IEEE/CVF International Conference on Computer Vision Workshops, Montreal, BC, Canada, 11–17 October 2021; pp. 3882–3891. [Google Scholar] [CrossRef]
  30. Fedoseev, A.; Serpiva, V.; Karmanova, E.; Cabrera, M.A.; Shirokun, V.; Vasilev, I.; Savushkin, S.; Tsetserukou, D. DroneTrap: Drone Catching in Midair by Soft Robotic Hand with Color-Based Force Detection and Hand Gesture Recognition. In Proceedings of the 2021 IEEE 4th International Conference on Soft Robotics, New Haven, CT, USA, 12–16 April 2021; pp. 261–266. [Google Scholar] [CrossRef]
  31. Singh, N.; Chouhan, S.S.; Verma, K. Object Oriented Programming: Concepts, Limitations and Application Trends. In Proceedings of the 2021 5th International Conference on Information Systems and Computer Networks, Mathura, India, 22–23 October 2021; pp. 1–4. [Google Scholar] [CrossRef]
  32. Balogun, M.O. Comparative Analysis of Complexity of C++ and Python Programming Languages. Asian J. Soc. Sci. Manag. Technol. 2022, 4, 1–12. [Google Scholar]
  33. Zehra, F.; Javed, M.; Khan, D.; Pasha, M. Comparative Analysis of C++ and Python in Terms of Memory and Time. 2020; Preprints. [Google Scholar] [CrossRef]
  34. Ullah, K.; Ahmed, I.; Ahmad, M.; Khan, I. Comparison of Person Tracking Algorithms Using Overhead View Implemented in OpenCV. In Proceedings of the 2019 9th Annual Information Technology, Electromechanical Engineering and Microelectronics Conference, Jaipur, India, 13–15 March 2019; pp. 284–289. [Google Scholar] [CrossRef]
  35. Boyko, N.; Basystiuk, O.; Shakhovska, N. Performance Evaluation and Comparison of Software for Face Recognition, Based on Dlib and Opencv Library. In Proceedings of the 2018 IEEE Second International Conference on Data Stream Mining Processing, Lviv, Ukraine, 21–25 August 2018; pp. 478–482. [Google Scholar] [CrossRef]
  36. Peter, J.; Karel, K.; Tomas, D.; Istvan, S. Comparison of tracking algorithms implemented in OpenCV. MATEC Web Conf. 2016, 76, 04031. [Google Scholar] [CrossRef]
  37. Raghava, N.; Gupta, K.; Kedia, I.; Goyal, A. An Experimental Comparison of Different Object Tracking Algorithms. In Proceedings of the 2020 International Conference on Communication and Signal Processing, Chennai, India, 28–30 July 2020; pp. 726–730. [Google Scholar] [CrossRef]
  38. Tang, K.; Wang, Y.; Liu, H.; Sheng, Y.; Wang, X.; Wei, Z. Design and Implementation of Push Notification System Based on the MQTT Protocol. In Proceedings of the 2013 International Conference on Information Science and Computer Applications, Changsha, China, 8–9 November 2013; pp. 116–119. [Google Scholar] [CrossRef]
  39. Belmonte, L.M.; García, A.S.; Morales, R.; de la Vara, J.L.; López de la Rosa, F.; Fernández-Caballero, A. Feeling of safety and comfort towards a socially assistive unmanned aerial vehicle that monitors people in a virtual home. Sensors 2021, 21, 908. [Google Scholar] [CrossRef]
  40. Lozano-Monasor, E.; López, M.; Vigo-Bustos, F.; Fernández-Caballero, A. Facial expression recognition in ageing adults: From lab to ambient assisted living. J. Ambient Intell. Humaniz. Comput. 2017, 8, 567–578. [Google Scholar] [CrossRef]
  41. Martínez, A.; Belmonte, L.M.; García, A.S.; Fernández-Caballero, A.; Morales, R. Facial emotion recognition from an unmanned flying social robot for home care of dependent people. Electronics 2021, 10, 868. [Google Scholar] [CrossRef]
  42. Ammar Sameer Anaz, D.M.F. Comparison between Open CV and MATLAB Performance in Real Time Applications. Al-Rafidain Eng. J. 2015, 23, 183–190. [Google Scholar] [CrossRef]
  43. Guennouni, S.; Ahaitouf, A.; Mansouri, A. Multiple object detection using OpenCV on an embedded platform. In Proceedings of the 2014 Third IEEE International Colloquium in Information Science and Technology (CIST), Tetouan, Morocco, 20–22 October 2014; pp. 374–377. [Google Scholar] [CrossRef]
  44. Borsatti, D.; Cerroni, W.; Tonini, F.; Raffaelli, C. From IoT to Cloud: Applications and Performance of the MQTT Protocol. In Proceedings of the 2020 22nd International Conference on Transparent Optical Networks (ICTON), Bari, Italy, 19–23 July 2020; pp. 1–4. [Google Scholar] [CrossRef]
  45. Hasan, N.I.; Hasan, M.T.; Turja, N.H.; Raiyan, R.; Saha, S.; Hossain, M.F. A Cyber-Secured MQTT based Offline Automation System. In Proceedings of the 2019 International Conference on Wireless Communications Signal Processing and Networking (WiSPNET), Chennai, India, 21–23 March 2019; pp. 479–484. [Google Scholar] [CrossRef]
  46. Sanchez, S.A.; Romero, H.J.; Morales, A.D. A review: Comparison of performance metrics of pretrained models for object detection using the TensorFlow framework. IOP Conf. Ser. Mater. Sci. Eng. 2020, 844, 012024. [Google Scholar] [CrossRef]
  47. Jackson, S.; Murphy, P. Managing Work-Role Performance: Challenges for 21st Century Organizations and Employees. In The Changing Nature of Work Performance; Wiley: Hoboken, NJ, USA, 1999; pp. 325–365. [Google Scholar]
  48. Gholape, N.; Gour, A.; Mourya, S. Finding missing person using ML, AI. Int. Res. J. Mod. Eng. Technol. Sci. 2021, 3, 1517–1520. [Google Scholar]
Figure 1. Video processing in Unity using (a) a native C++ DLL, (b) an external Python module communicated via MQTT.
Figure 1. Video processing in Unity using (a) a native C++ DLL, (b) an external Python module communicated via MQTT.
Applsci 12 05958 g001
Figure 2. Virtual indoor environment.
Figure 2. Virtual indoor environment.
Applsci 12 05958 g002
Figure 3. Image conversion and data transmission from Unity to the two approaches evaluated: internal C++ plugin and external Python program.
Figure 3. Image conversion and data transmission from Unity to the two approaches evaluated: internal C++ plugin and external Python program.
Applsci 12 05958 g003
Figure 4. Processing times prior to data transmission from Unity. For C++ DLL: average, 39.46 ms; minimum, 35 ms; maximum, 57 ms. For Python MQTT: average, 6.05 ms; minimum, 4 ms; maximum, 17 ms.
Figure 4. Processing times prior to data transmission from Unity. For C++ DLL: average, 39.46 ms; minimum, 35 ms; maximum, 57 ms. For Python MQTT: average, 6.05 ms; minimum, 4 ms; maximum, 17 ms.
Applsci 12 05958 g004
Figure 5. Data transmission times from Unity to C++ and Python. For C++ DLL: average, 1.19 ms; minimum, 0.23 ms; maximum, 1.90 ms. For Python MQTT: average, 1.01 ms; minimum, 0.14 ms; maximum, 1.99 ms.
Figure 5. Data transmission times from Unity to C++ and Python. For C++ DLL: average, 1.19 ms; minimum, 0.23 ms; maximum, 1.90 ms. For Python MQTT: average, 1.01 ms; minimum, 0.14 ms; maximum, 1.99 ms.
Applsci 12 05958 g005
Figure 6. Colour detection results in C++ and Python.
Figure 6. Colour detection results in C++ and Python.
Applsci 12 05958 g006
Figure 7. Processing times of the colour detection algorithm in C++ and Python. For C++ DLL: average, 0.70 ms; minimum, 0.64 ms; maximum, 2.52 ms. For Python MQTT: average, 2.65 ms; minimum, 1.98 ms; maximum, 4.0 ms.
Figure 7. Processing times of the colour detection algorithm in C++ and Python. For C++ DLL: average, 0.70 ms; minimum, 0.64 ms; maximum, 2.52 ms. For Python MQTT: average, 2.65 ms; minimum, 1.98 ms; maximum, 4.0 ms.
Applsci 12 05958 g007
Figure 8. Face detection results in C++ and Python.
Figure 8. Face detection results in C++ and Python.
Applsci 12 05958 g008
Figure 9. Processing times of the face detection algorithm in C++ and Python. For C++ DLL: average, 6.39 ms; minimum, 5.47 ms; maximum, 11.85 ms. For Python MQTT: average, 8.77 ms; minimum, 7 ms; maximum, 12 ms.
Figure 9. Processing times of the face detection algorithm in C++ and Python. For C++ DLL: average, 6.39 ms; minimum, 5.47 ms; maximum, 11.85 ms. For Python MQTT: average, 8.77 ms; minimum, 7 ms; maximum, 12 ms.
Applsci 12 05958 g009
Figure 10. Sequential execution of colour and face detection algorithms: (a) C++ DLL, (b) Python program communicated via MQTT.
Figure 10. Sequential execution of colour and face detection algorithms: (a) C++ DLL, (b) Python program communicated via MQTT.
Applsci 12 05958 g010
Figure 11. Complete processing times of the colour and face detection algorithms in C++ and Python. For C++ DLL: average, 43.38 ms; minimum, 40.30 ms; maximum, 66.08 ms. For Python MQTT: average, 16.30 ms; minimum, 13.41 ms; maximum, 26.82 ms.
Figure 11. Complete processing times of the colour and face detection algorithms in C++ and Python. For C++ DLL: average, 43.38 ms; minimum, 40.30 ms; maximum, 66.08 ms. For Python MQTT: average, 16.30 ms; minimum, 13.41 ms; maximum, 26.82 ms.
Applsci 12 05958 g011
Figure 12. Parallel execution of the colour and face detection algorithms in two Python programs communicated via MQTT.
Figure 12. Parallel execution of the colour and face detection algorithms in two Python programs communicated via MQTT.
Applsci 12 05958 g012
Figure 13. Total processing times of the colour and face detection algorithms in parallel execution in Python. For colour detection: average, 9.60 ms; minimum, 7.05 ms; maximum, 24.43 ms. For face detection: average, 16.10 ms; minimum, 13.05 ms; maximum, 30.43 ms.
Figure 13. Total processing times of the colour and face detection algorithms in parallel execution in Python. For colour detection: average, 9.60 ms; minimum, 7.05 ms; maximum, 24.43 ms. For face detection: average, 16.10 ms; minimum, 13.05 ms; maximum, 30.43 ms.
Applsci 12 05958 g013
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Bustamante, A.; Belmonte, L.M.; Morales, R.; Pereira, A.; Fernández-Caballero, A. Video Processing from a Virtual Unmanned Aerial Vehicle: Comparing Two Approaches to Using OpenCV in Unity. Appl. Sci. 2022, 12, 5958. https://doi.org/10.3390/app12125958

AMA Style

Bustamante A, Belmonte LM, Morales R, Pereira A, Fernández-Caballero A. Video Processing from a Virtual Unmanned Aerial Vehicle: Comparing Two Approaches to Using OpenCV in Unity. Applied Sciences. 2022; 12(12):5958. https://doi.org/10.3390/app12125958

Chicago/Turabian Style

Bustamante, Andrés, Lidia M. Belmonte, Rafael Morales, António Pereira, and Antonio Fernández-Caballero. 2022. "Video Processing from a Virtual Unmanned Aerial Vehicle: Comparing Two Approaches to Using OpenCV in Unity" Applied Sciences 12, no. 12: 5958. https://doi.org/10.3390/app12125958

APA Style

Bustamante, A., Belmonte, L. M., Morales, R., Pereira, A., & Fernández-Caballero, A. (2022). Video Processing from a Virtual Unmanned Aerial Vehicle: Comparing Two Approaches to Using OpenCV in Unity. Applied Sciences, 12(12), 5958. https://doi.org/10.3390/app12125958

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop