Let edge_image
be the edges calculated from a call to say cv2.Canny()
. According to the docs, I can calculate contours in Python using say (this is for version 3):
im2, contours, hierarchy = cv2.findContours(edge_image , cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
I understand what is returned in contours
and hierarchy
, but the docs only say that im2
is the "modified image", but they do not say how modified. Does im2 contain the edges modified by the contours. If not, what does it contain. And if not, if I want to create an edge-matrix from then contours, then I would have to create an matrix of the correct size, read the positions of each, and modify the matrix to have an edge at that location. I do not just want to draw the contours, I want to be able to store an edge-matrix with the edges now defined by the contours. If that is what is contained in im2
than I can just extract the values from that, but it is not at all clear, and web searches have not turned up anything useful.
Thanks for any help.