GFXprim
2D bitmap graphics library with emphasis on speed and correctness
Loading...
Searching...
No Matches
gp_sigma.h
1// SPDX-License-Identifier: LGPL-2.1-or-later
2/*
3 * Copyright (C) 2009-2012 Cyril Hrubis <metan@ucw.cz>
4 */
5
6 /*
7
8 Sigma Lee filter.
9
10 The xrad and yrad denotes radius the filter works on. The number of neighbor
11 pixels is exactly 2 * rad + 1 for both directions.
12
13 The sigma denotes maximal symetric difference of pixels scaled to [0,1]
14 interval. Greater sigma causes results to be closer to mean linear filter.
15
16 The min parameter defines minimial number of pixels that must be in the two
17 sigma iterval, if there is a less pixels in this interval the new pixel
18 value is computed as mean of the surrounding pixels (not including the
19 center one).
20
21 */
22
23#ifndef FILTERS_GP_SIGMA_H
24#define FILTERS_GP_SIGMA_H
25
26#include <filters/gp_filter.h>
27
28int gp_filter_sigma_ex(const gp_pixmap *src,
29 gp_coord x_src, gp_coord y_src,
30 gp_size w_src, gp_size h_src,
31 gp_pixmap *dst,
32 gp_coord x_dst, gp_coord y_dst,
33 int xrad, int yrad,
34 unsigned int min, float sigma,
35 gp_progress_cb *callback);
36
37gp_pixmap *gp_filter_sigma_ex_alloc(const gp_pixmap *src,
38 gp_coord x_src, gp_coord y_src,
39 gp_size w_src, gp_size h_src,
40 int xrad, int yrad,
41 unsigned int min, float sigma,
42 gp_progress_cb *callback);
43
44static inline int gp_filter_sigma(const gp_pixmap *src,
45 gp_pixmap *dst,
46 int xrad, int yrad,
47 unsigned int min, float sigma,
48 gp_progress_cb *callback)
49{
50 return gp_filter_sigma_ex(src, 0, 0, src->w, src->h,
51 dst, 0, 0, xrad, yrad, min, sigma, callback);
52}
53
54static inline gp_pixmap *gp_filter_sigma_alloc(const gp_pixmap *src,
55 int xrad, int yrad,
56 unsigned int min, float sigma,
57 gp_progress_cb *callback)
58{
59 return gp_filter_sigma_ex_alloc(src, 0, 0, src->w, src->h,
60 xrad, yrad, min, sigma, callback);
61}
62
63#endif /* FILTERS_GP_SIGMA_H */
int gp_coord
Integer type for coordinates i.e. x, y, ...
Definition gp_types.h:19
unsigned int gp_size
Integer type for sizes i.e. w, h, ...
Definition gp_types.h:24
Common filter includes.
A pixmap buffer.
Definition gp_pixmap.h:33
uint32_t h
Pixmap height in pixels.
Definition gp_pixmap.h:46
uint32_t w
Pixmap width in pixels.
Definition gp_pixmap.h:44
Progress callback.