forked from arrayfire/arrayfire
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflood_fill.cpp
More file actions
40 lines (32 loc) · 1.3 KB
/
flood_fill.cpp
File metadata and controls
40 lines (32 loc) · 1.3 KB
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
40
/*******************************************************
* Copyright (c) 2019, ArrayFire
* All rights reserved.
*
* This file is distributed under 3-clause BSD license.
* The complete license agreement can be obtained at:
* http://arrayfire.com/licenses/BSD-3-Clause
********************************************************/
#include <flood_fill.hpp>
#include <err_cpu.hpp>
#include <kernel/flood_fill.hpp>
using af::connectivity;
namespace cpu {
template<typename T>
Array<T> floodFill(const Array<T>& image, const Array<uint>& seedsX,
const Array<uint>& seedsY, const T newValue,
const T lowValue, const T highValue,
const af::connectivity nlookup) {
auto out = createValueArray(image.dims(), T(0));
getQueue().enqueue(kernel::floodFill<T>, out, image, seedsX, seedsY,
newValue, lowValue, highValue, nlookup);
return out;
}
#define INSTANTIATE(T) \
template Array<T> floodFill(const Array<T>&, const Array<uint>&, \
const Array<uint>&, const T, const T, const T, \
const af::connectivity);
INSTANTIATE(float)
INSTANTIATE(uint)
INSTANTIATE(ushort)
INSTANTIATE(uchar)
} // namespace cpu