added testpattern and implemented scharr