How can I compile opencv from source at Win 10 - opencv

I read this and this, and saw the videos, but looks I did not understand the required :(
I need to compile opencv from source in order to be able to use CV-Rust at my application, what I did is:
1- Downloaded and installed Visual Studio 2015 with Visual C++ option.
2- Downloaded and installed CUDA
3- Downloaded and installed Python
4- Downloaded and installed Tortoisegit
5- Downloaded and installed 7-zip
6- Downloaded and installed Miktex
7- Downloaded and installed DoxyGen
8- Upgraded the pip python -m pip install --upgrade pip and installed the below packages:
8-1- Setuptools as pip install setuptools
8-2- Sphinx as pip install -U Sphinx
8-3- NumPy as pip install NumPy
9- Downloaded and extracted the following, and put all the extracted folders in a seperate folder called it dep:
9-1- Threading Building Blocks 2018 Update 6 _win.zip
9-2- OpenEXR .tar.gz
9-3- Eigen .zip
10- Downloaded and unzipped the OpenCV winpack
11- Closed in another folder the OpenCV github using Tortoisegit
What is required now!

I'll summarize the issue I raised at github and its solution below:
It looks I was having some conflicts in my machine setup:
I was not having required permission to execute scripts as the PS, so I added the required permission as mentioned here, by writing:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
Also, I was installing VS2017 and VS2015 which was appeared to be causing some kind of conflict, so I uninstalled VS2017 as shown here and removed Win10 SDK as well.
Confirmed Cmake is installed properly and added to the path, by running cmake -version
Then I downloaded the cv-rs repository.
Then created directory C:\opencv
In the file explorer, enabled see hidden folders, to see the .git
Then copied both .git and .windows folders to the C:\opencv
Opened powershell console as administrator in c:\opencv
Run the below commands in PS:
PS C:\opencv> git reset --hard
PS C:\opencv> git submodule update
PS C:\opencv> .\.windows\msvc_2_build_OCV.ps1 -EnableCuda $False -Compiler vc14
It will take sometime running the script and configuring opencv.

Related

Installing OpenCV into PyCharm

Idk if this is a stackoverflow-appropriate post so forgive if the question is misplaced. I'm trying to install OpenCV into my Pycharm IDE through the conda virtual environment. I typed conda install -c conda-forge opencv inside the PyCharm terminal and it has been doing this for 11 hours and God knows how many more to go.
Pycharm did this with PyTorch as well. Am I doing something wrong or is this normal?
While you can install packages directly in PyCharm by going to file->settings select Project Interpreter and click on the '+' icon on the top right (see image)
I would recommend creating a requirements.txt file in the root of your project, and write down all your required packages. When a package is missing, PyCharm will automatically suggest to install the package for you.
e.g. for installing opencv you can add the following to you requirements.txt
opencv-python
Or even specify the version that your project needs
opencv-python==4.1.2
edit: the advantage of using a requirement.txt is that you can more easily port the project to another machine, and re-install the packages if needed.

Is there any windows command for display the path of files that were installed via pip command?

I installed OpenCV program via pip install opencv_contrib_python in Windows 10 terminal, but the terminal only showed me the progress and where it downloaded the files from. I had a hard time to figure out where the files were installed. Is there any Windows command to display where the downloaded files will be stored? I am not asking for the path of downloaded files directly from the internet browsers, but asking for the path of downloaded files from windows command like pip.
pip show --files opencv_contrib_python

unable open C:\Program Files (x86)\Python36-32\share\kivy-examples\demo\showcase\main.py in windows10

I installed kivy using pip's latest wheels but I can't load C:\Program Files (x86)\Python36-32\share\kivy-examples\demo\showcase\main.py in windows10. Can anyone help me?
When you install the kivy examples on Windows 10 using the following:
python -m pip install kivy_examples
or
python -m pip install Kivy_examples-1.10.1.dev0-py2.py3-none-any.whl
If your user is named "usr", the kivy examples are installed in the following location:
C:\Users\usr\AppData\Local\Programs\Python\Python36\share\kivy-examples
To run the showcase example, do the following:
python C:\Users\usr\AppData\Local\Programs\Python\Python36\share\kivy-examples\demo\showcase\main.py

How to generate .deb from catkin workspace in ROS

I can compile and install ROS package in the catkin workspace in ROS. How can I export the package in catkin workspace to a .deb file so I can install and use it on the other machines?
My ROS version is ROS Indigo and OS version is Ubuntu 14.04
Here is a step-by-step guide of doing it using ROS bloom:
Navigate to your package path
cd /path/to/package
Use ROS bloom to create the .deb file
bloom-generate rosdebian --os-name ubuntu --ros-distro kinetic fakeroot debian/rules binary
* If your ROS distribution is different from Kinetic, replace kinetic with your distribution
Copy the .deb file to the other machine, and in its folder type
sudo dpkg -i packagename.deb
this will install the package on that machine, and you are now able to use it like any other ROS package
1 - I think the ROS build farm would be a good starting point and solution for that. You cannot create a .deb as you said but, you can create a source closed ROS packages
The ROS build farm is also designed to enable deploying a custom build farm. This can be useful to release closed-source packages, build for platforms and architectures not provided by the official ROS build farm, and/or customize any part of the process to specific needs.
Take a look here for a better overview.
2 - Another approach would be using a CMake install. Although this will require the same architecture and ROS Distro between both your platforms and a location that can be the same for both machines.
Define a CMAKE_INSTALL_PREFIX for some location like: /opt/your_ros_install.
Run sudo make install to allow installing there.
Copy the install directory from machine A to machine B, using scp or tar or some other technique.
To run your installed ROS packages on either machine: source /opt/your_ros_install/setup.bash.
Take a look at this post: Generate .deb from ROS package
Use the following commands:
path-of-your-package$ bloom-generate rosdebian --os-name ubuntu --ros-distro kinetic
$fakeroot debian/rules binary

Import OpenCV in Pycharm [duplicate]

This question already has answers here:
How to install OpenCV on Windows and enable it for PyCharm without using the package manager
(3 answers)
Closed 4 years ago.
I want to use OpenCV (Python module) in pycharm. I set my Python interpreter in settings and added OpenCV path (C:\opencv\build\python\2.7) to the Python interpreter path. Unfortunately pycharm couldn't import OpenCV. It's noticeable that I see the cv2.pyd in the left panel (project panel).
Can anyone help me to resolve this issue ?
Refer to How to install OpenCV on Windows and enable it for PyCharm without using the package manager
Steps to follow:
Install Python 2.7.10
Install Pycharm(If you have not done it already)
Download and install the OpenCV executable.
Add OpenCV in the system path(%OPENCV_DIR% = /path/of/opencv/directory)
Goto C:\opencv\build\python\2.7\x86 folder and copy cv2.pyd file.
Goto C:\Python27\DLLs directory and paste the cv2.pyd file.
Goto C:\Python27\Lib\site-packages directory and paste the cv2.pyd file.
Goto PyCharm IDE and goto DefaultSettings>PythonInterpreter.
Select the Python which you have installed on Step1.
Install the packages numpy,matplotlib and pip in pycharm.
Restart your PyCharm.
PyCharm now has OpenCV library installed and working.
If you have installed pycharm,then you can type :
pip install opencv-python
after satisfied,
then go to file ,setting (in pycharm)
project ,project interpreter,click on plus icon on the top right ,
search opencv-python and install package.

Resources