24#include "fmi_image_filter.h"
25#include "fmi_image_histogram.h"
29 init_new_image(&temp);
30 canonize_image(source,&temp);
31 canonize_image(source,target);
32 pipeline_process(source,&temp,w,h,histogram_max);
33 pipeline_process(&temp,target,w,h,histogram_min);
34 if (FMI_DEBUG(4)) write_image(
"debug_morph_closing",target,PGM_RAW);
40 init_new_image(&temp);
41 canonize_image(source,&temp);
42 canonize_image(source,target);
43 pipeline_process(source,&temp,w,h,histogram_min);
44 pipeline_process(&temp,target,w,h,histogram_max);
50 register int i, j, k, s, t;
52 copy_image(source, target);
54 for (j = 0; j < target->height; j++) {
55 for (i = 0; i < target->width; i++) {
56 for (k = 0; k < target->channels; k++) {
57 t = get_pixel(target, i, j, k);
58 s = get_pixel(target, i - 1, j, k);
62 put_pixel(target, i, j, k, s);
65 s = get_pixel(target, i, j - 1, k);
69 put_pixel(target, i, j, k, s);
74 for (j = target->height - 1; j >= 0; j--) {
75 for (i = target->width - 1; i > 0; i--) {
76 for (k = 0; k < target->channels; k++) {
77 t = get_pixel(target, i, j, k);
78 s = get_pixel(target, i + 1, j, k);
82 put_pixel(target, i, j, k, s);
85 s = get_pixel(target, i, j + 1, k);
89 put_pixel(target, i, j, k, s);