Ask Your Question

Revision history [back]

I got error on libopencv_highgui.so.2.4 : undefined symbol

I am using OpenCV on python. And OS is OpenSUSE13.1

I made a python code below.

#!/usr/bin/python
import numpy as np
import sys
sys.path.append('/usr/lib64/python2.7/site-packages')
import cv2
from matplotlib import pyplot as plt

sys.path.append('/usr/local/lib/python2.7/site-packages')
img1 = cv2.imread(sys.argv[1],0)
img2 = cv2.imread(sys.argv[2],0)

sift = cv2.SIFT()

kp1, des1 = sift.detectAndCompute(img1,None)
kp2, des2 = sift.detectAndCompute(img2,None)

FLANN_INDEX_KDTREE = 0
index_params = dict(algorithm = FLANN_INDEX_KDTREE, trees = 5)
search_params = dict(checks=50)

flann = cv2.FlannBasedMatcher(inde x_params,search_params)

matches = flann.knnMatch(des1,des2,k=2)

matchesMask = [[0,0] for i in xrange(len(matches))]

for i,(m,n) in enumerate(matches):
    if m.distance < 0.7*n.distance:
        matchesMask[i]=[1,0]

draw_params = dict(matchColor = (0,255,0),
                   singlePointColor = (255,0,0),
                   matchesMask = matchesMask,
                   flags = 0)

img3 = cv2.drawMatchesKnn(img1,kp1,img2,kp2,matches,None,**draw_params)

plt.imshow(img3,),plt.show()

And in terminal, i command " root@linux-hhuk test]# ./ocvcorr.py img1.tiff img2.tiff "

(ocvcorr.py is python code above)

and I got an error message on command.


Traceback (most recent call last):

 File "./ocvcorr.py", line 5, in <module>

    import cv2

ImportError: /usr/lib64/libopencv_highgui.so.2.4: undefined symbol: _gst_fraction_type

I googled every terms, but I can't find answer to solve this problem.

How can I solve this problem?