setting an ROI in C++.net

Ask questions on using Emgu CV with C++

setting an ROI in C++.net

Postby mfg » Wed Dec 03, 2008 10:50 am

hi all,

im trying to set an ROI on the left border in an existing image with the following code:
Code: Select all
Emgu::CV::Image<Bgr^, Byte>^ img_work;
// .. create image ...
img_work->ROI = gcnew Emgu::CV::Rectangle<double>^(0,100,0,img_work->Height);
img_work = img_work->SmoothBlur(10,10);

when i try to execute this code, an unhandled exception occours with this message:
OpenCV: Bad input roi

does anybody know why this is not working?

Thanks, Fred.
mfg
 
Posts: 3
Joined: Wed Dec 03, 2008 10:37 am

Re: setting an ROI in C++.net

Postby mfg » Wed Dec 03, 2008 12:19 pm

hi all,

after an long trial and error marathon, i found out that the following code will work:
Code: Select all
img_work->ROI = gcnew Emgu::CV::Rectangle<double>(MCvRect(0, 0, 100, 100));
img_work->SmoothBlur(9,9)->CopyTo(img_work);
img_work->ROI = nullptr;

this code will smooth an area of 100x100 Pix at the left upper corner.

maybe the (obsolete) Rectangle<(Of <(T>)>)(T, T, T, T) constructor dont work, or i dont unterstand how to use it... i dont know...

( ok-ok-ok - in the first message, the SmoothBlur(10,10) throws also an exception, and the '^' after Rectangle<double> was false... :oops: )

Greetings from rainy Austria, Fred.
mfg
 
Posts: 3
Joined: Wed Dec 03, 2008 10:37 am

Re: setting an ROI in C++.net

Postby canming » Wed Dec 03, 2008 10:10 pm

maybe the (obsolete) Rectangle<(Of <(T>)>)(T, T, T, T) constructor dont work, or i dont unterstand how to use it... i dont know...

The original Rectangle has a constructor that accept 4 parameters in order different than the MCvRect, to avoid confusion, It has been obsoleted in 1.4.0.0 and it will be removed from 1.5.0.0.

the SmoothBlur(10,10) throws also an exception

It is because the cvSmooth function in OpenCV only accepts odd kernel size.
canming
Site Admin
 
Posts: 873
Joined: Thu Feb 28, 2008 4:16 pm


Return to C++ Help

Who is online

Users browsing this forum: No registered users and 1 guest