Your question is much to unclear to answer. You should at first learn some OpenCV like from this fine
OpenCV tutorial and than find some possible solution.
Tip: it is better to ask OpenCV questions in some
OpenCV forum because it is a highly specialized library.