|
I was trying to use the ObjectTracker.exe demo but it keep giving me this error when press the stop button:
Couldn't reder the video capture stream. hr=0x80070057
The capture device may already be in use by another application.
The sample will now close.
Any ideas?
Thank you.
|
|
|
|
|
And how is this a C# question?
Please don't cross-post, you already asked in the article's forum.
|
|
|
|
|
Sorry, I have already realised that I had posted the question to the wrong place.
|
|
|
|
|
Hi all,
I want to close the from with a keyboard input 'K' but I cannot handle the input.
Before asking here, I've done lots of researches on web and especially on msdn.
This is not the first time I've been using KeyDown event but now I'm on a new computer and I cannot figure out why this time it does not work.
my code is simple:
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.K)
{
this.Close();
}
}
and on the designer side:
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Form1_KeyDown);
All other events work just fine, like MouseOver, MouseDown or MouseMove
but when it comes to KeyDown or KeyPress, it doesn't work
any suggestions?
|
|
|
|
|
you need to enable KeyPreview of Form for which you want to write code
as
this.KeyPreview = true;
and then write
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.K)
{
this.Close();
}
}
or
private void Form1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == 'k')
{
Close();
}
}
Both Work fine
|
|
|
|
|
It worked
Thank you!
|
|
|
|
|
Is it possible to get events of a form that belongs to other application?
I was looking for API function to get a handle of the window then to get events but found nothing.
|
|
|
|
|
|
Assuming you can't change the other appication, the only way that I know is through the Windows message queue.
Windows Message Handling - Part 1[^]
You need to get the windows handle (the HWND pointer IIRC) of the application you want to interact with, then hook into the queue filtering messages aimed at that window. Finally, you need the pointer of the button that you want to observe, and react to any ON_CLICK event raised by it.
Go to Start Menu ---> Microsoft VSnnnn --> Visual Studio Tools --> Spy++. Spy ++ allows you to watch the message queue for a window through a GUI, so you can see better what is going on.
I had a requirement for a WPF project of mine to interact with a VC++ 6.0 application, via the message queue. We were lucky that the C++ app was written in-house, so we arranged for a handshake between our two applications (passing the HWND handle to eachother). This meant we could raise events and pass small amounts of data directly across the message queue. This avoided the need to figure out the HWND of the buttons, as these changed each time.
|
|
|
|
|
|
Can someone please suggest a good seminar for OO training?
Thanks
|
|
|
|
|
|
Ermmm no, dont post your question there!
|
|
|
|
|
|
Hello
If anyone know, how I can send message eg: "Sell Items", to game: Metin2, when game is minimized?
WIW - What I Want:
1. Click "Y"
2. Write "Sell items"
3. Click Enter
4. Click Mouse on position X, Y
I try with Sendmessage, but it work me only on activate window. When i minimize game, my program don't work. ;(
Please Examples. )
Thanks, and sorry for my english.
|
|
|
|
|
Please help!
|
|
|
|
|
hello
i am doing face detection project without buit-in libraries.
so i got the idea that whole face is an ellipse and further eyes and mouth are ellipse as well. if i detect ellipse in bitmap file, so then i can detect face in live video.
i have googled for this as well, but didn't get success.
please help me that how can i detect that the picture contains ellipse.
or any other suggestion about face detection will be appreciated.
thank you very much.
|
|
|
|
|
|
Hi Dave, you score 1212, that is 3 * 404.
|
|
|
|
|
I know, damn copy and paste..........should be fixed now.
[edit: deleted some mads, have calmed down now Note to self, use preview more before submit, been caught out by bad c+p too often....]
Dave
Find Me On: Web| Facebook| Twitter| LinkedIn
CPRepWatcher now available as Packaged Chrome Extension, visit my articles for link.
modified on Tuesday, October 26, 2010 4:04 PM
|
|
|
|
|
thank you for help and i saw your suggested links
but Motion detection and ellipse detection are two different things.
|
|
|
|
|
inayathussaintoori wrote: i am doing face detection project without buit-in libraries
I don't think you are doing that at all; from your question it seems you just hope to do so.
Detecting ellipses can be easy or very hard, depending on circumstances. A specialized Hough transform probably is your best bet. See here[^].
|
|
|
|
|
sir if you won't help me so it will remain just a hope
|
|
|
|
|
Guy, you have a serious problem. Noone is gonig to spoon-feed you this stuff. You said it yourself, you can't understand the math that's behind these algorithms. Without that kind of understanding, you have no hope of writing your own library, so you're forced to use someone elses.
Noone is going to walk you through a couple of Calculus classes so you can understand this stuff.
|
|
|
|
|
The Hough Transform suggested by Luc will work, but in this situation a quick and dirty approach may be easier:
1. We can assume the face color is (generally) different than the background. Find a threshold on your sample images that seems to separate the face/background the best.
2. Use this threshold to create a binary image (1 = face, 0 = background).
3. Do a morphological closing (http://homepages.inf.ed.ac.uk/rbf/HIPR2/close.htm[^]) on the binary image to close gaps (eyes, mouth, etc).
The closing is a dilation followed by an erosion. These sound more complicated than they are, and are explained in the link. They're just a set of Boolean operations on the image, and can be implemented entirely with ANDing or ORing the image with an offset copy of itself.
4. Do a morphological opening on the image to eliminate stray background pixels that are 1's.
5. You should have a convex blob in the face area. You can then trace the outline programmatically to find the bounds.
6. The outline should give you the general regions to look for other facial features in the original image.
|
|
|
|