我没有csc var的csc错误问题

时间:2019-10-21 22:08:46

标签: c#

#include

Servo serX;
Servo serY;

String tempModify;

void setup() {
    serX.attach(11);
    serY.attach(10);
    Serial.begin(9600);
    Serial.setTimeout(10);
}

void loop() {
    //lol
}

void serialEvent() {
    tempModify = Serial.readString();
    serX.write(parseDataX(tempModify));
    serY.write(parseDataY(tempModify));
}

int parseDataX(String data){
    data.remove(data.indexOf(":"));
    data.remove(data.indexOf("X"), 1);
    return data.toInt();
}

int parseDataY(String data){
    data.remove(0,data.indexOf(":") + 1);
    data.remove(data.indexOf("Y"), 1);
    return data.toInt()

    X(X position):Y(Y Position)



    public static class ImageRecognition
{
    private static List<PointF> facePositions = new List<PointF>();
    private static GpuCascadeClassifier classifier  = new GpuCascadeClassifier(@"haarcascade_frontalface_default.xml");

    public static Image<Bgr, byte> detectFace(Image<Bgr, byte> image, out List<PointF> positions)
    {
        Image<Bgr, byte> copyImage = new Image<Bgr, byte>(image.Bitmap);
        facePositions.Clear();

        using (GpuImage<Bgr, Byte> gpuImage = new GpuImage<Bgr, byte>(image))
        using (GpuImage<Gray, Byte> gpuGray = gpuImage.Convert<Gray, Byte>())
        {
            foreach (var face in classifier.DetectMultiScale(gpuGray, 1.2, 10, Size.Empty))
            {
                copyImage.Draw(face, new Bgr(Color.Red), 4);
                facePositions.Add(new PointF(face.Location.X + (face.Width / 2), face.Location.Y + (face.Height / 2)));
            }
            positions = facePositions;
        }
        return copyImage;
    }
}



classifier.DetectMultiScale(gpuGray, 1.2, 10, Size.Empty)



foreach (var face in classifier.DetectMultiScale(gpuGray, 1.2, 10, Size.Empty))
{
    copyImage.Draw(face, new Bgr(Color.Red), 4);
    facePositions.Add(new PointF(face.Location.X + (face.Width / 2), face.Location.Y + (face.Height / 2)));
}



private Point calculatePoint(PointF point)
{
    return (new Point(((int)(settings.xRightCalibration - (point.X / xScaleConst))), ((int)(settings.yTopCalibration - (point.Y / yScaleConst)))));
}



private void calculateDivisionConstants()
{
    xScaleConst = (captureFrameWidth) / (settings.xRightCalibration - settings.xLeftCalibration);
    yScaleConst = (captureFrameHeight) / (settings.yTopCalibration - settings.yBotCalibration);
}



private Point calculatePoint(PointF point)
{
    return (new Point(((int)(settings.xRightCalibration - (point.X / xScaleConst))), ((int)(settings.yTopCalibration - (point.Y / yScaleConst)))));
}
w


private void sendSignal(Point currentPoint)
{
    serialPort.Write("X" + (currentPoint.X + settings.xShift).ToString() + ":Y" + (currentPoint.Y + settings.yShift).ToString());
}

此代码可以识别面部并跟踪面部,但出现此错误:

  

'csc'不被识别为内部或外部命令,可操作   程序或批处理文件。

但是没有名为“ csc”的变量。

1 个答案:

答案 0 :(得分:0)

csc是C#编译器的名称。如果您遇到该错误,则说明您的构建环境有问题。 Visual Studio应该为您解决这一问题。如果您使用的是msbuild,也许您的PATH变量是错误的?