Quantcast

how to crop a regior from image in openCV

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

how to crop a regior from image in openCV

nikson_sust

i need to crop a section from the image which contain the object. but i can't. i am new with OpenCV. please anybody tell me it step by step.

thanks
Nikson

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to crop a regior from image in openCV

martin_savc
You didn't say, but I will that you already found the region you are looking for. Now you want to know, how to use that region on an image - how to set the region of interest (ROI). The new c++ api has a very simple way to set ROI, but its not as explicit as the C api. Here is the code, a similar one can also be found in the C++ cheat sheet:

Mat image = ...; // my image
Rect roi = ...; // the region of interest i want to set,
Mat cropped_image = image(roi); // cropping the image, aka setting the ROI

I you are also interested in how to find you ROI, you should give some more details on what kind of object you are detecting and whats your preferred detection method.
 
Hope it helps,
matrin

--- In [hidden email], "nikson_sust" <boss_nikson@...> wrote:
>
>
> i need to crop a section from the image which contain the object. but i can't. i am new with OpenCV. please anybody tell me it step by step.
>
> thanks
> Nikson
>


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to crop a regior from image in openCV

nikson_sust

thank you. its help me.


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to crop a regior from image in openCV

nikson_sust
In reply to this post by martin_savc
thank you. its help me.

--- In [hidden email], "martin_savc" <martin.savc@...> wrote:

>
> You didn't say, but I will that you already found the region you are looking for. Now you want to know, how to use that region on an image - how to set the region of interest (ROI). The new c++ api has a very simple way to set ROI, but its not as explicit as the C api. Here is the code, a similar one can also be found in the C++ cheat sheet:
>
> Mat image = ...; // my image
> Rect roi = ...; // the region of interest i want to set,
> Mat cropped_image = image(roi); // cropping the image, aka setting the ROI
>
> I you are also interested in how to find you ROI, you should give some more details on what kind of object you are detecting and whats your preferred detection method.
>  
> Hope it helps,
> matrin
>
> --- In [hidden email], "nikson_sust" <boss_nikson@> wrote:
> >
> >
> > i need to crop a section from the image which contain the object. but i can't. i am new with OpenCV. please anybody tell me it step by step.
> >
> > thanks
> > Nikson
> >
>


Loading...