diff --git a/Program.cs b/Program.cs index 46ad464..073c264 100644 --- a/Program.cs +++ b/Program.cs @@ -22,7 +22,7 @@ namespace BarcodeReaderExample camera.Set(VideoCaptureProperties.FrameWidth, 1280); camera.Set(VideoCaptureProperties.FrameHeight, 720); - camera.Set(VideoCaptureProperties.Fps, 60); + camera.Set(VideoCaptureProperties.Fps, 24); Mat hey = new Mat("photo.png"); @@ -39,6 +39,7 @@ namespace BarcodeReaderExample Cv2.NamedWindow("Camera preview", WindowFlags.AutoSize); int photocount = 0; + Mat src = Cv2.ImRead("test.png"); while (true) @@ -73,6 +74,11 @@ namespace BarcodeReaderExample continue; } + + Mat roi = frame[new Rect((int)pos3[0], (int)pos3[1], src.Width, src.Height)]; + src.CopyTo(roi); + + // DrawLine(location); @@ -88,14 +94,19 @@ namespace BarcodeReaderExample IEnumerable> contours = new[] { points1 }; - Cv2.FillPoly(frame, contours, Scalar.White); + // Cv2.FillPoly(frame, contours, Scalar.White); Cv2.PutText(frame, result.Text, new OpenCvSharp.Point((int)(pos2[0]-pos3[0])/2+(int)pos3[0]-160, (int)(pos2[1]-pos3[1])/2+(int)pos3[1]+60), HersheyFonts.HersheySimplex, 0.8, Scalar.Black, 2); + Console.WriteLine(result.Text); + + + // Cv2.draw + // Cv2.Circle(frame, (int)(RightBottomX), (int)(RightBottomY), 5, Scalar.Green, 2); //Cv2.Rectangle(frame, new Point((int)X, (int)Y), new Point ((int)Width, (int)Height), Scalar.Red, 2); - Console.WriteLine(result.Text); + // Console.WriteLine(result.Text); } @@ -106,7 +117,7 @@ namespace BarcodeReaderExample Cv2.ImShow("Camera preview", frame); - // Thread.Sleep(1000 / 24); + Thread.Sleep(1000 / 24); // Console.WriteLine("tick"); int key = Cv2.WaitKey(1); if (key == 27 || key == 'q') diff --git a/test.png b/test.png new file mode 100644 index 0000000..cbe326c Binary files /dev/null and b/test.png differ