python - Weird Error in OpenCV -
i'm writing program in python using opencv detects edges (canny edge detector) footage webcam records. i'm using 2 track-bars in order control threshold values (in order understand how these values change output of edge detector).
the code wrote following:
import cv2 import numpy np def nothing(x): pass img = np.zeros((300,512,3), np.uint8) cv2.namedwindow('cannyedge') cv2.createtrackbar("minval", "cannyedge", 0,100, nothing) cv2.createtrackbar("maxval", "cannyedge", 100,200,nothing) cap = cv2.videocapture(0) while(true): minval = cv2.gettrackbarpos("minval", "cannyedge") maxval = cv2.gettrackbarpos("maxval", "cannyedge") #capture frame frame ret, frame = cap.read() cv2.imshow('frame', frame) edge = cv2.canny(frame,minval,maxval) #display resulting frame cv2.imshow('frame', edge) if cv2.waitkey(1) & 0xff == ord('q'): break #when done, release capture cap.release cv2.destroyallwindows()
this program educational purposes i'm learning use opencv.
every time run program above code seems working fine following error:
glib-gobject-critical **: g_object_unref: assertion 'g_is_object (object)' failed
i've searched reason error occurs haven't found helpful. instinct tells me implementation trackbars wrong , it's causing error.
the tutorials used following:
does know why error occurs? appreciated!
i running ubuntu 14.04, opencv 3.2.0 , python 2.7.6
try making track bars , displaying image in same window , see if error persists. bet shouldn't. change: cv2.imshow('cannyedge', edge)
Comments
Post a Comment