Ask Your Question

Revision history [back]

Display percentage instead of line

This is a application can recognize emotions of happy/sad/anger/neutral/disgust/surprise.

The line will increase based on the current emotion that it detects.

The image below is my current work , but I want to display percentage instead of line, but I not sure how.

image description

Here is the part of code that display the line and emotion :

>

    int start=12, step=15, current;
    current = start;
    for(int i = 0; i < N_EXPRESSIONS; i++, current+=step) 
    {
                    //this line display the emotion.
        cvPutText(img, EXP_NAMES[i], cvPoint(5, current), &font, expColor);
    }

    expressions = get_class_weights(features);

    current = start - 3; 
    for(int i = 0; i < N_EXPRESSIONS; i++, current+=step) 
    {       //this line display the green line but I want to display percentage.
        cvLine(img, cvPoint(80, current), cvPoint((int)(80+expressions.at<double>(0,i)*50), current), expColor, 2);
    }

    current += step + step;
    if(showFeatures == 1)
    {
        for(int i=0; i<N_FEATURES; i++)
        {
            current += step;
            char buf[4];
            sprintf(buf, "%.2f", features.at<float>(0,i));
            cvPutText(img, buf, cvPoint(5, current), &font, expColor);
        }
    }
}
}

Display percentage instead of line

This is a application can recognize emotions of happy/sad/anger/neutral/disgust/surprise.

The line will increase based on the current emotion that it detects.

The image below is my current work , but I want to display percentage instead of line, but I not sure how.

image descriptionimage description

Here is the part of code that display the line and emotion :

>

    int start=12, step=15, current;
    current = start;
    for(int i = 0; i < N_EXPRESSIONS; i++, current+=step) 
    {
                    //this line display the emotion.
        cvPutText(img, EXP_NAMES[i], cvPoint(5, current), &font, expColor);
    }

    expressions = get_class_weights(features);

    current = start - 3; 
    for(int i = 0; i < N_EXPRESSIONS; i++, current+=step) 
    {       //this line display the green line but I want to display percentage.
        cvLine(img, cvPoint(80, current), cvPoint((int)(80+expressions.at<double>(0,i)*50), current), expColor, 2);
    }

    current += step + step;
    if(showFeatures == 1)
    {
        for(int i=0; i<N_FEATURES; i++)
        {
            current += step;
            char buf[4];
            sprintf(buf, "%.2f", features.at<float>(0,i));
            cvPutText(img, buf, cvPoint(5, current), &font, expColor);
        }
    }
}
}

Display percentage instead of line

This is a application can recognize emotions of happy/sad/anger/neutral/disgust/surprise.

The line will increase based on the current emotion that it detects.

The image below is my current work , but I want to display percentage instead of line, but I not sure how.

image description

Here is the part of code that display the line and emotion :

>

    int start=12, step=15, current;
    current = start;
    for(int i = 0; i < N_EXPRESSIONS; i++, current+=step) 
    {
                    //this line display the emotion.
        cvPutText(img, EXP_NAMES[i], cvPoint(5, current), &font, expColor);
    }

    expressions = get_class_weights(features);

    current = start - 3; 
    for(int i = 0; i < N_EXPRESSIONS; i++, current+=step) 
    {       //this line display the green line but I want to display percentage.
        cvLine(img, cvPoint(80, current), cvPoint((int)(80+expressions.at<double>(0,i)*50), current), expColor, 2);
    }

    current += step + step;
    if(showFeatures == 1)
    {
        for(int i=0; i<N_FEATURES; i++)
        {
            current += step;
            char buf[4];
            sprintf(buf, "%.2f", features.at<float>(0,i));
            cvPutText(img, buf, cvPoint(5, current), &font, expColor);
        }
    }
}
}