more
This commit is contained in:
+15
-4
@@ -22,7 +22,7 @@ namespace BarcodeReaderExample
|
|||||||
|
|
||||||
camera.Set(VideoCaptureProperties.FrameWidth, 1280);
|
camera.Set(VideoCaptureProperties.FrameWidth, 1280);
|
||||||
camera.Set(VideoCaptureProperties.FrameHeight, 720);
|
camera.Set(VideoCaptureProperties.FrameHeight, 720);
|
||||||
camera.Set(VideoCaptureProperties.Fps, 60);
|
camera.Set(VideoCaptureProperties.Fps, 24);
|
||||||
|
|
||||||
|
|
||||||
Mat hey = new Mat("photo.png");
|
Mat hey = new Mat("photo.png");
|
||||||
@@ -39,6 +39,7 @@ namespace BarcodeReaderExample
|
|||||||
|
|
||||||
Cv2.NamedWindow("Camera preview", WindowFlags.AutoSize);
|
Cv2.NamedWindow("Camera preview", WindowFlags.AutoSize);
|
||||||
int photocount = 0;
|
int photocount = 0;
|
||||||
|
Mat src = Cv2.ImRead("test.png");
|
||||||
|
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
@@ -73,6 +74,11 @@ namespace BarcodeReaderExample
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Mat roi = frame[new Rect((int)pos3[0], (int)pos3[1], src.Width, src.Height)];
|
||||||
|
src.CopyTo(roi);
|
||||||
|
|
||||||
|
|
||||||
// DrawLine(location);
|
// DrawLine(location);
|
||||||
|
|
||||||
|
|
||||||
@@ -88,14 +94,19 @@ namespace BarcodeReaderExample
|
|||||||
IEnumerable<IEnumerable<OpenCvSharp.Point>> contours = new[] { points1 };
|
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);
|
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.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);
|
//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);
|
Cv2.ImShow("Camera preview", frame);
|
||||||
// Thread.Sleep(1000 / 24);
|
Thread.Sleep(1000 / 24);
|
||||||
// Console.WriteLine("tick");
|
// Console.WriteLine("tick");
|
||||||
int key = Cv2.WaitKey(1);
|
int key = Cv2.WaitKey(1);
|
||||||
if (key == 27 || key == 'q')
|
if (key == 27 || key == 'q')
|
||||||
|
|||||||
Reference in New Issue
Block a user