You are here:

C++/furthermore

Advertisement


Question
QUESTION:
Your question was

I'm trying to build a program which can recognize the position of a red dot with a webcam, and give the coordinates of the mouse when I click.

I really don't have any idea how to begin, because I just can't make any sense of how to import frames of my webcam and use them for colour-tracking...I'm using VC++, so I really have a nice programming enviroment:)



Please help, our math teacher ( the only one who can really program in C++ ) can't help us out either..



Kind regards,



Stijn van Schooten

But this is outside of my expertise.

Expert: Bill A


It says on the website that you can answer questions regarding  C++...But if it's not your field of expertise, who do I have to adress instead?

Kind ragerds,
 Stijn van Schooten

ANSWER: "recognize the position of a red dot with a webcam" is outside the area of my expertise. Just because one knows C++ or any language for that matter doesn't mean they can solve any problem asked using it. In fact your teacher knows C++ and he/she can't solve the problem, so is there any difference than my not being able to solve it?

Bill

---------- FOLLOW-UP ----------

QUESTION: That sounds reasonable, but furthermore the question about getting the coordinates of the mouse remain. Do you know how we could acquire those coordinates?

After all, with some digging into USB-class specifications and research on the internet we've found an answer how to import the images. I would love to send the code to you but it's a but too much for this manner of communication...Could I mail you or something? Only problem is now that we can't figure out how to incoorporate a pixel-scanning subroutine into the hole package. So we can find the red dot of course...

With kind regards,
Stijn van schooten

ANSWER: Understand that I have not done what you want to do, but if I was going to do it, here is something I would try:

Create a transparent window resized to the whole screen area.  For the Window, use OnMouseMove to check the mouse position and buttons.

How you correlate that to the WEB Cam I don't know.  I also saw a reference that DirectX supports mouse functions.  Since DirectX also handles video, it may be that going through DirectX is a better method?

I'm glad you're finding what you need.  The internet is a great reference.  I saw you want to send me the program, but I seriously don't have the time (as a volunteer here) to build and run this program.

Good luck - it sounds like you're getting somewhere on this.

Bill

---------- FOLLOW-UP ----------

QUESTION: That's the next problem I'm encountering: I can't figure out how to get my program running in a nice windows-screen instead of a dos-screen...I'm using visualC++, but can't find how to create a window. and how to make it transparent...

Thanks for your help!

Answer
VC++ has great online help.  You didn't say if you're using the MFC framework.  I suggest you do since it's way easier than managing windows and windows messages yourself.

If you use MFC, look at CWnd - CreateEx has parameters for the window size and style which the help covers very well.

Bill

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


Bill A

Expertise

I can answer questions about C++, programming algorithms, Windows programming in MFC (which is C++). I cannot answer questions about STL (templates) and I have no experience with Linux. I do enjoy reviewing code and critiquing it or finding problems in it. I will also gladly show better algorithms or methods if you want to take advantage of that.

Experience

I've developed a commercial embedded C compiler/assembler and IDE with debugger toolset, of which the IDE and debugger are written in C++. I work in the industry writing high tech embedded programs and Windows programs to communicate with the embedded devices.

Publications
Book: Embedded Systems Design using the Rabbit 3000 Microprocessor Authored Chapter 10 in its entirety.

Education/Credentials
BS Computer Engineering

©2016 About.com. All rights reserved.