This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// A callback handler specifically for rapid image capture from the camera's video port. | |
/// </summary> | |
public class FastImageOutputCallbackHandler : DefaultOutputCallbackHandler | |
{ | |
private static DateTime _start; | |
private static int _fps; | |
/// <summary> | |
/// Creates a new instance of <see cref="FastImageOutputCallbackHandler"/>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async Task PicAndVid() | |
{ | |
using (var imgCaptureHandler = new ImageStreamCaptureHandler("/home/pi/images/", "jpg")) | |
using (var vidCaptureHandler = new VideoStreamCaptureHandler("/home/pi/videos/", "avi")) | |
using (var splitter = new MMALSplitterComponent(null)) | |
using (var imgEncoder = new MMALImageEncoder(imgCaptureHandler, continuousCapture: true)) | |
using (var vidEncoder = new MMALVideoEncoder(vidCaptureHandler)) | |
using (var nullSink = new MMALNullSinkComponent()) | |
{ | |
cam.ConfigureCameraSettings(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Diagnostics; | |
using System.Drawing; | |
using System.IO; | |
using Accord.Vision.Detection; | |
using MMALSharp.Handlers; | |
using SixLabors.ImageSharp; | |
using SixLabors.ImageSharp.PixelFormats; | |
using Image = SixLabors.ImageSharp.Image; |