00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef MR_LAG_H
00020 #define MR_LAG_H
00021
00022 #include <mr_vector.h>
00023 #include <mr_image.h>
00024
00025 #include <mr_lag_segment.h>
00026 #include <mr_lag_section.h>
00027 #include <mr_lag_junction.h>
00028 #include <mr_lag_component.h>
00029
00030 #include <mr_line.h>
00031
00032 #ifdef __cplusplus
00033 extern "C"
00034 {
00035 #endif
00036
00037 typedef struct MrLag MrLag;
00038
00046 struct MrLag
00047 {
00049 MrVector* segments;
00051 MrVector* sections;
00053 MrVector* junctions;
00056 MrVector* filaments;
00059 MrVector* chains;
00060
00062 unsigned int w;
00064 unsigned int h;
00065
00067 unsigned int staff_line_thickness;
00069 unsigned int staff_spacing;
00070 };
00071
00072
00073
00075 MrLag* mr_lag_new(unsigned int w, unsigned int h);
00076
00078 void mr_lag_free(void *p);
00079
00082
00084 short int mr_lag_extract_segments(MrLag*, MrImage*);
00086 void mr_lag_build_lag(MrLag* lag);
00088 void mr_lag_filament_detection(MrLag* lag);
00090 void mr_lag_build_chain(MrLag* lag);
00094 void mr_lag_build_staff_line(MrLag* lag, MrVector* lines);
00096 void mr_lag_remove_filaments_in_staff_line(MrLag* lag, unsigned int y);
00099 void mr_lag_remove_filaments_in_staff_lines(MrLag* lag, MrVector* lines);
00100
00101 void mr_lag_bar_detection(MrImage* image, MrLine* bb);
00102
00104 void mr_lag_extract_component(MrLag* lag, MrVector* components);
00105
00110
00112 void mr_lag_add_segment(MrLag* lag, MrLagSegment* segment, unsigned int j);
00114 MrLagSection* mr_lag_add_section(MrLag* lag, MrLagSegment* segment);
00116 MrLagJunction* mr_lag_create_junction(MrLag* lag,
00117 MrLagSection* left_section,
00118 MrLagSection* right_section);
00121 unsigned int length_chain(MrVector* chain);
00122
00126 unsigned int mr_lag_chain_horizontal_line(MrVector* chain);
00127
00129 void mr_lag_remove_sections_on_image(MrLag* lag, MrImage* img);
00131 void mr_lag_remove_section_on_image(MrLag* lag, MrLagSection* section, MrImage* img);
00133 void mr_lag_remove_segment_on_image(MrLag* lag, MrLagSegment* segment, MrImage* img);
00134
00137 #ifdef __cplusplus
00138 }
00139 #endif
00140
00141 #endif