Jan-01-2017, 02:19 PM
(This post was last modified: Jan-01-2017, 02:20 PM by Standard_user.)
Good day,
let's say I have an image:
How do I extract each coin and stitch up a new image, like this:
I was able to draw contours around each coin:
But where do I go further? Not asking to write code for me, just for a few hints, because this area is totally new for me.
let's say I have an image:
How do I extract each coin and stitch up a new image, like this:
I was able to draw contours around each coin:
import cv2 im = cv2.imread('pic.jpg') imgray = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY) ret,thresh = cv2.threshold(imgray, 127, 255, 0) contours = cv2.findContours(thresh, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) cv2.drawContours(im, contours[1], -1, (0, 255, 0), 3) cv2.imshow('', im) cv2.waitKey(0)Result:
But where do I go further? Not asking to write code for me, just for a few hints, because this area is totally new for me.