Esempio n. 1
0
// find the proper img according to average
int findProperPic (Color *avgs, Color *vars, PicNode** picNode, PicNodeList *picNodeList) {
	int i;
	double min = MAX_VALUE;
    
    //printf("Finding proper pic...\n");
    
	for (i = 0; i < picNodeList->numOfImgs; i++) {
		//printf("Original pic node path = %s\n", picNodeList->picNode[i].path);
        
        PicNode *pnode = &(picNodeList->picNode[i]);
        
        //printf("new pic node path = %s\n", pnode->path);
        
		double current = checkAvg(pnode, avgs);
		if (current < min) {
			min = current;
			*picNode = pnode;
		}
	}
    
	if (min == MAX_VALUE)
		return -1;
    
    //printf("returned pic node = [%s]", picNode->path);
    
    //printf("Finish finding proper pic...\n");
    
	return 0;
}
Esempio n. 2
0
 void run() {
     checkAvg(operand1(), operand2());
     checkAvg(operand2(), operand1());
 }