Precautions for installing and using opencv in Linux

Source: Internet
Author: User
Tags gtk

After several days of hard work (almost a week .), Finally, we installed opencv in Linux and the program in it was ready for normal use. What should have been successfully completed. However, it is an indisputable fact that many difficulties have been encountered. "C & G/o! D & f-g * V
8 M0 E; I * '/{$ J3 B! V (C
Summarize the following precautions and hope to help you in the future: (problems may occur during installation on the opencv website)
8 V3 Q-P! M1 G1 R, *@! H'h4 I *\.? 2 N, B7 @ 'd #\
1. When installing rh9, remember to install GTK +. Otherwise, all programs in opencv cannot be executed.
9 L) s ;[! V7 F0 D/I
$ C, X-C j @ % v * U2. remember to modify/etc/lD. So. conf.
, G4 x * S8 M6 a % Q
Add/usr/local/lib % v # @. D3 G: W; ){! M! W; |

) Q. J # H % \ (@ * h # ldconfig (Root User)/M7 P (O5 ~ & V4 N0 O (m)} 1 _ # T
C' 8 d * T # t0 J. W # J
Then, convert opencv in/usr/local/lib/PKG-config. copy the PC to/usr/lib/PKG-config. (If you do not do this step, you cannot compile it.) 4 Y) R0 ~ 5 E6 I, m % N * '* X # x
6 O, A6 U $ C2 V5 F, P?
This operation can be used for 5 K; j7 Q8 'b0 ^ '_ 0 m
# Cp/usr/local/lib/PKG-config/opencv. PC/usr/lib/PKG-config "X5 N7 | 2 H & I4 J

* D (Z2 K + X "A $ G! K;]: X2} * | (| 3. For congfigure, enter./configure -- without-Python -- enable-static
& V % J %} % W/M9 E3 K0? 4 [4 Y
; X3 h; C8 L; T/u 'y2 u! Z2? Note: On my computer, if there is no first without, make will make an error, helpless; the second is to generate a static Connection Library file when compiling the program (I have not understood how to generate it yet, Newbie ...) & W % U3 P5 D4 U: C4 E/O :?
9 M. X8 running V6 M4 K (_
Then, the prompt message is:
0 C & F/B6 Y. U1 E./configure
(Q/d; C (U5 T * | checking build system type... i686-pc-linux-gnu $ D8 w % O) O
Checking host system type... i686-pc-linux-gnu
+ V y l. A (Y + {/A7} checking target system type... i686-pc-linux-gnu + C2} $ B. I $ '* R1 L) K * u) K3 {7 m
Checking for a BSD-compatible install.../usr/bin/install-C
; N' A * Q6 P. Q) G0 kchecking whether build environment is sane... yes
8 \/C) P "p-K, F + {checking for gawk... No1 G1 [/Z! A0 [* k/{$ H0 Z1 Z
......
& @ # E & E7 Shunde [2 T % l9 | 1 Z & K, Y2 '-W-l
General configuration ===================$ Q (G & E + R4 g /}! R-C
# O6 u! ] 'A! '. W
Compiler: G ++
0 '. B9 P.' (K, f-o & B0 U ;?! K )~ /M'e
Cxxflags:-wall-fno-rtti-pipe-O3-g-March = i686-ffast-math-fomit-frame-pointer
6 A3 U1 R7 Q K2 C + W8 l 'C
, D9 i8 g )~ 5 P6 f * O0 ^ +} 8 sinstall path:/usr/local
-Q) Z S7 \ + P + o6 X6 a % m/] % Y) ['l "H
Highgui configuration ============================ 4 K; D & Z2 e # H/X' R) i7 J
"L )? $ @ "N6 ~
Windowing system --------------
4 A $ {:? 1 B3 h # _ 4 [& S2 Z (quse carbon/Mac OS X: no5 D-F2 {0 x $ @ 8 K1 M7 l '': E * l % n' x
Use GTK + 2.x: Yes
3 C "P: X [! G A: quse gthread: Yes. U $ '; E8 z6 Q5 N "E: O

6 S8 }! L 'f4 A: R "s * vimage I/O ---------------------
"@-[K4 B & A6 O U $ m' l! A; quse libjpeg: Yes % O7 C: G; X ++? 0 N1 H, Q-Y & O
Use zlib: Yes
. M1 m ;? 1 V8 ~) N! H7 luse libpng: Yes
; O % v "C8 P: T & U-H5 juse LibTIFF: Yes L # U2 ^ &\! S
Use libjasper: NO ^ (G8 g) D5 n e "H
Use libilmimf: No {'n6 K. H6 Q # R3 K; ^

% U4 H9 Q/[# S % B rvideo I/O --------------------- 7 N3 [-{)\! Y: a. o $ u
Use quicktime/Mac OS X: No & L4] 9 \, [+ Z, K9 m
Use xine: No
; Y4 E, Z % N: n (wuse FFMPEG: No
V & G8 D/h % E2 X "~ 4 Guse dc1394 & raw1394: No: W. '4 M: A7 p * C
Use v4l: Yes
) R & K1 g/o @ 5 V % z7 N) Ruse v4l2: No
9 U0 ^.} @ (P4 p $ U2 T: T.]
5 m3 d; o6 h; rwrappers for other versions ages ================
-A' G-d -~ & | + [0 K7 R # K & V; y6 R "Y" [1 Q * @, N4 C
Swig
6 W9 Z2 A1 Y5 B7 Y1 vpython Yes, N5 s '_ 9 I! P2 @

* D; P; T. I & S2 I $ v) eadditional build settings ============
. '3' $ l % Y % m-z "| (| + O
/O1 B) G1 C 'q2 L7 Q # sbuild demo apps Yes V + S 'd; V % S7 I. d' V9 N) c-t #]

/'1 [& G/! Q) t' o/U9 @ now run make... (\: X7 D (] 3 [2 I9 M5

, _ 2 h '''u9 w % '.'. [K is not the same as it is on the Internet. It may be unable to move forward due to this problem in future work. 'N' & F' K: o % Z3 h;} # i8}

-N, O (F; H1 ~ "N: I & [8 L y4. also note that the header file under opencv contains cv. H and highgui. h. All the files in the directory of the two files (remember/usr/local/include/opencv) are copied to/usr/include (don't ask me why, if you do not copy the file, the system prompts that the two header files cannot be found during program compilation)
) X "\ % y7 K! G3 I % L! J8 C
5 F0 Z-\ 5 x $ P, l "d # B5. how to compile the link file: 2 N; G] 8 ~ # M0 D6 n' [3 U0 Z

2 R "h; [# I 'q7 X8 y to edit cvtest. the C file is used as an example (C ++ is used in highgui, so it must be compiled using G ++) 3G: R * J2 _/d, A + L

. L4 J! G/L-J5 ca. g ++ 'pkg-config -- cflags opencv '-O cvtest. c' PKG-config -- libs opencv'
& K2 Z + {1 ~ $ S0 Q2 \ 0 U! P) J. K! X & J0 V6 _ 0 p
B. Compile: G ++ 'pkg-config -- cflags opencv '-C cvtest. c
: S: W/R0 _ * t0 {B1 P1 Q
: {3 I; s, t0]; B9 [# S * L1 L2 E Link: G ++ 'pkg-config -- libs opencv '-O cvtest. o) O5 T4 S-y # G "l % W $ O3 P ;~) H

5} 1 s, @; N: T * k? 1 I5 F note: the thing behind g ++ is ', which is the key under ESC.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.