Astico2D: Another Simple Tool for Image Computing with OpenCV in 2D https://pageperso.lis-lab.fr/edouard.thiel/Astico2D/ CC BY-SA Edouard.Thiel@univ-amu.fr - 02/08/2024 - v1.1c Installation of OpenCV and Astico2D =================================== Contents : 0. Preamble 1. On Ubuntu 2. On Windows 2.1 On Windows 1x with WSL or WSL2 2.2 On Windows 1x with MinGW64 3. On MacOS 0. Preamble --------- Uncompress the archive astico2d.tgz. 1. On Ubuntu ---------- Open a terminal and type: sudo apt install g++ make libopencv-dev Then go to the Astico2D directory with the cd command, and type make -j all ./demo1 IMAGES/cat1.jpg If during compilation there are error messages relating to pkg-config (for example on Ubuntu <= 18.04), edit the Makefile, replace "OPENCV = opencv4" with "OPENCV = opencv", then restart the compilation. 2. On Windows ----------- 2.1 On Windows 1x with WSL or WSL2 ------------------------------ WSL (Windows Subsystem for Linux) enables a Linux virtual machine to be natively into Windows, with a choice of distributions. Advantages : - easy and fairly quick to install, and then you can install all your Linux software with the apt command. Disadvantage: - when WSL is installed, you may have trouble with VirtualBox. To install WSL or WSL2 on Windows, with an Ubuntu distribution, read: https://learn.microsoft.com/fr-fr/windows/wsl/install After that, if your Windows version is Windows 10, also install an X server for graphics display: https://sourceforge.net/projects/vcxsrv/ After installation, in the Windows menu, run VcXsrv / XLaunch then accept all the default values. Then, open a "Ubuntu Terminal". We start by updating the system; type (or copy-paste) in the terminal: sudo apt update sudo apt upgrade In the same terminal, install the OpenCV and the development packages: sudo apt install g++ make libopencv-dev Download the file astico2d.tgz using your web browser, save the file (for example in the Windows directory "Downloads"). Then move this file in your Linux working directory, by replacing YOUR_USER in the following command by the name of your Windows user in the Ubuntu terminal: cp /mnt/c/Users/YOUR_USER/Downloads/astico2d.tgz . Unpack the file, then move in the folder: tar xvfz astico2d.tgz cd Astico2D ls Compile the sources (-j means in parallel): make -j all then run the demos: ./demo1 IMAGES/cat1.jpg 2.2 On Windows 1x with MinGW64 --------------------------- MinGW is a set of GNU utilities for Windows (gcc, make, etc). Advantages : - you can develop with gcc for the Windows API, even for older Windows. Disadvantages: - OpenCV must be compiled (easy, but takes 1 to 2 hours depending on the machine); - OpenCV's trackbars (sliders) are a bit ugly and impractical. a) Install Mingw-w64 : http://www.mingw-w64.org/doku.php/download/mingw-builds click on Sourceforge ... Save the file open mingw-w64-install.exe Setup: leave as default (Threads: posix) Destination folder: replace with c:\local\mingw64 (create sub-directories), Next, Finish. In Windows Help : type "Environment" -> Modify environment variables in the System Properties window, Advanced System Settings, at the bottom Environment variables... in System Variables: click on Path, modify, new add: c:\local\mingw64\mingw32\bin Open a terminal ("command prompt") type: echo %PATH% and check that the path to mingw appears. type: g++ --version to check that g++ works. b) OpenCV sources https://github.com/opencv/opencv/releases choose the most recent, Source code (zip) Unzip it on your desktop for example: C:\Users\thiel\Desktop\opencv-4.5.3 c) Install cmake https://cmake.org/download/ choose Latest Stable Release, Binary distribution, Windows x64 installer, .msi check Add CMake to the system PATH for all users Install CMake to: c:\local\CMake\ (create subdirectory) Run cmake-gui d) Compiling OpenCV in cmake-gui : where is the source code: C:/Users/thiel/Desktop/opencv-4.5.3 where to build the binaries: C:/local/opencv/build-4.5.3-mingw64 (create the sub-directories) Configure Generator : MinGW Makefiles, default, Finish then wait for... "Configuration done" Generate ... Generating done Exit Open a terminal cd C:\local\opencv\build-4.5.3-mingw64 mingw32-make ... general compilation, about 1 hour ... mingw32-make install Finally, in the environment variables, in System variables: click on Path, modify, new C:\local\opencv\build-4.5.3-mingw64\installx64\mingw\bin Close the current terminal and open a new terminal; check PATH by typing: echo %PATH%. Type: opencv_version (displays, for example: 4.5.3) e) Compiling Astico2D Go to the Astico2D directory. Copy the following 2 lines into a "make.bat" file, removing the spaces on the left: @REM Script for Windows, to call make with Makefile-mingw mingw32-make -f Makefile-mingw %* Edit Makefile-mingw, changing the path and version if necessary: OPENCVPATH = C:\local\opencv\build-4.5.3-mingw64\install VER = 453 Type : make -j all demo1.exe IMAGES/cat1.jpg 3. On MacOS --------- Open a terminal and type : brew install g++ make opencv Edit the Makefile file located in the Astico2D directory, to replace "OPENCV = opencv4" with "OPENCV = opencv". Then go to the Astico2D directory with the cd command, and type make -j all ./demo1 IMAGES/cat1.jpg