Resize boundaries of object
I have object's bounding rect and contour. I want to use a contour as a mask to enlarge boundaries of this object to the size of bounding rect. In other words if object with green boundary pixels fitted in rectangle is on black background I want to make black pixels green.
How to do that?
This is image after thresholding and applying findContours. I want to use this contour as a mask to extract leaf from original image and expand its boundaries to fill rectangle. I need to perform texture calculations and don't want to have black pixels around.
Can you show your image ?
Ok. Post edited.