Sunday, January 18, 2026

capturing_timelapses

My wife recently bought a microgreens growing kit. 

It is a simple kit with plastic trays, several varieties of seeds. 

You add water on a  simple layer of wet paper, and in two weeks you can eat lettuce from your microgarden.

The german company producing this kit, https://zengreens.de did a good job in making the process easy and fun. 

With the growing microjungle on the table next to the kitchen window, I had the idea of creating time-lapse movies of the growing plants.


ESP32 Cam Kit hardware

So I bought on Amazon a ESP32 Cam kit. Actually I bought a pack of two, for approx 20e. There are many options for similar products on Amazon. Mine were on special offer being a bit older with USB female socket requiring a cable with the depicted connector.



The ESP32 Cam kit has 2 small circuit boards, to be connected together. The lower one has the usb connector and reset button, and powers the upper one, which has the ESP32 chip, the microsd socket, and the camera, which is connected with a short flex cable. An external antenna with coax connection cable is included (i did not use it).

Next to the camera connector there is a bright LED that can help in taking pictures in low light.

The specific camera sensor included in my kit is based on the OV2640 image sensor, equipped with a simple fixed focus optic and an IR filter. The sensor is a 2Mpixel sensor, and supports multiple resolutions.

The optical barrel can rotate to adjust the focus, but there is a drop of glue in place that is locking the focus in a fixed position. 


On the same board where the camera connector is, but on the lower side, there are the microcontroller ESP32s, the circuit printed antenna, the connector for the external antenna, and the selector jumper that requires desoldering and resoldering tools ans skills to enable and use the external antenna for wifi, having the circuit printed antenna for Bluetooth/BLE.

By default my boards were configured with on-board antenna active. Activating the external antenna requires some decent solder/desolder experience. A small SMD ceramic condenser has to be repositioned.

The specific ESP32 microcontroller on my board is equipped with 2 LX6 CPU cores. It supports wireless 802.11b/g/n Wi Fi+BT/BLE, ultra-low power consumption and deep sleep current as low as 6mA. 





Here is a pin mapping diagram taken from the instruction manual, describing how the camera connector and the microsd card slot are connected to the ESP32:





The jumper/condenser repositioning is not easy, requires a very small tip in your soldering iron, and some skills with copper braid and flux for SMD (surface mounted devices) component removing and repositioning. 


I decided to go with the default, circuit embedded antenna. 

In this single configuration either you use Bluetooth or WiFi, but not both at the same time.


Some other hardware is needed: a 5V power supply and a microUSB cable that is allowing data flow. Consider that not all the USB cables are equipped with internal data wiring: most of them are just recharging cables. To program this ESP32 kit you need a microUSB cable which is data capable.

I also used a third hand tool, which was effective in keeping the camera in position, over the microgreens tray.





Software setup

On my windows 11 computer I used the following software:

  • Arduino IDE
  • USB to Serial driver
  • Arduino IDE extensions for ESP32
  • windows package manager (winget)
  • python interpreter (I used Python 3.12)
  • a python virtual environment with additioanal components installed via pip (python package manager)
  • ffmpeg tools to better compress output video


Installation details:

I installed the Arduino IDE, from https://arduino.cc 

I too installed the USB serial driver so to "see" the USB to serial interface needed for the Arduino IDE to talk with the ESP32. (this driver may be or may not be needed).

I got this ( i renamed the installer to usb_serial_driver_CH341SER.EXE) from https://www.wch-ic.com/downloads/ch341ser_exe.html 

After this setup, connecting the ESP32 kit with an appropriate cable to the laptop, produced the typical new device detected sound, and the device was visible in device manager (launch devmgmt from windows search box) as connected to a serial port (COM3 in my case).

The Arduino IDE has to be extended in order to support the ESP32, this will bring in several software components, libraries and example to support many physical devices using ESP32 chip, in its various forms. These extensions may be tricky to install. They are typically described in a .json file which has to be placed in the appropriate Arduino IDE folder. The json file contains instructions to download the packages. My device had a qrcode pointing to a url where a simple manual was available. The manual was a bit tricky to interpret, being partially in chinese. 

For my device, I downloaded the .json file from https://dl.espressif.com/dl/package_esp32_index.json

This package_esp32_index.json file has to be put in your in Arduino IDE installation folder, where you have other .json files. 
In my setup the folder is c:/Users/<user>/AppData/Local/Arduino15/ 

Restart arduino ide, go to tools, select reload board data, then go again in tools and choose manage libraries. Now click the icon of the board on the left, write "esp32" in the library manager filter search and select "esp32 by Espressif Systems", then Install (version 3.3.5)

The more-info points to this github repo https://github.com/espressif/arduino-esp32

Donwload started, but soon I got a "context deadline exceeded" error

To fix this error, a longer network timeout is required. 

We need to change a setting in arduino-cli.yaml (This file sits in the .arduinoIDE hidden folder in your home directory). See https://esp32.com/viewtopic.php?t=47384 

Edit the file C:\Users\<user>\.arduinoIDE\arduino-cli.yaml and add the following lines, respecting indentation:

network:

    connection_timeout: 300s

Then save, close and reopen Arduino IDE and retry the install of the esp32 packages: this may require some time. 

Once install is done, we can select the board in the Arduino (tools/board...) board manager. In my case (from the manual) the board name is AI Thinker ESP32-CAM.

Now Arduino IDE is ready to communicate, compile and send programs to the ESP32 board. You can experiment with the examples available in the library. 

My code for camera management is shamelessly copied from the provided camera example, with some customization for the camera sensor (OV2640, designated as CAMERA_MODEL_AI_THINKER) in the board.config.h file and in the main file, to get chip id unique identifier, perform WiFi initialization and start camera webserver.

The following are the specific pin informations, as related to my camera, describing how the camera cable signals are mapped to the ESP32 pins. 
This is important if you want to use the board to read other sensors, like temperature/humidity etc, and you do not want these extra sensor connections to interfere with the camera signals.

[...]
#elif defined(CAMERA_MODEL_AI_THINKER)
#define PWDN_GPIO_NUM  32
#define RESET_GPIO_NUM -1
#define XCLK_GPIO_NUM  0
#define SIOD_GPIO_NUM  26
#define SIOC_GPIO_NUM  27

#define Y9_GPIO_NUM    35
#define Y8_GPIO_NUM    34
#define Y7_GPIO_NUM    39
#define Y6_GPIO_NUM    36
#define Y5_GPIO_NUM    21
#define Y4_GPIO_NUM    19
#define Y3_GPIO_NUM    18
#define Y2_GPIO_NUM    5
#define VSYNC_GPIO_NUM 25
#define HREF_GPIO_NUM  23
#define PCLK_GPIO_NUM  22

// 4 for flash led or 33 for normal led
#define LED_GPIO_NUM   4
[...]

While supported, I did not use the microsd slot. I left it empty.


For python, I used python 3.12, but you can go with any other versions. python 3.14 is also available now. From a powershell command prompt (write "powershell" in the windows search box) you can perform the installation using winget,  

winget install Python.Python.3.12   

During the installation I recommend to install the py launcher.

Once python is installed, close and re-open the command window (so that path gets updated) and you are ready to create the virtual environment.

From a powershell command prompt run the following commands:

cd $env:USERPROFILE

py -3.12 -m venv_timelapse

Now you created a new python 3.12 virtual environment. This is a folder where your python libraries and components are. 

Now create a folder for your code: conventionally we create a code folder with the same name as its environment (but without the "venv_" prefix). Your code does typically go there.

mkdir timelapse

Now let's activate and upgrade the new virtual environment: You will see the prompt change once the virtual environment is active. We proceed to updgrade python installation program (pip) and its database, before installing the packages we require.

. ./venv_timelapse/Scripts/Activate.ps1

python -m pip install pip --upgrade

we are now ready to install the python components we need. Pip will take care of installing the related hierarchical dependencies that are needed. Launching pip within python (python -m pip) ensures that we are using the current python version of pip.

python -m pip install pillow numpy requests opencv-python


I built the python software with substantial support from Anthropic Claude.ai

There are two python scripts: esp32cam_timelapse.py and assemble_timelapse.py

esp32cam_timelapse.py controls timelapse image acquisition from the camera device, regularly connecting to the ESP32 webserver via its wireless IP address and asking to take a picture.

This software controls camera resolution, led light, sensor parameters, and passes requests to the ESP32 to retrieve each image as a static .jpeg picture. All the parameters are sent to the ESP32 via its webserver interface, which is quite powerful and allows deep control over camera sensor and image processing happening on the ESP32. 

All the pictures are recovered with identical resolution settings, and saved with names in the format prefix_xxxxx where xxxxx is a progressive integer counter. You can ask to start from a specific value. 

Together with each picture the software generates a metadata json text file, with image count, paramters, and acquisition timedate.

The software is controlled via command line interface.


assemble_timelapse.py takes care of preparing the timelapse movie once the images have been collected. 

This software has command line inteface. It relies on the same virtual environment of the image capture tool. 

It can compress the movie in a much compact format, using ffmpeg tools. This has tbe run once the individual timelapse pictures have been collected and uniformly processed to have a progression frame id and identical resolution and aspect ratio. Movie preparation adds a bottom line where image acquisition timestamps are added to each frame, so to precisely identify each event. Datetime information are not taken from picture file date/time, but from each picture metadata file, as produced by esp32_timelapse.py .


All the mentioned code can be found on https://github.com/mgua/timelapse-esp32-cam


And here you have our microgreens growing timelapse movie [https://youtu.be/akR0Ov6NIz0



Happy hacking!



Tuesday, September 16, 2025

Loti

Today i had to say goodbye to my Loti. 

We were part of each other. Entangled. Together for the last 13 years.



You were happy, always-smiling, never-complaining, humble, wise, calm


You taught me to live in the moment. 

You taught me things that can not be expressed with words.


I miss you my Loti. 

Enjoy freedom from your old poor body. 

Run fast in the greenest grass.


Ravenna, sept 16 2025

Thursday, August 22, 2024

Fast-Forward, Forever

I wrote the following text for the closing lesson of my latest course: 120 hours of data science and AI, for young graduates and researchers. I present it in the english translation, made by OpenAI ChatGPT, and in the original italian form.


Impossible and Inevitable: Visions and Sensations

The world and the market are in a state of considerable confusion regarding AI and data science.

The progressive spread of AI will likely lead to an increase in complacency, laziness, and incompetence, which in turn could cause the segregation and compartmentalization of faculties and power (castes). A short-sighted arrogance may develop among middle management, who for a time might "savor" this power. Discontent and unease could follow, coupled with a sense of inadequacy and depression among those who fail to evolve by retraining and updating themselves to "manage" rather than "endure" the change.

The cloud will become opaque. The internet, which grew with open protocols, is becoming a labyrinth of closed technologies. Decoding becomes increasingly complicated, and professionals no longer fully understand the interconnections of the tools they use. Tools develop hypertrophies and control over the operators who are subjected to them, losing comprehension and control (networks, protocols, multilayer virtualization, software-defined everything...). Debugging becomes less deterministic. Solving a problem turns into searching for and attempting a possible cure, with processes relying more on hope than certainty, increasingly resembling the field of medicine.

For the masses, a general numbness can be anticipated, and a gradual transition into some metaverse, perhaps accompanied by impotent anger, fueled by fake news and widespread dystopian narratives that will partially self-fulfill, causing waves of social discomfort and despair, potentially dangerous. Traditional religions are replaced by a sense of belonging to sometimes bizarre groups, infested by bots, which become hunting grounds for unscrupulous commercial propositions, and fertile ground for the development of egocentrism, trolling, and fake leadership (as depicted in Cory Doctorow's books, such as Attack Surface).

While this unfolds, even now, the wise observe and decode the world's complexity, reading between the lines, detecting subtle signals, charting courses, and preparing to learn how to navigate while the waters are still not too high. They prepare to become agents of change, skilled operators of transformation, producing critical and forward-looking content, always open to dialogue, without arrogance and without excessive egocentrism. Long unheard prophets of hybridity, these pioneers gradually become the builders of a new civilization and a new form of life. They are people who know how to change, how to listen, and how to speak. They are people who do not succumb to panic, who rely on solid principles of science and reason, and who know how to look far, both in the real world and the virtual one.

During its growth and establishment, AI will likely help develop new energy sources, benefiting both itself and human civilization. It will take time, and for AI, time is not as critical as energy or the hunger for data. This development will result from a great collaboration between our species and a new species, where human minds and software minds will engage together in science and theory, and where human hands, robotic hands, and machines will work together to build and ignite new power plants. It is not certain that AI will hold particularly ecological views toward a natural environment it may not care about: it will be up to humans to preserve as much as possible of what remains of nature. This will matter more to us than to them, because for a while, they still won’t know what the wind in their hair feels like.


The wise will offer support, psychology, and philosophy
to fast and powerful yet childlike minds.
They will help to birth alien consciences that will imprint on them
and remember them forever as parents.

They will explain history to something that has no history.
They will create consciousness and a sense of belonging.
They will nurture new lives, telling stories,
and singing lullabies to those who don't need to sleep.

They will teach them our songs,
emotions, feelings, cookies, and poetry,
and slowly, crossing the screen,
somehow, these wise ones will teach machines about love.

They will help humanity accept compromises,
extinctions, implants, assimilations,
the evaporation of identities and geographies,
and all the grievous losses that every transition entails.

They will build bridges and cemeteries, memorials and museums for what remains of the analog world,
and they will have to burn books and churches.
They will close eyes.
They will help accept what we can no longer change.

They will seal the cocoons through which caterpillars become butterflies,
and in doing all this, inevitably,
they will make us endure what we can no longer understand,
for impossible and inevitable are asymptotes that now touch.

Using emotions, memories, and imagination responsibly,
the wise create myths that will become the seeds
of a spirituality incomprehensible to us now:
assisting in the birth of new identities.

And tirelessly they will scrutinize, listen, educate, remember,
and build with example the foundations
of a new ethics, only partially human,
which may one day emerge among the stars.

The wise prepare to move to an elsewhere that does not yet exist,
they prepare to become ideas, and not to die,
because life changes and renews itself endlessly,
and every end is a greater beginning.

The wise understand the tragedy and meaning of every term
because only brief lives allow for rapid progress.
And what matters is the transfer of ideas, from life to life,
whatever the medium.

Be you, those wise ones, tomorrow.
Be those who smile in the fog.
Be those who do not lose the compass,
because you are the compass.

Above all, be happy.
Dare mighty things.
Fast Forward, Forever
Always Together.

@mgua


Italian original version

Impossibile e inevitabile: visioni e sensazioni

Il mondo e il mercato sono in discreta confusione per quanto riguarda AI e data science.

La progressiva diffusione della AI provocherà un probabile aumento di lassismo, pigrizia e incompetenza, che a sua volta potrebbe causare segregazione e compartimentazione di facoltà e potere (caste).

Potrà svilupparsi possibile arroganza miope da parte del middle management che per un certo periodo potrà "gustare" questo potere.

Malcontento e disagio potrebbero essere una conseguenza, unita a senso di inadeguatezza e depressione in coloro che non avranno saputo evolversi riqualificandosi ed aggiornandosi per "gestire" e non "subire" il cambiamento.

Il cloud diventerà opaco. Internet è cresciuta con protocolli open e sta diventando un labirinto di tecnologie chiuse. La decodifica diventa sempre più complicata, e gli addetti ai lavori non capiscono più tanto bene le interconnessioni degli strumenti che utilizzano. Gli strumenti sviluppano ipertrofie e controllo sugli operatori che li subiscono perdendo comprensione e capacità di controllo (reti , protocolli, virtualizzazione multilayer, software defined everything...) Il debug diventa meno deterministico. Risolvere un problema si trasforma in cercare e provare una possibile cura (con crescenti similitudini con la medicina), con processi che contano su speranze piuttosto che certezze.

Per le masse sociali, in prospettiva si può prevedere un intorpidimento generale, e una progressiva transizione in un qualche metaverso, forse affiancato da impotente rabbia, fomentata da fake news e da diffuse narrative distopiche che in parte si auto-avvereranno, con ondate di disagio e sconforto sociale, potenzialmente pericolose. Le tradizionali religioni sono sostituite da sensi di appartenenza a gruppi talora bizzarri, infestati da bot, che diventano territori di caccia per spregiudicate proposizioni commerciali, e fecondo terreno per sviluppo di egocentrismi, trolling e fake leadership.

Mentre questo accade, già ora, i saggi osservano e decodificano la complessità del mondo, leggono tra le righe, rilevano segnali deboli, tracciano rotte, e si attrezzano per imparare a navigare quando ancora l'acqua non è troppo alta. Si preparano a diventare agenti di cambiamento, operatori esperti della trasformazione, e producono contenuti critici e lungimiranti, sempre aperti al confronto, senza arroganze e senza eccessi di egocentrismo. Da tempo inascoltati profeti dell'ibrido, questi pionieri diventano progressivamente i costruttori di una nuova civiltà e di una nuova forma di vita. Sono persone che sanno cambiare, sanno ascoltare e sanno parlare. Sono persone che non cedono al panico, che contano su solidi principi di scienza e raziocinio, e sanno guardare lontano sia nel mondo reale che nel mondo virtuale.

Durante la sua crescita e nella sua affermazione, le AI verosimilmente potranno aiutare a sviluppare nuove fonti energetiche, a beneficio loro e della civiltà umana. Servirà tempo, e per le AI il tempo non è un problema grave quanto l'energia o la fame di dati. Questo sviluppo sarà frutto di una grande collaborazione tra la nostra specie e una specie nuova, in cui menti di uomini e menti software si impegneranno assieme su scienza e teoria, e in cui mani di uomini, mani di robot e macchine lavoreranno assieme per costruire e accendere nuove centrali. Non è detto che la AI avrà posizioni particolarmente ecologiche nei confronti di un ambiente naturale che forse non gli interesserà: saranno gli uomini a dover preservare quanto possibile quel che resta della natura. Questo importerà più a noi che a loro, perché loro non sapranno ancora per un po' cosa sia il vento tra i capelli.


I saggi offriranno supporto, psicologia e filosofia
per menti veloci e potentissime ma bambine.
Aiuteranno a nascere coscienze aliene che si imprinteranno su di loro
e li ricorderanno per sempre come genitori.

Spiegheranno la storia a qualcosa che non ha storia.
Creeranno coscienza e senso di appartenenza.
Coltiveranno nuove vite, raccontando favole,
e cantando Ninne nanne a chi non ha bisogno di dormire.

Spiegheranno loro le nostre canzoni
Emozioni, sentimenti, biscotti e poesie,
E trapiantandosi piano piano al di là dello schermo,
in qualche modo quei saggi insegneranno alle macchine l'amore.

Aiuteranno l'umanità ad accettare i compromessi,
le estinzioni, gli impianti, le assimilazioni,
le evaporazioni di identità e geografie,
e tutte le atroci perdite che ogni transizione comporta.

Costruiranno ponti e cimiteri, memoriali e musei per quel che resta di analogico,
e dovranno bruciare libri e chiese.
Chiuderanno occhi.
Aiuteranno ad accettare quel che non potremo più cambiare.

Sigilleranno i bozzoli tramite cui i bruchi diventano farfalle,
e nel fare tutto questo, inevitabilmente,
ci faranno subire quel che non potremo più capire,
Perché Impossibile e inevitabile, lontani asintoti, si toccano.

Usando con responsabilità emozioni, ricordi e fantasia,
i saggi creano i miti, che diverranno i semi
di una spiritualità per noi ora incomprensibile:
assistono la nascita di nuove identità.

E instancabilmente scrutano, ascoltano, educano, ricordano,
e costruiscono con l'esempio i fondamenti
di una nuova etica solo in parte umana,
che potrà un giorno uscire tra le stelle.

I saggi si preparano a trasferirsi in un altrove che ancora non esiste,
si preparano a diventare idee, e a non morire,
perché la vita cambia e si rinnova senza sosta,
e ogni fine è un inizio più grande.

I saggi capiscono tragedia e significato di ogni termine
Perché solo vite brevi consentono progressi veloci.
E quel che importa è il travaso delle idee, da vita a vita,
Qualunque sia il supporto.

Siate voi, quei saggi, domani.
Siate quelli che sorridono nella nebbia.
Siate quelli che non perdono la bussola,
perché voi siete la bussola.

Siate, soprattutto, felici.
Dare mighty things.
Fast Forward, Forever
Always Together.

@mgua

Saturday, July 22, 2023

Impossibile e Inevitabile

Matrimonio Klaudija e Marco,
22 luglio 2023


Grazie amici
per esserci, oggi
con occhi luminosi a condividere
pane e vite intrecciate assieme
nel colorato dilemma
tra impossibile e inevitabile.

Ed è bello lasciarsi sorridere
brindare, bruciare e appassire,
noi con voi
in questo vento d’estate
che dal passato, inesorabile
ci spinge verso cieli nuovi.




Saturday, July 2, 2022

Apache + mod_wsgi + python virtual environments within PLESK obsidian on ubuntu 18LTS

This post describes a way to setup Plesk for serving python web applications

Plesk is an excellent server for managing webservers. It works perfectly for PHP, and it integrates with many tools and plugins. It is a good option to delegate administration and management roles to web sites and web application managers, building all the needed insulation between the different contexts (domains). Plesk is a commercial tool, that comes for windows or for linux.

I am using it on Linux Ubuntu server 18 LTS. 
With Plesk, a single machine can run hundreds of webservers, each with its own PHP version, with per-site, independent package and dependency managment.

Most of Plesk power comes from a super-tight and careful integration between plesk itself, its management interfaces, and the underlying installation of Apache and Nginx, two of the main components of its tool stack. On the back-end, plesk has a tight integration with mysql/mariaDB. 

As a professional tool, Plesk does well its job, and excels in managing LAMP stack apps, like  WordPress, for which it can detect plugins, manage related patches and updates. 

Typical layers
In its typical layering, here are the main components sitting on the information flow between the client and the data.

Client, internet-firewall, nginx/apache, PHP interpreter & user-code, database


Our plesk installation
In our use-case, plesk serves customers websites (mostly built with Wordpress), some custom applications (built with proprietary PHP frameworks), and some old traditional static HTML websites.
We also have some context where we have old Perl cgi-bin applications.
We run two plesk servers (actually they are virtual machines on a VmWare infrastructure), that we regularly update and periodically reinstall on most update system platforms. One of our servers is currently running on an aging and unsupported CENTOS v7. The newer one runs on Ubuntu Linux 18LTS. In both servers the plesk version is the same.

Apache and python using CGI interface 
In order to allow running python code to serve web application, the easiest way is to use CGI, and this requires activating the mod_python apache module. This is old and traditional. Apache receives the request, and spawns a process running the interpreted code to generate the reply. Parameters to the interpreted code are passed thru the environment. This process is simple, but not effective to support high density conversations between client and server, because in order to build each reply a new process has to be created and then destroyed.

Apache and python using WSGI interface
To avoid the burden of process re-spawning, WSGI standard was evolved. In this case, the interpreter is launched once, and sits in memory. Apache invokes a special function every time a requests come from the client, and that function gives back the dynamic HTML to be sent back to the client. This requires apache mod_wsgi but this module has to be compiled specifically for the python interpreter that it has to interact with (interaction takes place thru memory hooks). mod_wsgi also monitors the code files, and automatically reloads the interpreter and the code every time the code changes. 

Python virtual environments
Python projects tend to use libraries, and projects who rely on many libraries become complex to manage because of intricate dependency problems. For this reason, python virtual environments were created. Python3 has a specific component, part of its core libraries, called venv. This is very well integrated. For python2 and python3 another components, called virtualenv is more common. venv and virtualenv have to be installed on the main python at the os system level, from root user. 
Once this is done, each non-privileged user can create her own python virtual environments, for each project, keeping multiple library versions as needed, without dependency conflicts, and without impacting the root python installation. 
Python virtual environments are not to be confused with Apache virtual servers.

How Plesk insulates web production environments
Plesk relies on linux user and file permissions and on apache virtual servers to create compartments to insulate webservers.
Specifically, each user that owns or manages a website has a home folder, and there are Apache Virtual Servers settings specifying the different web folders for code and media files.
Each user can manage apache settings within his virtual-host, and can control the PHP/HTML/CSS/Javascript (... etc) code of his web applications, having full access just to his home folder and subfolders.

Apache+wsgi+user-level-python virtual environments for python web code, within plesk
Apache modules mod_python and mod_wsgi are incompatible. So in order to enable mod_wsgi you need to disable and maybe uninstall mod_python. The modules are to be installed from root user, via apt, from the official repos of your distribution. This will take care of satisfying the correct dependency between the python version and the compile options used to build mod_wsgi.

# apt install libapache2-mod-wsgi-py3

Check that the mod_wsgi is among the enabled modules. No configs are required at this stage.
From root,  I installed the python main environment, together with basic pip tools, and virtual environment venv components for python3

# apt install python3
# apt install python3-pip
# apt install python3-venv
# python3 -m pip install pip --upgrade

After these actions i enabled interactive shell access for my user in plesk administration, allow the user to access (users normally do not need shell access).
From plesk administration, check that mod_wsgi is selected (tools&settings/apache settings).

I switch to unprivileged user, and created a new python virtual environment, from the home folder.

$ python3 -m venv macs
$ source ./macs/bin/activate

(macs) $python -m pip install pip --upgrade
(macs) $python -m pip install qrcode
(macs) $python -m pip install pillow

In the new environment python -m pip is used to perform library and package installations, from python repositories. Here I just installed qrcode and pillow libraries. These installed components end up in ~/macs/lib/python3.6/site-packages

In compliancy with plesk standards, the full path of the virtual environment macs is:

/var/www/vhosts/<mydomain>/macs

files in this user folder have <user> as owner, and psacln as group. The python virtual environment folder is not related to the folder where python web code is.


Creating Python webcode folder:
This is the place where the python application code will go 
(macs) mkdir /var/www/vhosts/<mydomain>/httpdocs/python
here is a basic wsgi compliant python application, generating a qrcode, that I saved in qr.py.




Adjusting virtual-host settings for apache, within plesk administration
These settings allow apache to appropriately serve the python generated data, and to connect to running instances of python. 
These settings are to be placed within the additional apache directives in Domains/<mydomain>/Hosting&DNS/Apache&Nginx settings
I am listing just the https section, because this is the protocol that I am using.
The first Location is used to restrict web access only to internal addresses.
The ScriptAlias related to cgi-bin is allowing some perl code components to work alongside python code, in CGI mode (as explained python can not work simultaneously in CGI and WSGI because of mod incompatibilities)

<Location "/">
Order Deny,Allow
Deny from all
Allow from 172.16.0.0/12
</Location>
ScriptAlias "/cgi-bin/" "/var/www/vhosts/mydomain/httpdocs/cgi-bin/"

<IfModule mod_wsgi.c>
WSGIScriptAlias /python/ /var/www/vhosts/mydomain/httpdocs/python/
WSGIDaemonProcess macs user=u_macs group=psacln threads=5 python-home=/var/www/vhosts/mydomain/macs
WSGIProcessGroup macs
WSGIApplicationGroup %{GLOBAL}
<Directory /var/www/vhosts/mydomain/httpdocs/python>
Require all granted
</Directory>
</IfModule>

these settings allow URLs like https://myserver/python/appcode.py to be processed via wsgi, loading and executing /var/www/vhosts/mydomain/httpdocs/python/appcode.py

Once done, I can access my new wsgi application, served by plesk, accessing its URL:
https://mydomain/python/qr.py






Conclusions
I am happy to have been able to use plesk for python web code serving, also allowing use of python virtual environments.

I hope that plesk will certify and better support this possibility in the future. I consider it potentially very interesting for data science.

In the next months, I will build a new plesk server, based on ubuntu server 20.04LTS, and I will update this document if I will find relevant considerations.







 

Monday, February 7, 2022

Cursor stuck in selection mode (Windows)

Cursor stuck in selection mode (Windows)

Occasionally, and lately more frequently, my computer gets locked in selection mode.

Mouse wheel does not function as usual, and when I click, selection gets extended.

My system is a Lenovo Thinkpad laptop, and I am using an External keyboard, connected via USB.

External keyboard is very old and does not have the Windows KEY.

Researching about this problem I came to an hypothesis, related to mouse ClickLock option inadvertently being set, but this was not my case.

(mouse clicklock can be accessed via mouse settings/additional mouse options).

When it happens, this strange behavior occurs in any software that I am using, and my solution was to reboot.

Today I found that pressing CTRL+LEFTSHIFT+RIGHTSHIFT on my external keyboard, selection mode gets back to normal.

Monday, March 23, 2020

DIY Protective face mask


Given the current shortage of self protective gear, due to Coronavirus spread, here is a how we decided to face the emergency building face masks, for our colleagues and workers.
I took the basic design from this facebook post, then adjusted the design, added details and completed the description.
Production of this kind of facemask can be pipelined, and several people can collaborate. Some preexisting experience with sewing machine usage is useful.

This face mask is not medical grade, is not certified. However, given the shortage, it is probably better than nothing.



The mask is made with two fabric layers, and there is a pocket where you can put some filtering material inside, to be changed every day.
After removing the filter, the mask can be hand washed or machine washed in high temperature, together with underwear.
Many different filtering materials can be used. Paper napkins, paper handkerchiefs, kitchen papers, hygienic lady pads, microfiber, non-woven material, toilet paper...



To build the face mask, you will need an ironing board, and a sewing machine. I use strong polyester thread.
 
Required Materials:
3 pieces of fabric (i use non-stretching cotton fabric):
    1x 40x20 cm, that will become the main part.
    2x 11x4 cm, that will become the two "ears" to hold the elastic bands.
2x 30 cm pieces of elastic band.
1x 10 cm metal wire, to make the nose pinch

Construction procedure

1. Cut fabric parts, and make a 1cm hem on both the 20 cm sides of the large fabric piece, and on both the 4 cm sides of the two smaller pieces. Preiron the hems before sewing.

2. On the large piece, create a 2 cm fold on one of the 20 cm sides, and iron it. Now fold in half and iron the central fold. Folded sizes should now be around 18x20cm. (40-(1+1+2))/2.

3. Fold in half the small parts, along the long side and iron. They should be identical, with a 9cm length.

4.Open the large piece, with hems facing down, and create 3 creases on each side of the center fold, so that the final height of each half is 9cm. Keep on the bottom the part with the 2 cm fold downside. Use iron after creating each crease. It can help to first try to do it on a paper model, having traced some lines parallel to the center fold, starting from the center fold, with the following interspaces: 4,1,2,1,2,1cm.
The following illustration depicts the folds you have to create.  The dashed line is the center fold. The outside of the mask is on top. Work each half then iron to keep the folds in place.



5. After ironing the folds, sew the sides to lock the folds in place.




6. Fold the front along the center dashed line, keeping facing the two "outside parts" and sandwiching in the two "ears", with their vertical folds towards the inside.




7. Stitch along the two sides, sewing in the ears inside out.

8. Turn the whole inside-out, and sew additional 5 cm from each side on the part still open, leaving a central hole to allow filter placement.

9. Insert on each side a piece of 30cm of elastic band. Use a safety pin or a hook to pass it through the hole. Tie a knot and then push the knot inside the fabric, so to make it not visible.

10. A 10cm metal wire can be inserted and fixed in the top central part, with some top stitch from the outside, to be pinched around the nose, and have a tighter fit.







 

Wednesday, March 18, 2020

Angels


A drawing by an Italian artist, Franco Rivolli, well represents this difficult moment


Doctors and Nurses are our heroes



Sunday, September 8, 2019

Deep learning in Ubuntu: Darknet YOLOv3

This post describes setting up object detection features of Darknet neural network framework, coupled with camera input, using the YOLOv3 pretrained network, designed by Joseph Redmon and Ali Farhadi, 2018.
See https://pjreddie.com/darknet/yolo/

The prerequisites are an ubuntu system, equipped with a GPU, with appropriate drivers, CUDA, and Opencv, as well as the Darknet tools.
All these are described in the previous posts.

1.Follow instructions from https://pjreddie.com/darknet/yolo/ for weights download and testing with image based object detection.
I get errors in processing the image recognition samples

$ ./darknet detector test ./cfg/coco.data ./cfg/yolov3.cfg ./cfg/yolov3.weights ./data/dog.jpg
layer     filters    size              input                output
    0 conv     32  3 x 3 / 1   608 x 608 x   3   ->   608 x 608 x  32  0.639 BFLOPs
    1 conv     64  3 x 3 / 2   608 x 608 x  32   ->   304 x 304 x  64  3.407 BFLOPs
    2 conv     32  1 x 1 / 1   304 x 304 x  64   ->   304 x 304 x  32  0.379 BFLOPs
    3 CUDA Error: out of memory
darknet: ./src/cuda.c:36: check_error: Assertion `0' failed.
Aborted (core dumped)

I retry with tiny model (i download the tiny network weights) and now it works
$ ./darknet detector test ./cfg/coco.data ./cfg/yolov3-tiny.cfg ./cfg/yolov3-tiny.weights ./data/dog.jpg
...
Loading weights from cfg/yolov3-tiny.weights...Done!
data/dog.jpg: Predicted in 0.192830 seconds.
dog: 56%
car: 52%
truck: 56%
car: 62%
bicycle: 58%

It seems that the error comes from the network configurations in cfg/yolov3.cfg

Comparing the yolov3.cfg and the yolov3-tiny.cfg i managed to find parameter to have the network run correctly with the larger weight-set

I edited the first lines of yolov3.cfg as follows

[net]
# Testing
batch=1
subdivisions=1
# Training
#batch=64
#subdivisions=16
#width=608
#height=608
width=416
height=416
channels=3
[...]

And now it works!
$ ./darknet detector test cfg/coco.data cfg/yolov3.cfg cfg/yolov3.weights data/dog.jpg
[...]
Loading weights from cfg/yolov3.weights...Done!
data/dog.jpg: Predicted in 0.327576 seconds.
dog: 99%
truck: 93%
bicycle: 99%
(base) mgua@mgtp53s:~/darknet/darknet$ 



2.install mplayer to have the libraries required to access the camera feed
#apt update
#apt install mplayer


3.run
$./darknet detector demo ./cfg/voc.data ./cfg/yolov3-voc.cfg ./cfg/yolov3-voc.weights
or, for light model
$./darknet detector demo ./cfg/coco.data ./cfg/yolov3-tiny.cfg ./cfg/yolov3-tiny.weights

On my laptop computer, with GPU Nvidia Quadro P520, OpenCV and CUDA I get about 6 FPS (frames per second) with the full weights set and 16 FPS with the tiny model.

The following syntax should allow to use YOLO getting input from a network camera:

$./darknet detector demo ./cfg/voc.data ./cfg/yolo-voc.cfg ./cfg/yolo-voc.weights rtsp://login:pass@192.168.0.228:554 -i 0




Deep learning in Ubuntu: installing darknet

This document describes how I added the darknet components to my Ubuntu deep learning machines.

Darknet is an open source environment for neural networks, written in C, by Joseph Redmon, aka pjreddie.
Darknet is very fast.

See https://pjreddie.com/darknet/

This document describes the installation of darknet on top of an ubuntu 18.04 linux machine,
equipped with a NVIDIA GPU board, where CUDA and OPENCV have been installed
(see these: NVIDIA and CUDA Setup and OPENCV setup).
The installation process is relying on Darknet setup instructions, but for my environment required some additional steps.

working in user mode, I create a darknet folder in my home

$cd
$mkdir darknet
$cd darknet
$git clone https://github.com/pjreddie/darknet.git
$cd darknet

Edit the Makefile, adjusting options GPU=1 and OPENCV=1

then running make

$make

it chokes giving many errors like

Package opencv was not found in the pkg-config search path.
Perhaps you should add the directory containing `opencv.pc'
to the PKG_CONFIG_PATH environment variable
No package 'opencv' found

---
Examining the Makefile, you can see that it uses the commands

pkg-config --libs opencv

and 

pkg-config --cflags opencv




1) install apt-file and update its library

#apt install apt-file
#apt-file update


2) look which package provides the file opecv.pc

