MCPcopy Create free account
hub / github.com/CVCUDA/CV-CUDA / MorphologyInto

Function MorphologyInto

python/mod_cvcuda/operators/OpMorphology.cpp:34–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32
33namespace {
34Tensor MorphologyInto(Tensor &output, Tensor &input, NVCVMorphologyType morph_type,
35 const std::tuple<int, int> &maskSize, const std::tuple<int, int> &anchor,
36 std::optional<Tensor> workspace, int32_t iteration, NVCVBorderType border,
37 std::optional<Stream> pstream)
38{
39 if (!pstream)
40 {
41 pstream = Stream::Current();
42 }
43
44 auto morphology = CreateOperator<cvcuda::Morphology>();
45
46 ResourceGuard guard(*pstream);
47 guard.add(LockMode::LOCK_MODE_READ, {input});
48 guard.add(LockMode::LOCK_MODE_WRITE, {output});
49 guard.add(LockMode::LOCK_MODE_NONE, {*morphology});
50
51 nvcv::Size2D maskSizeArg{std::get<0>(maskSize), std::get<1>(maskSize)};
52 int2 anchorArg;
53 anchorArg.x = std::get<0>(anchor);
54 anchorArg.y = std::get<1>(anchor);
55
56 if (workspace)
57 {
58 guard.add(LockMode::LOCK_MODE_READ, {*workspace});
59 morphology->submit(pstream->cudaHandle(), input, output, *workspace, morph_type, maskSizeArg, anchorArg,
60 iteration, border);
61 }
62 else
63 {
64 morphology->submit(pstream->cudaHandle(), input, output, nvcv::NullOpt, morph_type, maskSizeArg, anchorArg,
65 iteration, border);
66 }
67
68 return output;
69}
70
71Tensor Morphology(Tensor &input, NVCVMorphologyType morph_type, const std::tuple<int, int> &maskSize,
72 const std::tuple<int, int> &anchor, std::optional<Tensor> workspace, int32_t iteration,

Callers 1

MorphologyFunction · 0.85

Calls 3

cudaHandleMethod · 0.80
addMethod · 0.45
submitMethod · 0.45

Tested by

no test coverage detected