Example:Hough transform/C: Difference between revisions
m
Fixed syntax highlighting.
(Transfer example from task:Hough transform) |
m (Fixed syntax highlighting.) |
||
Line 1:
==={{Programming-example-page|Hough transform|language=C}}===
{{trans|Tcl}}
(Tested only with the pentagon image given)
<
#include <stdlib.h>
#include <stdint.h>
Line 118:
return EXIT_SUCCESS;
}</
Output image (but with white background):
Line 125:
<br style="clear:both" />
===
[[file:penta-hugh.png|thumb]][[file:hugh-lines-in.png|thumb]][[file:hugh-lines-out.png|thumb]]
This code is a little to long to my liking, because I had to put some ad hoc stuff that should be better served by libraries. But you don't want to see libpng code here, trust me.
<
#include <stdlib.h>
#include <unistd.h>
Line 380:
/* not going to free memory we used: OS can deal with it */
return 0;
}</
This program takes a pnm file (binary, either P5 or P6) and does the transformation, then dump output onto stdout. Sample images below are output from the pentagram; sample lines with added noise; output of processing that. Both output were with 1.5 gamma.
|