Skip to content
Snippets Groups Projects
Commit 364bbae3 authored by Aline Gondim Santos's avatar Aline Gondim Santos
Browse files

Change preferences on-the-fly

Change-Id: Iec444649c958b8c61f766f32292dc659a50658ab
parent 5aa39656
No related branches found
No related tags found
No related merge requests found
......@@ -17,9 +17,12 @@ set (JPL_DIRECTORY ${PROJECT_BINARY_DIR}/jpl)
if(WIN32)
message(OS:\ WINDOWS\ ${CMAKE_SYSTEM_PROCESSOR})
set (CONTRIB_PLATFORM_CURT ${CMAKE_SYSTEM_PROCESSOR})
if (NOT ${CMAKE_CL_64})
message( FATAL_ERROR "\nUse CMake only for x64 Windows" )
endif()
set (CONTRIB_PLATFORM_CURT x64)
set (CONTRIB_PLATFORM ${CONTRIB_PLATFORM_CURT}-windows)
set (LIBRARY_FILE_NAME lib${PLUGIN_NAME}.dll)
set (LIBRARY_FILE_NAME ${PLUGIN_NAME}.dll)
set (LIBS_DIR $ENV{HOME}/Documents/GITHUB/Libs)
set (OPENCV $ENV{HOME}/Documents/GITHUB/opencv/build-bash/)
set (FFMPEG ${CONTRIB_PATH}/build/ffmpeg/Build/win32/x64)
......@@ -77,8 +80,7 @@ set(plugin_SRC main.cpp
videoSubscriber.cpp
)
set(plugin_HDR ${ProjectName}Config.h
pluginInference.h
set(plugin_HDR pluginInference.h
pluginMediaHandler.h
pluginParameters.h
pluginProcessor.h
......@@ -111,8 +113,8 @@ target_include_directories(${ProjectName} PUBLIC ${PROJECT_BINARY_DIR}
${LIBS_DIR}/${TENSORFLOW}/include/third_party/eigen3
${LIBS_DIR}/${TENSORFLOW}/include/flatbuffers
)
link_directories(${ProjectName} PUBLIC ${CONTRIB_PATH}
if (WIN32)
target_link_directories(${ProjectName} PUBLIC ${CONTRIB_PATH}
${LIBS_DIR}/${TENSORFLOW}/lib/${CONTRIB_PLATFORM}
${OPENCV}/install/x64/vc16/staticlib
${FFMPEG}/bin
......@@ -121,11 +123,20 @@ link_directories(${ProjectName} PUBLIC ${CONTRIB_PATH}
${CONTRIB_PATH}/${CONTRIB_PLATFORM}/lib/opencv4/3rdparty
${LIBS_DIR}/${TENSORFLOW}/lib/${CONTRIB_PLATFORM}
)
if (WIN32)
target_link_libraries(${ProjectName} PUBLIC swscale avutil libpng opencv_imgcodecs411 opencv_imgproc411 opencv_core411 ${TFLIB} zlib)
endif()
if (UNIX)
link_directories(${ProjectName} PUBLIC ${CONTRIB_PATH}
${LIBS_DIR}/${TENSORFLOW}/lib/${CONTRIB_PLATFORM}
${OPENCV}/install/x64/vc16/staticlib
${FFMPEG}/bin
${LIBS_DIR}
${CONTRIB_PATH}/${CONTRIB_PLATFORM}/lib
${CONTRIB_PATH}/${CONTRIB_PLATFORM}/lib/opencv4/3rdparty
${LIBS_DIR}/${TENSORFLOW}/lib/${CONTRIB_PLATFORM}
)
target_link_libraries(${ProjectName} PUBLIC swscale avutil libpng opencv_imgcodecs opencv_imgproc opencv_core ${TFLIB})
endif()
......@@ -145,13 +156,22 @@ add_custom_command(
COMMENT "Assembling Plugin files"
)
add_custom_command(
TARGET ${ProjectName}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/Release/${LIBRARY_FILE_NAME} ${JPL_DIRECTORY}/lib/
if (WIN32)
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/Release/${ProjectName}.lib ${JPL_DIRECTORY}/lib/
endif()
COMMAND python ${PROJECT_SOURCE_DIR}/../assemblePlugin.py --plugins=GreenScreen
COMMENT "Generating JPL archive"
)
if (WIN32)
add_custom_command(
TARGET ${ProjectName}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/Release/${ProjectName}.lib ${JPL_DIRECTORY}/lib/${CONTRIB_PLATFORM}
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/Release/${LIBRARY_FILE_NAME} ${JPL_DIRECTORY}/lib/${CONTRIB_PLATFORM}
COMMAND python ${PROJECT_SOURCE_DIR}/../assemblePlugin.py --plugins=GreenScreen
COMMENT "Generating JPL archive"
)
else()
add_custom_command(
TARGET ${ProjectName}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/Release/${LIBRARY_FILE_NAME} ${JPL_DIRECTORY}/lib/${CONTRIB_PLATFORM}
COMMAND python ${PROJECT_SOURCE_DIR}/../assemblePlugin.py --plugins=GreenScreen
COMMENT "Generating JPL archive"
)
endif()
\ No newline at end of file
......@@ -88,10 +88,10 @@ PluginMediaHandler::setPreferenceAttribute(const std::string& key, const std::st
bool
PluginMediaHandler::preferenceMapHasKey(const std::string& key)
{
if (ppm_.find(key) == ppm_.end()) {
return false;
if (key == "backgroundlist") {
return true;
}
return true;
return false;
}
void
......
......@@ -41,13 +41,11 @@ public:
virtual void detach() override;
virtual void setPreferenceAttribute(const std::string& key, const std::string& value) override;
virtual bool preferenceMapHasKey(const std::string& key) override;
std::shared_ptr<VideoSubscriber> mVS;
std::string dataPath() const { return datapath_; }
private:
bool preferenceMapHasKey(const std::string& key);
std::string dataPath() const { return datapath_; }
private:
const std::string datapath_;
......
......@@ -43,7 +43,7 @@ namespace jami
{
PluginProcessor::PluginProcessor(const std::string& dataPath):
pluginInference{TFModel{dataPath + sep + "models/" + mPluginParameters->model}}
pluginInference{TFModel{dataPath + sep + "models" + sep + mPluginParameters->model}}
{
initModel();
setBackgroundImage(dataPath, mPluginParameters->image);
......@@ -52,7 +52,7 @@ pluginInference{TFModel{dataPath + sep + "models/" + mPluginParameters->model}}
void
PluginProcessor::setBackgroundImage(const std::string& dataPath, const std::string& value)
{
backgroundPath = dataPath + sep + "backgrounds" + sep + value;
backgroundPath = dataPath + sep + "backgrounds" + sep + value; //
cv::Size size = cv::Size{0,0};
if (!backgroundImage.empty())
......
......@@ -8,10 +8,10 @@
"defaultValue": "out",
"entries": ["sent", "received"],
"entryValues": ["out", "in"],
"editable": "true"
"scope": "plugin"
},
{
"category" : "ModelPreference",
"category" : "models",
"type": "List",
"key": "modellist",
"title": "Model to load",
......@@ -19,17 +19,17 @@
"defaultValue": "mModel.pb",
"entries": ["mModel"],
"entryValues": ["mModel.pb"],
"editable": "false"
"scope": "plugin"
},
{
"category" : "ImageBackground",
"type": "List",
"category" : "backgrounds",
"type": "UserList",
"key": "backgroundlist",
"title": "Background image",
"summary": "Select the image background to use",
"defaultValue": "background2.png",
"entries": ["Painture", "Beach"],
"entryValues": ["background1.png", "background2.png"],
"editable": "true"
"entries": [ "Add new image", "Painture", "Beach" ],
"entryValues": ["", "background1.png", "background2.png"],
"scope": "plugin,Foreground Segmentation"
}
]
......@@ -8,10 +8,10 @@
"defaultValue": "out",
"entries": ["sent", "received"],
"entryValues": ["out", "in"],
"editable": "true"
"scope": "plugin"
},
{
"category" : "ModelPreference",
"category" : "models",
"type": "List",
"key": "modellist",
"title": "Model to load",
......@@ -19,17 +19,17 @@
"defaultValue": "mModel.tflite",
"entries": ["mModel"],
"entryValues": ["mModel.tflite"],
"editable": "false"
"scope": "plugin"
},
{
"category" : "ImageBackground",
"type": "List",
"category" : "backgrounds",
"type": "UserList",
"key": "backgroundlist",
"title": "Background image",
"summary": "Select the image background to use",
"defaultValue": "background2.png",
"entries": ["Painture", "Beach"],
"entryValues": ["background1.png", "background2.png"],
"editable": "true"
"entries": [ "Add new image", "Painture", "Beach" ],
"entryValues": ["", "background1.png", "background2.png"],
"scope": "plugin,Foreground Segmentation"
}
]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment