-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathtest_CoHOGDetectorCUDA.cpp
More file actions
40 lines (29 loc) · 890 Bytes
/
test_CoHOGDetectorCUDA.cpp
File metadata and controls
40 lines (29 loc) · 890 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "gtest/gtest.h"
#include "CoHOGDetectorCUDA.hpp"
#include <opencv2/opencv.hpp>
class TestCoHOGDetectorCUDA : public ::testing::Test
{
protected:
libcohog::gpu_context context;
virtual void SetUp()
{ }
};
TEST_F(TestCoHOGDetectorCUDA, transfer_image)
{
cv::Mat_<unsigned char> img = cv::Mat_<unsigned char>::eye(1024, 768);
libcohog::set_image(context, img.data, img.cols, img.rows);
for(int y = 0; y < img.rows; ++y)
for(int x = 0; x < img.cols; ++x)
EXPECT_EQ(img(y, x), img.data[y * img.cols + x]);
//check
EXPECT_EQ(img.cols, context.w);
EXPECT_EQ(img.rows, context.h);
//check image
context.download();
for(int i = 0; i < context.w * context.h; ++i)
EXPECT_EQ(img.data[i], context.img_cpu[i]);
}
TEST_F(TestCoHOGDetectorCUDA, calc_gradient)
{
libcohog::calc_gradient(context, 8, 10);
}