Skip to content

Commit 0f0edd8

Browse files
Template for the second practice.
1 parent 3cc8859 commit 0f0edd8

File tree

8 files changed

+88
-8
lines changed

8 files changed

+88
-8
lines changed

include/auxiliaries.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#pragma once
2+
3+
int parseArguments(int argc, char **argv);

include/img_proc.hpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#pragma once
2+
3+
#include <opencv2/core/core.hpp>
4+
#include <opencv2/highgui/highgui.hpp>
5+
#include <opencv2/imgproc/imgproc.hpp>
6+
7+
using namespace cv;
8+
9+
int getFrame(Mat& src);
10+
11+
int processFrame(const Mat& src, Mat& dst);
12+
13+
int show(const Mat& src, const Mat& dst);

samples/sample_template.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#include <opencv2/core/core.hpp>
2+
#include <iostream>
3+
4+
#include "auxiliaries.hpp"
5+
#include "img_proc.hpp"
6+
7+
using namespace std;
8+
using namespace cv;
9+
10+
int main(int argc, char **argv)
11+
{
12+
if (parseArguments(argc, argv) != 0)
13+
{
14+
cout << "Incorrect input parameters!" << endl;
15+
return 1;
16+
}
17+
18+
Mat src, dst;
19+
20+
if (getFrame(src) != 0)
21+
{
22+
cout << "Error: \'src\' image is null or empty!" << endl;
23+
return 2;
24+
}
25+
26+
processFrame(src, dst);
27+
28+
show(src, dst);
29+
30+
return 0;
31+
}

src/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
set(target ${PRACTICE1_LIBRARY})
1+
set(target ${PRACTICE2_LIBRARY})
22

3-
FILE(GLOB hdrs "*.h*" "${PRACTICE1_INCLUDE}/*.h*")
3+
FILE(GLOB hdrs "*.h*" "${PRACTICE2_INCLUDE}/*.h*")
44
FILE(GLOB srcs "*.cpp")
55

66
ADD_LIBRARY(${target} STATIC ${srcs} ${hdrs})

src/auxiliaries.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include "auxiliaries.hpp"
2+
3+
int parseArguments(int argc, char **argv)
4+
{
5+
return 0;
6+
}

src/img_proc.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#include "img_proc.hpp"
2+
3+
int getFrame(Mat& src)
4+
{
5+
return 0;
6+
}
7+
8+
int processFrame(const Mat& src, Mat& dst)
9+
{
10+
return 0;
11+
}
12+
13+
int show(const Mat& src, const Mat& dst)
14+
{
15+
return 0;
16+
}

test/CMakeLists.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/gtest")
88
ADD_EXECUTABLE(${target} ${srcs} ${hdrs})
99
TARGET_LINK_LIBRARIES(${target} gtest ${PRACTICE2_LIBRARY})
1010

11-
add_custom_command(
12-
TARGET ${PRACTICE2_TESTS}
13-
POST_BUILD
14-
COMMAND ln -fns "${CMAKE_SOURCE_DIR}/testdata" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE}/testdata"
15-
COMMENT "Adding a symbolic link to testdata"
16-
)
11+
#add_custom_command(
12+
# TARGET ${PRACTICE2_TESTS}
13+
# POST_BUILD
14+
# COMMAND ln -fns "${CMAKE_SOURCE_DIR}/testdata" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE}/testdata"
15+
# COMMENT "Adding a symbolic link to testdata"
16+
#)

test/aux_test.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#include <gtest/gtest.h>
2+
#include "auxiliaries.hpp"
3+
4+
TEST(practice2, parseArguments)
5+
{
6+
int argc = 0;
7+
char **argv = 0;
8+
int res = parseArguments(argc, argv);
9+
10+
EXPECT_EQ(0, res);
11+
}

0 commit comments

Comments
 (0)