private static void VideoCapture_ImageGrabbed(object sender, EventArgs e) { Console.WriteLine("reussi"); VideoCapture capture = (VideoCapture)sender; //capture.Grab(); Mat image = new Mat(); capture.Retrieve(image, 0); image.Save("C:/Users/natha/OneDrive/Documents/test/img.png"); Image img = Image.FromFile("C:/Users/natha/OneDrive/Documents/test/img.png"); VisionAPI.MakeAnalysisRequest(img); System.Threading.Thread.Sleep(5000); img.Dispose(); File.Delete("C:/Users/natha/OneDrive/Documents/test/img.png"); }
private static void VideoCapture_ImageGrabbed(object sender, EventArgs e) { string path = "C:/Users/natha/OneDrive/Documents/test/img.png"; /*USe this path for relative path*/ //string folder = path.getdirectoryname(process.getcurrentprocess().mainmodule.filename) + @"\images\"; //string path = folder + @"img.png"; //path.replace(@"\\", @"\"); //does not work yet VideoCapture capture = (VideoCapture)sender; //capture.Grab(); Mat image = new Mat(); capture.Retrieve(image, 0); image.Save(path); Image img = Image.FromFile(path); VisionAPI.MakeAnalysisRequest(img); System.Threading.Thread.Sleep(50000); img.Dispose(); File.Delete(path); }