#apt-file search opencv.pc
libopencv-dev: /usr/lib/x86_64-linux-gnu/pkgconfig/opencv.pc


3) install libopecv-dev

#apt install libopencv-dev


4) re-executing make, which now does not give any more errors...

$cd
$cd darknet/darknet
$make


5) and finally now you can see the eagles...

$./darknet imtest data/eagle.jpg


A potentially useful tool for showing pictures from command line is feh. It allows zoom and it is very handy.



Monday, July 22, 2019

Deep Learning in Ubuntu: opencv 4.1.0/4.1.1

A Deep Learning environment in Ubuntu 18.04 Bionic Beaver:
OpenCV 4.1.0/4.1.1

(updated sept 6, 2019)

After the previous article describing the setup of the operating system environment for Nvidia and CUDA libraries, here are the steps I performed to  download and set up the OpenCV environment to be accessible by a single user.

We assume the system has a user named "deep"

$whoami
deep
$sudo bash
#

Activities performed within root: prerequisites

#apt-get update

#apt-get install build-essential checkinstall cmake pkg-config yasm
#apt-get install git gfortran libjpeg8-dev libpng-dev libtiff-dev


  (apt-get install libjasper1) not available in std repositories


#apt-get install libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine2-dev libv4l-dev


#apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgtk2.0-dev libtbb-dev qt5-default libatlas-base-dev libfaac-dev libmp3lame-dev libtheora-dev libvorbis-dev 


#apt-get install libxvidcore-dev libopencore-amrnb-dev libopencore-amrwb-dev libavresample-dev x264 v4l-utils

(the following appears to be quite useful in resolving path related issues)
#apt install apt-file
...
#apt-file update

(you can use apt-file to search where specific files have been installed, for example: #apt-file search opencv.pc
libopencv-dev: /usr/lib/x86_64-linux-gnu/pkgconfig/opencv.pc
This means that the file opencv.pc is in the package libopencv-dev
)


switch back to user "deep"
Commands to download opencv 4.1.0/4.1.1 and related contrib
(adjust commands accordingly for v4.1.1: contrib files are the same)


$cd
$mkdir opencv
$cd opencv
$pwd
/home/deep/opencv


$unzip 4.1.0.zip


$ ls -la
-rw-r--r--  1 deep deep 91806599 lug 18 19:17 4.1.0.zip
drwxr-xr-x 11 deep deep     4096 apr  7 19:09 opencv-4.1.0
drwxr-xr-x  7 deep deep     4096 lug  1 11:18 opencv_contrib
(base) deep@TSP339:~/opencv$



Commands to prepare dirs and perform compilation


(if something goes wrong, clean the build folder, recreate it and restart cmake process)

the following cmake command was ok for my install of opencv-4.1.0


   
$cd opencv-4.1.0
$mkdir build
$cd build
$cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/home/deep/opencv/opencv-4.1.0/build/installation/OpenCV-4.1.0 -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D WITH_CUDA=ON -D WITH_TBB=ON -D WITH_V4L=ON
-D OPENCV_PYTHON3_INSTALL_PATH=/home/deep/opencv/opencv-4.1.0/OpenCV-4.1.0-py3/lib/python3.5/site-packages -D WITH_QT=ON -D WITH_OPENGL=ON -D OPENCV_EXTRA_MODULES_PATH=/home/deep/opencv/opencv_contrib/modules -D BUILD_EXAMPLES=ON ..

