WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rating: Thread Rating: 4 votes, 4.75 average. Display Modes
  #1  
Old 03-08-2010, 08:35 AM
sircedric4 sircedric4 is offline
Member
 
Join Date: Aug 2009
Posts: 22
I just got finished trying the capture-cam.py example and got a runtime error. When I ran it, it first prompted me to select a web camera and then when it tried to run it gave the following error:

Code:
Microsoft Visual C++ Runtime Library
Runtime Error!

Program: C:\program files\WorldViz\Vizard31\bin\winviz.exe

This application has requested the Runtime to terminate it in an unusual way.  Please contact the application's support team for more information.
I would like to marry the capturing of a video camera with the square detection of squares.py. Does anyone know what runtime error it is running into. It looks like it is getting hung up on:

Code:
# get size of the frame
    frame_size = cv.cvGetSize (frame)
Reply With Quote
  #2  
Old 03-09-2010, 08:01 AM
JimC JimC is offline
Member
 
Join Date: Jun 2009
Posts: 42
It works for me in Vizard (with a Logitech QuickCam). A camera driver issue? What do you get if you print type(frame) just before the crash?
Reply With Quote
  #3  
Old 03-09-2010, 09:13 AM
nige777 nige777 is offline
Member
 
Join Date: Nov 2007
Location: UK
Posts: 78
:d

Thanks for the upload - really appreciate it & once I can work out how to use vizards window instead of highGUI's i'll be flying!

Just one odd thing though, when I try to run the kalman example I get this error message:

Traceback (most recent call last):
File "<string>", line11, in ?
File "kalman.py", line 35, in ?
kalman.transition_matrix[:] = A;
File "C:\Program Files\Worldviz\Vizard30\bin\lib\site-packages\opencv\cv.py", line 1944, in __setitem__
return _cv.CvMat__setitem__(*args)
RuntimeError: openCV Error:
Status=Sizes of input arguments do not match
function name=cvConvertScale
error message=
file_name=C:\User\VP\opencv\cxcore\src\cxconvert.c pp
line=1600

Any idea's because I'm fresh out of them?

Thanks
Reply With Quote
  #4  
Old 03-09-2010, 09:29 AM
JimC JimC is offline
Member
 
Join Date: Jun 2009
Posts: 42
Code:
return _cv.CvMat__setitem__(*args)
RuntimeError: openCV Error:
Status=Sizes of input arguments do not match
My guess would be to try looping through the two arrays and setting corresponding elements one at a time rather than trying to set the whole thing at once, e.g.:

Code:
for i in range(2):
  for j in range(2):
     transition_matrix[i][j] = A[i][j]
Reply With Quote
  #5  
Old 03-09-2010, 10:33 AM
sircedric4 sircedric4 is offline
Member
 
Join Date: Aug 2009
Posts: 22
Quote:
Originally Posted by JimC View Post
It works for me in Vizard (with a Logitech QuickCam). A camera driver issue? What do you get if you print type(frame) just before the crash?
I get <type 'NoneType'>.

It would be nice if I could get the openCV camera frame capture stuff to work. I tried incorporating the Vizard (vizcapture) function into squares using the Vizard webcam capabilities and I have not found a means to convert the image from the vizcapture screen buffer into an IPLImage for openCV. I have tried a straight convert and also used adapter.py to try and convert the images, but apparantly there was an error in OpenCV 1.0 when moving from a PIL or other image type to IPLImage.

I have grown tired of going the viz cam route and am back onto trying to get the OpenCV camera handler to work, so any ideas you have I will entertain. I'll try and play with drivers and stuff and let you know how it goes. I have more than one camera plugged in right now, I'll pull those and see if they're causing conflicts.
Reply With Quote
  #6  
Old 03-10-2010, 05:52 AM
nige777 nige777 is offline
Member
 
Join Date: Nov 2007
Location: UK
Posts: 78
Thank you

Thanks you very much that worked perfectly.

Now I, like the original poster, just need to sort a method for converting frame buffer images to IPLImage!!

Came across this -

http://www.depthfirstsearch.net/blog...cv-and-python/

- which seems to address this prob however I am unable to utilize this at the moment due to my severe lack of C or C++ know-how. Any windows/C++ wizards out there who could help?
Reply With Quote
  #7  
Old 03-10-2010, 06:40 AM
sircedric4 sircedric4 is offline
Member
 
Join Date: Aug 2009
Posts: 22
Quote:
Originally Posted by nige777 View Post
Thanks you very much that worked perfectly.

Now I, like the original poster, just need to sort a method for converting frame buffer images to IPLImage!!

Came across this -

http://www.depthfirstsearch.net/blog...cv-and-python/

- which seems to address this prob however I am unable to utilize this at the moment due to my severe lack of C or C++ know-how. Any windows/C++ wizards out there who could help?
I am still trying to find a better way to do the conversion myself, but in the meantime I was able to get something to "work" using the actual screen capture and file save capability in Vizard.

I used the viztask schedule capability and basically saved each image to a bitmap and then loaded the bitmaps into the squares example. It is slow, only average 2 -3 frames per second which doesn't work for me, but might work for your application. I am attaching the code I used in squares for you to look at. Maybe it'll help you.

Like, you I found that same link that might address the problem but I couldn't figure out how to do anything with it. I do know C++, but only as a language. Getting all the plugins, modules, and runtime environments setup is beyond my capability. I'd kill for some sort of class to attend that would cover all the setup stuff that people assume you know just because you know a language.

Code:
def SquareIt():
	global img, storage

	while True:
		name = 'C:/DK Files/OpenCV Learn/test1.bmp'
		yield viz.window.screenCapture(name)
#
		# create memory storage that will contain all the dynamic data
		storage = cvCreateMemStorage(0);
		img0 = cvLoadImage( name, 1 );
		if not img0:
			print "Couldn't load %s" % name
		img = cvCloneImage( img0 );
		# force the image processing
		on_trackbar(0);
		# Also the function cvWaitKey takes care of event processing
		cvWaitKey(5);
			# clear memory storage - reset free space position
		cvClearMemStorage( storage );

t = viztask.schedule( SquareIt() )
vizact.onkeyup('s',t.kill)
Reply With Quote
  #8  
Old 03-10-2010, 09:38 AM
JimC JimC is offline
Member
 
Join Date: Jun 2009
Posts: 42
Yes, figuring out how to build complex C/C++ projects is a hideous nightmare, particularly on Windows with its plethora of compilers. That's why sane people prefer Python.

You might have a look at ctypes_opencv. It's not intended for Python 2.4, but as it's pure python code it might be made to work. Requires the ctypes module, and there are quite a few lines of the form:

Code:
min_val_p = c_double() if min_val is True else min_val
that need to be converted to e.g.:
Code:
if min_val is True:
  min_val_p = c_double()
else:
  min_val_p = min_val
Those are the difficulties that appear right off the bat, anyway...
Reply With Quote
  #9  
Old 03-10-2010, 09:48 AM
JimC JimC is offline
Member
 
Join Date: Jun 2009
Posts: 42
Quote:
You might have a look at ctypes_opencv. It's not intended for Python 2.4, but as it's pure python code it might be made to work.
Sorry, that was perhaps not clear. It's still a wrapper around the C dlls, but ctypes allows you to write the wrapper directly in Python rather than in some C-like (SWIG) or C++-like (SIP) dialect...If the problem is in the original pyopencv wrapper code, then this might provide a workaround...
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Native WorldViz support for character animation luakt Vizard 10 09-15-2008 11:39 PM
Incampatible CAL3D files luakt Vizard 4 09-14-2008 11:28 PM
WorldViz support of callada luakt Vizard 2 09-14-2008 10:59 PM


All times are GMT -7. The time now is 04:27 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC