opencv tip, Rect bounding

Sometimes, it causes memory error or unexpected result when we set lager rect size than image.

It is very annoying to always check.

But this tip is very simple and easy.

Plz see the code and result.


cv::Rect bounds(0,0,100,100);
cv::Rect roi(10,10,40,40);
Rect boundedRect = (roi & bounds);
cout << "x = " << boundedRect.x << endl;
cout << "y = " << boundedRect.y << endl;
cout << "width = " << boundedRect.width << endl;
cout << "height = " << boundedRect.height << endl;
 
cv::Rect roi2(-10,10,40,40);
Rect boundedRect2 = (roi2 & bounds);
cout << boundedRect << endl;

cv::Rect roi3(-10,-10,400,40);
cout << (roi3 & bounds) << endl;
...


derivative of tan(x)


google urls of each countries

usa : http://www.google.com/webhp?hl=en
uk: http://www.google.co.uk/webhp?hl=en
australia  :  http://www.google.com.au/webhp?hl=en

france by french   http://www.google.fr/webhp?hl=fr
france by english   http://www.google.fr/webhp?hl=en

japen   http://www.google.co.jp/webhp?hl=ja
japen by english   http://www.google.co.jp/webhp?hl=en