Commit 9f8abd77 authored by remicres's avatar remicres
Browse files

ADD: implementation of the baatzSegmenter node memory computation

Showing with 16 additions and 0 deletions
+16 -0
...@@ -94,6 +94,7 @@ namespace lsrm ...@@ -94,6 +94,7 @@ namespace lsrm
float ComputeMergingCost(NodePointerType n1, NodePointerType n2); float ComputeMergingCost(NodePointerType n1, NodePointerType n2);
void UpdateSpecificAttributes(NodePointerType n1, NodePointerType n2); void UpdateSpecificAttributes(NodePointerType n1, NodePointerType n2);
void InitFromImage(); void InitFromImage();
unsigned int GetNodeMemory(unsigned int nEdges);
}; };
} // end of namespace lsrm } // end of namespace lsrm
......
...@@ -129,6 +129,21 @@ namespace lsrm ...@@ -129,6 +129,21 @@ namespace lsrm
this->m_Complete = !prev_merged; this->m_Complete = !prev_merged;
} }
} }
template<class TImage>
unsigned int
BaatzSegmenter<TImage>::GetNodeMemory(unsigned int nEdges)
{
unsigned int nBands = this->m_InputImage->GetNumberOfComponentsPerPixel();
long long unsigned int memory = 0;
memory += sizeof(NodePointerType); // size of the node pointer
memory += sizeof(NodeType); // size of the node
memory += 4 * nBands * sizeof(float); // size of the 4 attributes, multiplied by the nb. of bands
memory += nEdges * sizeof(EdgeType); // size of the edges
return memory;
}
} // end of namespace lsrm } // end of namespace lsrm
#endif #endif
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment