ROI with Quad or irregular shapes

Hi, i need to do a crop of an image using ROI , i would like to know if its possible to use a quad instead a rectangle o a irregular shape.

How can i use a quad?



Hey Adam,

if you are working with ofxCvImages you can use the techniques from this thread:’s-blob-detection/6151/4

if you are drawing an image or a texture, perhaps setting your own texture coordinates would work:

something like this, off the top of my head:

ofPoint pointsOnTheImage[4];  
ofPoint pointsOnTheScreen[4];  
//... fill out these ^ with points in 4 corners  
//like so:  
//  1---2  
//  |   |  
//  4---3  
pointsOnTheImage[0] = ofPoint(0, 0);  
pointsOnTheScreen[0] = ofPoint(20, 20);  
//then draw  
for(int i = 0; i < 4; i++){  
    glTexCoord2f(pointsOnTheImage[i].x, pointsOnTheImage[i].y);  

or if you need a perspective warp you can look at this thread for doing more “projection mapping” type of quad distortion:

hope this helps