Skip to content

Instantly share code, notes, and snippets.

View jeanpat's full-sized avatar

Pommier jeanpat

View GitHub Profile
@jeanpat
jeanpat / Combination_Area_sort.py
Last active December 9, 2015 16:28
This script generates N random points in a plane, then it builds all the combinations of two (three or four) points in N points. The function nclosestpoints, returns the n closest pair of points . The function nsmallesttriangles returns the n smallest triangles according to their area. The function trianglesbellow returns all triangles with an a…
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 14 22:02:31 2012
@author: Jean-Patrick
"""
import random
import itertools as it
@jeanpat
jeanpat / QuadrilateralArea.py
Last active December 9, 2015 20:58
Given four points in a plane, defined by their coordinates, there are 4!=24 permutations of those points. The scripts computes the area of the 24 different quadrilaterals with the shoelace formula and plot them. The maximal area found, seems to correspond to non self crossing direct quadrilaterals.
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 18 08:33:15 2012
Modif 3 january 2013 to use matplotlib.patches.Polygon
@author: Jean-Patrick Pommier
Test the shoelace formula to compute the area of a quadrilateral:
. Chose four points
. test if self intersection occurs:
@jeanpat
jeanpat / Shapes-Skeleton.ipynb
Last active December 17, 2015 09:59
A ipython notebook: Skeletons from 2D binary shapes are used to produce a features vector depending on the evolution of the number of endpoints after successive skeleton prunings.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 31 10:40:59 2013
@author: Jean-Patrick Pommier
http://dip4fish.blogspot.fr/2013/01/selecting-simple-quadrilateral-from.html
simpoly :
http://people.virginia.edu/~ll2bf/docs/various/polyarea.html
"""
@jeanpat
jeanpat / LargestBlob
Created June 5, 2013 07:29
ipython notebook. Detect the largest blob in an image and calculate its area.
{
"metadata": {
"name": "largest object"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
@jeanpat
jeanpat / SkeletonToGraph.ipynb
Last active June 11, 2021 11:05
A ipython notebook. Takes an image, converts its skeleton to a networkx graph
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jeanpat
jeanpat / HMT-SE.ipynb
Created June 20, 2013 16:18
Several structuring elements used with hit-or-miss operator implemented in mahotas to detect branched-points and end-points
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jeanpat
jeanpat / pictures.py
Created August 20, 2013 19:52
modified version of kivy-example/demo/pictures/main.py available in kivy package
'''
Pictures demo
=============
This is a basic picture viewer, using the scatter widget.
'''
import os
import kivy
kivy.require('1.0.6')
@jeanpat
jeanpat / pictures.kv
Created August 20, 2013 20:10
Interface file for the pictures.py application. Modified version of kivy-example/demo/pictures/pictures.kv
#:kivy 1.0
#:import kivy kivy
#:import win kivy.core.window
FloatLayout:
canvas:
Color:
rgb: 1, 1, 1
Rectangle:
source: 'data/images/background.jpg'