Program crahes when the function "cvThreshold" is called (Bug #71)


Added by Илья Москвин about 15 years ago. Updated almost 13 years ago.


Status:Cancelled Start date:
Priority:Blocker Due date:
Assignee:Vadim Pisarevsky % Done:

0%

Category:python bindings
Target version:-
Affected version: Operating System:
Difficulty: HW Platform:
Pull request:

Description

Program crahes when the function "cvThreshold" is called. This code crashes:

from opencv import cv 
from opencv import highgui as hg
image=hg.cvLoadImage('D:\\system\\Desktop\\lena.jpg')
red=cv.cvCreateImage(cv.cvGetSize(image),8,1)
binary=cv.cvCreateImage(cv.cvGetSize(image),8,1)
print 1
cv.cvSplit(image,red,None,None,None)
print 2
cv.cvThreshold(red,binary,42,255,cv.CV_THRESH_BINARY)
print 3

In this code we use "cvSplit" function instead "cvCvtColor" because of Ticket #70 :-)
If we call this function in a new thread it works normally. But in WinXP this trick doesn@t work.
Following code doesn@t crash in Win Vista, but crashes in Win XP:

def track():

    image=hg.cvLoadImage('D:\\system\\Desktop\\lena.jpg')
    red=cv.cvCreateImage(cv.cvGetSize(image),8,1)
    binary=cv.cvCreateImage(cv.cvGetSize(image),8,1)
    print 1
    cv.cvSplit(image,red,None,None,None)
    print 2
    cv.cvThreshold(red,binary,42,255,cv.CV_THRESH_BINARY)
    print 3

if +name+ == '+main+':
    import threading
    p1=threading.Thread(target=track)
    p1.start()

Environment: OpenCV 2.0.0.a, Python 2.6, SWIG python bindings, 2 different mashines with Windows Vista Home Premium and Windows XP Pro SP3


Related issues

duplicated by Bug #80: Functions "CvtColor" and "Threshold" crash with the new p... Cancelled

Associated revisions

Revision eea6fe8e
Added by Vadim Pisarevsky over 12 years ago

Merge pull request #71 from NikoKJ/ocl4_2.4.3

This patch is for the ocl module of 2.4.3

(tested on Mac (OSX 10.8, Xcode 4.5, OpenCL 1.1(?))

History

Updated by James Bowman about 15 years ago

r2636 adds code above (appropriately translated) to test_Threshold:

        image = self.get_sample("samples/c/lena.jpg", 0)
        red = cv.CreateImage(cv.GetSize(image), 8, 1)
        binary = cv.CreateImage(cv.GetSize(image), 8, 1)
        cv.Split(image, red, None, None, None)
        cv.Threshold(red, binary, 42, 255, cv.CV_THRESH_BINARY)

Cannot reproduce problem. Setting area to "swig python".
Suggest switching to new bindings.

Updated by Илья Москвин about 15 years ago

Replying to [comment:1 jamesb]:

r2636 adds code above (appropriately translated) to test_Threshold:

>         image = self.get_sample("samples/c/lena.jpg", 0)
>         red = cv.CreateImage(cv.GetSize(image), 8, 1)
>         binary = cv.CreateImage(cv.GetSize(image), 8, 1)
>         cv.Split(image, red, None, None, None)
>         cv.Threshold(red, binary, 42, 255, cv.CV_THRESH_BINARY)

Cannot reproduce problem. Setting area to "swig python".
Suggest switching to new bindings.

Do you mean that we should try revision 2636 instead of OpenCV 2.0.0a build?

Updated by Илья Москвин about 15 years ago

The new bindings after building them with MS C++VStudio are working properly, but we don@t know about the swig because we didn@t rebuild them with MSVS.

Updated by Victor Eruhimov over 14 years ago

  • Status deleted (Open)

Updated by Vadim Pisarevsky over 14 years ago

Since the new bindings work well and since SWIG bindings are not included into OpenCV anymore and not supported, I'm closing the ticket.

  • Status set to Done
  • (deleted custom field) set to wontfix

Updated by Andrey Kamaev almost 13 years ago

  • Status changed from Done to Cancelled
  • Category set to python bindings

Also available in: Atom PDF