@@ -38,45 +38,44 @@ using System.Threading;
3838using SeeShark ;
3939using SeeShark .FFmpeg ;
4040
41- namespace YourProgram
41+ namespace YourProgram ;
42+
43+ // This program will display camera frames info for 10 seconds.
44+ class Program
4245{
43- // This program will display camera frames info for 10 seconds.
44- class Program
46+ static void Main (string [] args )
4547 {
46- static void Main (string [] args )
47- {
48- // Create a CameraManager to manage camera devices
49- using var manager = new CameraManager ();
48+ // Create a CameraManager to manage camera devices
49+ using var manager = new CameraManager ();
5050
51- // Get the first camera available
52- using var camera = manager .GetCamera (0 );
51+ // Get the first camera available
52+ using var camera = manager .GetCamera (0 );
5353
54- // Attach your callback to the camera's frame event handler
55- camera .OnFrame += FrameEventHandler ;
54+ // Attach your callback to the camera's frame event handler
55+ camera .OnFrame += frameEventHandler ;
5656
57- // Start decoding frames asynchronously
58- camera .StartCapture ();
57+ // Start decoding frames asynchronously
58+ camera .StartCapture ();
5959
60- // Just wait a bit
61- Thread .Sleep (TimeSpan .FromSeconds (10 ));
60+ // Just wait a bit
61+ Thread .Sleep (TimeSpan .FromSeconds (10 ));
6262
63- // Stop decoding frames
64- camera .StopCapture ();
65- }
63+ // Stop decoding frames
64+ camera .StopCapture ();
65+ }
6666
67- // Create a callback for decoded camera frames
68- public static void FrameEventHandler (object ? _sender , FrameEventArgs e )
69- {
70- // Only care about new frames
71- if (e .Status != DecodeStatus .NewFrame )
72- return ;
67+ // Create a callback for decoded camera frames
68+ private static void frameEventHandler (object ? _sender , FrameEventArgs e )
69+ {
70+ // Only care about new frames
71+ if (e .Status != DecodeStatus .NewFrame )
72+ return ;
7373
74- Frame frame = e .Frame ;
74+ Frame frame = e .Frame ;
7575
76- // Get information and raw data from a frame
77- Console .WriteLine ($" New frame ({frame .Width }x{frame .Height } | {frame .PixelFormat })" );
78- Console .WriteLine ($" Length of raw data: {frame .RawData .Length } bytes" );
79- }
76+ // Get information and raw data from a frame
77+ Console .WriteLine ($" New frame ({frame .Width }x{frame .Height } | {frame .PixelFormat })" );
78+ Console .WriteLine ($" Length of raw data: {frame .RawData .Length } bytes" );
8079 }
8180}
8281```
@@ -96,7 +95,7 @@ You can request a feature or fix a bug by reporting an issue.
9695If you feel like fixing a bug or implementing a feature, you can fork this repository and make a pull request at any time!
9796
9897You can also join our discord server where we talk about our different projects.
99- We have a dedicated ** #seeshark ** channel for this one .
98+ We have a dedicated ** #tracking ** channel where we talk about SeeShark, MediaPipe.NET and other related repositories .
10099
101100## License
102101
0 commit comments