Ask Your Question

l3an's profile - activity

2015-07-25 07:54:23 -0500 commented answer opencv3 EM.getCovs(covs)

you're the man. Thank you

2015-07-24 13:40:37 -0500 asked a question opencv3 EM.getCovs(covs)

what type should covs be in getCovs(covs)?

From the 3.0-beta c++, "Returns vector std::vector<Mat>& covs of covariation matrices. Number of matrices is the number of gaussian mixtures, each matrix is a square floating-point matrix NxN, where N is the space dimensionality."

from this old opencv2 bug, I understand that "vector<mat> corresponds to a list of numpy arrays, not 3D numpy array (since matrices in vector can in general have different size.) "

from cv2 import ml
import numpy as np

def dictionary(descriptors, number_clusters=N):
    covs = [np.zeros(( N, N), np.float64)]
    em = ml.EM_create()
    em.setClustersNumber(N)
    em.trainEM(descriptors)
    means = em.getMeans()
    covs = em.getCovs(covs)
    weights = em.getWeights()
    return np.float32(means), np.float32(covs), np.float32(weights)[0]

printing out covs just prints out the original [np.zeros(( N, N), np.float64)]. Any body know how to get the covs?

Note that attempting to run this code will not work without fixing this bug and rebuilding.

2015-07-24 08:12:33 -0500 received badge  Supporter (source)
2015-07-23 13:22:54 -0500 commented answer How to get luminosity from the camera Android ?

luminance = luminosity / m.squared. So the asker just needs to multiply the luminance value by the area being photographed? or the area of the lens? please explain @Lorena GdL instead of just telling me that I'm wrong

2015-07-23 12:54:04 -0500 commented answer How to get luminosity from the camera Android ?

that was a typo; fixed

2015-07-23 12:47:46 -0500 commented answer opencv3 Expectation Maximization Python getCovs

plea acknowledged and accepted. I will definitely start contributing...

2015-07-23 11:46:30 -0500 commented answer opencv3 Expectation Maximization Python getCovs

got it. thanks 4 your help.

2015-07-23 11:23:22 -0500 commented answer opencv3 Expectation Maximization Python getCovs

yes it is opencv3. Once fixed, will I need to rebuild opencv from scratch?

2015-07-23 11:21:32 -0500 received badge  Scholar (source)
2015-07-23 11:21:30 -0500 commented answer opencv3 Expectation Maximization Python getCovs

haha i see. please do make the pr if u don't mind

2015-07-23 11:18:44 -0500 received badge  Editor (source)
2015-07-23 11:16:41 -0500 commented answer How to get luminosity from the camera Android ?

@thdrksdfthmn interesting. thanks...I've removed that portion of the answer

2015-07-23 10:40:11 -0500 received badge  Student (source)
2015-07-23 10:07:18 -0500 asked a question opencv3 Expectation Maximization Python getCovs

How do I use the em.getCovs() function in python with opencv3?

def dictionary(descriptors, N):
    em = cv2.ml.EM_create()
    em.setClustersNumber(N)
    em.trainEM(descriptors)
    means = em.getMeans()
    covs = em.getCovs()
    weights = em.getWeights()
    return np.float32(means), np.float32(covs), np.float32(weights)

I keep getting a AttributeError: 'cv2.ml_EM' object has no attribute 'getCovs'

2015-07-23 10:07:18 -0500 answered a question How to get luminosity from the camera Android ?

I don't have any android experience, but you can easily calculate luminosity like so...

1) Splitting image into R, G, B values, something like b, g, r = cv2.split(img)

2) Average the b, g, r values over the entire image --> b_avg = average(b)

3) compute luminosity w/ the following equation: double luminosity = r_avg*0.299 + g_avg*0.587 + b_avg*0.114

from this tutorial:

"The reason these values are weighted is because pure red, green and blue are actually darker/lighter than each other, with green being the darkest and blue being the lightest."