step1:copy demos and set rights
3 |
cp OpenCV-2.1.0/samples/c/*
openCV_samples |
step2:Some of the training data for object detection is stored in /usr/local/share/opencv/haarcascades. You need to tell OpenCV which training data to use. I will use one of the frontal face detectors available. Let’s find a face:
1 |
./facedetect
--cascade= "/usr/local/share/opencv/haarcascades/haarcascade_frontalface_alt.xml" --scale=1.5
lena.jpg |

step3:Note the scale parameter. It allows you to increase or decrease the size of the smallest object found in the image (faces in this case). Smaller numbers allows OpenCV to find smaller faces, which may lead to increasing the number of false detections.
Also, the computation time needed gets larger when searching for smaller objects.
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步