int main(int argc, char * argv[]) {


	//ImageFactory::setImplementation(ImageFactory::DEFAULT);
	ImageFactory::setImplementation(ImageFactory::STUDENT);


	ImageIO::debugFolder = "..\\..\\..\\FaceMinMin";
	ImageIO::isInDebugMode = true; //If set to false the ImageIO class will skip any image save function calls

	RGBImage * input = ImageFactory::newRGBImage();
	if (!ImageIO::loadImage("..\\..\\..\\testsets\\Set A\\TestSet Images\\child-1.png", *input)) {

		std::cout << "Image could not be loaded!" << std::endl;
		system("pause");
		return 0;
	}



	ImageIO::saveRGBImage(*input, ImageIO::getDebugFileName("debug.png"));

	DLLExecution * executor = new DLLExecution(input);
	if (executeSteps(executor)) {
		std::cout << "Face recognition successful!" << std::endl;
		std::cout << "Facial parameters: " << std::endl;
		for (int i = 0; i < 16; i++) {
			std::cout << (i+1) << ": " << executor->facialParameters[i] << std::endl;
		}
	}

	delete executor;
	system("pause");
	return 1;
}
Example #2
0
int main(int argc, char * argv[]) {
	ImageIO::debugFolder = "C:\\Users\\Matthijs\\Source\\Repos\\HU-Vision-1415-Base\\testsets\\Set A\\Debug folder\\";
	ImageIO::isInDebugMode = true; //If set to false the ImageIO class will skip any image save function calls
	ImageFactory::setImplementation(ImageFactory::STUDENT);

	RGBImage * input = ImageFactory::newRGBImage();
	if (!ImageIO::loadImage("C:\\Users\\Matthijs\\Source\\Repos\\HU-Vision-1415-Base\\testsets\\Set A\\TestSet Images\\valve.png", *input)) {
		std::cout << "Image could not be loaded!" << std::endl;
		std::cin.get();
		return 0;
	}

	if (TESTING) {
		if (RUN_TEST == 1) {
			Test::RunLocalizationTest(input);
			ImageIO::loadImage("C:\\Users\\Matthijs\\Source\\Repos\\HU-Vision-1415-Base\\testsets\\Set A\\TestSet Images\\female-1.png", *input);
			Test::RunLocalizationTest(input);
			ImageIO::loadImage("C:\\Users\\Matthijs\\Source\\Repos\\HU-Vision-1415-Base\\testsets\\Set A\\TestSet Images\\female-2.png", *input);
			Test::RunLocalizationTest(input);
			ImageIO::loadImage("C:\\Users\\Matthijs\\Source\\Repos\\HU-Vision-1415-Base\\testsets\\Set A\\TestSet Images\\female-3.png", *input);
			Test::RunLocalizationTest(input);
			ImageIO::loadImage("C:\\Users\\Matthijs\\Source\\Repos\\HU-Vision-1415-Base\\testsets\\Set A\\TestSet Images\\male-1.png", *input);
			Test::RunLocalizationTest(input);
			ImageIO::loadImage("C:\\Users\\Matthijs\\Source\\Repos\\HU-Vision-1415-Base\\testsets\\Set A\\TestSet Images\\male-2.png", *input);
			Test::RunLocalizationTest(input);
			ImageIO::loadImage("C:\\Users\\Matthijs\\Source\\Repos\\HU-Vision-1415-Base\\testsets\\Set A\\TestSet Images\\male-3.png", *input);
			Test::RunLocalizationTest(input);
		}
		else if(RUN_TEST == 2)
			Test::RunGaussianTest(input);
	} else {
		ImageIO::saveRGBImage(*input, ImageIO::getDebugFileName("debug.png"));

		DLLExecution * executor = new DLLExecution(input);


		if (executeSteps(executor)) {
			std::cout << "Face recognition successful!" << std::endl;
			std::cout << "Facial parameters: " << std::endl;
			for (int i = 0; i < 16; i++) {
				std::cout << (i + 1) << ": " << executor->facialParameters[i] << std::endl;
			}
		}

		delete executor;
	}

	std::cin.get();
	return 1;
}
Example #3
0
double Calculator::CalculateFromInfix(string infix)
{
  char ch;
  double result;

  for (int i = 0; i < infix.size(); i++) {
	ch = infix[i];

	switch (ch) {

	case '0':	case '1':	case '2':	case '3':	case '4':
	case '5':	case '6':	case '7':	case '8':	case '9':

	  // digits, i.e. operands.  assumption is that each operand is a single digit
	  CALC_DEBUG(cout << "pushing val " << ch - '0' << endl);
	  valStack.push(ch - '0');
	  break;

	case '+':	case '-':	case '*':	case '/':

	  // operators
	  if (opStack.isEmpty()) {

	    CALC_DEBUG(cout << "pushing  op " << ch << endl);
	    opStack.push(ch);

	  } else if (precedence(ch) > precedence(opStack.peek())) {

	    CALC_DEBUG(cout << "pushing  op " << ch << endl);
	    opStack.push(ch);

	  } else {

		while (!opStack.isEmpty() && (precedence(ch) <= precedence(opStack.peek()))) {
		  executeSteps();
		}

		CALC_DEBUG(cout << "pushing  op " << ch << endl);
		opStack.push(ch);
	  }
	  break;

	case '(':

	  CALC_DEBUG(cout << "pushing  op " << ch << endl);
	  opStack.push(ch);
	  break;

	case ')':

	  while (opStack.peek() != '(') {
		executeSteps();
	  }
	  CALC_DEBUG(cout << "popping  op " << endl);
	  opStack.pop();
	  break;

	case ' ':
	  // skip spaces
	  break;

	default:
	  // TODO: handle error case
	  cout << "Should not get here:" << ch << endl;
	}
  }

  while (!opStack.isEmpty()) {
	executeSteps();
  }
  
  result = valStack.peek();
  return result;
}