38 if (!ignoreLinkedPosition)
44 if (image.YawisLinked())
48 if (image.YawisLinkedWith(pano.
getImage(j)))
59 for (
size_t i = 0; i < cps.size(); ++i)
63 m_graph[cps[i].image1Nr].insert(cps[i].image2Nr);
64 m_graph[cps[i].image2Nr].insert(cps[i].image1Nr);
75 for (
size_t i = 0; i < nrImages-1; ++i)
77 for (
size_t j = i + 1; j < nrImages; ++j)
88 template<
typename VALUETYPE>
91 marks[vertex] = setType;
92 for (HuginBase::UIntSet::const_iterator it = graph[vertex].begin(); it != graph[vertex].end(); ++it)
94 if (marks[*it] == unvisitedType)
109 std::vector<size_t> marks(
m_graph.size(), 0);
111 for (
size_t i = 0; i <
m_graph.size(); ++i)
116 DepthFirstSearch<size_t>(
m_graph, marks, i, counter, 0);
120 comp.resize(counter);
121 for (
size_t imgNr = 0; imgNr < marks.size(); ++imgNr)
123 comp[marks[imgNr] - 1].insert(imgNr);
135 std::vector<bool> visited(
m_graph.size(),
false);
137 for (std::vector<bool>::const_iterator it = visited.begin(); it != visited.end(); ++it)
150 while (!queue.empty())
152 const size_t vertex = queue.front();
154 if (!visited[vertex])
156 visited[vertex] =
true;
159 for (HuginBase::UIntSet::const_iterator it = graph[vertex].begin(); it != graph[vertex].end(); ++it)
163 visitedNeighbors.insert(*it);
167 unvisitedNeighbors.insert(*it);
171 visitor->
Visit(vertex, visitedNeighbors, unvisitedNeighbors);
183 const size_t realStartImg = (startImg >=
m_graph.size()) ? 0 : startImg;
184 std::vector<bool> visited(
m_graph.size(),
false);
185 std::queue<size_t> queue;
187 queue.push(realStartImg);
189 if (forceAllComponents)
194 for (
size_t i = 0; i <
m_graph.size(); ++i)
double getOverlap(unsigned int i, unsigned int j) const
returns the overlap for 2 images with number i and j
bool IsConnected()
check if all images are connected
std::vector< HuginBase::UIntSet > Components
stores the components of the graph
ImageGraph(const HuginBase::PanoramaData &pano, bool ignoreLinkedPosition=false)
constructor, build internal representation of graph
std::set< unsigned int > UIntSet
void VisitAllImages(const size_t startImg, bool forceAllComponents, BreadthFirstSearchVisitor *visitor)
visit all images via a breadth first search algorithm for each visited images, the functor visitor is...
std::vector< HuginBase::UIntSet > GraphList
stores adjacency list for graph
void BreadthFirstSearchVisit(const ImageGraph::GraphList &graph, std::queue< size_t > &queue, std::vector< bool > &visited, BreadthFirstSearchVisitor *visitor)
virtual const SrcPanoImage & getImage(std::size_t nr) const =0
get a panorama image, counting starts with 0
void DepthFirstSearch(const ImageGraph::GraphList &graph, std::vector< VALUETYPE > &marks, const size_t vertex, const VALUETYPE setType, const VALUETYPE unvisitedType)
virtual const CPVector & getCtrlPoints() const =0
get all control point of this Panorama
Components GetComponents()
find all connected components
std::vector< ControlPoint > CPVector
unsigned int getNrOfImages() const
return number of images in underlying pano
class for calculating overlap of images
virtual std::size_t getNrOfImages() const =0
number of images.
All variables of a source image.
virtual void Visit(const size_t vertex, const HuginBase::UIntSet &visitedNeighbors, const HuginBase::UIntSet &unvisitedNeighbors)=0
abstract base functor for breadth first search in ImageGraph