ROPO
Loading...
Searching...
No Matches
fmi_image_filter_line.c
1
21#include "fmi_util.h"
22#include "fmi_image.h"
23#include "fmi_image_filter.h"
24#include "fmi_image_filter_line.h"
25
26/* source = VALUE TO BE PROPAGATED; IF NULL VALUE=1*/
27/* mask = control image */
28
29
30void detect_horz_line_segments(FmiImage *target,FmiImage *trace,unsigned char min_length,unsigned char min_elevation){
31
32 detect_vert_maxima(target,trace); /* fmi_image_filter.h */
33 if (FMI_DEBUG(1)) write_image("maxima",trace,PGM_RAW);
34
35 /* fmi_image_filter.h */
36 mask_image(trace,trace,min_elevation,0);
37 if (FMI_DEBUG(1)) write_image("maxima2",trace,PGM_RAW);
38
39 /* go right, measure segment length... */
40 propagate_right(NULL,trace,trace,1,put_pixel);
41 if (FMI_DEBUG(1)) write_image("prop",trace,PGM_RAW);
42
43 /* ...and spread it back left */
44 propagate_left(trace,trace,trace,0,put_pixel);
45 if (FMI_DEBUG(1)) write_image("prop2",trace,PGM_RAW);
46
47 mask_image(trace,trace,min_length,0);
48}
49
50void detect_horz_edge_segments(FmiImage *target,FmiImage *trace,unsigned char min_length,unsigned char min_elevation){
51
52 detect_horz_edges(target,trace); /* fmi_image_filter.h */
53 if (FMI_DEBUG(1)) write_image("maxima",trace,PGM_RAW);
54
55 /* fmi_image_filter.h */
56 mask_image(trace,trace,min_elevation,0);
57 if (FMI_DEBUG(1)) write_image("maxima2",trace,PGM_RAW);
58
59 /* go right, measure segment length... */
60 propagate_right(NULL,trace,trace,1,put_pixel);
61 if (FMI_DEBUG(1)) write_image("prop",trace,PGM_RAW);
62
63 /* ...and spread it back left */
64 propagate_left(trace,trace,trace,0,put_pixel);
65 if (FMI_DEBUG(1)) write_image("prop2",trace,PGM_RAW);
66
67 mask_image(trace,trace,min_length,0);
68}
69
70void detect_vert_line_segments(FmiImage *target,FmiImage *trace,unsigned char min_length,unsigned char min_elevation){
71 /*int i,j,k,length; */
72 /* const int CRITICAL_LENGTH=4; */
73 /*int g1,g2,gd,gmax; */
74 /* FmiImage trace; */
75 /* canonize_image(target,&trace); */
76 /* info(target); */
77 /*info(trace); */
78
79
80 detect_horz_maxima(target,trace); /* fmi_image_filter.h */
81 if (FMI_DEBUG(1)) write_image("maxima",trace,PGM_RAW);
82
83 /* fmi_image_filter.h */
84 mask_image(trace,trace,min_elevation,0);
85 if (FMI_DEBUG(1)) write_image("maxima2",trace,PGM_RAW);
86
87 /* go right, measure segment length... */
88 propagate_up(NULL,trace,trace,1,put_pixel);
89 if (FMI_DEBUG(1)) write_image("prop",trace,PGM_RAW);
90
91 /* ...and spread it back left */
92 propagate_down(trace,trace,trace,0,put_pixel);
93 if (FMI_DEBUG(1)) write_image("prop2",trace,PGM_RAW);
94
95 mask_image(trace,trace,min_length,0);
96 /*release_image(trace); */
97}
98