예제 #1
0
int main () {
	
	stringstream ss;
	string name;
	
	//int n=10;
	
	// Be sure that this is the path where you have saved your images!
	// Otherwise, write your own
	ss << "images/";
	cout << "\nType name of picture (in .jpg format) that you wish to analyse: ";
	cin >> name;
	if (name[0] == '/')
	{
		ss.str("");
		ss << name << ".jpg";
	}
	else
	{
		ss << name << ".jpg"; 
	}
	
	string extension = ss.str();
	const char * path = extension.c_str();
	cout << "\nOpening " << path << endl;
	
	Edgedetection detecting(path);

	detecting.canny_edge_detection();
	
	return 0;

}
예제 #2
0
파일: snake.c 프로젝트: haha370104/OSCourse
void HariMain(void)
{


	char *buf;
	int win, i, x, y, timer;
	api_initmalloc();
	buf = api_malloc(200 * 200);
	char* title;
	char keyflag[4];
	char *last_direction;
	*last_direction = '4';


	//snake
	struct snakeNode *head = api_malloc(sizeof(struct snakeNode));
	head->preNode = NULL;
	head->posX = 75;
	head->posY = 55;
	head->moveDirection = 4;

	struct snakeNode *tail = head;
	//snake

	//food
	struct Food food;
	food.posX = 69;
	food.posY = 61;
	food.isEaten = 1;// not eaten;
	//food



	sprintf(title, "posX: %d, posY: %d, mp: %d", tail->posX, tail->posY, tail->moveDirection);
	//sprintf(title, "Hungry Snake");
	win = api_openwin(buf, 200, 200, -1, title);
	timer = api_alloctimer();

	api_inittimer(timer, 128);

	api_boxfilwin(win, 5, 25, 195, 195, 0);
	x = 75;
	y = 55;
	tail->posX = 75;
	tail->posY = 55;
	api_putstrwin(win, tail->posX, tail->posY, 3, 1, "*");
	//scrnRefresher(win, tail, 3, "*");





	for (;;) {

		i = *last_direction;
		scrnRefresher(win, tail, 0, "*");
		// updateSnake(head);
		updateSnake(tail);
		scrnRefresher(win, tail, 3, "*");

		//add food here
		foodInit(&food, win, 4, "+");
		//add food here


		/*detecting*/
		detecting(head, &tail, &food);



		delay();
		//if (snakeLength < 10) {tail = addSegment(tail, &snakeLength);}

		wait(1, timer, keyflag, last_direction, head);
	}




	api_closewin(win);
	api_end();
}