Skip to content

Commit

Permalink
submission...
Browse files Browse the repository at this point in the history
Conflicts:
	DkNomacs/DkNomacs.rc
  • Loading branch information
diemmarkus committed Apr 30, 2015
1 parent abebb46 commit 57956f2
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 13 deletions.
11 changes: 10 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ ENDIF()
include_directories (
${OpenCV_INCLUDE_DIRS}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/DkViennaMS
${CMAKE_CURRENT_SOURCE_DIR}/DkNomacs
${CMAKE_CURRENT_SOURCE_DIR}/DkModule
${CMAKE_CURRENT_SOURCE_DIR}/DkCore
Expand All @@ -100,6 +101,10 @@ file(GLOB DKNOMACS_HEADERS "DkNomcas/*.h")
file(GLOB DKNOMACS_MOCS "DkNomacs/*.h")
file(GLOB DKNOMACS_CONFIGS "DkNomacs/*.conf")

file(GLOB DKVIENNAMS_SOURCES "DkViennaMS/*.cpp")
file(GLOB DKVIENNAMSS_HEADERS "DkViennaMS/*.h")


file(GLOB DKCORE_SOURCES "DkCore/*.cpp")
file(GLOB DKCORE_HEADERS "DkCore/*.h")

Expand Down Expand Up @@ -139,12 +144,16 @@ set(DKMODULELIB_NAME optimized ${DKMODULEDLL_NAME}.lib debug ${DKMODULEDLL_NAME}

set(NOMACSDLL_NAME optimized libnomacs.lib debug libnomacsd.lib)

set(EXE_NAME_NOMACS ${CMAKE_PROJECT_NAME}-nomacs)
set(EXE_NAME ${CMAKE_PROJECT_NAME})
add_definitions(-DDK_DEBUG)
add_definitions(-DDK_DEBUG)
add_definitions(-DDK_SAVE_DEBUG)
link_directories(${LIBRAW_LIBRARY_DIRS} ${OpenCV_LIBRARY_DIRS} ${CMAKE_CURRENT_BINARY_DIR}/libs)
add_executable(${EXE_NAME} MACOSX_BUNDLE ${DKNOMACS_SOURCES} ${DKNOMACS_HEADERS} ${DKNOMACS_MOC_SRC} ${DKNOMACS_TRANSLATIONS} ${DKNOMACS_FORMS} ${DKNOMACS_MOCS} ${DKNOMACS_RESOURCES} ${DKNOMACS_CONFIGS} ${DKNOMACS_RC} ${DKNOMACS_RCC})
add_executable(${EXE_NAME_NOMACS} MACOSX_BUNDLE ${DKNOMACS_SOURCES} ${DKNOMACS_HEADERS} ${DKNOMACS_MOC_SRC} ${DKNOMACS_TRANSLATIONS} ${DKNOMACS_FORMS} ${DKNOMACS_MOCS} ${DKNOMACS_RESOURCES} ${DKNOMACS_CONFIGS} ${DKNOMACS_RC} ${DKNOMACS_RCC})

add_executable(${EXE_NAME} MACOSX_BUNDLE ${DKVIENNAMS_SOURCES} ${DKVIENNAMS_HEADERS})

target_link_libraries(${EXE_NAME} ${OpenCV_LIBS} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTNETWORK_LIBRARY} ${QT_QTMAIN_LIBRARY} ${DKCOREDLL_NAME} ${DKMODULEDLL_NAME} ${NOMACSDLL_NAME})

set_target_properties(${EXE_NAME} PROPERTIES LINK_FLAGS_REALLYRELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /SUBSYSTEM:WINDOWS /LARGEADDRESSAWARE")
Expand Down
11 changes: 0 additions & 11 deletions DkCore/DkUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
//#include "DkCoreIncludes.h"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/core/core.hpp"
#include "opencv2/features2d/features2d.hpp"
#include <time.h>

#include <sstream>
Expand Down Expand Up @@ -128,16 +127,6 @@ class DkUtils {
return printMat<float>(src);
}

static std::string keyPointToString(const KeyPoint& kp) {

std::string str;
str += "<" + DkUtils::stringify(kp.pt.x, 1) + ", " + DkUtils::stringify(kp.pt.y, 1) + "> ";
str += "size|octave: " + DkUtils::stringify(kp.size) + " | " + DkUtils::stringify(kp.octave);
str += " angle: " + DkUtils::stringify(kp.angle, 1);

return str;
}

/**
* Prints a matrix to the standard output.
* This is especially useful for copy and pasting e.g.
Expand Down
22 changes: 21 additions & 1 deletion DkModule/DkMSModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
DkMSModule::DkMSModule(const std::wstring& folderName) {

this->folderName = folderName;
strictInput = false;
strictInput = true;
}

void DkMSModule::load() {
Expand Down Expand Up @@ -103,11 +103,31 @@ void DkMSModule::load() {
throw DkIllegalArgumentException(msg, __LINE__, __FILE__);
}

if (strictInput) {
for (size_t idx = 0; idx < msImgs.size(); idx++) {
if (msImgs[idx].empty()) {
std::string msg = "Channel " + DkUtils::stringify(idx+1) + " is empty! I need to abort sorry...";
throw DkIllegalArgumentException(msg, __LINE__, __FILE__);
}
}
}
imgs = DkMSData(msImgs);

iout << "images loaded in: " << dt << dkendl;
}

bool DkMSModule::saveImage(const std::string& imageName) const {

cv::Mat segImgInv = segImg.clone();
DkIP::invertImg(segImgInv);
bool ok = cv::imwrite(imageName, segImgInv);

if (!ok)
mout << "sorry, I could not write to: " << imageName << dkendl;

return ok;
}

void DkMSModule::compute() {

DkTimer dt;
Expand Down
2 changes: 2 additions & 0 deletions DkModule/DkMSModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ class DK_MODULE_API DkMSModule {
cv::Mat getSegImg() const;
DkMSData getMSImages() const;
cv::Mat getGT() const;

std::vector<std::wstring> indexFolder(const std::wstring& folderName) const;
bool saveImage(const std::string& imageName) const;

protected:
std::wstring folderName;
Expand Down
Binary file modified DkNomacs/DkNomacs.rc
Binary file not shown.
59 changes: 59 additions & 0 deletions DkViennaMS/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/**************************************************
* main.cpp
*
* Created on: 16.08.2011
* Author: Markus Diem
* Company: Vienna University of Technology
**************************************************/

#include "DkMSModule.h"

std::string helpText();

int main(int argc, char *argv[]) {

if (argc != 3) {
std::cout << "Wrong number of input arguments: " << argc-1 << " (2 expected)" << std::endl;
std::cout << helpText();
return 1;
}

try {

std::string folderName(argv[1]);
std::replace(folderName.begin(), folderName.end(), '\\', '/');
std::wstring folderNameW(folderName.begin(), folderName.end());
std::string imageName(argv[2]);

DkMSModule module(folderNameW);
module.load();
module.compute();
module.saveImage(imageName);

}
catch(DkException iae) {
printf("%s\n", iae.Msg().c_str());
std::cout << helpText() << std::endl;
return 1;
}
catch(cv::Exception cvex) {
printf("Error in function %s, in file %s: msg %s\n", cvex.func.c_str(), cvex.file.c_str(), cvex.err.c_str());
std::cout << helpText() << std::endl;
return 2;
}

return 0;

}

std::string helpText() {

std::string ht;
ht += "Welcome to ViennaMS.\n\n";
ht += "ViennaMS.exe <folder_name> <output_img_name>\n";
ht += " <folder_name> path to the MS folder.\n The folder should contain 8 image files (FXXs.png) where XX is the channel number.\n";
ht += " <output_img_name> the output image name.\n\n";
ht += " Enjoy your day!\n";

return ht;
}

0 comments on commit 57956f2

Please sign in to comment.