Webcam Application
-
I want to draw a rectangle inside webcam application and I have built the camera where should I write the code to insert ROI please help me. My code:
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;namespace Camera_app
{
public partial class Form1 : Form
{
Camera c;
List<Bitmap> imag = new List<Bitmap>();
public Form1()
{
InitializeComponent();
c = new Camera(cbox1);} private void panel1\_Paint(object sender, PaintEventArgs e) { } private void button1\_Click(object sender, EventArgs e) { c.Connect(cbox1, pbox1); } private void button3\_Click(object sender, EventArgs e) { c.Disconnect(); } private void button2\_Click(object sender, EventArgs e) { c.Capture(pbox2); } private void pbox2\_Click(object sender, EventArgs e) { } private void panel3\_Paint(object sender, PaintEventArgs e) { } private void panel3\_Paint\_1(object sender, PaintEventArgs e) { } private void pbox3\_Click(object sender, EventArgs e) { } private void panel5\_Paint(object sender, PaintEventArgs e) { } }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;namespace Camera_app
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
} -
I want to draw a rectangle inside webcam application and I have built the camera where should I write the code to insert ROI please help me. My code:
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;namespace Camera_app
{
public partial class Form1 : Form
{
Camera c;
List<Bitmap> imag = new List<Bitmap>();
public Form1()
{
InitializeComponent();
c = new Camera(cbox1);} private void panel1\_Paint(object sender, PaintEventArgs e) { } private void button1\_Click(object sender, EventArgs e) { c.Connect(cbox1, pbox1); } private void button3\_Click(object sender, EventArgs e) { c.Disconnect(); } private void button2\_Click(object sender, EventArgs e) { c.Capture(pbox2); } private void pbox2\_Click(object sender, EventArgs e) { } private void panel3\_Paint(object sender, PaintEventArgs e) { } private void panel3\_Paint\_1(object sender, PaintEventArgs e) { } private void pbox3\_Click(object sender, EventArgs e) { } private void panel5\_Paint(object sender, PaintEventArgs e) { } }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;namespace Camera_app
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}You're going to have to be a bit more specific. Draw a rectangle on WHAT?? The Form? On top of a control?? On top of the video??
A guide to posting questions on CodeProject[^]
Dave Kreskowiak -
You're going to have to be a bit more specific. Draw a rectangle on WHAT?? The Form? On top of a control?? On top of the video??
A guide to posting questions on CodeProject[^]
Dave KreskowiakI am so sry about this . I want to draw an Roi over videosourceplayer of camera actually...
-
I am so sry about this . I want to draw an Roi over videosourceplayer of camera actually...
Well, that's not going to happen in Windows Forms code. Those pixels are owned by the control that is painting the video image and anything you draw on the control will be overwritten over and over again at the frame rate your video is being drawn at. You'd have to use something like AForge.NET or OpenCVSharp to do an overlay. Google for them.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak