![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: May 2007
Posts: 6
Rep Power: 0
![]() |
OpenCV Help Needed: Can't use the keyboard while running cvcamSetPropetry
If there are any OpenCV experts out there, I could use some help.
I am attempting to modify some C++ code that uses the OpenCV library for image processing. The majority of the code is run within a loop, but the loop is not formed from a traditional control structure such as 'for' or 'while', but from the command cvcamSetProperty(0, CVCAM_PROP_CALLBACK, code). Essentially, cvcamSetPropetry(0, CVCAM_PROP_CALLBACK, code) continually reads images from a firewire camera attached to the computer, and then sends those images to the function 'code' to be analyzed. This loop will run indefinitely until a press any key other then the function keys. The problem is that I need to be able to use keyboard inputs to alter the code's operation while cvcamSetProperty is running. I want to set the code up such that when I press a given key on the keyboard, the code 'code' will write to a file I have already opened. The problem is, cvcamSetProperty will automatically terminate the loop as soon as I attempt to use the keyboard for that purpose, as the loop terminates as soon as any key is pressed(other than the function keys). Is there any way in which I can alter the operation of cvcamSetProperty(0, CVCAM_PROP_CALLBACK, code) so that it will only terminate when a specific key is pressed, as opposed to any key. Or baring that, it there any way I can get C++ to detected a function key as an input. Thanks for the help. |
|
|
|
|
|
#2 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Function keys are not available on every system in the world. Therefore, it is not an issue the language addresses. You'd have to write implementation-specific, non-portable code. Not that you shouldn't do that, just be aware that it's required.
I know nothing about OpenCV, so perhaps someone who does could address the issue of modifying the code from "any key" to "one key".
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#3 |
|
Professional Programmer
Join Date: May 2006
Location: Maryland, USA
Posts: 306
Rep Power: 3
![]() |
I don't think you understand what is going on. I just checked the docs and the callback function has nothing to actually do with key input. It is called after every frame is caputered, and frames start being captured when you call cvcamStart() (which returns immediately) and stop when you call cvcamStop(). In between those calls you can do whatever else you want to do in your application.
__________________
Robotics @ Maryland AUV Team - Software Lead |
|
|
|
|
|
#4 |
|
Newbie
Join Date: May 2007
Posts: 6
Rep Power: 0
![]() |
Yea, your right. Its cvcamStop() that determines when the loop stops, I thought it was something internal to cvcamProperty. Now that I know that I have been able to correct the program.
Thanks for the help. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Keyboard guide needed | Aphex_Twin | C++ | 3 | May 21st, 2005 12:13 PM |