Update: Reformating
Update: Alright, solved segfault issue. Detect was declared as returning a Mat but didn't. Mat::release() on nothing causes segfault... you do the maths.