How to put frame from camera into imageBox

Ask questions on using Emgu CV with C++
Post Reply
pawelm85
Posts: 13
Joined: Fri Feb 06, 2009 3:54 am

How to put frame from camera into imageBox

Post by pawelm85 » Sat Mar 07, 2009 12:22 pm

Hi, i've luckily added imageBox to my project. Now i want to put picture from jpg file put into imageBox when i click the button i put on the Form. Could somebody write me a sample code? Thanks in advance.

canming
Site Admin
Posts: 1038
Joined: Thu Feb 28, 2008 4:16 pm

Re: How to put frame from camera into imageBox

Post by canming » Tue Mar 10, 2009 8:54 pm

On the Button Click Event, add the following code:

Code: Select all

myImageBox.Image = gcnew Image<Bgr, Byte>("MyImage.jpg");

pawelm85
Posts: 13
Joined: Fri Feb 06, 2009 3:54 am

Re: How to put frame from camera into imageBox

Post by pawelm85 » Wed Mar 18, 2009 12:36 pm

it doesn't work. I get 102 erors like:
error C3225: generic type argument for 'TColor' cannot be 'Emgu::CV::Bgr', it must be a value type or a handle to a reference type

canming
Site Admin
Posts: 1038
Joined: Thu Feb 28, 2008 4:16 pm

Re: How to put frame from camera into imageBox

Post by canming » Thu Mar 26, 2009 8:16 am

myImageBox.Image = gcnew Image<Bgr, Byte>("MyImage.jpg");
This is the syntax for Emgu CV 1.5, for version 1.4, do the following:

Code: Select all

myImageBox.Image = gcnew Image<Bgr^, Byte>("MyImage.jpg");

pawelm85
Posts: 13
Joined: Fri Feb 06, 2009 3:54 am

Re: How to put frame from camera into imageBox

Post by pawelm85 » Sat Mar 28, 2009 3:34 pm

I can only put sometking like:

private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) {
imageBox1->Image = gcnew Emgu::CV::Image<Bgr^,Byte>("test.jpg");
}

but it doesn't work either.
I can compile program but when i click button program breaks.

Post Reply