MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / testSobelDerivatives

Function testSobelDerivatives

test/sobel.cpp:47–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45
46template<typename Ti, typename To>
47void testSobelDerivatives(string pTestFile) {
48 SUPPORTED_TYPE_CHECK(Ti);
49
50 vector<dim4> numDims;
51 vector<vector<Ti>> in;
52 vector<vector<To>> tests;
53
54 readTests<Ti, To, int>(pTestFile, numDims, in, tests);
55
56 dim4 dims = numDims[0];
57 af_array dxArray = 0;
58 af_array dyArray = 0;
59 af_array inArray = 0;
60
61 ASSERT_SUCCESS(af_create_array(&inArray, &(in[0].front()), dims.ndims(),
62 dims.get(),
63 (af_dtype)dtype_traits<Ti>::af_type));
64
65 ASSERT_SUCCESS(af_sobel_operator(&dxArray, &dyArray, inArray, 3));
66
67 vector<To> currDXGoldBar = tests[0];
68 vector<To> currDYGoldBar = tests[1];
69
70 ASSERT_VEC_ARRAY_EQ(currDXGoldBar, dims, dxArray);
71 ASSERT_VEC_ARRAY_EQ(currDYGoldBar, dims, dyArray);
72
73 // cleanup
74 ASSERT_SUCCESS(af_release_array(inArray));
75 ASSERT_SUCCESS(af_release_array(dxArray));
76 ASSERT_SUCCESS(af_release_array(dyArray));
77}
78
79// rectangle test data is generated using opencv
80// border type is set to cv.BORDER_REFLECT_101 in opencv

Callers

nothing calls this directly

Calls 5

af_create_arrayFunction · 0.50
af_sobel_operatorFunction · 0.50
af_release_arrayFunction · 0.50
ndimsMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected