medfilt

Functions

int main(int argc, char *argv[])

medfilt [ option ] [ infile ]

  • -l int

    • length of vector \((1 \le M + 1)\)

  • -m int

    • order of vector \((0 \le M)\)

  • -k int

    • order of filter \((0 \le K)\)

  • -w int

    • way to apply filter

      • 0 each dimension

      • 1 across dimension

  • -magic double

    • magic number

  • infile str

    • double-type data sequence

  • stdout

    • double-type filtered data sequence

echo 1 3 5 7 | x2x +ad | medfilt -w 0 -l 1 -k 2 | x2x +da
# 2 3 5 6
echo 1 2 3 4 5 6 7 8 | x2x +ad | medfilt -w 0 -l 2 | x2x +da
# 2 3 3 4 5 6 6 7
echo 1 2 3 4 5 6 7 8 | x2x +ad | medfilt -w 1 -l 2 | x2x +da
# 2.5 3.5 5.5 6.5
Parameters:
  • argc[in] Number of arguments.

  • argv[in] Argument vector.

Returns:

0 on success, 1 on failure.

See also

median

class MedianFilter : public sptk::InputSourceInterface

Apply a median filter to signals.

Public Functions

MedianFilter(int num_input_order, int num_filter_order, InputSourceInterface *input_source, bool apply_each_dimension, bool use_magic_number, double magic_number = 0.0)
Parameters:
  • num_input_order[in] Order of input, \(M\).

  • num_filter_order[in] Order of filter.

  • input_source[in] Input data sequence.

  • apply_each_dimension[in] Whether to apply filter to each dimension.

  • use_magic_number[in] Whether to use a magic number.

  • magic_number[in] A magic number.

inline int GetNumInputOrder() const
Returns:

Order of input.

inline int GetNumFilterOrder() const
Returns:

Order of median filter.

inline double GetMagicNumber() const
Returns:

Magic number.

inline virtual int GetSize() const override
Returns:

Output size.

inline virtual bool IsValid() const override
Returns:

True if this object is valid.

virtual bool Get(std::vector<double> *output) override
Parameters:

output[out] Filtered input.

Returns:

True on success, false on failure.