Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ Ubuntu 12.04 installed OpenCV 2.3.1, binary image     - Linux protobuf-c (Linux)

- Installation and Configuration OpenVPN server and client on Ubuntu 15.04 (Server)

- Use Swift remove the spaces in the string (Programming)

- vnStatSVG: traffic monitoring software vnStat (Linux)

- Eclipse remove all comments and code spaces (Linux)

- CentOS How to mount the hard drive (Linux)

- JavaScript closures and the scope chain (Programming)

- Python script file directory traversal examples (Programming)

- Growth since Oracle set the table space (Database)

- Android Fragment really fully resolve (Programming)

- SUSE Linux network configuration and firewall configuration (Linux)

- Everyone should know something about TCP (Linux)

- How to download apk file from the Google Play store on Linux (Linux)

- Linux scheduling summary (Linux)

- Linux System Getting Started Tutorial: Using the Linux common commands (Linux)

- Basic Tutorial: Linux novice should know 26 commands (Linux)

- Find details block device with Linux blkid command (Linux)

- Linux system package manager (rpm, yum, source packages installation) (Linux)

- Oracle to create an external table (Database)

- How to implement large-scale distributed Yahoo depth study on the Hadoop cluster (Server)

 
         
  Ubuntu 12.04 installed OpenCV 2.3.1, binary image
     
  Add Date : 2017-08-31      
         
         
         
  1, The installation libgtk2.0-dev and pkg-config

Terminal run sudo apt-get install libgtk2.0-dev pkg-config

2. Download OpenCV-2.3.1 (to openCV official website can be downloaded)

cd command to enter the appropriate download directory. Run the following command sequence

$ Tar xf OpenCV-2.3.1.tar.bz2
$ Cd OpenCV-2.3.1

3. Run a terminal

$ Mkdir build
$ Cd build
$ Cmake .. here is two points behind cmake spaces.

4 and then click Run

$ Make

$ Sudo make install

 At this point compile successfully.

5 Configure the necessary libraries.

run

$ Sudo gedit /etc/ld.so.conf.d/opencv.conf

Add / usr / local / lib to the file

6 Run

$ Sudo ldconfig

7 run sudo gedit /etc/bash.bashrc, add the following two lines to the end of the file and save it.

 PKG_CONFIG_PATH = $ PKG_CONFIG_PATH: / usr / local / lib / pkgconfig
 export PKG_CONFIG_PATH

8 Run samples

$ Cd ~
$ Mkdir openCV_samples
$ Cp OpenCV-2.3.1 / samples / c / * openCV_samples
$ Cd openCV_samples /
$ Chmod + x build_all.sh
$ ./build_all.sh

$. / One_way_sample. ./one_way_train_0000.jpg ./one_way_train_0001.jpg

8 programming (binary image)

  1 #include "cv.h"
  2 #include "cxcore.h"
  3 #include "highgui.h"
  4 #include < iostream >
  5
  6 using namespace std;
  7
  8 int main (int argc, char * argv [])
  9 {
 10 IplImage * img = cvLoadImage (argv [1], -1);
 11 IplImage * biimg = cvCreateImage (cvGetSize (img), img-> depth, img-> nChannels);
 12 CvScalar s;
 13 int sum = 0;
 14 for (int i = 0; i height; i ++)
 15 {
 16 for (int j = 0; j width; j ++)
 17 {
 18 s = cvGet2D (img, i, j);
 19 cout << s.val [0] << "" << s.val [1] << "" << s.val [2] << endl;
 20 sum = (s.val [0] + s.val [1] + s.val [2]) / 3;
 21 if (sum> 128)
 22 s.val [0] = s.val [1] = s.val [2] = 255;
 23 else
 24 s.val [0] = s.val [1] = s.val [2] = 0;
 25
 26 cvSet2D (img, i, j, s);
 27}
 28}
 29 cvCopy (img, biimg);
 30 cvSaveImage ( "combibi.JPG", biimg);
 31 cvNamedWindow ( "imagebinary");
 32 cvShowImage ( "imagebinary", biimg);
 33 cvWaitKey (0);
 34 cvDestroyWindow ( "imagebinary");
 35 cvReleaseImage (& img);
 36 cvReleaseImage (& biimg);
 37 return 0;
 38}

Compile

$ Gcc erzhihua.cpp -o erzhi `pkg-config --cflags --libs opencv`

(Question: run gcc `pkg-config --cflags --libs opencv` erzhihua.cpp -o erzhi compile-time error will be, do not know why ??)

run

$ ./erzhi Lena.jpg
     
         
         
         
  More:      
 
- To_explore Linux system boot process (Linux)
- Ubuntu Apache2 setting, problem solving css, pictures, etc. can not be displayed (Server)
- High-performance Linux system firewall detailed analysis of double-effect (Linux)
- Linux program analysis tool: ldd and nm (Linux)
- SecureCRT in Python scripting study guide (Programming)
- Oracle and MySQL difference between the jdbc (Database)
- Ubuntu 14.04 solved using MyEclipse 10.7 flash back (Linux)
- Linux upgrade GCC 4.8.1 clear and concise tutorials (Ubuntu 12.04 64-bit version as an example) (Linux)
- Production Environment MongoDB Fragmentation and Cluster Solution (Database)
- Use ISO document production OpenStack used CoreOS mirror (Linux)
- First start with Kali Linux 2.0 (Linux)
- Android media library of analysis: MediaProvider (Programming)
- Linux package management operations Basic entry (Linux)
- Let you Fun Ubuntu desktop eleven weapon (Linux)
- Spring + Log4j + ActiveMQ remote logging - Analysis of combat (Server)
- Installation on Ubuntu class Winamp audio player Qmmp 0.9.0 (Linux)
- Ubuntu deployment Flask + UWSGI + Nginx Comments (Server)
- Spring Data study notes -Helloworld (Programming)
- Customize the output format in Linux history (Linux)
- Squid proxy server configuration under Linux (Server)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.