[TBT][Face detection][TSAM-5469][Face detection rectangle coordinate fixed] 19/77019/1
authorAmlan Chowdhury <amlan.c@samsung.com>
Tue, 28 Jun 2016 08:56:13 +0000 (14:56 +0600)
committerAmlan Chowdhury <amlan.c@samsung.com>
Tue, 28 Jun 2016 09:02:11 +0000 (15:02 +0600)
Signed-off-by: Amlan Chowdhury <amlan.c@samsung.com>
Change-Id: I00b3d92585c6fdf69c1fef0decb71e4ffe224180

release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk
release/binary-x86/org.tizen.tbtcoreapp-1.0.0-i386.tpk
tbtcoreapp/src/view/tbt-camera-view.c

index d928263c3d07448d7337a8dedbedb9d7b5dec9eb..8f7ab1538ddc4207e4ab89f93edb8455ffdfc569 100644 (file)
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
index 32dd16998f63d714b88837dae20910949edb4767..17fc49ae005b4bdb5a454b5c38167b7c2c934c2e 100644 (file)
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
index 5ce8ab55d960b14660287ddee7d289e824affd6b..30eafdec4fde1b3555ae4d40bce48a68a92fb36d 100644 (file)
@@ -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]);