-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from Sologala/build-for-macos
build_for_macos
Showing
5 changed files
with
981 additions
and
742 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
|
||
project(Stag) | ||
|
||
IF(NOT CMAKE_BUILD_TYPE) | ||
SET(CMAKE_BUILD_TYPE Release) | ||
ENDIF() | ||
|
||
MESSAGE("Build type: " ${CMAKE_BUILD_TYPE}) | ||
|
||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -w ") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -w ") | ||
|
||
# Check C++11 or C++0x support | ||
include(CheckCXXCompilerFlag) | ||
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) | ||
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) | ||
|
||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") | ||
|
||
find_package(OpenCV REQUIRED) | ||
|
||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib) | ||
file(GLOB SRC_FILE1 "src/*.c*") | ||
file(GLOB SRC_FILE2 "src/ED/*.c*") | ||
|
||
include_directories( | ||
${OpenCV_INCLUDE_DIRS} | ||
src/ | ||
src/ED/ | ||
) | ||
add_library( | ||
LibStag SHARED | ||
${SRC_FILE1} | ||
${SRC_FILE2} | ||
) | ||
target_link_libraries( | ||
LibStag | ||
${OpenCV_LIBS} | ||
) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/app) | ||
|
||
add_executable( | ||
testrun | ||
main.cpp | ||
) | ||
|
||
target_link_libraries( | ||
testrun | ||
LibStag | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include "Stag.h" | ||
#include "opencv2/opencv.hpp" | ||
|
||
int main() { | ||
cv::Mat image = cv::imread("1.png", CV_LOAD_IMAGE_GRAYSCALE); | ||
|
||
Stag stag(15, 7, true); | ||
|
||
stag.detectMarkers(image); | ||
stag.logResults(""); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,71 @@ | ||
#ifndef TIMER_H | ||
#define TIMER_H | ||
|
||
#define BUILD_MACOS | ||
|
||
#ifndef BUILD_MACOS | ||
|
||
#include <windows.h> | ||
|
||
class Timer { | ||
private: | ||
__int64 freq, tStart, tStop; | ||
|
||
public: | ||
Timer(){ | ||
Timer() { | ||
// Get the frequency of the hi-res timer | ||
QueryPerformanceFrequency((LARGE_INTEGER*)&freq); | ||
} //end-TimerClass | ||
QueryPerformanceFrequency((LARGE_INTEGER *)&freq); | ||
} // end-TimerClass | ||
|
||
void Start(){ | ||
void Start() { | ||
// Use hi-res timer | ||
QueryPerformanceCounter((LARGE_INTEGER*)&tStart); | ||
} //end-Start | ||
QueryPerformanceCounter((LARGE_INTEGER *)&tStart); | ||
} // end-Start | ||
|
||
void Stop(){ | ||
void Stop() { | ||
// Perform operations that require timing | ||
QueryPerformanceCounter((LARGE_INTEGER*)&tStop); | ||
} //end-Stop | ||
QueryPerformanceCounter((LARGE_INTEGER *)&tStop); | ||
} // end-Stop | ||
|
||
// Returns time in milliseconds | ||
double ElapsedTime(){ | ||
double ElapsedTime() { | ||
// Calculate time difference in milliseconds | ||
return ((double)(tStop - tStart)/(double)freq)*1e3; | ||
} //end-Elapsed | ||
return ((double)(tStop - tStart) / (double)freq) * 1e3; | ||
} // end-Elapsed | ||
}; | ||
#else | ||
|
||
#include <chrono> | ||
#include <ctime> | ||
#include <sys/_types/_int64_t.h> | ||
#include <sys/_types/_timespec.h> | ||
|
||
class Timer { | ||
private: | ||
std::chrono::steady_clock::time_point testTime_t1, testTime_t2; | ||
|
||
public: | ||
Timer() {} // end-TimerClass | ||
|
||
void Start() { | ||
// Use hi-res timer | ||
testTime_t1 = std::chrono::steady_clock::now(); | ||
} // end-Start | ||
|
||
void Stop() { | ||
// Perform operations that require timing | ||
testTime_t2 = std::chrono::steady_clock::now(); | ||
} // end-Stop | ||
|
||
// Returns time in milliseconds | ||
double ElapsedTime() { | ||
// Calculate time difference in milliseconds | ||
return std::chrono::duration_cast<std::chrono::duration<double>>( | ||
testTime_t2 - testTime_t1) | ||
.count(); | ||
} // end-Elapsed | ||
}; | ||
|
||
#endif // !1 | ||
|
||
#endif |
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.