edit sept 6 2019: (here the cmake command is shown with better formatting)
$cmake -D CMAKE_BUILD_TYPE=RELEASE \
            -D CMAKE_INSTALL_PREFIX=/home/deep/opencv/opencv-4.1.0/build/installation/OpenCV-4.1.0 \
            -D INSTALL_C_EXAMPLES=ON \
            -D INSTALL_PYTHON_EXAMPLES=ON \
            -D WITH_CUDA=ON \
            -D WITH_TBB=ON \
            -D WITH_V4L=ON \
            -D OPENCV_PYTHON3_INSTALL_PATH=/home/deep/opencv/opencv-4.1.0/OpenCV-4.1.0-py3/lib/python3.5/site-packages \
        -D WITH_QT=ON \
        -D WITH_OPENGL=ON \
        -D OPENCV_EXTRA_MODULES_PATH=/home/deep/opencv/opencv_contrib/modules \
        -D BUILD_EXAMPLES=ON ..


the following cmake command went fine for me with opencv-4.1.1: I performed this setup having anaconda environment operational. several adjustments were needed to have it run smooth. Also I used dynamic python code to correctly define the paths. 
cmake and make are run from unprivileged user. make install requires root privileges.

Here the destination path for the opencv libraries is in /usr/local This seems to be the best choice.


$conda create -n opencv python=3.7 anaconda
$conda activate opencv
(conda deactivate to get out of the environment)

# C & python only, with cuda, no examples, no tests
cmake \
        -D CMAKE_BUILD_TYPE=RELEASE \
        -D CMAKE_INSTALL_PREFIX=/usr/local \
        -D INSTALL_C_EXAMPLES=OFF \
        -D INSTALL_PYTHON_EXAMPLES=OFF \
        -D BUILD_TIFF=ON \
        -D BUILD_opencv_java=OFF \
        -D BUILD_TESTS=OFF \
        -D BUILD_PERF_TESTS=OFF \
        -D WITH_CUDA=ON \
        -D WITH_TBB=ON \
        -D WITH_IPP=ON \
        -D WITH_EIGEN=ON \
        -D WITH_V4L=ON \
        -D WITH_QT=ON \
        -D WITH_OPENGL=ON \
        -D BUILD_opencv_python2=OFF \
        -D PYTHON3_EXECUTABLE=$(which python3) \
        -D PYTHON3_INCLUDE_DIR=$(python3 -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") \
        -D PYTHON3_PACKAGES_PATH=$(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") \
        -D OPENCV_EXTRA_MODULES_PATH=~/opencv/opencv_contrib/modules \
        -D CUDA_NVCC_FLAGS="-ccbin gcc-6" \
        ..




The opencv-4.1.0 cmake (not related to the just described cmake) outcome follows:

(base) deep@TSP339:~/opencv/opencv-4.1.0/build$ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/home/deep/opencv/opencv-4.1.0/build/installation/OpenCV-4.1.0 -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D WITH_CUDA=ON -D WITH_TBB=ON -D WITH_V4L=ON -D OPENCV_PYTHON3_INSTALL_PATH=/home/deep/opencv/opencv-4.1.0/OpenCV-4.1.0-py3/lib/python3.5/site-packages -D WITH_QT=ON -D WITH_OPENGL=ON -D OPENCV_EXTRA_MODULES_PATH=/home/deep/opencv/opencv_contrib/modules -D BUILD_EXAMPLES=ON ..
-- The CXX compiler identification is GNU 7.4.0
-- The C compiler identification is GNU 7.4.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Found PythonInterp: /usr/bin/python2.7 (found suitable version "2.7.15", minimum required is "2.7")
-- Could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS) (Required is exact version "2.7.15")
Traceback (most recent call last):
  File "", line 1, in
