Hi
I would like to open USB camera and acquiring images under windows form application. I create an application but the streaming of images is going very slowly (The images appear and disappear in big intervals). Where is my error. Using a console application there is no such a problem. Here is my code.
timer1->Interval = 1; VideoCapture cap(0); Mat frame; private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
timer1->Start();
}
private: System::Void timer1_Tick(System::Object^ sender, System::EventArgs^ e) {
cap.read(frame);
graphics = pictureBox1->CreateGraphics();
System::IntPtr ptr(frame.ptr());
b = gcnew System::Drawing::Bitmap(frame.cols,frame.rows,frame.step,System::Drawing::Imaging::PixelFormat::Format24bppRgb,ptr);
System::Drawing::RectangleF rect(0,0,pictureBox1->Width,pictureBox1->Height);
graphics->DrawImage(b,rect);
pictureBox1->Refresh();
}