Extend cvRect manually
I am finding the text on business cards and sometimes the bounding box cuts off a part of a letter. How can I go through each Rect
and make it just slightly bigger?
Given a vector of Rects how could I extend the x and y?
please, use the c++ api (cv::Rect), not the outdated c-api (cvRect)
but basically, if you want to extend your rect by Z pixels, you subtract Z from x,y, and add 2*Z to w and h
also, don't forget to check, if your extended Rect is still within the image's boundaries !!
(btw, that card looks like taken straight from 'american psycho'...)
How do I check if the rect is within the image boundaries?
@Luek, just check if extended.x and extended.y are positive and smaller than your card dimensions...
... and x+r.width+2Z and y+r.height+2Z are smaller than your card dimensions...