Re: objects with their Delaunay graphs overlaid.
Franck Kalala <[email protected]>
| Newsgroups | gmane.comp.python.scientific.user |
|---|---|
| Message-ID | <CAN+jCOpDY70nuwXREOujkEnsdmsxJN+C8pQ8pHH4tgc5ohyimQ@mail.gmail.com> |
It does not bring a big change.... 2018-03-14 17:54 GMT+00:00 Thiago Franco Moraes <[email protected]>: > Try to invert the points: > > triangles = tri.Triangulation(points[:,1], points[:,0]) > > On Wed, Mar 14, 2018 at 2:16 PM Franck Kalala Mutombo <[email protected]> > wrote: > >> Thank you Thiago, >> >> It is working but the triangulation goes out of the object for some >> points and is that I wanted to avoid compare the image I attached. >> >> Best >> >> - >> Franck Kalala Mutombo, (PhD. Mathematics ) >> +243(04)844140 411 | +27(0)7646 91608 >> skype: franckm4 >> >> "*No one knows the future, however, but this does not prevent us to >> project** in it and to act as if we control it*" >> >> >> On 14 March 2018 at 16:42, Thiago Franco Moraes <[email protected]> >> wrote: >> >>> You have to use plt.triplot. Also, you can use >>> matplotlib.tri.Triangulation to triangulate using the delaunay. Something >>> like this: >>> >>> from matplotlib import pyplot as plt >>> >>> from skimage.io import imread >>> from skimage.feature import corner_harris, corner_subpix, corner_peaks, >>> peak_local_max >>> import matplotlib.tri as tri >>> import matplotlib.pyplot as plt >>> >>> image = imread("cup.png", as_grey='True') >>> points = peak_local_max(corner_harris(image), min_distance=2) >>> triangles = tri.Triangulation(points[:,0], points[:,1]) >>> fig, ax = plt.subplots() >>> ax.imshow(image, interpolation='nearest', cmap=plt.cm.gray) >>> ax.triplot(triangles) >>> plt.show() >>> >>> >>> >>> >>> On Wed, Mar 14, 2018 at 1:24 PM Franck Kalala < >>> [email protected]> wrote: >>> >>>> Hello All >>>> >>>> I am not sure this a good place to ask this. I am just making a try. >>>> I have and image and I would like to reproduced the Delaunay graphs >>>> overlaid. >>>> See the attached image for an idea. >>>> >>>> I try the following code: >>>> >>>> from matplotlib import pyplot as plt >>>> >>>> from skimage.io import imread >>>> from skimage.feature import corner_harris, corner_subpix, corner_peaks, >>>> peak_local_max >>>> from scipy.spatial import Delaunay >>>> import matplotlib.pyplot as plt >>>> >>>> image = imread("cup.png", as_grey='True') >>>> >>>> >>>> #points = corner_peaks(corner_harris(image), min_distance=1) >>>> points = peak_local_max(corner_harris(image), min_distance=2) >>>> #coords_subpix = corner_subpix(image, coords, window_size=13) >>>> tri = Delaunay(points) >>>> >>>> #imgplot = plt.imshow(image,cmap='gray') >>>> #plt.triplot(points[:,0], points[:,1], tri.simplices.copy()) >>>> #plt.plot(points[:,0], points[:,1], 'o') >>>> #plt.show() >>>> #print(image) >>>> >>>> coords = peak_local_max(corner_harris(image), min_distance=2) >>>> coords_subpix = corner_subpix(image, coords, window_size=13) >>>> >>>> fig, ax = plt.subplots() >>>> ax.imshow(image, interpolation='nearest', cmap=plt.cm.gray) >>>> ax.plot(coords[:, 1], coords[:, 0], '.b', markersize=3) >>>> #ax.plot(coords_subpix[:, 1], coords_subpix[:, 0], '+r', markersize=15) >>>> #ax.axis((0, 350, 350, 0)) >>>> plt.show() >>>> >>>> >>>> this code does not help. I attach also the cup image for a try. >>>> >>>> best >>>> >>>> franck >>>> _______________________________________________ >>>> SciPy-User mailing list >>>> [email protected] >>>> https://mail.python.org/mailman/listinfo/scipy-user >>>> >>> >>> _______________________________________________ >>> SciPy-User mailing list >>> [email protected] >>> https://mail.python.org/mailman/listinfo/scipy-user >>> >>> >> _______________________________________________ >> SciPy-User mailing list >> [email protected] >> https://mail.python.org/mailman/listinfo/scipy-user >> > > _______________________________________________ > SciPy-User mailing list > [email protected] > https://mail.python.org/mailman/listinfo/scipy-user > > _______________________________________________ SciPy-User mailing list [email protected] https://mail.python.org/mailman/listinfo/scipy-user