Wednesday, June 22, 2016

Problems we Face when Running Opencv in Ubuntu

In Windows:


ImgColor=cv2.imread('/home/arun/Desktop/Arun.jpg',1) # Read it as color image

cv2.namedWindow('Figure', cv2.WINDOW_NORMAL)
cv2.imshow('Figure',ImgColor)
cv2.waitKey(0)
cv2.destroyAllWindows()

Opens the image and display it in the window named 'Figure'. Upon a key press it destroy all opened window. but it doesn't work in linux (opened window simply hangs)

In Linux:

ImgColor=cv2.imread('/home/arun/Desktop/Arun.jpg',1) # Read it as color image
 
cv2.startWindowThread() # Solves the issue
cv2.namedWindow('Figure', cv2.WINDOW_NORMAL)
cv2.imshow('Figure',ImgColor)
cv2.waitKey(0)
cv2.destroyAllWindows()


No comments:

Post a Comment