Add dfs-opencv
authorTae-Young Chung <ty83.chung@samsung.com>
Tue, 5 Oct 2021 06:32:16 +0000 (15:32 +0900)
committerTae-Young Chung <ty83.chung@samsung.com>
Tue, 5 Oct 2021 06:32:26 +0000 (15:32 +0900)
This commit is to provide dummy library to test with
dfs-adaptation and mediavision's depth module.

Signed-off-by: Tae-Young Chung <ty83.chung@samsung.com>
CMakeLists.txt [new file with mode: 0644]
dfs-opencv.manifest [new file with mode: 0644]
packaging/dfs-opencv.spec [new file with mode: 0644]
src/dfs_opencv.cpp [new file with mode: 0644]
src/dfs_opencv_private.h [new file with mode: 0644]

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644 (file)
index 0000000..9233dd5
--- /dev/null
@@ -0,0 +1,90 @@
+
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+SET(fw_name "dfs-opencv")
+
+PROJECT(${fw_name})
+
+SET(CMAKE_INSTALL_PREFIX /usr)
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+
+SET(INC_DIR "${PROJECT_SOURCE_DIR}/include")
+SET(dependents "dlog dfs-adaptation")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(${fw_name} REQUIRED ${dependents})
+FOREACH(flag ${${fw_name}_CFLAGS})
+    SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+    SET(EXTRA_CXXFLAGS "${EXTRA_CXXFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+find_package(OpenCV REQUIRED calib3d imgproc)
+if(NOT OpenCV_FOUND)
+       message(SEND_ERROR "OpenCV NOT FOUND")
+       return()
+endif()
+
+SET(CMAKE_C_FLAGS "-I./include -I./include/headers ${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -w")
+SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
+
+SET(CMAKE_CXX_FLAGS "-I./include -I./include/headers ${CMAKE_CXX_FLAGS} ${EXTRA_CXXFLAGS} -fPIC")
+SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g --w")
+
+ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+ADD_DEFINITIONS("-DTIZEN_DEBUG")
+
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIB_INSTALL_DIR}")
+
+aux_source_directory(src SOURCES)
+ADD_LIBRARY(${fw_name} SHARED ${SOURCES})
+
+TARGET_LINK_LIBRARIES(${fw_name} ${OpenCV_LIBS} ${EXTRA_LDFLAGS})
+
+
+SET_TARGET_PROPERTIES(${fw_name}
+     PROPERTIES
+     CLEAN_DIRECT_OUTPUT 1
+)
+
+INSTALL(TARGETS ${fw_name} DESTINATION ${LIB_INSTALL_DIR})
+INSTALL(
+        DIRECTORY ${INC_DIR}/ DESTINATION include/media
+        FILES_MATCHING
+        PATTERN "*_private.h" EXCLUDE
+        PATTERN "*.h"
+        )
+
+SET(PC_NAME ${fw_name})
+SET(PC_REQUIRED ${pc_dependents})
+SET(PC_LDFLAGS -l${fw_name})
+SET(PC_CFLAGS -I\${includedir}/media)
+
+IF(UNIX)
+
+ADD_CUSTOM_TARGET (distclean @echo cleaning for source distribution)
+ADD_CUSTOM_COMMAND(
+        DEPENDS clean
+        COMMENT "distribution clean"
+        COMMAND find
+        ARGS    .
+        -not -name config.cmake -and \(
+        -name tester.c -or
+        -name Testing -or
+        -name CMakeFiles -or
+        -name cmake.depends -or
+        -name cmake.check_depends -or
+        -name CMakeCache.txt -or
+        -name cmake.check_cache -or
+        -name *.cmake -or
+        -name Makefile -or
+        -name core -or
+        -name core.* -or
+        -name gmon.out -or
+        -name install_manifest.txt -or
+        -name *.pc -or
+        -name *~ \)
+        | grep -v TC | xargs rm -rf
+        TARGET  distclean
+        VERBATIM
+)
+
+ENDIF(UNIX)
diff --git a/dfs-opencv.manifest b/dfs-opencv.manifest
new file mode 100644 (file)
index 0000000..a76fdba
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+       <request>
+               <domain name="_" />
+       </request>
+</manifest>
diff --git a/packaging/dfs-opencv.spec b/packaging/dfs-opencv.spec
new file mode 100644 (file)
index 0000000..de5bfa1
--- /dev/null
@@ -0,0 +1,45 @@
+Name:       dfs-opencv
+Summary:    OpenCV based Depth-from-Stereo implementation
+Version:    0.0.1
+Release:    0
+Group:      Multimedia/Libraries
+License:    Apache-2.0
+Source0:    %{name}-%{version}.tar.gz
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
+BuildRequires: cmake
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(dfs-adaptation)
+BuildRequires: pkgconfig(opencv)
+
+%description
+OpenCV based Dept-from-Stereo implementation
+
+
+%prep
+%setup -q
+
+%build
+%if 0%{?sec_build_binary_debug_enable}
+export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
+export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
+export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
+%endif
+
+%cmake .
+
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+
+%make_install
+
+%post -p /sbin/ldconfig
+%postun -p /sbin/ldconfig
+
+%files
+%manifest %{name}.manifest
+%license LICENSE.APLv2
+%defattr(-,root,root,-)
+%{_libdir}/*.so
diff --git a/src/dfs_opencv.cpp b/src/dfs_opencv.cpp
new file mode 100644 (file)
index 0000000..37a8b14
--- /dev/null
@@ -0,0 +1,48 @@
+/**
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 "dfs_opencv_private.h"
+#include <dlog.h>
+
+namespace DfsAdaptationImpl
+{
+       DfsOCV::DfsOCV()
+       {
+               LOGI("ENTER");
+               LOGI("LEAVE");
+       }
+
+       DfsOCV::~DfsOCV()
+       {
+               LOGI("ENTER");
+               LOGI("LEAVE");
+       }
+
+       extern "C"
+       {
+               class IDfsAdaptation *AdaptorInit(void)
+               {
+                       //InferenceTFLite *engine = new InferenceTFLite();
+                       DfsOCV *adaptor = new DfsOCV();
+                       return adaptor;
+               }
+
+               void AdaptorDestroy(class IDfsAdaptation *adaptor)
+               {
+                       delete adaptor;
+               }
+       }
+}
diff --git a/src/dfs_opencv_private.h b/src/dfs_opencv_private.h
new file mode 100644 (file)
index 0000000..bcdb171
--- /dev/null
@@ -0,0 +1,46 @@
+/**
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+
+#ifndef __DFS_OPENCV_PRIVATE_H__
+#define __DFS_OPENCV_PRIVATE_H__
+
+#include <dfs_adaptation.h>
+
+/**
+* @file dfs_opencv_private.h
+* @brief This file contains the DfsAdaptorOCV class which
+*        provides OpenCV based depth functionality
+*/
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "DFS_ADAPTATION_OCV"
+
+using namespace DfsAdaptation;
+
+namespace DfsAdaptationImpl
+{
+       class DfsOCV : public IDfsAdaptation
+       {
+       public:
+               DfsOCV();
+               ~DfsOCV();
+       };
+}
+
+#endif /* __DFS_OPENCV_PRIVATE_H__ */