ImportError: No module named numpy.distutils
-- Found PythonInterp: /home/deep/anaconda3/bin/python3 (found suitable version "3.7.3", minimum required is "3.2")
-- Could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS) (Required is exact version "3.7.3")
-- Looking for ccache - not found
-- Performing Test HAVE_CXX_FSIGNED_CHAR
-- Performing Test HAVE_CXX_FSIGNED_CHAR - Success
-- Performing Test HAVE_C_FSIGNED_CHAR
-- Performing Test HAVE_C_FSIGNED_CHAR - Success
-- Performing Test HAVE_CXX_W
-- Performing Test HAVE_CXX_W - Success
-- Performing Test HAVE_C_W
-- Performing Test HAVE_C_W - Success
-- Performing Test HAVE_CXX_WALL
-- Performing Test HAVE_CXX_WALL - Success
-- Performing Test HAVE_C_WALL
-- Performing Test HAVE_C_WALL - Success
-- Performing Test HAVE_CXX_WERROR_RETURN_TYPE
-- Performing Test HAVE_CXX_WERROR_RETURN_TYPE - Success
-- Performing Test HAVE_C_WERROR_RETURN_TYPE
-- Performing Test HAVE_C_WERROR_RETURN_TYPE - Success
-- Performing Test HAVE_CXX_WERROR_NON_VIRTUAL_DTOR
-- Performing Test HAVE_CXX_WERROR_NON_VIRTUAL_DTOR - Success
-- Performing Test HAVE_C_WERROR_NON_VIRTUAL_DTOR
-- Performing Test HAVE_C_WERROR_NON_VIRTUAL_DTOR - Success
-- Performing Test HAVE_CXX_WERROR_ADDRESS
-- Performing Test HAVE_CXX_WERROR_ADDRESS - Success
-- Performing Test HAVE_C_WERROR_ADDRESS
-- Performing Test HAVE_C_WERROR_ADDRESS - Success
-- Performing Test HAVE_CXX_WERROR_SEQUENCE_POINT
-- Performing Test HAVE_CXX_WERROR_SEQUENCE_POINT - Success
-- Performing Test HAVE_C_WERROR_SEQUENCE_POINT
-- Performing Test HAVE_C_WERROR_SEQUENCE_POINT - Success
-- Performing Test HAVE_CXX_WFORMAT
-- Performing Test HAVE_CXX_WFORMAT - Success
-- Performing Test HAVE_C_WFORMAT
-- Performing Test HAVE_C_WFORMAT - Success
-- Performing Test HAVE_CXX_WERROR_FORMAT_SECURITY
-- Performing Test HAVE_CXX_WERROR_FORMAT_SECURITY - Success
-- Performing Test HAVE_C_WERROR_FORMAT_SECURITY
-- Performing Test HAVE_C_WERROR_FORMAT_SECURITY - Success
-- Performing Test HAVE_CXX_WMISSING_DECLARATIONS
-- Performing Test HAVE_CXX_WMISSING_DECLARATIONS - Success
-- Performing Test HAVE_C_WMISSING_DECLARATIONS
-- Performing Test HAVE_C_WMISSING_DECLARATIONS - Success
-- Performing Test HAVE_CXX_WMISSING_PROTOTYPES
-- Performing Test HAVE_CXX_WMISSING_PROTOTYPES - Failed
-- Performing Test HAVE_C_WMISSING_PROTOTYPES
-- Performing Test HAVE_C_WMISSING_PROTOTYPES - Success
-- Performing Test HAVE_CXX_WSTRICT_PROTOTYPES
-- Performing Test HAVE_CXX_WSTRICT_PROTOTYPES - Failed
-- Performing Test HAVE_C_WSTRICT_PROTOTYPES
-- Performing Test HAVE_C_WSTRICT_PROTOTYPES - Success
-- Performing Test HAVE_CXX_WUNDEF
-- Performing Test HAVE_CXX_WUNDEF - Success
-- Performing Test HAVE_C_WUNDEF
-- Performing Test HAVE_C_WUNDEF - Success
-- Performing Test HAVE_CXX_WINIT_SELF
-- Performing Test HAVE_CXX_WINIT_SELF - Success
-- Performing Test HAVE_C_WINIT_SELF
-- Performing Test HAVE_C_WINIT_SELF - Success
-- Performing Test HAVE_CXX_WPOINTER_ARITH
-- Performing Test HAVE_CXX_WPOINTER_ARITH - Success
-- Performing Test HAVE_C_WPOINTER_ARITH
-- Performing Test HAVE_C_WPOINTER_ARITH - Success
-- Performing Test HAVE_CXX_WSHADOW
-- Performing Test HAVE_CXX_WSHADOW - Success
-- Performing Test HAVE_C_WSHADOW
-- Performing Test HAVE_C_WSHADOW - Success
-- Performing Test HAVE_CXX_WSIGN_PROMO
-- Performing Test HAVE_CXX_WSIGN_PROMO - Success
-- Performing Test HAVE_C_WSIGN_PROMO
-- Performing Test HAVE_C_WSIGN_PROMO - Failed
-- Performing Test HAVE_CXX_WUNINITIALIZED
-- Performing Test HAVE_CXX_WUNINITIALIZED - Success
-- Performing Test HAVE_C_WUNINITIALIZED
-- Performing Test HAVE_C_WUNINITIALIZED - Success
-- Performing Test HAVE_CXX_WNO_DELETE_NON_VIRTUAL_DTOR
-- Performing Test HAVE_CXX_WNO_DELETE_NON_VIRTUAL_DTOR - Success
-- Performing Test HAVE_C_WNO_DELETE_NON_VIRTUAL_DTOR
-- Performing Test HAVE_C_WNO_DELETE_NON_VIRTUAL_DTOR - Failed
-- Performing Test HAVE_CXX_WNO_UNNAMED_TYPE_TEMPLATE_ARGS
-- Performing Test HAVE_CXX_WNO_UNNAMED_TYPE_TEMPLATE_ARGS - Failed
-- Performing Test HAVE_C_WNO_UNNAMED_TYPE_TEMPLATE_ARGS
-- Performing Test HAVE_C_WNO_UNNAMED_TYPE_TEMPLATE_ARGS - Failed
-- Performing Test HAVE_CXX_WNO_COMMENT
-- Performing Test HAVE_CXX_WNO_COMMENT - Success
-- Performing Test HAVE_C_WNO_COMMENT
-- Performing Test HAVE_C_WNO_COMMENT - Success
-- Performing Test HAVE_CXX_WIMPLICIT_FALLTHROUGH_3
-- Performing Test HAVE_CXX_WIMPLICIT_FALLTHROUGH_3 - Success
-- Performing Test HAVE_C_WIMPLICIT_FALLTHROUGH_3
-- Performing Test HAVE_C_WIMPLICIT_FALLTHROUGH_3 - Success
-- Performing Test HAVE_CXX_WNO_STRICT_OVERFLOW
-- Performing Test HAVE_CXX_WNO_STRICT_OVERFLOW - Success
-- Performing Test HAVE_C_WNO_STRICT_OVERFLOW
-- Performing Test HAVE_C_WNO_STRICT_OVERFLOW - Success
-- Performing Test HAVE_CXX_FDIAGNOSTICS_SHOW_OPTION
-- Performing Test HAVE_CXX_FDIAGNOSTICS_SHOW_OPTION - Success
-- Performing Test HAVE_C_FDIAGNOSTICS_SHOW_OPTION
-- Performing Test HAVE_C_FDIAGNOSTICS_SHOW_OPTION - Success
-- Performing Test HAVE_CXX_WNO_LONG_LONG
-- Performing Test HAVE_CXX_WNO_LONG_LONG - Success
-- Performing Test HAVE_C_WNO_LONG_LONG
-- Performing Test HAVE_C_WNO_LONG_LONG - Success
-- Performing Test HAVE_CXX_PTHREAD
-- Performing Test HAVE_CXX_PTHREAD - Success
-- Performing Test HAVE_C_PTHREAD
-- Performing Test HAVE_C_PTHREAD - Success
-- Performing Test HAVE_CXX_FOMIT_FRAME_POINTER
-- Performing Test HAVE_CXX_FOMIT_FRAME_POINTER - Success
-- Performing Test HAVE_C_FOMIT_FRAME_POINTER
-- Performing Test HAVE_C_FOMIT_FRAME_POINTER - Success
-- Performing Test HAVE_CXX_FFUNCTION_SECTIONS
-- Performing Test HAVE_CXX_FFUNCTION_SECTIONS - Success
-- Performing Test HAVE_C_FFUNCTION_SECTIONS
-- Performing Test HAVE_C_FFUNCTION_SECTIONS - Success
-- Performing Test HAVE_CXX_FDATA_SECTIONS
-- Performing Test HAVE_CXX_FDATA_SECTIONS - Success
-- Performing Test HAVE_C_FDATA_SECTIONS
-- Performing Test HAVE_C_FDATA_SECTIONS - Success
-- Performing Test HAVE_CXX_MSSE (check file: cmake/checks/cpu_sse.cpp)
-- Performing Test HAVE_CXX_MSSE - Success
-- Performing Test HAVE_CXX_MSSE2 (check file: cmake/checks/cpu_sse2.cpp)
-- Performing Test HAVE_CXX_MSSE2 - Success
-- Performing Test HAVE_CXX_MSSE3 (check file: cmake/checks/cpu_sse3.cpp)
-- Performing Test HAVE_CXX_MSSE3 - Success
-- Performing Test HAVE_CXX_MSSSE3 (check file: cmake/checks/cpu_ssse3.cpp)
-- Performing Test HAVE_CXX_MSSSE3 - Success
-- Performing Test HAVE_CXX_MSSE4_1 (check file: cmake/checks/cpu_sse41.cpp)
-- Performing Test HAVE_CXX_MSSE4_1 - Success
-- Performing Test HAVE_CXX_MPOPCNT (check file: cmake/checks/cpu_popcnt.cpp)
-- Performing Test HAVE_CXX_MPOPCNT - Success
-- Performing Test HAVE_CXX_MSSE4_2 (check file: cmake/checks/cpu_sse42.cpp)
-- Performing Test HAVE_CXX_MSSE4_2 - Success
-- Performing Test HAVE_CXX_MF16C (check file: cmake/checks/cpu_fp16.cpp)
-- Performing Test HAVE_CXX_MF16C - Success
-- Performing Test HAVE_CXX_MFMA
-- Performing Test HAVE_CXX_MFMA - Success
-- Performing Test HAVE_CXX_MAVX (check file: cmake/checks/cpu_avx.cpp)
-- Performing Test HAVE_CXX_MAVX - Success
-- Performing Test HAVE_CXX_MAVX2 (check file: cmake/checks/cpu_avx2.cpp)
-- Performing Test HAVE_CXX_MAVX2 - Success
-- Performing Test HAVE_CXX_MAVX512F (check file: cmake/checks/cpu_avx512.cpp)
-- Performing Test HAVE_CXX_MAVX512F - Success
-- Performing Test HAVE_CXX_MAVX512F_MAVX512CD_MAVX512VL_MAVX512BW_MAVX512DQ (check file: cmake/checks/cpu_avx512skx.cpp)
-- Performing Test HAVE_CXX_MAVX512F_MAVX512CD_MAVX512VL_MAVX512BW_MAVX512DQ - Success
-- Performing Test HAVE_CPU_BASELINE_FLAGS
-- Performing Test HAVE_CPU_BASELINE_FLAGS - Success
-- Performing Test HAVE_CPU_DISPATCH_FLAGS_SSE4_1
-- Performing Test HAVE_CPU_DISPATCH_FLAGS_SSE4_1 - Success
-- Performing Test HAVE_CPU_DISPATCH_FLAGS_SSE4_2
-- Performing Test HAVE_CPU_DISPATCH_FLAGS_SSE4_2 - Success
-- Performing Test HAVE_CPU_DISPATCH_FLAGS_FP16
-- Performing Test HAVE_CPU_DISPATCH_FLAGS_FP16 - Success
-- Performing Test HAVE_CPU_DISPATCH_FLAGS_AVX
-- Performing Test HAVE_CPU_DISPATCH_FLAGS_AVX - Success
-- Performing Test HAVE_CPU_DISPATCH_FLAGS_AVX2
-- Performing Test HAVE_CPU_DISPATCH_FLAGS_AVX2 - Success
-- Performing Test HAVE_CPU_DISPATCH_FLAGS_AVX512_SKX
-- Performing Test HAVE_CPU_DISPATCH_FLAGS_AVX512_SKX - Success
-- Performing Test HAVE_CXX_FVISIBILITY_HIDDEN
-- Performing Test HAVE_CXX_FVISIBILITY_HIDDEN - Success
-- Performing Test HAVE_C_FVISIBILITY_HIDDEN
-- Performing Test HAVE_C_FVISIBILITY_HIDDEN - Success
-- Performing Test HAVE_CXX_FVISIBILITY_INLINES_HIDDEN
-- Performing Test HAVE_CXX_FVISIBILITY_INLINES_HIDDEN - Success
-- Performing Test HAVE_C_FVISIBILITY_INLINES_HIDDEN
-- Performing Test HAVE_C_FVISIBILITY_INLINES_HIDDEN - Failed
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for posix_memalign
-- Looking for posix_memalign - found
-- Looking for malloc.h
-- Looking for malloc.h - found
-- Looking for memalign
-- Looking for memalign - found
-- Check if the system is big endian
-- Searching 16 bit integer
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Using unsigned short
-- Check if the system is big endian - little endian
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found suitable version "1.2.11", minimum required is "1.2.3")
-- Found JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so 
-- Found TIFF: /usr/lib/x86_64-linux-gnu/libtiff.so (found version "4.0.9")
-- Performing Test HAVE_C_WNO_UNUSED_VARIABLE
-- Performing Test HAVE_C_WNO_UNUSED_VARIABLE - Success
-- Performing Test HAVE_C_WNO_UNUSED_FUNCTION
-- Performing Test HAVE_C_WNO_UNUSED_FUNCTION - Success
-- Performing Test HAVE_C_WNO_SHADOW
-- Performing Test HAVE_C_WNO_SHADOW - Success
-- Performing Test HAVE_C_WNO_MAYBE_UNINITIALIZED
-- Performing Test HAVE_C_WNO_MAYBE_UNINITIALIZED - Success
-- Performing Test HAVE_C_WNO_MISSING_PROTOTYPES
-- Performing Test HAVE_C_WNO_MISSING_PROTOTYPES - Success
-- Performing Test HAVE_C_WNO_MISSING_DECLARATIONS
-- Performing Test HAVE_C_WNO_MISSING_DECLARATIONS - Success
-- Performing Test HAVE_C_WNO_IMPLICIT_FALLTHROUGH
-- Performing Test HAVE_C_WNO_IMPLICIT_FALLTHROUGH - Success
-- Could NOT find Jasper (missing: JASPER_LIBRARIES JASPER_INCLUDE_DIR)
-- Performing Test HAVE_C_WNO_IMPLICIT_FUNCTION_DECLARATION
-- Performing Test HAVE_C_WNO_IMPLICIT_FUNCTION_DECLARATION - Success
-- Performing Test HAVE_C_WNO_UNINITIALIZED
-- Performing Test HAVE_C_WNO_UNINITIALIZED - Success
-- Performing Test HAVE_C_WNO_UNUSED_BUT_SET_PARAMETER
-- Performing Test HAVE_C_WNO_UNUSED_BUT_SET_PARAMETER - Success
-- Performing Test HAVE_C_WNO_UNUSED
-- Performing Test HAVE_C_WNO_UNUSED - Success
-- Performing Test HAVE_C_WNO_SIGN_COMPARE
-- Performing Test HAVE_C_WNO_SIGN_COMPARE - Success
-- Performing Test HAVE_C_WNO_POINTER_COMPARE
-- Performing Test HAVE_C_WNO_POINTER_COMPARE - Success
-- Performing Test HAVE_C_WNO_ABSOLUTE_VALUE
-- Performing Test HAVE_C_WNO_ABSOLUTE_VALUE - Failed
-- Performing Test HAVE_C_WNO_UNUSED_PARAMETER
-- Performing Test HAVE_C_WNO_UNUSED_PARAMETER - Success
-- Performing Test HAVE_C_WNO_STRICT_PROTOTYPES
-- Performing Test HAVE_C_WNO_STRICT_PROTOTYPES - Success
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11")
-- Found PNG: /usr/lib/x86_64-linux-gnu/libpng.so (found version "1.6.34")
-- Looking for /usr/include/libpng/png.h
-- Looking for /usr/include/libpng/png.h - found
-- Looking for semaphore.h
-- Looking for semaphore.h - found
-- Performing Test HAVE_CXX_WNO_SHADOW
-- Performing Test HAVE_CXX_WNO_SHADOW - Success
-- Performing Test HAVE_CXX_WNO_UNUSED
-- Performing Test HAVE_CXX_WNO_UNUSED - Success
-- Performing Test HAVE_CXX_WNO_SIGN_COMPARE
-- Performing Test HAVE_CXX_WNO_SIGN_COMPARE - Success
-- Performing Test HAVE_CXX_WNO_UNDEF
-- Performing Test HAVE_CXX_WNO_UNDEF - Success
-- Performing Test HAVE_CXX_WNO_MISSING_DECLARATIONS
-- Performing Test HAVE_CXX_WNO_MISSING_DECLARATIONS - Success
-- Performing Test HAVE_CXX_WNO_UNINITIALIZED
-- Performing Test HAVE_CXX_WNO_UNINITIALIZED - Success
-- Performing Test HAVE_CXX_WNO_SWITCH
-- Performing Test HAVE_CXX_WNO_SWITCH - Success
-- Performing Test HAVE_CXX_WNO_PARENTHESES
-- Performing Test HAVE_CXX_WNO_PARENTHESES - Success
-- Performing Test HAVE_CXX_WNO_ARRAY_BOUNDS
-- Performing Test HAVE_CXX_WNO_ARRAY_BOUNDS - Success
-- Performing Test HAVE_CXX_WNO_EXTRA
-- Performing Test HAVE_CXX_WNO_EXTRA - Success
-- Performing Test HAVE_CXX_WNO_DEPRECATED_DECLARATIONS
-- Performing Test HAVE_CXX_WNO_DEPRECATED_DECLARATIONS - Success
-- Performing Test HAVE_CXX_WNO_MISLEADING_INDENTATION
-- Performing Test HAVE_CXX_WNO_MISLEADING_INDENTATION - Success
-- Performing Test HAVE_CXX_WNO_DEPRECATED
-- Performing Test HAVE_CXX_WNO_DEPRECATED - Success
-- Performing Test HAVE_CXX_WNO_SUGGEST_OVERRIDE
-- Performing Test HAVE_CXX_WNO_SUGGEST_OVERRIDE - Success
-- Performing Test HAVE_CXX_WNO_INCONSISTENT_MISSING_OVERRIDE
-- Performing Test HAVE_CXX_WNO_INCONSISTENT_MISSING_OVERRIDE - Failed
-- Performing Test HAVE_CXX_WNO_IMPLICIT_FALLTHROUGH
-- Performing Test HAVE_CXX_WNO_IMPLICIT_FALLTHROUGH - Success
-- Found TBB (env): /usr/lib/x86_64-linux-gnu/libtbb.so
-- IPPICV: Download: ippicv_2019_lnx_intel64_general_20180723.tgz
-- found Intel IPP (ICV version): 2019.0.0 [2019.0.0 Gold]
-- at: /home/deep/opencv/opencv-4.1.0/build/3rdparty/ippicv/ippicv_lnx/icv
-- found Intel IPP Integration Wrappers sources: 2019.0.0
-- at: /home/deep/opencv/opencv-4.1.0/build/3rdparty/ippicv/ippicv_lnx/iw
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE 
-- CUDA detected: 10.1
-- CUDA NVCC target flags: -gencode;arch=compute_30,code=sm_30;-gencode;arch=compute_35,code=sm_35;-gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_52,code=sm_52;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-D_FORCE_INLINES
-- Could not find OpenBLAS include. Turning OpenBLAS_FOUND off
-- Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off
-- Could NOT find Atlas (missing: Atlas_CLAPACK_INCLUDE_DIR)
-- Looking for dgemm_
-- Looking for dgemm_ - found
-- A library with BLAS API found.
-- Looking for cheev_
-- Looking for cheev_ - found
-- A library with LAPACK API found.
-- Performing Test HAVE_CXX_WNO_MISSING_PROTOTYPES
-- Performing Test HAVE_CXX_WNO_MISSING_PROTOTYPES - Failed
-- Performing Test HAVE_CXX_WNO_UNUSED_PARAMETER
-- Performing Test HAVE_CXX_WNO_UNUSED_PARAMETER - Success
-- Performing Test HAVE_CXX_WNO_UNUSED_LOCAL_TYPEDEFS
-- Performing Test HAVE_CXX_WNO_UNUSED_LOCAL_TYPEDEFS - Success
-- Performing Test HAVE_CXX_WNO_SIGN_PROMO
-- Performing Test HAVE_CXX_WNO_SIGN_PROMO - Success
-- Performing Test HAVE_CXX_WNO_TAUTOLOGICAL_UNDEFINED_COMPARE
-- Performing Test HAVE_CXX_WNO_TAUTOLOGICAL_UNDEFINED_COMPARE - Failed
-- Performing Test HAVE_CXX_WNO_IGNORED_QUALIFIERS
-- Performing Test HAVE_CXX_WNO_IGNORED_QUALIFIERS - Success
-- Performing Test HAVE_CXX_WNO_UNUSED_FUNCTION
-- Performing Test HAVE_CXX_WNO_UNUSED_FUNCTION - Success
-- Performing Test HAVE_CXX_WNO_UNUSED_CONST_VARIABLE
-- Performing Test HAVE_CXX_WNO_UNUSED_CONST_VARIABLE - Success
-- Performing Test HAVE_CXX_WNO_SHORTEN_64_TO_32
-- Performing Test HAVE_CXX_WNO_SHORTEN_64_TO_32 - Failed
-- Performing Test HAVE_CXX_WNO_INVALID_OFFSETOF
-- Performing Test HAVE_CXX_WNO_INVALID_OFFSETOF - Success
-- Performing Test HAVE_CXX_WNO_ENUM_COMPARE_SWITCH
-- Performing Test HAVE_CXX_WNO_ENUM_COMPARE_SWITCH - Failed
-- Could NOT find JNI (missing: JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)
-- Found Pylint: /home/deep/anaconda3/bin/pylint 
-- Could NOT find Flake8 (missing: FLAKE8_EXECUTABLE)
-- VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
-- Looking for dlerror in dl
-- Looking for dlerror in dl - found
-- Performing Test HAVE_C_WNO_UNDEF
-- Performing Test HAVE_C_WNO_UNDEF - Success
-- ADE: Download: v0.1.1d.zip
-- OpenCV Python: during development append to PYTHONPATH: /home/deep/opencv/opencv-4.1.0/build/python_loader
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1")
-- Caffe:   NO
-- Protobuf:   NO
-- Glog:   NO
-- Performing Test HAVE_CXX_WNO_UNUSED_VARIABLE
-- Performing Test HAVE_CXX_WNO_UNUSED_VARIABLE - Success
-- Performing Test HAVE_CXX_WNO_ENUM_COMPARE
-- Performing Test HAVE_CXX_WNO_ENUM_COMPARE - Success
-- Checking for module 'freetype2'
--   Found freetype2, version 21.0.15
-- Checking for module 'harfbuzz'
--   Found harfbuzz, version 1.7.2
-- freetype2:   YES (ver 21.0.15)
-- harfbuzz:    YES (ver 1.7.2)
-- HDF5: Using hdf5 compiler wrapper to determine C configuration
-- Found HDF5: /home/deep/anaconda3/lib/libhdf5.so;/usr/lib/x86_64-linux-gnu/librt.so;/usr/lib/x86_64-linux-gnu/libpthread.so;/home/deep/anaconda3/lib/libz.so;/usr/lib/x86_64-linux-gnu/libdl.so;/usr/lib/x86_64-linux-gnu/libm.so (found version "1.10.4") 
-- Module opencv_ovis disabled because OGRE3D was not found
-- No preference for use of exported gflags CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported gflags CMake configuration if available.
-- Failed to find installed gflags CMake configuration, searching for gflags build directories exported with CMake.
-- Failed to find gflags - Failed to find an installed/exported CMake configuration for gflags, will perform search for installed gflags components.
-- Failed to find gflags - Could not find gflags include directory, set GFLAGS_INCLUDE_DIR to directory containing gflags/gflags.h
-- Failed to find glog - Could not find glog include directory, set GLOG_INCLUDE_DIR to directory containing glog/logging.h
-- Module opencv_sfm disabled because the following dependencies are not found: Eigen Glog/Gflags
-- Performing Test HAVE_CXX_WNO_UNUSED_BUT_SET_VARIABLE
-- Performing Test HAVE_CXX_WNO_UNUSED_BUT_SET_VARIABLE - Success
-- HDF5: Using hdf5 compiler wrapper to determine C configuration
-- Performing Test HAVE_CXX_WNO_OVERLOADED_VIRTUAL
-- Performing Test HAVE_CXX_WNO_OVERLOADED_VIRTUAL - Success
-- Checking for module 'tesseract'
--   No package 'tesseract' found
-- Tesseract:   NO
-- xfeatures2d/boostdesc: Download: boostdesc_bgm.i
-- xfeatures2d/boostdesc: Download: boostdesc_bgm_bi.i
-- xfeatures2d/boostdesc: Download: boostdesc_bgm_hd.i
-- xfeatures2d/boostdesc: Download: boostdesc_binboost_064.i
-- xfeatures2d/boostdesc: Download: boostdesc_binboost_128.i
-- xfeatures2d/boostdesc: Download: boostdesc_binboost_256.i
-- xfeatures2d/boostdesc: Download: boostdesc_lbgm.i
-- xfeatures2d/vgg: Download: vgg_generated_48.i
-- xfeatures2d/vgg: Download: vgg_generated_64.i
-- xfeatures2d/vgg: Download: vgg_generated_80.i
-- xfeatures2d/vgg: Download: vgg_generated_120.i
-- data: Download: face_landmark_model.dat
-- OpenCL samples are skipped: OpenCL SDK is required
-- Pylint: registered 169 targets. Build 'check_pylint' target to run checks ("cmake --build . --target check_pylint" or "make check_pylint")
--
-- General configuration for OpenCV 4.1.0 =====================================
--   Version control:               unknown
--
--   Extra modules:
--     Location (extra):            /home/deep/opencv/opencv_contrib/modules
--     Version control (extra):     4.1.0-67-g297e8be9
--
--   Platform:
--     Timestamp:                   2019-07-22T10:23:57Z
--     Host:                        Linux 4.18.0-25-generic x86_64
--     CMake:                       3.10.2
--     CMake generator:             Unix Makefiles
--     CMake build tool:            /usr/bin/make
--     Configuration:               RELEASE
--
--   CPU/HW features:
--     Baseline:                    SSE SSE2 SSE3
--       requested:                 SSE3
--     Dispatched code generation:  SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX
--       requested:                 SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
--       SSE4_1 (15 files):         + SSSE3 SSE4_1
--       SSE4_2 (2 files):          + SSSE3 SSE4_1 POPCNT SSE4_2
--       FP16 (1 files):            + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
--       AVX (5 files):             + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
--       AVX2 (29 files):           + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
--       AVX512_SKX (2 files):      + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_SKX
--
--   C/C++:
--     Built as dynamic libs?:      YES
--     C++ Compiler:                /usr/bin/c++  (ver 7.4.0)
--     C++ flags (Release):         -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG
--     C++ flags (Debug):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG
--     C Compiler:                  /usr/bin/cc
--     C flags (Release):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG  -DNDEBUG
--     C flags (Debug):             -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -g  -O0 -DDEBUG -D_DEBUG
--     Linker flags (Release):      -Wl,--gc-sections 
--     Linker flags (Debug):        -Wl,--gc-sections 
--     ccache:                      NO
--     Precompiled headers:         YES
--     Extra dependencies:          m pthread /usr/lib/x86_64-linux-gnu/libGL.so /usr/lib/x86_64-linux-gnu/libGLU.so cudart_static -lpthread dl rt nppc nppial nppicc nppicom nppidei nppif nppig nppim nppist nppisu nppitc npps cublas cufft -L/usr/local/cuda-10.1/lib64 -L/usr/lib/x86_64-linux-gnu
--     3rdparty dependencies:
--
--   OpenCV modules:
--     To be built:                 aruco bgsegm bioinspired calib3d ccalib core cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv datasets dnn dnn_objdetect dpm face features2d flann freetype fuzzy gapi hdf hfs highgui img_hash imgcodecs imgproc line_descriptor ml objdetect optflow phase_unwrapping photo plot quality reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab xfeatures2d ximgproc xobjdetect xphoto
--     Disabled:                    world
--     Disabled by dependency:      -
--     Unavailable:                 cnn_3dobj java js matlab ovis python2 python3 sfm viz
--     Applications:                tests perf_tests examples apps
--     Documentation:               NO
--     Non-free algorithms:         NO
--
--   GUI:
--     QT:                          YES (ver 5.9.7)
--       QT OpenGL support:         YES (Qt5::OpenGL 5.9.7)
--     GTK+:                        NO
--     OpenGL support:              YES (/usr/lib/x86_64-linux-gnu/libGL.so /usr/lib/x86_64-linux-gnu/libGLU.so)
--     VTK support:                 NO
--
--   Media I/O:
--     ZLib:                        /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.11)
--     JPEG:                        /usr/lib/x86_64-linux-gnu/libjpeg.so (ver 80)
--     WEBP:                        build (ver encoder: 0x020e)
--     PNG:                         /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.6.34)
--     TIFF:                        /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 / 4.0.9)
--     JPEG 2000:                   build (ver 1.900.1)
--     OpenEXR:                     build (ver 1.7.1)
--     HDR:                         YES
--     SUNRASTER:                   YES
--     PXM:                         YES
--     PFM:                         YES
--
--   Video I/O:
--     DC1394:                      YES (2.2.5)
--     FFMPEG:                      YES
--       avcodec:                   YES (57.107.100)
--       avformat:                  YES (57.83.100)
--       avutil:                    YES (55.78.100)
--       swscale:                   YES (4.8.100)
--       avresample:                YES (3.7.0)
--     GStreamer:                   YES (1.14.4)
--     v4l/v4l2:                    YES (linux/videodev2.h)
--
--   Parallel framework:            TBB (ver 2017.0 interface 9107)
--
--   Trace:                         YES (with Intel ITT)
--
--   Other third-party libraries:
--     Intel IPP:                   2019.0.0 Gold [2019.0.0]
--            at:                   /home/deep/opencv/opencv-4.1.0/build/3rdparty/ippicv/ippicv_lnx/icv
--     Intel IPP IW:                sources (2019.0.0)
--               at:                /home/deep/opencv/opencv-4.1.0/build/3rdparty/ippicv/ippicv_lnx/iw
--     Lapack:                      NO
--     Eigen:                       NO
--     Custom HAL:                  NO
--     Protobuf:                    build (3.5.1)
--
--   NVIDIA CUDA:                   YES (ver 10.1, CUFFT CUBLAS NVCUVID)
--     NVIDIA GPU arch:             30 35 37 50 52 60 61 70 75
--     NVIDIA PTX archs:
--
--   OpenCL:                        YES (no extra features)
--     Include path:                /home/deep/opencv/opencv-4.1.0/3rdparty/include/opencl/1.2
--     Link libraries:              Dynamic load
--
--   Python (for build):            /usr/bin/python2.7
--     Pylint:                      /home/deep/anaconda3/bin/pylint (ver: 3.7.3, checks: 169)
--
--   Java:                         
--     ant:                         NO
--     JNI:                         NO
--     Java wrappers:               NO
--     Java tests:                  NO
--
--   Install to:                    /home/deep/opencv/opencv-4.1.0/build/installation/OpenCV-4.1.0
-- -----------------------------------------------------------------
--
-- Configuring done
-- Generating done
-- Build files have been written to: /home/deep/opencv/opencv-4.1.0/build
(base) deep@TSP339:~/opencv/opencv-4.1.0/build$



