In Matlab, there is a function "contour" (Matlab contour). If I use this for my Image, I got what I want. But my goal is to implement such a function to my image editor myself. I read the Matlab's "documentation" for "contour" function and based on that, I used Marching Squares algorithm. Hovewer, my result looks "ugly". Contours are crossing each other and I have very hight number of nested contours, which are eliminated in Matlab. Anyone know about some solution, how to generate contours from grey-scale image with, lets say, every 10th brightness value ?
Asked
Active
Viewed 2,289 times
1
-
I don't understand your question. You are trying to implement the `countour` function again? Take a look at the source of [Octave's contour](http://hg.savannah.gnu.org/hgweb/octave/file/1cc10ce368ea/scripts/plot/contour.m) and [\_\_countour\_\_](http://hg.savannah.gnu.org/hgweb/octave/file/1cc10ce368ea/scripts/plot/private/__contour__.m) then. – carandraug Nov 26 '12 at 13:57
-
Yes.. I am trying to implement contour function. Octave's contour is fine example, but source code is unreadable. I don't know Octave and it's syntax. Looks like "C", but there are lot of function calls, that I don't know. – Martin Perry Nov 26 '12 at 14:15
-
@MartinPerry it's unreadable? It's the same syntax as matlab which you already are familiar with. The main difference there is the use of specific endfor/if/function instead of an all encompassing end keyword. – carandraug Nov 26 '12 at 14:47
-
I dont know Matlab at all... I only used contour function and load image (2 lines of code :)) – Martin Perry Nov 26 '12 at 14:49
1 Answers
0
The openCV source for their contouring algorithm is available
One of the simplest serious algorithms is Paul Bourke's conrec (with source available) or there is a simple discussion of popular approaches at imageprocessingplace

Martin Beckett
- 94,801
- 28
- 188
- 263