Рисовать точки поверх видео. Microsoft.DirectX.AudioVideoPlayback - C#
Формулировка задачи:
Всем здравствуйте!
Подскажите пожалуйста каким образом можно ставить точки поверх видео?
Для управления видео использую Microsoft.DirectX.AudioVideoPlayback, отображаю видео в panel1.
Точки пытаюсь ставить panel2.CreateGraphics().FillRectangle(Brushes.Red, e.X, e.Y, 10, 10);
Пытался расположить поверх panel1 panel2 с прозрачным стилем. Но panel2, что ни делай не видит видео, а видит сквозь видео panel1.
Спасибо, за любую информацию!
Решение задачи: «Рисовать точки поверх видео. Microsoft.DirectX.AudioVideoPlayback»
textual
Листинг программы
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using Emgu.CV; using Emgu.CV.CvEnum; using Emgu.CV.Structure; using Emgu.CV.UI; using Emgu.CV.Features2D; using Emgu.CV.Util; using System.Threading; namespace WindowsFormsApplication8 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } public Capture capture; public double FrameRate; public double TotalFrames; public double FrameNumber; private void Form1_Load(object sender, EventArgs e) { OpenFileDialog openFileDialog1 = new OpenFileDialog(); DialogResult result = openFileDialog1.ShowDialog(); if (result == DialogResult.OK) { string fileName = openFileDialog1.FileName; capture = new Capture(fileName); FrameRate = capture.GetCaptureProperty(Emgu.CV.CvEnum.CapProp.Fps); TotalFrames = capture.GetCaptureProperty(Emgu.CV.CvEnum.CapProp.FrameCount); timer1.Interval = 1000 / Convert.ToInt16(FrameRate); capture.SetCaptureProperty(CapProp.PosFrames, 0); imageBox1.Image = capture.QueryFrame(); label1.Text = "Total frame: " + TotalFrames.ToString(); label2.Text = "Frame number: " + FrameNumber.ToString(); } } private void My_Timer_Tick(object sender, EventArgs e) { if (imageBox1.Image != null) { imageBox1.Image.Dispose(); } imageBox1.Image = capture.QueryFrame(); FrameNumber = capture.GetCaptureProperty(Emgu.CV.CvEnum.CapProp.PosFrames); label2.Text = "Frame number: " + FrameNumber.ToString(); } private void box_MouseClick(object sender, MouseEventArgs e) { imageBox1.CreateGraphics().FillRectangle(Brushes.Red, e.X, e.Y, 5f, 5f ); } private void button1_Click(object sender, EventArgs e) { timer1.Start(); } private void button2_Click(object sender, EventArgs e) { timer1.Stop(); } } }
ИИ поможет Вам:
- решить любую задачу по программированию
- объяснить код
- расставить комментарии в коде
- и т.д