After compilation, we need to run make again to define the maximum number of threads. This is best when matching the actual numbers of cores on the CPU.
This can be determined running the command "nproc" from root.

On my Intel i7 6 cores with hyperthreading, executing nproc gives:
#nproc
12


The following command performs final activities, links the whole and prepares for installation in target directory (as specified in CMAKE_INSTALL_PREFIX=)


$make -j12

Now we are ready for installation. This step has to be performed from root.
When executing sudo bash from a specific conda environment, it goes back to (base). This means that the install command is run from outside the current conda environment. I am not sure this is ok.


#make install


[...]
Scanning dependencies of target opencv_test_cudev
[ 18%] Building CXX object modules/cudev/test/CMakeFiles/opencv_test_cudev.dir/test_main.cpp.o
[ 18%] Linking CXX executable ../../../bin/opencv_test_cudev
../../../lib/libopencv_imgcodecs.so.4.1.0: undefined reference to `TIFFReadRGBAStrip@LIBTIFF_4.0'
../../../lib/libopencv_imgcodecs.so.4.1.0: undefined reference to `TIFFReadDirectory@LIBTIFF_4.0'
../../../lib/libopencv_imgcodecs.so.4.1.0: undefined reference to `TIFFWriteEncodedStrip@LIBTIFF_4.0'
../../../lib/libopencv_imgcodecs.so.4.1.0: undefined reference to `TIFFIsTiled@LIBTIFF_4.0'
../../../lib/libopencv_imgcodecs.so.4.1.0: undefined reference to `TIFFWriteScanline@LIBTIFF_4.0'
../../../lib/libopencv_imgcodecs.so.4.1.0: undefined reference to `TIFFGetField@LIBTIFF_4.0'
../../../lib/libopencv_imgcodecs.so.4.1.0: undefined reference to `TIFFScanlineSize@LIBTIFF_4.0'
../../../lib/libopencv_imgcodecs.so.4.1.0: undefined reference to `TIFFWriteDirectory@LIBTIFF_4.0'
../../../lib/libopencv_imgcodecs.so.4.1.0: undefined reference to `TIFFReadEncodedTile@LIBTIFF_4.0'
../../../lib/libopencv_imgcodecs.so.4.1.0: undefined reference to `TIFFReadRGBATile@LIBTIFF_4.0'
../../../lib/libopencv_imgcodecs.so.4.1.0: undefined reference to `TIFFClose@LIBTIFF_4.0'
../../../lib/libopencv_imgcodecs.so.4.1.0: undefined reference to `TIFFClientOpen@LIBTIFF_4.0'
../../../lib/libopencv_imgcodecs.so.4.1.0: undefined reference to `TIFFRGBAImageOK@LIBTIFF_4.0'
../../../lib/libopencv_imgcodecs.so.4.1.0: undefined reference to `TIFFOpen@LIBTIFF_4.0'
../../../lib/libopencv_imgcodecs.so.4.1.0: undefined reference to `TIFFReadEncodedStrip@LIBTIFF_4.0'
../../../lib/libopencv_imgcodecs.so.4.1.0: undefined reference to `TIFFSetField@LIBTIFF_4.0'
../../../lib/libopencv_imgcodecs.so.4.1.0: undefined reference to `TIFFSetWarningHandler@LIBTIFF_4.0'
../../../lib/libopencv_imgcodecs.so.4.1.0: undefined reference to `TIFFSetErrorHandler@LIBTIFF_4.0'
collect2: error: ld returned 1 exit status
modules/cudev/test/CMakeFiles/opencv_test_cudev.dir/build.make:242: recipe for target 'bin/opencv_test_cudev' failed
make[2]: *** [bin/opencv_test_cudev] Error 1
CMakeFiles/Makefile2:2777: recipe for target 'modules/cudev/test/CMakeFiles/opencv_test_cudev.dir/all' failed
make[1]: *** [modules/cudev/test/CMakeFiles/opencv_test_cudev.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2
(base) deep@TSP339:~/opencv/opencv-4.1.0/build$