Ask Your Question
1

How can I imread just an ROI, not the whole image?

asked 2013-03-30 12:55:58 -0600

RubeRad gravatar image

Hey all,

This seems like a really dumb question, but I've searched, and cannot find any answer.

I am working with large images -- or at least large enough that I don't want to load the whole thing into memory -- and I want to process just ROI at a time.

Is there a way in OpenCV to read just a desired ROI into memory? Or do I have to imread the whole thing, copy out my ROI and release the full image?

edit retag flag offensive close merge delete

Comments

1

Actually I think the way you are describing is actually the only possible way. I am doing exactly the same for 5000x5000 and 25000x25000 images.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-03-30 13:20:51 -0600 )edit

Hmmm, maybe a feature request is in order? All it would take would be a flavor of imread with an extra ROI argument

RubeRad gravatar imageRubeRad ( 2013-03-30 14:28:23 -0600 )edit

Then you should try it to implement yourself and file a pull request. :)

StevenPuttemans gravatar imageStevenPuttemans ( 2013-03-30 16:30:22 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
2

answered 2013-04-01 12:20:44 -0600

Seb gravatar image

You still need to read the entire binary file. But you can alter the part where OpenCV build a Mat object. You can just read your ROI from memory and create a smaller Mat object.

edit flag offensive delete link more

Comments

Actually one you know how the binary file structure looks like, shouldn't it be possible to read a partial binary file? Just curious about this too.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-04-01 13:00:41 -0600 )edit

Hi steven, I am also doing assignment on processing Selected ROI from whole image . If you have any idea or sample codes to understand the concept please help me .Thank you !!

Sharath gravatar imageSharath ( 2013-04-01 20:05:45 -0600 )edit

Like i already suggested above, only way it is working now is defining a rectangle, than using that rectangle to create a region of interest copy of the original Mat image.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-04-02 02:29:06 -0600 )edit

Question Tools

Stats

Asked: 2013-03-30 12:55:58 -0600

Seen: 1,307 times

Last updated: Apr 01 '13