こんにちは、ここの例にあるように、1)検出2)分類という2段階に分けてすればいいと思います。いまは2)のほうがうまくいっているようなので、1)のほうに取り組めば解決可能かと思いますがいかがでしょうか?
https://jp.mathworks.com/matlabcentral/fileexchange/72380?s_tid=srchtitle
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!