برق، الکترونیک، الکتروتکنیک، مکاترونیک، پزشکی، کشاورزی

برق، الکترونیک، الکتروتکنیک، مکاترونیک، پزشکی، کشاورزی و

برق، الکترونیک، الکتروتکنیک، مکاترونیک، پزشکی، کشاورزی

برق، الکترونیک، الکتروتکنیک، مکاترونیک، پزشکی، کشاورزی و

داده هایی در مورد برق، الکترونیک، الکتروتکنیک، مکاترونیک، پزشکی، کشاورزی و

تبلیغات
آخرین نظرات

۱ مطلب با کلمه‌ی کلیدی «اپن سی وی+ایکلیپس+ویندوز+سی میک+مینگ جی سی سی» ثبت شده است

اپن سی وی+ایکلیپس+ویندوز+سی میک+مینگ جی سی سی

ShahBaz | سه شنبه, ۳۰ شهریور ۱۳۹۵، ۰۶:۰۸ ب.ظ

In order to get a working OpenCV environment on Windows, we'll need the following tools:
  1. MinGW
  2. OpenCV
  3. Cmake
  4. Eclipse IDE
The following procedure was tested with these versions of the aforementioned tools, but should also work with other versions close to these:
- OS: Windows 10 Pro 
- MinGW (mingw-get version 0.6.2)
- OpenCV for Windows (v. 2.4.11)
- CMake for Windows (v. 3.3.1)
- Eclipse for C/C++ Developers (version: Mars Release 4.5.0)
 
Download, Install and Setup MinGW

 
 Download
Browse the official website for MinGW at mingw.org and click on "Download Installer" on the right. You'll be redirected on a sourceforge page where the executable file should begin downloading automatically.The file mingw-get-setup.exe is downloaded.
 
 Install
Run mingw-get-setup.exe and press "Install". 
Better leave the default Installation Directory to "C:\MinGW". Also better leave checked the following checkboxes as they are by default:
Then press "Continue". On the next screen just wait for it to download a few things and when it's done press "Continue".
A new window will appear. Select "Basic Setup" on the left side (probably selected by default) and mark for installation the packages "mingw32-base" and "mingw32-gcc-g++". These should be enough. 
Then click "Installation | Apply Changes". On the next screen press "Apply" again. Wait until it's done and then close all windows.
 
As a last step, we need to add the "C:\MinGW\bin" path to the PATH environment variable.
Go to "System | Advanced system settings | Environment Variables...", select the Path system variable and press "Edit...". At the end of the path add ";C:\MinGW\bin" (do not forget the semi-colon in front of C in order to separate it from the other paths). It should look something like this:
 
Then press "OK" on all windows opened, and you're done.
 

Download and Install OpenCV


 Download
Browse OpenCV's website at opencv.org/downloads.html and download "OpenCV for Windows". Here, we'll be using OpenCV version 2.4.11 as an example. The downloaded file should be opencv-2.4.11.exe (for the 2.4.11 version). 

 Install
Run opencv-2.4.11.exe. It will ask for a folder to extract OpenCV. I chose to extract under C:\. Select your extraction folder and click "Extract". 

After extraction "C:\opencv" contains the extracted files. Browse there with Windows Explorer. Inside there should be two folders named build and sources. Create another folder and name in "MinGW" (or anything else you want). We're gonna use this empty folder on a later step.

Download and Install CMake


 Download
Browse Cmake's website at www.cmake.org/download and click on the latest stable link. Look at Binary distributions and select the file that corresponds to Windows (Win32 Installer). As of now the file is cmake-3.3.1-win32-x86.exe.

 Install
Run the downloaded file and install it using all the default options selected.

 Setup
After installation run CMake (cmake-gui). Press the Browse Source button and navigate to "C:\opencv\sources" (if you installed OpenCV on a different path instead of right under C:\ as I did previously, then browse to that path and select the sources folder). 
Next, press Browse Build and select the folder we created under C:\opencv, which I named MinGW. So the path entered should be "C:\opencv\MinGW". 
Then, press Configure. This brings up a new dialog where you're asked to specify the generator for this project. I just select here "MinGW Makefiles" and leave the "Use default native compilers" selected. Then click on Finish. When it's done, press Generate. You'll see something like this, if succeed, and close cmake:

Open Command Prompt and go to "C:\opencv\MinGW". Then write: mingw32-make.
Wait until it reaches 100% and then close the prompt.

*Note: You may experience an error message during mingw32-make, like this:
If that happens, open Windows Explorer, go to "C:\MinGW\include" folder and find and open the file "commctrl.h". Find the lines on top of the file (probably lines 13-15) that look like this:
1
2
3
#if 0
#define _WIN32_IE 0x0300
#endif
Change these lines to:
1
2
3
#if 1
#define _WIN32_IE 0x0500
#endif
Save the file, and try again mingw32-make. This time it should work.

Finally add to the PATH environment variable the path "C:\opencv\MinGW\bin". Go to "System | Advanced system settings | Environment Variables...", select the Path system variable and press "Edit...". At the end of the path add ";C:\opencv\MinGW\bin" (do not forget the semi-colon in front of C in order to separate it from the other paths). It should look something like this now:

Download and Install Eclipse for C++ Developers

 Download
Browse to the download page of Eclipse's website eclipse.org/downloads and download Eclipse IDE for C/C++ Developers. Then extract the downloaded archive.
Note: To run Eclipse you need to have Java installed (Java JRE or JDK). Don't mix 32-bit versions of one tool with 64-bit versions of another, or errors may occur. Here, we've used the 32-bit versions of Java, Eclipse, MinGW, and CMake.

 Setup CDT Tools
Open eclipse and if it's the first time, specify a workspace folder where the projects will reside. Go to "Help | Install New Software..." and click on "Available Software Sites". A new dialog appears and make sure that the checkbox in front of CDT is checked and press OK. Then under Work with select "CDT  - http://download.eclipse.org/tools/cdt/releases/8.7". Check the "CDT Main Features" and press Next, then Next again, then accept the license agreements and press Finish.
Restart eclipse.


--
Next, we'll see how to setup a functioning OpenCV project with all the necessary dependencies, both in C++ and Java, using eclipse.
  • ShahBaz