From: Amlan Chowdhury Date: Tue, 28 Jun 2016 08:56:13 +0000 (+0600) Subject: [TBT][Face detection][TSAM-5469][Face detection rectangle coordinate fixed] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1cd499b5b5844377d637338f591f92b150c95649;p=test%2Ftct%2Fnative%2Fbehavior.git [TBT][Face detection][TSAM-5469][Face detection rectangle coordinate fixed] Signed-off-by: Amlan Chowdhury Change-Id: I00b3d92585c6fdf69c1fef0decb71e4ffe224180 --- diff --git a/release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk b/release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk index d928263..8f7ab15 100644 Binary files a/release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk and b/release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk differ diff --git a/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-i386.tpk b/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-i386.tpk index 32dd169..17fc49a 100644 Binary files a/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-i386.tpk and b/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-i386.tpk differ diff --git a/tbtcoreapp/src/view/tbt-camera-view.c b/tbtcoreapp/src/view/tbt-camera-view.c index 5ce8ab5..30eafde 100644 --- a/tbtcoreapp/src/view/tbt-camera-view.c +++ b/tbtcoreapp/src/view/tbt-camera-view.c @@ -401,12 +401,18 @@ static camera_h create_camera(camera_view *this) int result; camera_h camera = NULL; - if (this->view->tbt_info->apptype == TBT_APP_CAMERA_HDR_CAPTURE || this->view->tbt_info->apptype ==TBT_APP_CAMERA_FACE_DETECT) + if (this->view->tbt_info->apptype == TBT_APP_CAMERA_HDR_CAPTURE) { result = camera_create(CAMERA_DEVICE_CAMERA0, &camera); RETVM_IF(result != CAMERA_ERROR_NONE, NULL, "camera_create fail > Error = %s", get_camera_error(result)); RETVM_IF(NULL == camera, NULL, "camera handle null"); } + else if (this->view->tbt_info->apptype ==TBT_APP_CAMERA_FACE_DETECT) + { + result = camera_create(CAMERA_DEVICE_CAMERA1, &camera); + RETVM_IF(result != CAMERA_ERROR_NONE, NULL, "camera_create fail > Error = %s", get_camera_error(result)); + RETVM_IF(NULL == camera, NULL, "camera handle null"); + } else { @@ -979,15 +985,15 @@ static void _camera_face_detected_cb(camera_detected_face_s *faces, int count, v RETM_IF(NULL == view, "view is NULL"); int ret, height, width; - Evas_Coord canvas_width, canvas_height; + Evas_Coord canvas_x, canvas_y, canvas_width, canvas_height; ret = camera_get_preview_resolution(view->camera, &width, &height); RETM_IF(width < 0 || height < 0, "width or height cannot be less than zero"); RETM_IF(ret != CAMERA_ERROR_NONE, "camera_get_preview_resolution error: %s", get_camera_error(ret)); DBG("The Count of detected faces is %d", count); - evas_object_geometry_get(view->camera_rect, NULL, NULL, &canvas_width, &canvas_height); + evas_object_geometry_get(view->camera_rect, &canvas_x, &canvas_y, &canvas_width, &canvas_height); - DBG("THe canvas width and height is %d %d", canvas_width, canvas_height); + DBG("THe canvas width and height is %d %d x %d y %d", canvas_width, canvas_height, canvas_x, canvas_y); int i; for (i = 0; i < max_face_count; i++) @@ -999,9 +1005,17 @@ static void _camera_face_detected_cb(camera_detected_face_s *faces, int count, v } } - for (i = 0; i < count; i++) + int local_count = count <= max_face_count?count : max_face_count; + + + for (i = 0; i < local_count; i++) { - draw_lines(faces[i].x, faces[i].y, faces[i].width, faces[i].height, i, view); + //draw_lines(faces[i].x, faces[i].y, faces[i].width, faces[i].height, i, view); + //DBG("x: %d, y: %d, w: %d, h: %d", faces[i].y, faces[i].x+faces[i].width, faces[i].height, faces[i].width); + //draw_lines(faces[i].y, faces[i].x+faces[i].width, faces[i].height, faces[i].width, i, view); + draw_lines((canvas_width-faces[i].width)-faces[i].y, canvas_height-faces[i].x, faces[i].width, faces[i].height, i, view); + //draw_lines(canvas_x-faces[i].x, canvas_y-faces[i].y, faces[i].height, faces[i].width, i, view); + DBG("x: %d, y: %d, w: %d, h: %d", faces[i].y, faces[i].x, faces[i].width, faces[i].height); } } @@ -1025,9 +1039,10 @@ void draw_lines(int x, int y, int height, int width, int face_index, void *user_ view->poly_drawn[face_index] = evas_object_polygon_add(evas_object_evas_get(view->camera_rect)); evas_object_polygon_point_add(view->poly_drawn[face_index], x, y); - evas_object_polygon_point_add(view->poly_drawn[face_index], x + width, y); - evas_object_polygon_point_add(view->poly_drawn[face_index], x + width, y + height); evas_object_polygon_point_add(view->poly_drawn[face_index], x, y + height); + evas_object_polygon_point_add(view->poly_drawn[face_index], x + width, y + height); + evas_object_polygon_point_add(view->poly_drawn[face_index], x + width, y); + evas_object_color_set(view->poly_drawn[face_index], 0, 0, 255, 100); evas_object_show(view->poly_drawn[face_index]);