--- /dev/null
+//
+// Copyright (c) 2022 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#include "ITs-media-vision-common.h"
+
+//& set: MediaVision
+
+/** @addtogroup itc-media-vision
+* @ingroup itc
+* @{
+*/
+
+const char *g_Mv3dExampleDir = NULL;
+static bool g_IsMv3dDepthSupported = false;
+static bool g_IsMv3dPointCloudSupported = false;
+static int g_StartupError;
+
+static mv_engine_config_h g_EngineConfigHandle = NULL;
+static mv_source_h g_BaseSourceHandle = NULL;
+static mv_source_h g_ExtraSourceHandle = NULL;
+static bool g_Mv3dDepthCallBackInvoked = false;
+static bool g_Mv3dPointCloudCallBackInvoked = false;
+static int g_Mv3dPcdWriteResultErr;
+static mv_3d_h g_Mv3d_handle = NULL;
+static bool g_WriteToFile = false;
+
+static int Set3dEngineConfig(mv_engine_config_h engine_cfg)
+{
+ int nRet;
+
+ nRet = mv_engine_config_set_int_attribute(engine_cfg, MV_3D_DEPTH_MODE, MV_3D_DEPTH_MODE_STEREO);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_engine_config_set_int_attribute", MediaVisionGetError(nRet));
+
+ nRet = mv_engine_config_set_int_attribute(engine_cfg, MV_3D_DEPTH_WIDTH, MV3D_DEPTH_WIDTH);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_engine_config_set_int_attribute", MediaVisionGetError(nRet));
+
+ nRet = mv_engine_config_set_int_attribute(engine_cfg, MV_3D_DEPTH_HEIGHT, MV3D_DEPTH_HEIGHT);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_engine_config_set_int_attribute", MediaVisionGetError(nRet));
+
+ nRet = mv_engine_config_set_int_attribute(engine_cfg, MV_3D_DEPTH_MIN_DISPARITY, MV3D_MINIMUN_DISPARITY);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_engine_config_set_int_attribute", MediaVisionGetError(nRet));
+
+ nRet = mv_engine_config_set_int_attribute(engine_cfg, MV_3D_DEPTH_MAX_DISPARITY, MV3D_MAXIMUM_DISPARITY);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_engine_config_set_int_attribute", MediaVisionGetError(nRet));
+
+ char calibFilename[PATHLEN];
+ snprintf(calibFilename, PATHLEN, "%s/%s", g_Mv3dExampleDir, MV3D_CALIBRATION_FILENAME);
+ nRet = mv_engine_config_set_string_attribute(engine_cfg, MV_3D_DEPTH_STEREO_CONFIG_FILE_PATH, calibFilename);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_engine_config_set_string_attribute", MediaVisionGetError(nRet));
+
+ nRet = mv_engine_config_set_double_attribute(engine_cfg, MV_3D_POINTCLOUD_SAMPLING_RATIO, MV3D_SAMPLING_RATIO);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_engine_config_set_double_attribute", MediaVisionGetError(nRet));
+
+ nRet = mv_engine_config_set_int_attribute(engine_cfg, MV_3D_POINTCLOUD_OUTLIER_REMOVAL_POINTS, MV3D_OUTLIER_REMOVAL_POINTS);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_engine_config_set_int_attribute", MediaVisionGetError(nRet));
+
+ nRet = mv_engine_config_set_double_attribute(engine_cfg, MV_3D_POINTCLOUD_OUTLIER_REMOVAL_RADIUS, MV3D_OUTLIER_REMOVAL_RAIDUS);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_engine_config_set_double_attribute", MediaVisionGetError(nRet));
+
+ char mediaFilename[PATHLEN];
+ snprintf(mediaFilename, PATHLEN, "%s", "/tmp");
+ nRet = mv_engine_config_set_string_attribute(engine_cfg, MV_3D_POINTCLOUD_OUTPUT_FILE_PATH, mediaFilename);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_engine_config_set_string_attribute", MediaVisionGetError(nRet));
+
+ return nRet;
+}
+
+
+static void MvDepthCB(mv_source_h source, unsigned short* depth, unsigned int width, unsigned int height, void* user_data)
+{
+ g_Mv3dDepthCallBackInvoked = true;
+ FPRINTF("[Line : %d][%s] Callback Invoked: MvDepthCB\\n", __LINE__, API_NAMESPACE, "MvDepthCB");
+ if (!g_WriteToFile)
+ QuitGmainLoop();
+}
+
+static void MvPointcloudCB(mv_source_h source, mv_3d_pointcloud_h pointcloud, void *user_data)
+{
+ g_Mv3dPointCloudCallBackInvoked = true;
+ FPRINTF("[Line : %d][%s] Callback Invoked: MvPointcloudCB\\n", __LINE__, API_NAMESPACE, "MvDepthCB");
+ if (g_WriteToFile)
+ {
+ mv_3d_h mv3d_handle = (mv_3d_h)user_data;
+ char outfilename[PATHLEN];
+ snprintf(outfilename, 1024, "/tmp/%s", g_Mv3dExampleDir, MV3D_POINTCLOUD_OUT_FILENAME);
+ g_Mv3dPcdWriteResultErr = mv_3d_pointcloud_write_file(mv3d_handle, pointcloud, MV_3D_POINTCLOUD_TYPE_PCD_BIN, MV3D_POINTCLOUD_OUT_FILENAME);
+ }
+}
+
+/**
+ * @function ITs_media_vision_3d_startup
+ * @description Called before each test
+ * @parameter NA
+ * @return NA
+ */
+void ITs_media_vision_3d_startup(void)
+{
+ struct stat stBuff;
+ if ( stat(ERR_LOG, &stBuff) == 0 )
+ {
+ remove(ERR_LOG);
+ }
+
+ g_IsMv3dSupported = false;
+ g_IsMv3dCreated = true;
+ g_bMismatch = false;
+ g_WriteToFile = false;
+ g_IsMv3dDepthSupported = TCTCheckSystemInfoFeatureSupported(MV3D_DEPTH_FEATURE, API_NAMESPACE);
+ g_IsMv3dPointCloudSupported = TCTCheckSystemInfoFeatureSupported(MV3D_POINTCLOUD_FEATURE, API_NAMESPACE);
+
+
+ if (g_IsMv3dDepthSupported || g_IsMv3dPointCloudSupported)
+ g_IsMv3dSupported = true;
+ else
+ g_IsMv3dSupported = false;
+
+ int nRet = mv_3d_create(&g_Mv3d_handle);
+ if (!g_IsMv3dSupported)
+ {
+ if ( MEDIA_VISION_ERROR_NOT_SUPPORTED != nRet){
+ FPRINTF("[Line : %d][%s] Feature is not supported, mv_3d_create API did not returned NOT_SUPPORTED error code.\\n", __LINE__, API_NAMESPACE);
+ g_bMismatch = true;
+ return;
+ }
+ }
+ else{
+ if ( MEDIA_VISION_ERROR_NONE != nRet){
+ FPRINTF("[Line : %d][%s] Feature is not supported, mv_3d_create API failed. error code: [%s]\\n", __LINE__, API_NAMESPACE, MediaVisionGetError(nRet));
+ g_IsMv3dCreated = false;
+ return;
+ }
+ }
+
+ char pszValue[CONFIG_VALUE_LEN_MAX] = {0,};
+ if (true == GetValueForTCTSetting("DEVICE_SUITE_TARGET_30", pszValue, API_NAMESPACE))
+ {
+ FPRINTF("[Line : %d][%s] 'DEVICE_SUITE_TARGET_30' Values Received %s\\n", __LINE__, API_NAMESPACE, pszValue);
+ g_Mv3dExampleDir = (char*)calloc(strlen(pszValue)+strlen("/res/res/3d")+1, sizeof(char));
+ snprintf(g_Mv3dExampleDir, strlen(pszValue)+strlen("/res/res/3d")+1, "%s/res/res/3d", pszValue);
+
+ } else {
+ FPRINTF("[Line : %d][%s] GetValueForTCTSetting returned error for 'DEVICE_SUITE_TARGET_30'\\n", __LINE__, API_NAMESPACE);
+ }
+
+ g_StartupError = mv_create_engine_config(&g_EngineConfigHandle);
+ if (MEDIA_VISION_ERROR_NONE != g_StartupError)
+ {
+ g_EngineConfigHandle = NULL;
+ FPRINTF("[Line : %d][%s] mv_create_engine_config failed, returned error: [%s]'\\n", __LINE__, API_NAMESPACE, MediaVisionGetError(nRet));
+ return;
+ }
+
+ return;
+}
+
+
+/**
+ * @function ITs_media_vision_3d_cleanup
+ * @description Called after each test
+ * @parameter NA
+ * @return NA
+ */
+void ITs_media_vision_3d_cleanup(void)
+{
+ if (g_EngineConfigHandle) {
+ mv_destroy_engine_config(g_EngineConfigHandle);
+ g_EngineConfigHandle = NULL;
+ }
+
+ if (g_BaseSourceHandle) {
+ mv_destroy_source(g_BaseSourceHandle);
+ g_BaseSourceHandle = NULL;
+ }
+
+ if (g_ExtraSourceHandle) {
+ mv_destroy_source(g_ExtraSourceHandle);
+ g_ExtraSourceHandle = NULL;
+ }
+
+ if (g_Mv3d_handle)
+ {
+ mv_3d_destroy(g_Mv3d_handle);
+ g_Mv3d_handle = NULL;
+ }
+
+ return;
+}
+
+/** @addtogroup itc-media-vision-testcases
+* @brief Integration testcases for module media-vision
+* @ingroup itc-media-vision
+* @{
+*/
+
+//& type: auto
+//& purpose: Creates mv3d handle and destroy it
+/**
+ * @testcase ITc_media_vision_mv_3d_create_destroy_p
+ * @author SRID(shobhit.v)
+ * @reviewer SRID(ankit.sri1)
+ * @type auto
+ * @since_tizen 7.0
+ * @description To Creates mv3d handle and destroy it
+ * @scenario Creates mv 3d handle and destroy it
+ * @apicovered mv_3d_create and mv_3d_destroy
+ * @passcase If mv_3d_create and mv_3d_destroy pass
+ * @failcase If Precondition API or Target API Fails
+ * @precondition NA
+ * @postcondition NA
+ * */
+int ITc_media_vision_mv_3d_create_destroy_p(void)
+{
+ START_TEST_3D;
+
+ int nRet;
+ nRet = mv_3d_destroy(g_Mv3d_handle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_3d_destroy", MediaVisionGetError(nRet));
+
+ nRet = mv_3d_create(&g_Mv3d_handle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_3d_create", MediaVisionGetError(nRet));
+ CHECK_HANDLE_NONE(g_Mv3d_handle, "mv_3d_create");
+
+ nRet = mv_3d_destroy(g_Mv3d_handle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_3d_destroy", MediaVisionGetError(nRet));
+
+ nRet = mv_3d_create(&g_Mv3d_handle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_3d_create", MediaVisionGetError(nRet));
+ CHECK_HANDLE_NONE(g_Mv3d_handle, "mv_3d_create");
+
+ return 0;
+}
+
+
+//& type: auto
+//& purpose: To configure mv 3d handle
+/**
+ * @testcase ITc_media_vision_mv_3d_configure_p
+ * @author SRID(shobhit.v)
+ * @reviewer SRID(ankit.sri1)
+ * @type auto
+ * @since_tizen 7.0
+ * @description To configure mv 3d handle
+ * @scenario To configure mv 3d handle
+ * @apicovered mv_3d_create, mv_3d_destroy and mv_3d_configure
+ * @passcase If mv_3d_create, mv_3d_destroy and mv_3d_configure pass
+ * @failcase If Precondition API or Target API Fails
+ * @precondition NA
+ * @postcondition NA
+ * */
+int ITc_media_vision_mv_3d_configure_p(void)
+{
+ START_TEST_3D;
+ int nRet = -1;
+
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, g_StartupError, "mv_create_engine_config", MediaVisionGetError(nRet));
+
+ nRet = Set3dEngineConfig(g_EngineConfigHandle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "Set3dEngineConfig", MediaVisionGetError(nRet));
+
+ nRet = mv_3d_configure(g_Mv3d_handle, g_EngineConfigHandle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_3d_configure", MediaVisionGetError(nRet));
+
+ return 0;
+}
+
+
+//& type: auto
+//& purpose: Sets mv_3d_depth_cb() callback
+/**
+ * @testcase ITc_media_vision_mv_3d_set_depth_cb_p
+ * @author SRID(shobhit.v)
+ * @reviewer SRID(ankit.sri1)
+ * @type auto
+ * @since_tizen 7.0
+ * @description Sets mv_3d_depth_cb() callback
+ * @scenario Sets mv_3d_depth_cb() callback
+ * @apicovered mv_3d_create, mv_3d_destroy, mv_3d_configure and mv_3d_set_depth_cb
+ * @passcase If mv_3d_create, mv_3d_destroy, mv_3d_configure and mv_3d_set_depth_cb pass
+ * @failcase If Precondition API or Target API Fails
+ * @precondition NA
+ * @postcondition NA
+ * */
+int ITc_media_vision_mv_3d_set_depth_cb_p(void)
+{
+ START_TEST_3D;
+ int nRet = -1;
+
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, g_StartupError, "mv_create_engine_config", MediaVisionGetError(nRet));
+
+ nRet = Set3dEngineConfig(g_EngineConfigHandle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "Set3dEngineConfig", MediaVisionGetError(nRet));
+
+ nRet = mv_3d_configure(g_Mv3d_handle, g_EngineConfigHandle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_3d_configure", MediaVisionGetError(nRet));
+
+ nRet = mv_3d_set_depth_cb(g_Mv3d_handle, MvDepthCB, NULL);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_3d_set_depth_cb", MediaVisionGetError(nRet));
+
+ return 0;
+}
+
+
+//& type: auto
+//& purpose: Sets mv_3d_depth_cb() callback
+/**
+ * @testcase ITc_media_vision_mv_3d_set_pointcloud_cb_p
+ * @author SRID(shobhit.v)
+ * @reviewer SRID(ankit.sri1)
+ * @type auto
+ * @since_tizen 7.0
+ * @description Sets mv_3d_pointcloud_cb() callback
+ * @scenario Sets mv_3d_pointcloud_cb() callback
+ * @apicovered mv_3d_create, mv_3d_destroy, mv_3d_configure and mv_3d_set_pointcloud_cb
+ * @passcase If mv_3d_create, mv_3d_destroy, mv_3d_configure and mv_3d_set_pointcloud_cb pass
+ * @failcase If Precondition API or Target API Fails
+ * @precondition NA
+ * @postcondition NA
+ * */
+int ITc_media_vision_mv_3d_set_pointcloud_cb_p(void)
+{
+ START_TEST_3D;
+ int nRet = -1;
+
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, g_StartupError, "mv_create_engine_config", MediaVisionGetError(nRet));
+
+ nRet = Set3dEngineConfig(g_EngineConfigHandle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "Set3dEngineConfig", MediaVisionGetError(nRet));
+
+ nRet = mv_3d_configure(g_Mv3d_handle, g_EngineConfigHandle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_3d_configure", MediaVisionGetError(nRet));
+
+ nRet = mv_3d_set_pointcloud_cb(g_Mv3d_handle, MvPointcloudCB, g_Mv3d_handle);
+ if (g_IsMv3dPointCloudSupported){
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_3d_set_pointcloud_cb", MediaVisionGetError(nRet));
+ }
+ else{
+ PRINT_RESULT(MEDIA_VISION_ERROR_NOT_SUPPORTED, nRet, "mv_3d_set_pointcloud_cb", MediaVisionGetError(nRet));
+ }
+
+ return 0;
+}
+
+//& type: auto
+//& purpose: Prepares handle
+/**
+ * @testcase ITc_media_vision_mv_3d_prepare_p
+ * @author SRID(shobhit.v)
+ * @reviewer SRID(ankit.sri1)
+ * @type auto
+ * @since_tizen 7.0
+ * @description Prepares handle to mv 3d
+ * @scenario Prepares handle to mv 3d
+ * @apicovered mv_3d_create, mv_3d_destroy, mv_3d_configure and mv_3d_set_pointcloud_cb, mv_3d_prepare
+ * @passcase If mv_3d_create, mv_3d_destroy, mv_3d_configure, mv_3d_set_pointcloud_cb and mv_3d_prepare pass
+ * @failcase If Precondition API or Target API Fails
+ * @precondition NA
+ * @postcondition NA
+ * */
+int ITc_media_vision_mv_3d_prepare_p(void)
+{
+ START_TEST_3D;
+ int nRet = -1;
+
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, g_StartupError, "mv_create_engine_config", MediaVisionGetError(nRet));
+
+ nRet = Set3dEngineConfig(g_EngineConfigHandle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "Set3dEngineConfig", MediaVisionGetError(nRet));
+
+ nRet = mv_3d_configure(g_Mv3d_handle, g_EngineConfigHandle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_3d_configure", MediaVisionGetError(nRet));
+
+ nRet = mv_3d_set_depth_cb(g_Mv3d_handle, MvDepthCB, NULL);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_3d_set_depth_cb", MediaVisionGetError(nRet));
+
+ nRet = mv_3d_set_pointcloud_cb(g_Mv3d_handle, MvPointcloudCB, g_Mv3d_handle);
+ if (g_IsMv3dPointCloudSupported){
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_3d_set_pointcloud_cb", MediaVisionGetError(nRet));
+ }
+ else{
+ PRINT_RESULT(MEDIA_VISION_ERROR_NOT_SUPPORTED, nRet, "mv_3d_set_pointcloud_cb", MediaVisionGetError(nRet));
+ }
+
+ nRet = mv_3d_prepare(g_Mv3d_handle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_3d_prepare", MediaVisionGetError(nRet));
+
+ return 0;
+}
+
+//& type: auto
+//& purpose: Gets depth or pointcloud synchronously from given source
+/**
+ * @testcase ITc_media_vision_mv_3d_run_p
+ * @author SRID(shobhit.v)
+ * @reviewer SRID(ankit.sri1)
+ * @type auto
+ * @since_tizen 7.0
+ * @description Gets depth or pointcloud synchronously from given source
+ * @scenario Gets depth or pointcloud synchronously from given source
+ * @apicovered mv_3d_create, mv_3d_destroy, mv_3d_configure and mv_3d_set_pointcloud_cb, mv_3d_run
+ * @passcase If mv_3d_create, mv_3d_destroy, mv_3d_configure, mv_3d_set_pointcloud_cb and mv_3d_run pass
+ * @failcase If Precondition API or Target API Fails
+ * @precondition NA
+ * @postcondition NA
+ * */
+int ITc_media_vision_mv_3d_run_p(void)
+{
+ START_TEST_3D;
+
+ int nRet = -1;
+ g_Mv3dDepthCallBackInvoked = false;
+
+ char pszImageFileName[PATHLEN];
+ snprintf(pszImageFileName, 1024, "%s/%s", g_Mv3dExampleDir, MV3D_BASE_IMAGE_FILENAME);
+
+ nRet = mv_create_source(&g_BaseSourceHandle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_create_source", MediaVisionGetError(nRet));
+
+ nRet = image_load(pszImageFileName, g_BaseSourceHandle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "image_load", MediaVisionGetError(nRet));
+
+ char pzsExtraImageFilename[PATHLEN];
+ snprintf(pzsExtraImageFilename, 1024, "%s/%s", g_Mv3dExampleDir, MV3D_EXTRA_IMAGE_FILENAME);
+
+ nRet = mv_create_source(&g_ExtraSourceHandle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_create_source", MediaVisionGetError(nRet));
+
+ nRet = image_load(pzsExtraImageFilename, g_ExtraSourceHandle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "image_load", MediaVisionGetError(nRet));
+
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, g_StartupError, "mv_create_engine_config", MediaVisionGetError(nRet));
+
+ nRet = Set3dEngineConfig(g_EngineConfigHandle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "Set3dEngineConfig", MediaVisionGetError(nRet));
+
+ nRet = mv_3d_configure(g_Mv3d_handle, g_EngineConfigHandle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_3d_configure", MediaVisionGetError(nRet));
+
+ nRet = mv_3d_set_depth_cb(g_Mv3d_handle, MvDepthCB, NULL);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_3d_set_depth_cb", MediaVisionGetError(nRet));
+
+ nRet = mv_3d_set_pointcloud_cb(g_Mv3d_handle, MvPointcloudCB, g_Mv3d_handle);
+ if (g_IsMv3dPointCloudSupported){
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_3d_set_pointcloud_cb", MediaVisionGetError(nRet));
+ }
+ else{
+ PRINT_RESULT(MEDIA_VISION_ERROR_NOT_SUPPORTED, nRet, "mv_3d_set_pointcloud_cb", MediaVisionGetError(nRet));
+ }
+
+ nRet = mv_3d_prepare(g_Mv3d_handle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_3d_prepare", MediaVisionGetError(nRet));
+
+ nRet = mv_3d_run(g_Mv3d_handle, g_BaseSourceHandle, g_ExtraSourceHandle, NULL);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_3d_run", MediaVisionGetError(nRet));
+ if(!g_Mv3dDepthCallBackInvoked)
+ {
+ FPRINTF("[Line : %d][%s] Callback not hit\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ return 0;
+}
+
+//& type: auto
+//& purpose: Gets depth or pointcloud asynchronously from given source
+/**
+ * @testcase ITc_media_vision_mv_3d_run_async_p
+ * @author SRID(shobhit.v)
+ * @reviewer SRID(ankit.sri1)
+ * @type auto
+ * @since_tizen 7.0
+ * @description Gets depth or pointcloud asynchronously from given source
+ * @scenario Gets depth or pointcloud asynchronously from given source
+ * @apicovered mv_3d_create, mv_3d_destroy, mv_3d_configure and mv_3d_set_pointcloud_cb, mv_3d_run_async
+ * @passcase If mv_3d_create, mv_3d_destroy, mv_3d_configure, mv_3d_set_pointcloud_cb and mv_3d_run_async pass
+ * @failcase If Precondition API or Target API Fails
+ * @precondition NA
+ * @postcondition NA
+ * */
+int ITc_media_vision_mv_3d_run_async_p(void)
+{
+ START_TEST_3D;
+
+ int nRet = -1;
+ int nTimeoutId = 0;
+ g_Mv3dDepthCallBackInvoked = false;
+ g_Mv3dPointCloudCallBackInvoked = false;
+
+ char pszImageFileName[PATHLEN];
+ snprintf(pszImageFileName, 1024, "%s/%s", g_Mv3dExampleDir, MV3D_BASE_IMAGE_FILENAME);
+
+ nRet = mv_create_source(&g_BaseSourceHandle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_create_source", MediaVisionGetError(nRet));
+
+ nRet = image_load(pszImageFileName, g_BaseSourceHandle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "image_load", MediaVisionGetError(nRet));
+
+ char pzsExtraImageFilename[PATHLEN];
+ snprintf(pzsExtraImageFilename, 1024, "%s/%s", g_Mv3dExampleDir, MV3D_EXTRA_IMAGE_FILENAME);
+
+ nRet = mv_create_source(&g_ExtraSourceHandle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_create_source", MediaVisionGetError(nRet));
+
+ nRet = image_load(pzsExtraImageFilename, g_ExtraSourceHandle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "image_load", MediaVisionGetError(nRet));
+
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, g_StartupError, "mv_create_engine_config", MediaVisionGetError(nRet));
+
+ nRet = Set3dEngineConfig(g_EngineConfigHandle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "Set3dEngineConfig", MediaVisionGetError(nRet));
+
+ nRet = mv_3d_configure(g_Mv3d_handle, g_EngineConfigHandle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_3d_configure", MediaVisionGetError(nRet));
+
+ nRet = mv_3d_set_depth_cb(g_Mv3d_handle, MvDepthCB, NULL);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_3d_set_depth_cb", MediaVisionGetError(nRet));
+
+ nRet = mv_3d_set_pointcloud_cb(g_Mv3d_handle, MvPointcloudCB, g_Mv3d_handle);
+ if (g_IsMv3dPointCloudSupported){
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_3d_set_pointcloud_cb", MediaVisionGetError(nRet));
+ }
+ else{
+ PRINT_RESULT(MEDIA_VISION_ERROR_NOT_SUPPORTED, nRet, "mv_3d_set_pointcloud_cb", MediaVisionGetError(nRet));
+ }
+
+ nRet = mv_3d_prepare(g_Mv3d_handle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_3d_prepare", MediaVisionGetError(nRet));
+
+ nRet = mv_3d_run_async(g_Mv3d_handle, g_BaseSourceHandle, g_ExtraSourceHandle, NULL);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_3d_run", MediaVisionGetError(nRet));
+ RUN_POLLING_LOOP;
+ if(!g_Mv3dDepthCallBackInvoked)
+ {
+ FPRINTF("[Line : %d][%s] Callback not hit\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ return 0;
+}
+
+
+//& type: auto
+//& purpose: Writes pointcloud data to a file
+/**
+ * @testcase ITc_media_vision_mv_3d_pointcloud_write_file_p
+ * @author SRID(shobhit.v)
+ * @reviewer SRID(ankit.sri1)
+ * @type auto
+ * @since_tizen 7.0
+ * @description Writes pointcloud data to a file
+ * @scenario Writes pointcloud data to a file
+ * @apicovered mv_3d_create, mv_3d_destroy, mv_3d_configure and mv_3d_set_pointcloud_cb, mv_3d_run and mv_3d_pointcloud_write_file
+ * @passcase If mv_3d_create, mv_3d_destroy, mv_3d_configure, mv_3d_set_pointcloud_cb, mv_3d_run and mv_3d_pointcloud_write_file pass
+ * @failcase If Precondition API or Target API Fails
+ * @precondition NA
+ * @postcondition NA
+ * */
+int ITc_media_vision_mv_3d_pointcloud_write_file_p(void)
+{
+ START_TEST_3D;
+
+ int nRet = -1;
+ g_Mv3dDepthCallBackInvoked = false;
+ g_Mv3dPointCloudCallBackInvoked = false;
+ g_WriteToFile = true;
+
+ char pszImageFileName[PATHLEN];
+ snprintf(pszImageFileName, 1024, "%s/%s", g_Mv3dExampleDir, MV3D_BASE_IMAGE_FILENAME);
+
+ nRet = mv_create_source(&g_BaseSourceHandle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_create_source", MediaVisionGetError(nRet));
+
+ nRet = image_load(pszImageFileName, g_BaseSourceHandle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "image_load", MediaVisionGetError(nRet));
+
+ char pzsExtraImageFilename[PATHLEN];
+ snprintf(pzsExtraImageFilename, 1024, "%s/%s", g_Mv3dExampleDir, MV3D_EXTRA_IMAGE_FILENAME);
+
+ nRet = mv_create_source(&g_ExtraSourceHandle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_create_source", MediaVisionGetError(nRet));
+
+ nRet = image_load(pzsExtraImageFilename, g_ExtraSourceHandle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "image_load", MediaVisionGetError(nRet));
+
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, g_StartupError, "mv_create_engine_config", MediaVisionGetError(nRet));
+
+ nRet = Set3dEngineConfig(g_EngineConfigHandle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "Set3dEngineConfig", MediaVisionGetError(nRet));
+
+ nRet = mv_3d_configure(g_Mv3d_handle, g_EngineConfigHandle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_3d_configure", MediaVisionGetError(nRet));
+
+ nRet = mv_3d_set_depth_cb(g_Mv3d_handle, MvDepthCB, NULL);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_3d_set_depth_cb", MediaVisionGetError(nRet));
+
+ nRet = mv_3d_set_pointcloud_cb(g_Mv3d_handle, MvPointcloudCB, g_Mv3d_handle);
+ if (g_IsMv3dPointCloudSupported){
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_3d_set_pointcloud_cb", MediaVisionGetError(nRet));
+ }
+ else{
+ PRINT_RESULT(MEDIA_VISION_ERROR_NOT_SUPPORTED, nRet, "mv_3d_set_pointcloud_cb", MediaVisionGetError(nRet));
+ }
+
+ nRet = mv_3d_prepare(g_Mv3d_handle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_3d_prepare", MediaVisionGetError(nRet));
+
+ nRet = mv_3d_run(g_Mv3d_handle, g_BaseSourceHandle, g_ExtraSourceHandle, NULL);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_3d_run", MediaVisionGetError(nRet));
+ if(!g_Mv3dDepthCallBackInvoked)
+ {
+ FPRINTF("[Line : %d][%s] Callback not hit\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, g_Mv3dPcdWriteResultErr, "mv_3d_pointcloud_write_file", MediaVisionGetError(nRet));
+
+ return 0;
+}
+
+/** @} */
+/** @} */