# Revision history [back]

### how to turn contours into vectors?

Hi

I have a simple irregular shape. I have a broken edges of this shape in black and white after pre-processing it. I extracted the contours from this image.

I want to convert this contour to a simple vector.

Any help as to how I can do this?????

### how to turn contours into vectors?

Hi

I have a simple irregular shape. I have a broken edges of this shape in black and white after pre-processing it. I extracted the contours from this image.

I want to convert this contour to a simple vector.

Any help as to how I can do this?????

Example: Image of a stone

This is the edge extracted image I have got after pre processing

Here's the code I'm using to access the contours

ret, thresh = cv2.threshold(dnoise,127,255,0)
dnoise, contours, hieararchy = cv2.findContours(thresh,cv2.RETR_TREE,cv2.CHAIN_APPROX_NONE)

print(contours)
for ar_i, arr in enumerate(contours):
for row_i, row in enumerate(arr):
if (row_i==0):
for el in row:
print("\n",format(el))


### how to turn contours into vectors?

Hi

I have a simple irregular shape. I have a broken edges of this shape in black and white after pre-processing it. I extracted the contours from this image.

I want to convert this contour to a simple vector.

Any help as to how I can do this?????

Example: Image of a stone

This is the edge extracted image I have got after pre processing

Here's the code I'm using to access the contours

ret, thresh = cv2.threshold(dnoise,127,255,0)
dnoise, contours, hieararchy = cv2.findContours(thresh,cv2.RETR_TREE,cv2.CHAIN_APPROX_NONE)

print(contours)
for ar_i, arr in enumerate(contours):
for row_i, row in enumerate(arr):
if (row_i==0):
for el in row:
print("\n",format(el))


I don't want to use inbuilt ellipse function in cv!

### how to turn contours into vectors?

Hi

I have a simple irregular shape. I have a broken edges of this shape in black and white after pre-processing it. I extracted the contours from this image.

I want to convert this contour to a simple vector.vector(least number of points with which I can reconstruct the edges again).

Any help as to how I can do this?????

Example: Image of a stone

This is the edge extracted image I have got after pre processing

Here's the code I'm using to access the contours

ret, thresh = cv2.threshold(dnoise,127,255,0)
dnoise, contours, hieararchy = cv2.findContours(thresh,cv2.RETR_TREE,cv2.CHAIN_APPROX_NONE)

print(contours)
for ar_i, arr in enumerate(contours):
for row_i, row in enumerate(arr):
if (row_i==0):
for el in row:
print("\n",format(el))


I don't want to use inbuilt ellipse function in cv!

 5 retagged sturkmen 6772 ●3 ●48 ●79 https://github.com/stu...

### how to turn contours into vectors?

Hi

I have a simple irregular shape. I have a broken edges of this shape in black and white after pre-processing it. I extracted the contours from this image.

I want to convert this contour to a simple vector(least number of points with which I can reconstruct the edges again).

Any help as to how I can do this?????

Example: Image of a stone

This is the edge extracted image I have got after pre processing

Here's the code I'm using to access the contours

ret, thresh = cv2.threshold(dnoise,127,255,0)
dnoise, contours, hieararchy = cv2.findContours(thresh,cv2.RETR_TREE,cv2.CHAIN_APPROX_NONE)

print(contours)
for ar_i, arr in enumerate(contours):
for row_i, row in enumerate(arr):
if (row_i==0):
for el in row:
print("\n",format(el))


I don't want to use inbuilt ellipse function in cv!