I'm trying to create a program that recognices faces from streamed video but am starting with still photos so i'll learn from the bottom up my code so far is:
$ dotnet new console -o DetectFaces
$ cd DetectFaces
$ dotnet add package DlibDotNet
using System;
using DlibDotNet;
using DlibDotNet.Extensions;
using Dlib = DlibDotNet.Dlib;
namespace FaceDetector
{
/// <summary>
/// The main program class
/// </summary>
class Program
{
// file paths
private const string inputFilePath = "./input.jpg";
/// <summary>
/// The main program entry point
/// </summary>
/// <param name="args">The command line arguments</param>
static void Main(string[] args)
{
// set up Dlib facedetector
using (var fd = Dlib.GetFrontalFaceDetector())
{
// load input image
var img = Dlib.LoadImage<RgbPixel>(inputFilePath);
// find all faces in the image
var faces = fd.Operator(img);
foreach (var face in faces)
{
// draw a rectangle for each face
Dlib.DrawRectangle(img, face, color: new RgbPixel(0, 255, 255), thickness: 4);
}
// export the modified image
Dlib.SaveJpeg(img, "output.jpg");
$ dotnet run
}
}
}
}
When i try to run it i get the "launch with errors?" message saying "one or more files in your project contain errors. Do you want to launch anyway?" I press yes and get "invalid syntax (FacialRecognitionLearning.py, line 2)". Here is the problem, i have no idea where to even start, i understand that the problem is in line 2 but the code looks exactly like in the example im using to learn from (link bellow). https://medium.com/machinelearningadvantage/detect-faces-with-c-and-dlib-in-only-40-lines-of-code-f0bb1b929133 I've tried google and looking at the comments on the guide but can't seem to fix it, i'm really new at this.