muse_camera_msg_get(count, recv_msg);
muse_camera_msg_get(tbm_key, recv_msg);
- if (count > 0 && tbm_key > 0) {
+ if (count >= 0) {
LOGD("FACE_DETECTION - count %d, tbm_key %d", count, tbm_key);
- if (!_camera_import_tbm_key(cb_info->bufmgr, tbm_key, &bo, &bo_handle))
- break;
-
- /* set face info */
- faces = bo_handle.ptr;
-
- ((camera_face_detected_cb)cb_info->user_cb[event])(faces, count, cb_info->user_data[event]);
-
-#if 0
- {
- int i = 0;
+ if (tbm_key > 0) {
- for (i = 0 ; i < count ; i++) {
- LOGD("id[%2d] - score %d, position (%d,%d,%dx%d)",
- i, faces[i].score, faces[i].x, faces[i].y, faces[i].width, faces[i].height);
+ if (_camera_import_tbm_key(cb_info->bufmgr, tbm_key, &bo, &bo_handle)) {
+ /* set face info */
+ faces = bo_handle.ptr;
}
}
-#endif
+
+ ((camera_face_detected_cb)cb_info->user_cb[event])(faces, count, cb_info->user_data[event]);
/* release bo */
_camera_release_imported_bo(&bo);
/* return buffer */
- CAMERA_MSG_PARAM_SET(param, INT, tbm_key);
- _camera_msg_send_param1(MUSE_CAMERA_API_RETURN_BUFFER, cb_info, NULL, ¶m, 0);
-
- /*LOGD("return buffer done");*/
+ if (tbm_key > 0) {
+ CAMERA_MSG_PARAM_SET(param, INT, tbm_key);
+ _camera_msg_send_param1(MUSE_CAMERA_API_RETURN_BUFFER, cb_info, NULL, ¶m, 0);
+ /*LOGD("return buffer done");*/
+ }
} else {
LOGE("invalid message - count %d, key %d", count, tbm_key);
}
static void _face_detected(camera_detected_face_s *faces, int count, void *user_data)
{
- g_print("face detected!!\n");
+ g_print("face detected!! - count %d\n", count);
int i;
for (i = 0 ; i < count ; i++)
}
break;
case 'l': /* Setting > Face detection setting */
- g_print("* Face detect mode !\n");
- flush_stdin();
- for (i = 0 ; i < 2 ; i++)
- g_print("\t %d. %s \n", i+1, detection_mode[i]);
- err = scanf("%d", &idx);
if (camera_is_supported_face_detection(hcamcorder->camera)) {
- if (idx >= 0 && idx < 2)
+ g_print("* Face detect mode !\n");
+ flush_stdin();
+ for (i = 0 ; i < 2 ; i++)
+ g_print("\t %d. %s \n", i, detection_mode[i]);
+ err = scanf("%d", &idx);
+ if (idx == 0)
+ bret = camera_stop_face_detection(hcamcorder->camera);
+ else if (idx == 1)
bret = camera_start_face_detection(hcamcorder->camera, _face_detected, NULL);
- } else
+ else
+ g_print("\n invalid input [%d]\n\n", idx);
+ } else {
g_print("face detection_not supported");
+ }
break;
case 'k': /* Setting > Anti-handshake */
g_print("*Anti-handshake !\n");