Click here to Skip to main content
15,879,474 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
HI Everyone!

I am working in image processing and in this field of programming i am a beginner.
I wanna detect rectangel on picture i am using openCV librarys and C++.
How can i set a ROI on image, with Opencv, if i have white background and about in the center of image i have an rectangle with black background.
The image size is(800*600px) and the rectangel's size (150*150px);
I dont know exactly where is that rectangle in image.
This is a gray scaled image.

Thank you advance!
Posted
Comments
Sergey Alexandrovich Kryukov 29-Apr-12 17:54pm    
And ROI is?.. Return Of Investment? Rate Of Return? Royal Institute of Oil Painters? Risk Of Infection? :-)
--SA
BupeChombaDerrick 29-Apr-12 18:49pm    
ROI is Region Of Interest. Anyways who knows exactly what it means here in the question :-)
Sergey Alexandrovich Kryukov 29-Apr-12 22:43pm    
Thank you very much. Anyway, abbreviations is evil in most cases, and using this one makes a question not quite valid.
--SA
BupeChombaDerrick 30-Apr-12 8:22am    
you are welcome.

Are you asking for an algorithm to detect a rectangle or how to set and unset Region of Interest(ROI)?

use

C++
cvSetImageROI(img,cvRect(x,y,width,height));


to set ROI where img = image, x,y are anchor points for the rectangle

and

C++
cvResetImageROI(img);


to unset ROI

Then all processing will take place within the specified region of interest (ROI).

Hope this helps
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900