public static List <Mat> LoadVideo() { Emgu.CV.VideoCapture videoCapture; List <Mat> framesFromVideo = new List <Mat>(); FileOp.LoadFromFile((s, path) => { videoCapture = new Emgu.CV.VideoCapture(path); while (true) { Mat mat = new Mat(); videoCapture.Read(mat); if (mat == null || mat.Rows == 0) { return; } framesFromVideo.Add(mat); for (int p = 0; p < 4; p++) { videoCapture.Read(mat); } } }); return(framesFromVideo); }
public static Emgu.CV.Image <Bgr, byte> FromFile() { Emgu.CV.Image <Bgr, byte> loadedImage = null; FileOp.LoadFromFile((s, path) => { var mat = Emgu.CV.CvInvoke.Imread(path, Emgu.CV.CvEnum.ImreadModes.Color); if (mat != null) { loadedImage = mat.ToImage <Bgr, byte>(); } }); return(loadedImage); }