Example #1
0
void Morphology::GenerateObjectList(std::vector<std::vector<int>> map, std::vector<std::shared_ptr<Object>>& objects, int Width, int Height, std::vector<std::vector<int>>& Labels)
{
	std::multimap<int, Cell> Maps;
	Labeling(map, Labels, Width, Height, Maps);

	std::multimap<int, Cell>::iterator k, v;

	for (k = Maps.begin(); k != Maps.end(); k = v)
	{
		Object o;
		auto theKey = k->first;
		auto keyRange = Maps.equal_range(theKey);
		for (v = keyRange.first; v != keyRange.second; ++v)
			o.addCell(Cell(v->second.x, v->second.y));
		o.generateObject();
		objects.push_back(std::make_shared<Object>(o));
	}
}
void CBlobLabeling::DoLabeling()
{
	m_nBlobs = Labeling(m_Image, m_nThreshold);
}
Example #3
0
void CBlobLabeling::DoLabeling()  // ���̺� ���� �Լ�
{
	m_nBlobs = Labeling(m_Image, m_nThreshold);   // �̹����� Threshold���� �Ѱ��־� �νĵ� ��ü�� ������ ���� ����.
}
Example #4
0
// Depending on the type of the vertex, set up the possible labelings.
// These are the maximum possible. As the waltz filter runs, we'll cull
// out labelings that actually don't work.
void Vertex::possible_labelings()
{
   switch(type) {
   case ELL:    // There are 6 different possible labelings for an ELL type
      labelings[0] = Labeling(RIGHT, LEFT);
      labelings[1] = Labeling(LEFT, RIGHT);
      labelings[2] = Labeling(PLUS, RIGHT);
      labelings[3] = Labeling(LEFT, PLUS);
      labelings[4] = Labeling(MINUS, LEFT);
      labelings[5] = Labeling(RIGHT, MINUS);
      num_labelings = 6;
      break;
   case FORK:   // There are 5 different possible labelings for a FORK type
      labelings[0] = Labeling(PLUS, PLUS, PLUS);
      labelings[1] = Labeling(MINUS, MINUS, MINUS);
      labelings[2] = Labeling(LEFT, RIGHT, MINUS);
      labelings[3] = Labeling(MINUS, LEFT, RIGHT);
      labelings[4] = Labeling(RIGHT, MINUS, LEFT);
      num_labelings = 5;
      break;
   case TEE:   // There are 4 different possible labelings for a TEE type
      labelings[0] = Labeling(RIGHT, LEFT, PLUS);
      labelings[1] = Labeling(RIGHT, LEFT, MINUS);
      labelings[2] = Labeling(RIGHT, LEFT, LEFT);
      labelings[3] = Labeling(RIGHT, LEFT, RIGHT);
      num_labelings = 4;
      break;
   case ARROW:   // There are 3 different possible labelings for an ARROW type
      labelings[0] = Labeling(LEFT, RIGHT, PLUS);
      labelings[1] = Labeling(MINUS, MINUS, PLUS);
      labelings[2] = Labeling(PLUS, PLUS, MINUS);
      num_labelings = 3;
      break;
   }
}