|
发表于 2013-4-18 16:16:31
|
显示全部楼层
EMCV:可在DSP上运行的OpenCV
尊敬的于老师,
您好!
最新更新的EMCV有做浮点转定点。那
1, 分类器中的值是不是要相应做定点。你的标定长度是多少呢,是22吗,scale 标定是 5吗,
{
{0,
0, 8, 10, 7, -1,
5, 8, 5, 7, 2,
0, 0, 0, 0, 0,
},
-4875, //q22
0,
-1,
22376, //q22
-31894,//q22
以上,我只做了两个数的定点化,其他也要做吗
float threshold;定点
int left;
int right;
float alpha[2]; 定点
2,detect_and_draw(IplImage* img) 这个函数要怎么调用?
void detect_and_draw(IplImage* img) {
CvPoint pt1;
CvPoint pt2;
CvScalar color2 = { 0, 255, 0 };
CvScalar color3 = { 0, 255, 255 };
printf("nihao 3 \\n");
static CvScalar colors[] = { { { 0, 0, 255 } }, { { 0, 128, 255 } }, { { 0,
255, 255 } }, { { 0, 255, 0 } }, { { 255, 128, 0 } }, { { 255, 255,
0 } }, { { 255, 0, 0 } }, { { 255, 0, 255 } } };
int scale = 1.3 * (1 << 5);//这样修改,好像没有结果
printf("scale %d \\n", scale);
IplImage* gray = cvCreateImage(cvSize(img->width, img->height), 8, 1);
IplImage* small_img = cvCreateImage(
cvSize(cvRound(img->width / (scale >> 5)),
cvRound(img->height / (scale >> 5))), 8, 1);
int i;
//cvCvtColor( img, gray, CV_BGR2GRAY );
cvResize(gray, small_img, CV_INTER_LINEAR);
// cvEqualizeHist( small_img, small_img );
cvClearMemStorage(storage);
if (cascade) {
CvSeq* faces = cvHaarDetectObjects(small_img, cascade, storage, scale,
2, 0/*CV_HAAR_DO_CANNY_PRUNING*/, cvSize(30, 30));
for (i = 0; i < (faces ? faces->total : 0); i++) {
CvRect* r = (CvRect*) cvGetSeqElem(faces, i);
CvPoint center;
int radius;
center.x = cvRound((r->x + r->width * 0.5) * (scale >> 5));
center.y = cvRound((r->y + r->height * 0.5) * (scale >> 5));
printf("r->x %d r->x %d \\n", r->x, r->x);
radius = cvRound((r->width + r->height) * 0.25 * (scale >> 5));
pt1.x = cvRound((r->x) * (scale >> 5));
pt1.y = cvRound((r->y) * (scale >> 5));
pt2.x = cvRound((r->x + r->width) * (scale >> 5));
pt2.y = cvRound((r->y + r->height) * (scale >> 5));
//cvCircle( img, center, radius, colors[i%8], 3, 8, 0 );
cvRectangle(img, pt2, pt1, color3, 2, ;
}
}
// cvShowImage( "result", img );
cvSaveImage("./3.bmp", img);
cvReleaseImage(&gray);
cvReleaseImage(&small_img);
} |
|