Moved blur detection functions to Cpp source (they will be executed everytime so they ought to be efficient).