c - Write Portion of an Image to File -


while can write whole image file with

cvsaveimage("image.png", img); 

how can write given rectangle image i'm working on file?

there's mat constructor:

mat(const mat& m, const rect& roi); 

so use it!

or if use c (not c++) interface have set roi (region of interest):

http://nashruddin.com/opencv_region_of_interest_(roi)/

your code should this:

cvsetimageroi(img, rect);//rect roi cvsaveimage("image.png", img); 

if want work again full image have reset roi:

cvresetimageroi( iplimage* img ) 

Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -