File Exchange

image thumbnail

Circle Median Filter

version 1.0.0.1 (2.39 MB) by Martin Storath
Fast median filter for circle-valued signals and images, e.g. phase data or orientation data

2 Downloads

Updated 26 Nov 2018

GitHub view license on GitHub

This toolbox contains fast algorithms for median filtering of signals and images with values on the unit circle, for example phase or orientation data.

Cite As

Martin Storath, Andreas Weinmann. Fast median filtering for phase or orientation data. IEEE Transactions on Pattern Analysis and Machine Intelligence, 40(3):639-652, 2018

Comments and Ratings (6)

I am afraid that I do not have a solution as it seems to be more related to the mex system than to the implementation of this toolbox.
A possible workaround could be to compile the C++ files on a system with root permission and to copy the precompiled binaries.

Best,
Martin

Jimbo

Hmmm... how do I install on a server, where I don't have root permission?

>> CMF_install
Setting path...
Compile mex files...
Building with 'g++'.
Error using mex
/usr/bin/ld: /tmp/mex_16898772571390606_229064/CMF_library.o: relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /tmp/mex_16898772571390606_229064/CMF_medfiltCirc2DMex.o: relocation R_X86_64_PC32 against symbol `mxGetM' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status

Error in CMF_install (line 13)
mex CXXFLAGS='-O2 -DNDEBUG' CMF_medfiltCirc2DMex.cpp CMF_library.cpp

Thanks for the feedback! I have added the relevant lines to the header.

Best,
Martin

to compile with Microsoft Visual studio :

#include <math.h>
#include <iostream>
#include "time.h"
#include <stdio.h>
#include <limits>
#pragma once
#include <cmath>
#ifndef M_PI
namespace
{
const double M_PI = std::acos(-1.0);
}
#endif

#ifndef INFINITY

const double INFINITY = std::numeric_limits<double>::infinity();

#endif

/*
* Reference implementation of the arc distance median filters

Hi Lennart,

you can simply comment out or delete the lines containing "throw std::invalid_argument ..." in CMF_library.cpp.
The code should still work. Note that this disables the check for correct parameters (odd filter dimensions and filter mask smaller than the image), so that Matlab might crash if you call it with incorrect parameters.

Please let me know if it worked for you.

Best,
Martin

Lennart

Hi Martin, this looks very useful. Thanks for uploading your code. I tried compiling the mex files, but I get an error of which Im not sure how to handle, which I copied below. Maybe I`m missing stdio.h, do you know what that is part of or where I can get it?

Error using mex
CMF_library.cpp: In function 'void checkDims(int, int, int, int)':

CMF_library.cpp:78:15: error: 'invalid_argument' is not a member of 'std'
throw std::invalid_argument( "Invalid input: filter size must be odd.");

CMF_library.cpp:82:15: error: 'invalid_argument'is not a member of 'std'
throw std::invalid_argument( "Invalid input: filter cannot be larger than the image.");

Error in CMF_install (line 13)
mex CXXFLAGS='-O2 -DNDEBUG' CMF_medfiltCirc2DMex.cpp CMF_library.cpp

Updates

1.0.0.1

Updated references

1.0.0.0

- description

1.0.0.0

- updated header for compilation with Visual Studio (thanks to Gianni Schena)

1.0.0.0

- description

1.0.0.0

- updated name

1.0.0.0

- added image

MATLAB Release Compatibility
Created with R2016a
Compatible with any release
Platform Compatibility
Windows macOS Linux