OpenCV stops working well.

asked 2015-11-23 13:36:15 -0600

engivi gravatar image

updated 2015-11-24 03:36:49 -0600

Eduardo gravatar image

Hello.

I had installed opencv me and everything worked fine until a few days ago. The problem I have is that there are things in opencv that work well and others not. I'm trying to explain with an example.

if I do with python:

import cv2
img_01 = cv2.imread ('Webcam_panel.png', 0)

All goes well.

but if I do such a simple script like (this script worked well before, it should not have any errors):

import cv2

img_01 = cv2.imread ('Webcam_panel.png', 0)

print img_01.shape

for c in range (20):
    adapt_g = cv2.adaptiveThreshold (img_01, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, \
                                    cv2.THRESH_BINARY_INV, 11, c)
    c print
    fn = 'adapt_g_' + '{: 02d}'. format (c) + '.png'
    cv2.imwrite (fn, adapt_g)

Does not work and is thought for a long time .. (not show any error) And this happens with other scripts that I had and now this scripts doesn't work.

I reinstalled opencv and has not fixed the error. (But not uninstall the previous opencv because I dont know how I have to do it with ubuntu)

I'm working with ubuntu 14.04 + 2.7 + opencv python 3.0.0

Any idea to solve the problem?

Sorry for my poor english.

Thank You in Advance!

edit retag flag offensive close merge delete

Comments

What exactly do you mean with 'does not work'? How did you reinstalled opencv?

boaz001 gravatar imageboaz001 ( 2015-11-25 09:15:30 -0600 )edit

Thank you very much for your interest boaz001

I want to say that it's like a loop. It never ends. It remains frozen. Another example, the next script never ends. The image is not generated.

import numpy as np

import cv2

import Image, ImageTk

img1 = cv2.imread('Webcam.png')

img2 = cv2.imread('Webcam2.png')

mascara=img1.copy()

cv2.absdiff(img1,img2,difference)

mascara_arr = Image.fromarray(difference)

mascara_arr.save('difference.png')

I want to stress that the script worked well, before.

For the installation I follow this: https://help.ubuntu.com/community/OpenCV and everything seemed right.

engivi gravatar imageengivi ( 2015-11-25 13:26:43 -0600 )edit