fix detect_text() Py<->C++ conversion