performance improvements
changed mat conversion
improved feature detection