These programs (written in C++ and Python) demonstrate how to use OpenCV to compute and draw Delaunay triangles on an image.
I derived these programs from source code available at http://www.learnopencv.com/delaunay-triangulation-and-voronoi-diagram-using-opencv-c-python/
The full source code for example_draw_delaunay_triangles.cpp is available at http://www.cs.sjsu.edu/~bruce/programs/fall_2016_cs_160/example_draw_delaunay_triangles/example_draw_delaunay_triangles.cpp (right mouse click then select "Save Link As..." to download).
The makefile to build example_draw_delaunay_triangles.cpp is available at http://www.cs.sjsu.edu/~bruce/programs/fall_2016_cs_160/example_draw_delaunay_triangles/Makefile (right mouse click then select "Save Link As..." to download).
The full source code for example_draw_delaunay_triangles.py is available at http://www.cs.sjsu.edu/~bruce/programs/fall_2016_cs_160/example_draw_delaunay_triangles/example_draw_delaunay_triangles.py (right mouse click then select "Save Link As..." to download).
A test image for these programs is available at http://www.cs.sjsu.edu/~bruce/programs/fall_2016_cs_160/example_draw_delaunay_triangles/rob.png (right mouse click then select "Save Link As..." to download).
To build the C++ program, type make at a shell prompt in the same directory containining example_draw_delaunay_triangles and your Makefile.
To run the compiled C++ program, enter example_draw_delaunay_triangles rob.png at a shell prompt inside the directory where your compiled program exists.
To run the Python program type example_draw_delaunay_triangles.py rob.png at a shell prompt inside the directory where you downloaded the Python code.
If you run the compiled version or the Python version, the output will be an image file titled OUTPUT-rob.png
Fall 2016, CS-160:
Lectures:
Assignments:
Handouts:
Programs: