Ask Your Question

Using OpenCV as a stress detector

asked 2012-10-01 18:55:11 -0600

nelmak gravatar image

Hi all,

I know that openCV is used mainly for vision processing. However, I intend to actually only use the SVN or classifiers in the API for stress detection. I have information from three biosignals which I can extract detailed characteristics such as mean, standard deviation and the such.

Using these inputs, can I form a vector of information for each second that I can input to the SVN or classifiers in the API? How likely would you think this implementation will succeed?? I have limited experience with classifiers and learning algorithms so any help is much appreciated.


edit retag flag offensive close merge delete


How many different situations do you want to distinguish? A priori I would think this is a N-dimensional clustering problem...

elmiguelao gravatar imageelmiguelao ( 2012-10-02 08:13:30 -0600 )edit

Two different situations where you are stressed and not stressed. Basically, I have 3 different sensors that extract information about the person. Based on these 3 sensors, I can calculate deviation, variance, and etc. I am planning to have 3 features for each sensor which gives me a 9 dimensional vector. I am planning to use PCA to project them into a lower dimension and then perform an LDA on the output of the PCA. Is this possible in OpenCV?

nelmak gravatar imagenelmak ( 2012-10-16 12:14:53 -0600 )edit

2 answers

Sort by ยป oldest newest most voted

answered 2012-10-17 05:16:43 -0600

Ben gravatar image

I think you could use a Support Vector Machine (SVM). It can easily handle 9 dimensions. Train your SVM with positive and negative samples (stressed / not stressed). You can then classify your live data every second, it's very fast. By averaging the results over time you should be able to filter out false classifications. But that depends of course on the quality of your data.

edit flag offensive delete link more

answered 2012-10-17 03:38:43 -0600

elmiguelao gravatar image

updated 2012-10-17 03:39:24 -0600

I think the problem can be formulated as a clustering of data into 2 categories (stressed, not stressed) (see answer to question in this q&a entry) -- main difference with that situation is that here we know how many clusters to create. The openCV method for clustering in N-dimension is cvKMeans2. The method is quite easy to use, just being careful to create a matrix where each row contains a sample vector, in this case the 9 points mentioned.

The results would be optimal if the underlying distributions are concentrated, i.e. there are indeed two states to distinguish. Computationally speaking k-Means is fast because you identify a termination criteria via number of iterations and/or solution accuracy; the larger the gradient the faster it would converge, and the gradient is basically the concentration of samples. LDA or similar approaches rely on creating a big matrix description of the system, then inverting the matrix or solving the large linear system at once, vs. the iterative approach of the k-Means algorithm.

edit flag offensive delete link more

Question Tools


Asked: 2012-10-01 18:55:11 -0600

Seen: 822 times

Last updated: Oct 17 '12