question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Find the inner and outer contour of a set of points

See original GitHub issue

Hi again @marcomusy. I have a set of points that I want to find the inner and outer contour of these points. This means the inner and outer contour of the red points below. The points order aren’t organized. This is so I can compute the deviation between the outer and inner contour to the blue lines. I have tried to reconstruct a surface of the points with recoSurface(pts), and tried to find the boundaries of the mesh, but I didnt suceed since the mesh was so coarse for my points. Also creating the surface with delauney2d. I have tried to reconstruct the same issue with some code below. In advance, thank you! image

from vedo import *

cyl1  = Cylinder(pos=(0,0,0), r=2, height=4, axis=(1,0,0), alpha=.5, cap=0, res=100).triangulate()
cyl2 = Cylinder(pos=(0,0,2), r=1, height=3, axis=(0,0.3,1), alpha=.5, cap=0, res=100).triangulate()
cyl3 = Cylinder(pos=(0,0,2), r=1.1, height=3, axis=(0,0.3,1), alpha=.5, cap=0, res=100).triangulate()
intersect_1 = cyl1.intersectWith(cyl2).join(reset=True).c('b')
intersect_2 = cyl1.intersectWith(cyl3).join(reset=True).c('b')
#show(cyl1,cyl2,cyl3, intersect_1, intersect_2).close()

#Trying to cut out the the surface between the two intersect lines
surf = cyl1.clone()
surf.cutWithMesh(cyl3, invert= True) #These two lines doesn't work for me, to cut out the section between cyl2 and cyl3? Have I done it wrong?
surf.cutWithMesh(cyl2, invert= True) # I tried using the cutWithCylinder also, instead of mesh, but the cut did end up with the same as cutWithMesh. An empty mesh.
show(surf,cyl2, cyl3).close()

#when figuring what I have done wrong with cutWithMesh, extract the points of the surf and find the countour. Maybe randomize the order of the points.
pts = v.Points(surf.points())

#find a way to find the inner and outer contour?



image

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
eivindtncommented, May 24, 2021

I understand. As always, gratitude for the fast response!

1reaction
marcomusycommented, May 23, 2021

…well it gives everything including the scaling, if you set rigid=True then this scaling should be one.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to determine between inner and outer contour with ...
To determine what contours are IN and OUT, you can simply use contour hierarchy to differentiate between the two. Specifically, when using cv2....
Read more >
Contour Features - OpenCV
To find the different features of contours, like area, perimeter, centroid, bounding box etc; You will see plenty of functions related to contours....
Read more >
Finding extreme points in contours with OpenCV
Learn how to extract the top-most (north), bottom-most (south), right-most (east), and left-most (west) extreme points from a contour using ...
Read more >
Finite point sets in recognizing location and orientation of ...
The developed method is based on matching the finite set of points retrieved from the external contour of the classified object.
Read more >
Find Co-ordinates of Contours using OpenCV | Python
Approach : The Co-ordinates of each vertices of a contour is hidden in the contour itself. In this approach, we will be using...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found