Ask Your Question

kim's profile - activity

2016-08-21 13:28:15 -0600 received badge  Student (source)
2016-06-20 13:49:40 -0600 asked a question knn for image classification in openCV 3.4.9

i want to train knn classifier for facial emotion recognition on the basis of SIFT features but unable to train knn classifier using:

Ptr<ml::knearest> knn(ml::KNearest::create());

error is value followed by ml:: must have namespace or class name

kindly help if someone have idea how to train and test knn in openCV c++ 3.4.9.

2016-02-24 05:06:18 -0600 received badge  Editor (source)
2016-02-24 05:00:05 -0600 asked a question Android application on the basis of facial emotion

I want to develop android app on the basis of facial emotion. app will perform some action on the basis of recognized user emotion e.g. play some song when user is happy. I develop an initial emotion recognition system on the basis of static database images in visual studio 2013 with opencv c++. now i have to develop android app that is highly preferable to write in java eclipse.. because android studio does not support opencv c++ that is required for image processing like feature extraction etc. is it possible to develop java classes with c++ and NDK in same project of eclipse ??? so that recorded mobile video will be processed by opencv c++ and emotion will be recognized that at the end pass to java class where some action perform on mobile according to emotion?? or is there a way of communication between visual studio c++ and eclipse or android studio to pass results between them? if possible kindly guide me about this..thanks in advance

2016-02-24 01:52:53 -0600 received badge  Enthusiast
2016-02-19 06:35:24 -0600 received badge  Teacher (source)
2016-02-18 12:47:31 -0600 received badge  Self-Learner (source)
2016-02-18 12:40:53 -0600 commented question HOGDescriptor window size adjustment adjustment

i fixed it with: HOGDescriptor d; d.winSize = Size(80,64);

and it resulted in correct number of feature descriptors, i think its right way of parameter setting. is it??

2016-02-18 12:17:21 -0600 asked a question HOGDescriptor window size adjustment adjustment

I am using HOGDescriptor::compute to get the HOG feature descriptor in the input image, but my input image if of size 80x64 of which HOG feature descriptor is required. AS default window size of HOGDescriptor is 64x128 so the program end with exception. that is why i need to change the default window size of HOGDescriptor equal to input image to avoid the exception. i read HOG documentation at [http://docs.opencv.org/3.1.0/d5/d33/s...] but don't understand.. if possible kindly help me

2016-02-16 00:15:31 -0600 commented question gradient orientation for 0-180 histogram bins in opencv 2.4.9 visual studio 2013

@sturkmen the book you recommended is looking helpful but complete chapter is not accessible for me,,can you please email me at [email protected] ..thank you.

2016-02-16 00:13:57 -0600 commented question gradient orientation for 0-180 histogram bins in opencv 2.4.9 visual studio 2013

thank you @matman for your time. actually i want to modify the the internal function of HOG that is why not using built in cv::HOGDescriptor ..i looked cv::cartToPolar but it also computes gradient angle in range 0-360 degree, i need 0-180 degree??

2016-02-15 11:45:07 -0600 asked a question gradient orientation for 0-180 histogram bins in opencv 2.4.9 visual studio 2013

I am trying to develop a facial emotion system using OpenCV 2.4.9 and C++ in Visual Studio 2013. I need to extract shape based facial features using pyramid HOG, i used cv::phase() for gradient orientation in range of 0-360... i tried to use cv::fastAtan2() for gradient 0-180 by first making the -ve gradient to be positive, but there are some dimension problem and code end with exception..if possible for anyone..kindly help me to solve this..thanks in advance. code i am using is as follows:

#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <fstream>  // library that contains file input/output functions
#include <math.h>
#include <stdio.h>
using namespace cv;
using namespace std;


/** @function main */
int main(int argc, char** argv)
{

    Mat src, src_gray;
    Mat grad;
    char* window_name = "Sobel  Edge Detector";
    int scale = 1;
    int delta = 0;
    int ddepth = CV_16S;//16S for 0-360 degree; 8U for 0-90 degree;16U for 0-90

    int c;

    /// Load an image
    src = imread( "whole_face_0.jpg");


    if (!src.data)
    {
        return -1;
    }

    //GaussianBlur(src, src, Size(3, 3), 0, 0, BORDER_DEFAULT);

    /// Convert it to gray
    //cvtColor(src, src_gray, CV_RGB2GRAY);
    src_gray = src;
    /// Create window
    namedWindow(window_name, CV_WINDOW_AUTOSIZE);

    /// Generate grad_x and grad_y
    Mat grad_x, grad_y;
    //The absolute values need to be computed for displaying the gradients (as you cannot display values <0), but they shouldn't be used for further processing.
    Mat abs_grad_x, abs_grad_y;//

    //to calculate the gradient in x direction we use : x_order  = 1 and y_ order  = 0. We do analogously for the y direction

    /// Gradient X
    //Scharr( src_gray, grad_x, ddepth, 1, 0, scale, delta, BORDER_DEFAULT );
    //Sobel(src_gray, grad_x, ddepth, 1, 0, 3, scale, delta, BORDER_DEFAULT);

    src_gray = src;

    //Scharr(src_gray, grad_x, CV_16S, 1, 0, scale, delta, BORDER_DEFAULT);
    Sobel(src_gray, grad_x, ddepth, 1, 0, 3, scale, delta, BORDER_DEFAULT);
    convertScaleAbs(grad_x, abs_grad_x); //CV_8U type for Sobel output. It is unsigned integer 8 bit. So it can store only positive values.

    /// Gradient Y
    //Scharr(src_gray, grad_y, CV_16S, 0, 1, scale, delta, BORDER_DEFAULT);//ddepth=CV_16S
    Sobel(src_gray, grad_y, ddepth, 0, 1, 3, scale, delta, BORDER_DEFAULT);

    //Calculates an absolute value of each matrix element
    convertScaleAbs(grad_y, abs_grad_y);

    //we try to approximate the gradient by adding both directional gradients
    //(note that this is not an exact calculation at all! but it is good for our purposes).
    /// Total Gradient (approximate)
    addWeighted(abs_grad_x, 0.5, abs_grad_y, 0.5, 0, grad);


    /////////////// gradient angle computation //////////////////
    Mat orientation = Mat::zeros(abs_grad_x.rows, abs_grad_y.cols, CV_32F); //to store the gradients grad_x.convertTo(grad_x,CV_32F);

    Mat angle;


    for (int g = 0; g < grad_x.rows;g++)
    for (int k = 0; k < grad_x.cols; k++){
        if (grad_x.at<float>(g, k) < 0)
            grad_x.at<float>(g, k) = grad_x.at<float>(g, k)*(-1);
        if (grad_y.at<float>(g, k) < 0)
            grad_y.at<float>(g, k) = grad_y.at<float>(g, k)*(-1);
        }

    for (int g = 0; g < grad_x.rows; g++)
    for (int k = 0; k < grad_x.cols; k++){
        angle.at<float>(g, k) = cv::fastAtan2(grad_y.at ...
(more)