1

I'm developing an application to control mouse via webcam, starting from this application

It simply tracks the hand using skin color segmentation, some noise filtering e contour analyzing, then calculate the centroid and assign it to the mouse cursor. Of course in this way the coordinates you get for the centroid of the hand tracked refers to the image frame captured by the webcam and don't correspond to the real screen coordinates, so there will be areas in the screen that you can not reach. Unless you have the same resolution for webcam frame and screen, how could I reach every point in the screen?

EDIT

Was simpler than I was thinking, here solution as proposed in the answer:

            Rectangle resolution = Screen.PrimaryScreen.Bounds;

            int real_X = (int)((Convert.ToDouble(current_X) / frame.Width)*resolution.Width);
            int real_Y = (int)((Convert.ToDouble(current_Y) / frame.Height)*resolution.Height);
rok
  • 2,574
  • 3
  • 23
  • 44

1 Answers1

2

How does a touchpad solve this, or a graphic tablet? They will also produce absolute coordinates. Why don't you just apply a simple mapping, for example by normalizing the coordinates from the webcam and then multiplying again by the resolution of the monitor?

I don't see the problem actually, so am I missing something?

Diederik
  • 136
  • 3