gaussian

Illumination normalization in OpenCV

*爱你&永不变心* 提交于 2019-12-05 01:22:58
问题 I am working on a face recognition project. I have pictures with different lighting so I need to do illumination normalization. I read a paper which which claims to do illumination normalization. The paper describe the following function and values. 1- gamma correction with gamma = 0.2 2- Difference of Gaussian (DOG) filtering with (sigma0 = 1, sigma1 =2) 3- contrast equalization (truncation threshold of 10 and compressive component 0.1 is used in the paper) I use CvPow for gamma correction,

Implementation of Gaussian Process Regression in Python y(n_samples, n_targets)

吃可爱长大的小学妹 提交于 2019-12-05 00:24:15
问题 I am working on some price data with x = day1, day2, day3,...etc. on day1, I have let's say 15 price points(y), day2, I have 30 price points(y2), and so on. When I read the documentation of Gaussian Process Regression: http://scikit-learn.org/stable/modules/generated/sklearn.gaussian_process.GaussianProcess.html#sklearn.gaussian_process.GaussianProcess.fit y is shape (n_samples, n_targets) with the observations of the output to be predicted. I assume n_targets refers all the price points I

Gaussian Elimination in Matlab

三世轮回 提交于 2019-12-04 23:56:31
问题 I am using the matlab code from this book: http://books.google.com/books/about/Probability_Markov_chains_queues_and_sim.html?id=HdAQdzAjl60C Here is the Code: function [pi] = GE(Q) A = Q'; n = size(A); for i=1:n-1 for j=i+1:n A(j,i) = -A(j,i)/A(i,i); end for j =i+1:n for k=i+1:n A(j,k) = A(j,k)+ A(j,i) * A(i,k); end end end x(n) = 1; for i = n-1:-1:1 for j= i+1:n x(i) = x(i) + A(i,j)*x(j); end x(i) = -x(i)/A(i,i); end pi = x/norm(x,1); Is there a faster code that I am not aware of? I am

Creating a Python Histogram without Pylab

穿精又带淫゛_ 提交于 2019-12-04 22:26:02
I have to generate a list of random numbers with a gaussian distribution (I'm able to do this) and then take those numbers and plot them in a histogram. My problem is that I'm supposed to do this without using the built-in histogram function within pylab (or any other package for that matter) and I'm at a complete loss. I've been looking on-line and I haven't found anything that explains how I would go about this, does any of you know what I could do? Thanks in advance. Let's assume you have a numpy array that represents your random numbers rnd_numb=array([ 0.48942231, 0.48536864, 0.48614467,

Fast Gaussian blur on unsigned char image- ARM Neon Intrinsics- iOS Dev

十年热恋 提交于 2019-12-04 20:06:27
Can someone tell me a fast function to find the gaussian blur of an image using a 5x5 mask. I need it for iOS app dev. I am working directly on the memory of the image defined as unsigned char *image_sqr_Baseaaddr = (unsigned char *) malloc(noOfPixels); for (row = 2; row < H-2; row++) { for (col = 2; col < W-2; col++) { newPixel = 0; for (rowOffset=-2; rowOffset<=2; rowOffset++) { for (colOffset=-2; colOffset<=2; colOffset++) { rowTotal = row + rowOffset; colTotal = col + colOffset; iOffset = (unsigned long)(rowTotal*W + colTotal); newPixel += (*(imgData + iOffset)) * gaussianMask[2 +

Generating a Smooth Random Trend (Random Walk) in JavaScript

百般思念 提交于 2019-12-04 19:41:08
I am looking for a JavaScript implementation of a random walk/random trend algorithm. I need something that will stick with a trend (so, just plain random deltas are out) while still staying within some specified boundaries. I tried writing something off the top of my head by choosing numbers based on a weighted average (the weight was calculated using the Gaussian function) and ended up with a slightly smoother line (not good enough). I then took a less direct approach and tried searching on the internet, and although I found a few outlines, there was nothing specific enough that I understood

How to add and remove noise from an image

折月煮酒 提交于 2019-12-04 19:38:59
I want to add gaussian noise to a 256x256 greyscale image and then remove it. I tried doing using the following code but all I get is an image which has noise alone. Is it possible to completely remove the noise from the image? And if not to what extent can gaussian noise be reduced? P =0; %mean Q =0.01; %variance R = imnoise(L,'gaussian',P,Q); %L-image subplot(2,1,1); imshow(R); title('Gaussian Noise'); U = conv2(double(R), ones(3)/9, 'same'); U1=uint8(U); subplot(2,1,2); imshow(U1); title('Median Filtered Image'); I'm planning to implement addition and removal of Poisson noise and Salt and

GaussianMixture initialization using component parameters - sklearn

ⅰ亾dé卋堺 提交于 2019-12-04 17:33:06
I want to use sklearn.mixture.GaussianMixture to store a gaussian mixture model so that I can later use it to generate samples or a value at a sample point using score_samples method. Here is an example where the components have the following weight, mean and covariances import numpy as np weights = np.array([0.6322941277066596, 0.3677058722933399]) mu = np.array([[0.9148052872961359, 1.9792961751316835], [-1.0917396392992502, -0.9304220945910037]]) sigma = np.array([[[2.267889129267119, 0.6553245618368836], [0.6553245618368835, 0.6571014653342457]], [[0.9516607767206848, -0.7445831474157608],

Scikit-learn's Pipeline: Error with multilabel classification. A sparse matrix was passed

你。 提交于 2019-12-04 16:31:47
I am implementing different classifiers using different machine learning algorithms. I'm sorting text files, and do as follows: classifier = Pipeline([ ('vectorizer', CountVectorizer ()), ('TFIDF', TfidfTransformer ()), ('clf', OneVsRestClassifier (GaussianNB()))]) classifier.fit(X_train,Y) predicted = classifier.predict(X_test) When I use the algorithm GaussianNB the following error occurs: TypeError: A sparse matrix was passed, but dense data is required. Use X.toarray () to convert to a dense numpy array. I saw the following post here In this post a class is created to perform the

MATLAB code for a lot of Gaussian Mixture Model

泪湿孤枕 提交于 2019-12-04 15:17:49
I have applied gaussmix function in voicebox MATLAB tools to calculate GMM. However, the code gives me error when I run it for 512 GMM components. No_of_Clusters = 512; No_of_Iterations = 10; [m_ubm1,v_ubm1,w_ubm1]=gaussmix(feature,[],No_of_Iterations,No_of_Clusters); Error using * Inner matrix dimensions must agree. Error in gaussmix (line 256) pk=px*wt; % pk(k,1) effective number of data points for each mixture (could be zero due to underflow) I need 1024 or 2048 Mixtures for Universal Background Model (UBM) construction. Could anyone give me matlab code to calculate GMM for big number of