예제 #1
0
        int FindY(CalibrationPoint cp1, CalibrationPoint cp2, int x)
        {
            //y = ax + b
            //b = y - (ax)

            float a = (cp2.WebcamY - cp1.WebcamY) / (cp2.WebcamX - cp1.WebcamX);
            float b = cp1.WebcamY - a * cp1.WebcamX;

            return (int)(a * x + b);
        }
예제 #2
0
        int FindX(CalibrationPoint cp1, CalibrationPoint cp2, int y)
        {
            //y = ax + b
            //b = y - (ax)

            //x = (y - b) / a

            float a = (cp2.WebcamY - cp1.WebcamY) / (cp2.WebcamX - cp1.WebcamX);
            float b = cp1.WebcamY - a * cp1.WebcamX;

            return (int)((y - b) / a);
        }