This commit is contained in:
Kq
2026-08-12 03:03:16 +02:00
parent 9e71bf3977
commit c6258cd0ae
2 changed files with 15 additions and 4 deletions
+15 -4
View File
@@ -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<IEnumerable<OpenCvSharp.Point>> 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')
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB