texts: Effect of Resizing (Up Scaling) an Image on the Ability to Detect / Recognize Objects

texts:
I work in a research lab and am currently setting up a system to image objects approximately 30 microns in diameter with a 250x USB microscope, then use image subtraction to isolate the objects as they move past the microscope FOV, and use blob detection to detect the object's presence in the binary subtracted image.

The microscope can capture still images at 1280x720, but video can only go up to 640x480. Ideally I wanted to take rapid still images (~10 FPS) at 1280x720, but various issues are preventing me from doing that. Capturing rapid images at 640x480 on the other hand is easily doable, but I'm not sure if the images would be clear enough for the image processing to resolve the objects at that resolution.

Would capturing the images at 640x480, then resizing them to 1280x720 before processing them, improve the ability to detect/resolve the objects in the image?


texts: Is it fast time or slow time for the delay in the ambiguity function domain for radar signal?

texts: I am confused about the delay concept in the ambiguity function. The FFT of slow time is the doppler frequency. However, people usually relate the range-doppler domain with the ambiguity function domain. However, the range corresponds to the fast time.


texts: Understanding unexpected i/q calculation on a downsampled signal

texts:
I am reading samples with an RTL-SDR, centered on an FM broadcast station:

with closing(RtlSdr()) as sdr:
    sdr.sample_rate = 2.4e6
    sdr.center_freq = 88.9e6
    sdr.gain = 'auto'
    x1 = sdr.read_samples(16384)

The read_samples() function normalizes the data:

>>> sdr.read_samples.__doc__
Read specified number of complex samples from tuner. Real and imaginary
parts are normalized to be in the range [-1, 1]. Data is safe after
this call (will not get overwritten by another one).

This returns an array that I can work with, with numpy, scipy, etc.

I create arrays for the real and imaginary parts:

x3_real = x3.real; x3_imag = x3.imag

For each pair in (for i,q in zip(x_real, x_imag)), I calculate h=math.sqrt(i**2 + q**2).  I don't expect h to ever be larger than sqrt(2), because the real and imaginary parts are normalized to [-1, 1].

Then I downsample to several different frequencies, less than the sampling frequency, using scipy.signal's decimate() function:

x3 = signal.decimate(x3, ds_factor, zero_phase=True)

and repeat the hypotenuse calculations.  In x2 I do not see numbers > sqrt(2), however I see numbers > sqrt(2) in the decimated signal (x3).  Why is this?


texts: Can we generate signals in reality that have non symmetric magnitude spectrum in the Fourier domain?

texts:
I am reading communication systems, and have a doubt:
Is it possible to generate signals in reality that have a non-symmetric magnitude spectrum in the Fourier domain?
For example, if I have a signal
$$u(f)$$ or something like this as Fourier domain representation
I know that their Inverse Fourier transform is going to have imaginary element $j$ in them, but does this $j$ just symbolize 90-degree phaseshift, can I generate signals in reality that have asymmetric magnitudes of their Fourier transforms.
I have read that $j/-j$ just represent a 90-degree lag or lead, but do such signals with asymmetric magnitude spectrum in the Fourier domain exist in reality?
This will also clear my doubt that whether there are such signals in reality that have just positive/negative frequency components in their Fourier domain representation.
As the answers suggest having $j$ just means phase shift, but if some practically permissible signal has representation $jm(t)$, where $m(t)$ is real, with no imaginary component, then with respect to what I have to define the phase.
Or such a condition will never arise where the inverse Fourier transform of a signal is purely an imaginary quantity.


texts: Distances In a Single Image With Some Real References

texts:
Consider following image:

We have some real references here: Stonehenge measurements (stone dimensions and distances), some strait lines at the back of carts, cart wheels that are almost of the same size for both carts. At the same time we don't know the specification of the camera lens.
Question: Is it possible to calculate distance of the cart from stones? Or can we even deduce that the cart belongs to the scene or not?


texts:
I want to know how in practice we can take a kHz/MHz signal to a GHz band?

Suppose we have an FSK modulated signal at around 300 kHz (or 20 MHz). I want to take it to 3.5 GHz, so about 3499700 kHz higher (or 3480 MHz higher).

Should I build an oscillator with a frequency of 3499700 kHz (or 3480 MHz) to use it as a mixer?
Is it possible in practice to have a precise 3499700 kHz oscillator?
Is there any IC useful or should it be by PLL?
How?
Is there any other and better solution?


texts: Why are ideal filters not particularly useful/ hard to do?

texts:
Why is a LPF ideal filter:

a) Not useful?

b) Hard to make?

I was asked to make a Low pass filter (simulink block) that will take an input of a cutoff frequency, and for a signal with a frequency higher then that cutoff frequency, the amplitude would be zero & with zero roll-off. Hence ideal. Is this an impossible task?


texts: How to compute the impulse response from a transfer function

texts:
Say I have a transfer function, for example:

$$H(z)=\frac{1}{1+0.1z^{-30}}$$

How can I compute the impulse response?

(This is just an example, the important thing is that it is in closed symbolic form!)

If I understand correctly, if I could just rewrite $H(z)$ as some polynomial in $z^-1$ (by using a Taylor expansion), I could just read off the coefficients.

But is there another way?


texts: What is difference between OFDM and GFDM?

texts:
I am trying to understand the difference(s) between OFDM (Orthogonal Frequency Division Multiplexing) and GFDM (Generalized Frequency Division Multiplexing) which are used as a multicarrier modulation techniques in wireless communication. As far as I know the OFDM uses the orthogonal subcarriers and the GFDM is with the non-orthogonal subcarriers when designing a transmitter. The GFDM is possibly going to be the modulation technique for 5G systems as it has been discussed in a research area.

Could anyone please explain further about GFDM design and its differences from OFDM?
What is the purpose of using GFDM when designing a transmitter? The subcarriers are created just after the IFFT?

In GFDM, how does the IFFT block work when creating the subcarriers?

What about the subcarrier pulse shaping in GFDM?

Thanks in Advance!


texts: Raised-Cosine Filter - calculating magnitude response

texts:
Here is the formula to compute magnitude of a raised-cosine filter:

I know that 0 <= Beta <= 1. I am not sure what are the values for f (frequency) and Ts. I assume that some normalization will take place. I also know that Ts is symbol period and it is reciprocal of symbol rate. What are these parameters and relationship between them? Can someone provide an example of typical values of these parameters as used in the raised-cosine formula? Here is the graph from Wikipedia. How the normalization of frequency and magnitude is done?


texts: How to correctly classify voice from other sound events?

texts:
I have a huge labeled dataset of several thousand sound events, including human voice, dish washing, things falling to the ground, among others.

I need to report when a human voice event takes place. Notice that it's not a simple voice activity detection (VAD), since there are other sound events competing with voice (in VAD, they normally only concern about well behaved noise).

My approach so far has been to train a binary SVM classifier (voice and non-voice classes) with MFCC features. Even after parameter optimization and tinkering about with different number of MFCC coefficients, the performance is awful for such a simple task...

Is there any heuristic or any thing that may help distinguish voice from non-voice events that I'm missing out on?

(This related question is similar, but I don't need to "eliminate" other sounds completely, and I'm looking, first, for possible heuristics to improve the classification. This article would be my last resort.)


texts:
So I have groups of (x,y) coordinates that I'm using to draw lines.  The lines aren't perfectly straight but they are connected.

In a Cartesian plane the middle would be called the origin, but I'm working with a digital image processing program, so the coordinate (0,0) is at the top left of the image.

What I'm trying to do is translate all of the coordinates in each line (group of coordinates) the same distance, so that the first point in each line starts at the middle of the image.

Here is an example of what I want:

Here is what I have:


texts: code construction process in polar coding

texts:
Arikan in his paper (arXiv link or IEEE link) about polar coding, explains how you can force the channel to polarize by applying a linear transformation (the generator matrix). He calls this a split and combine process, where he creates synthetic channels that have near perfect or near useless capacity.
But I understand that this is happening so that you can find the best positions in your block to place information bits to be coded. So what does that have to do with the actual channel?


texts: Finding the impulse response of a system

texts:
I have the following transfer function.

$$ H(j\omega) = \frac{1+0.5 e^{-j\omega}}{1-1.8 \cos(\frac{\pi}{16}) e^{-j\omega}+0.81 e^{-j2\omega}}$$

I'm trying to find the impulse response of the system. However, I couldn't separate the expression above and I couldn't figure out how I can find the impulse response. Can anybody help me how to solve this equation? Any help would be appreciated.


texts: Matlab: How do I implement the Expectation operator for time series

texts:
I have the output of a time series  y(t) which is a vector  for t = 1,2,...m denoting the number of data points.

Q1: If E[y(t)] = mean of a process y. This can be invoked using the command mean(y) or
writing the statement

m = size(y,1);
Expectation_y = sum(y)/m;

Then, how
do I  find the Expectation of the following expression as

 [E[y(t-1)*y(t-1)']]^-1

These kinds of related Expressions are found in the
Slide2 mentions the Autocorrelation matrix. In the formula, there is the Expectation operator. So how do I implement the expectation of the product of the lagged random variable with itself and other such expressions without using the inbuilt commands?

My problem is how do I implement them?

Q2: My confusion is what is the different between $E[\sum_{t = 1}^ N y(t-1)*y(t-1)^T]$ and expression  $E[y(t-1)*{y(t-1)}^T]$ which looks like the Autocorrelation of the lag and again how to implement them.

Thank you!


texts: Sum of Sine and Cosine with Random Phase as LTI System

texts:
I have the following system:

Where $ {H}_{1} \left( f \right) = {H}_{2} \left( f \right) $ and $ \theta \sim U[0, 2\pi]$ independent of any other factor in the system.

Given the input is identical, Is an LTI system?
Could you prove it?

Otherwise I don't have explanation why if the input is White Gaussian Noise with the same Variance to each of the inputs (Same statistics, not the same signal) $ {Y}_{1} $ and $ {Y}_{2} $ aren't Gaussian Process yet $ r(t) $ is a Gaussian Process.

I have the feeling the random phase is offset by the sum of the Sine and Cosine.

Thank You.


texts:
I am given a question in which I have to draw the spectrum of the signal $m(t)$ and then draw the spectrum of this modulated signal. The signal is

$$m(t)=\cos(1000\pi t)$$

Now in solution manual what they have done is that they have staright away drawn two pulses. One pulse in positive x-axis at $1000$ and at at negative x-axis at$-1000$. I was looking at the online solution of this question and in that solution following steps were taken:

We know that the Fourier Transform pair is:
\begin{align}
\cos(2\pi f_ot) &\leftrightarrow \frac{1}{2}[\delta(f-f_o)+\delta(f+f_o)]\\      m(t)&= \cos(1000\pi t)\\
&= \cos(2\pi 500t)
\end{align}

Apply Fourier Transform and we get:
$$M_1(f)=  \frac{1}{2}[\delta(f-500)+\delta(f+500)]$$
Hence two pulses of are drawn at 500 and -500.
Which of the above mentioned method is correct.
The solution manual is of Modern and Analog Digital Communication 4th edition.


texts:
I am having some trouble understanding the intuitive connection between the two. I worked through all the theory and learned that Sweldens showed how to derive lifting steps when having admissible filter taps (Daubechies, etc.).
The opposite is simple mathematically, i.e. deriving the filter taps when having discrete lifting steps. However, I dont get how one would come up with 'admissible' lifting steps in the first place, if not by getting them from valid filter taps like Sweldens showed.


texts: Why is the impulse response function of this system 0?

texts:
Suppose I have an system $ y(t) = t^{2}x(t)$.

The impulse response of this system would be: $h(t) = t^{2} \delta(t)$.

Since $\delta(t) = 0$ for $t \neq 0 , h(t) = 0$ for $t \neq 0$.
And at $t=0, h(t) = 0$.

But since $y(t) = \int_{-\infty}^{\infty}x(r)h(t-r)dr $, wouldn't $y(t) = 0$?

What am I missing here?


texts: MATLAB: Implementing Least Squares Estimator for a Given Model

texts:
The formula to estimate $\mathbf{h}$ is then
 $$\hat{\mathbf{h}} = (X^T X)^{-1} X^T \vec{y}\tag{2}$$

I think this can be implemented in Matlab using hat_h = pinv(X)*X*y

Question 1 : What is the lag of the model?

Question 2: I don't know how to create the design matrix X in order to estimate h. Can somebody please provide the complete implementation? Thank you


texts:
I have taken a series of images of a fringe pattern at regular time intervals. This fringes are generated by shining a laser beam onto the CCD camera. The laser goes through a lot of optics, which is why it creates these fringes.

There is some vibration in the laser system setup which causes these fringes to move around although not by much, couple of pixels at most. I want to analyze how much these fringes are moving around. Is there an easy way to do this?

One idea that I had, and I don't know if it's right, is to take the FFT of the image, and discard the DC (constant) components. I could analyze just one frequency component. Now, if the fringe pattern is moving about, then that should change the phase of that frequency component. Does that make sense?

Thanks.

Update
As suggested by A_A, I took one frame as a reference and subtracted it from the rest:

Out of the mess of fringes, I can clearly identify one pattern which is moving about. I particular, the diagonal fringes do not seem to be changing from frame to frame. In the end, I just want to identify if there's any one particular optic which is responsible for this vibration, so I could just set up my live camera feed to display the difference between consecutive images and play around with the optics to see if I can reduce the fringes.


texts: issue in the mfcc function in java and matlab,not the same

texts:
I am working on a project for recognizing and identifying the sounds in real time(like baby crying, birds, door knocking...)by java, so I made a model by using audio files for 9 categories of sound by using the mel coefficient function from Matlab documentation website

https://www.mathworks.com/matlabcentral/fileexchange/32849-htk-mfcc-matlab?focused=5199998&tab=function

and after getting the model and using it in the java project I am not obtaining the same mel coefficients, even if I use the same audio file for testing in Matlab and in java

in the java, I am using tarsos DSP mel function

https://github.com/JorenSix/TarsosDSP/blob/master/src/core/be/tarsos/dsp/mfcc/MFCC.java

and the fft java class is here

https://github.com/JorenSix/TarsosDSP/blob/master/src/core/be/tarsos/dsp/util/fft/FFT.java

I have tried to trace and debug both codes in Java and Matlab but I couldn't find where is the different step that makes the final result different, so if anyone can help I will appreciate it.
thanks in advance.

update1
in the mfcc function of the matlab the parameters are
Tw = 25;           % analysis frame duration (ms)
Ts = 10;           % analysis frame shift (ms)
alpha = 0.97;      % preemphasis coefficient
R = [300 3700];    % frequency range to consider
M = 20;            % number of filterbank channels
C = 13;            % number of cepstral coefficients
L = 22;            % cepstral sine lifter parameter
naumberOfFramesPerSecond=25 ; %like in java
% hamming window
hamming = @(N)(0.54-0.46*cos(2*pi*[0:N-1].'/(N-1)));

and the function is:
[coef,FBE,frames]=mfcc(babycryaverage,fs , Tw, Ts, alpha, hamming, R, M, C, L)

in _java_the function that i call from the class is:
MFCC(int samplesPerFrame, float sampleRate, int amountOfCepstrumCoef, int amountOfMelFilters, float lowerFilterFreq, float upperFilterFreq)

so the parameters that i use in java are:
MFCC(bufferSize,sampleRate,13,20,300f,3700f)

i calcuate the buffer size from sample rate multiply the frame size
sampleRate=16000f;
framesize=0.025f;//25ms
bufferSize= Math.round(sampleRate*framesize);//400

and the AudioDispatcher which is the step of preparing the audio file before the process of mfcc function is:
dispatcher = AudioDispatcherFactory.fromFile(audioFile,bufferSize, bufferOverlap)

the bufferoverlap calculated by :
int bufferOverlap=(int) (0.015f * sampleRate);


texts: What is the significance of Z-transform?

texts:
As we have in Laplace transform that the roots decide the stability of the system i.e. if the roots are complex and lie in the left side of the plane you get a sinusoidal response with decreasing amplitude

similarly is there any significance of the roots , zeros and  ROC of the z-transform and the stability criteria . All i read in books is how to find the ROC and the properties of z transform like linearity ,time reversal,time shifting . It has nowhere mentioned why we are even using z-transform

my  apologies if this question is too basic or if it shouldn't belong here.


texts: I'm wondering if MATLAB communications or DSP toolboxes has a FM discriminator? If so, what is the name of the function/object?


texts: standard deviation of two constant noised signals related through interpolation

texts:
Let us say say we have a noised constant signal and want to evaluate the standard deviation (std) of the noise. We calculate the std of the said noised signal and call it $\sigma_1$. Now we process the signal, by interpolating it and stretching it on a larger area and obtain a signal with more samples, which contains the same amount of information because we did interpolation. We calculate the standard deviation $\sigma_2$. How do they relate? Can we just compare them or do we need to make some adjustments based on the sample sizes. I get that $\sigma_2$ is less than $\sigma_1$ but it seems counterintuitive that the noise was reduced by just stretching the signal along with the noise.
Ok so let's us assume we have a DC signal 0.5 presented green and the noise is as follows

we then interpolate the signal and get the following signal

What we get is that the standard deviation in the first image is 0.3535 and in the second 0.2795, but what  I would like is to have more comparable standard deviation. We can't say that the lower image is less noised right?


texts: How to obtain digital IIR filter coefficients for known z-plane zero-pole plot?

texts: My clue is just to expand brackets and obtain coefficients of numerator and denominator of my transfer function. Am I right?


texts: Applying Nyquist's sampling theorem to a real signal

texts:
I'm struggling to fully understand the Nyquist-Shannon sampling theorem.

For some message input signal $m(t)$ that is infinite in time (i.e. is not identically $0$ for any interval $t_1<t<\infty$), and that is hence necessarily band-limited (by the properties of the fourier transform), the sampling theorem states that if $f_{sampling-frequency}>2f_{maximum-fourier-component}$, then the original signal $m(t)$ is fully determined by the samples.

However, for any real signal that is transient and aperiodic, we will always take a set of samples in some range $t_1<t<t_2$, and hence the message is time-limited, excluding the possibility of it being band-limited.

For example, here it states:

  The Shannon’s sampling theorem was derived
  using the assumption that the signals must exist over
  infinite time interval. But all of our applications are
  based on finite time intervals. The objective of this
  research is to correct this inconsistency. In this paper
  we show where and how this infinite time assumption
  was used in the derivation of the original sampling
  theorem and then we extend the results to finite time
  case. Our research shows that higher sample rate is
  necessary to recover finite duration signals. This
  paper validates, with detailed theory, the common
  industrial practice of higher sample rate. We use the
  infinite dimensionality property of function space as
  the basis of our theories. A graphical example
  illustrates the problem and the solution.

However, I don't understand why this should be the case. If we have some $m(t)$ defined in the range $t_1<t<t_2$ then we can postulate an oscillatory function that extends to infinity that is made up of direct repetitions of the waveform with period $t_2-t_1$. Now, the fourier transform of the function defined over infinity is a set of discrete values that range over some bound (band-limited). For this infinite function, the sampling theorem should hold in its current form, and the Discrete Fourier transform (DFT) translates between the set of discrete time-domain samples ${m_n}$ and the discrete set of complex frequency domain samples $M_b$. As long as we specify the time range over which our original signal was taken, since the DFT does not specify whether the original samples was actually periodic or not), it would seem that Nyquist's theorem holds in its current form.

To summarise, any signal we take is not a time-limited function if we hypothetically extend it in a periodic manner. However, I know there is something wrong with my understanding - it would imply that for any real signal or use of the theorem, we only need consider the DFT, and if so why is it routinely derived for infinite functions at all? What am I missing i.e. how is what I think incorrect, or how is it in fact consistent with the quote above?


texts:
I understood the concept behind Hough transform. One thing i am still unsure is the rho and theta range of hough transform. The range is given below.

If theta is in the range [0,pi), then rho values can have negative
values. If theta is in the range[0,2pi), then rho can have only
positive values.

How can rho be negative ?. Is the range standard for all the images ?. I have referred questions on Hough Transform under stack overflow as well as dsp-stackoverflow, but it wasn't helpful. Can someone explain me bit more clearly please ?.


texts:
I'm working on a dsPIC33, using Audio Codec Board - Proto to read audio samples and for reproduction.
In order to implement a relatively simple signal processing algorithm, I'm reading audio samples and I'm supposed to process them and pass them to DAC for reproduction.
The dsPIC33 I'm using filters the signal using Q15 format, but the samples I'm getting from Codec board are signed 2's complement, 16-bit. Thus far, I managed to get the reading and send it to DAC, without any data manipulation, but now I need to filter the signal.
Is there a way to overcome this format barrier? I suppose that conversions from signed 2's complement to Q15 and vice versa are necessary.


texts: How to write e^(-1000|t|) in matlab title?

texts: I wanted to write e^(-1000|t|) in matlab title of a plot. When I entered this and ran it actually, it showed ( as a superscript and every thing else in the line in regular font.  Now I wanted the whole thing -1000|t| to appear as a superscript.  I tried bracketing etc and finally I achieved what I wanted by inserting ^ before every letter. Is there a better way?


texts: Real signal from I,Q, sample rate and center frequency

texts:
I am given a recording of an ionosonde sounding. The signal $S$ is represented as a series of  I/Q pairs at a sample rate $F_{sr} = 10\,\text{MHz}$.  I am told that the center frequency of the recording is $F_{center} = 7\,\text{MHz}$.

I have a $T=200\,\text s$ recording as $I=[I[0],..,I[T\times F_{sr}-1]]$, $Q=[Q[0],..,Q[T\times F_{sr}-1]]$.

The actual signal $R[t]$ being recorded can vary from $2\,\text{MHz}$ to $12\,\text{MHz}$, that is from ${F_{sr}\over 2} -F_{center}$ to ${F_{sr}\over 2}+F_{center}$.

Let $S=I+Q j$ be the complex representation of the recording.

How do I recover the original signal $R[t]$ at a sample rate of $F_{up}=24\,\text{MHz}$, which is high enough to represent a $12\,\text{MHz}$ signal directly, as a function  $R(S,F_{center},F_{sr})$?

That is, $F_{up}=2F_{sr}+ 2  F_{center}$, so $R=R[0],...,R[T\times F_{up}-1]$.


texts: Are IQ-samples independent from the carrier frequency?

texts:
Since i am not sure if i have understood IQ samples correctly, i want to ask the following question:

If i look at inphase and quadrature in an IQ diagramme, the length of the arrow describes the amplitude of the signal, while the angle between the arrow and the x-axis describes the phase shift. That however would mean, that these samples could still be transmitted on different frequencys, maintaining the same amplitude and phase shift.

Is this right or am i misunderstanding something?


texts: Is it possible to have high energy compaction in audio signal?

texts: We all know that the energy compactness in image can be achieved in high scale.But in case of audio signal is it possible to have such high energy compactness?


texts: What is the proper way to implement a real time spectrogram?

texts:
I am trying to implement a real time spectrogram and I am not sure that I am implementing it the right way.  First I decided to use Matlab, I was taking a short recording of lets say 0.1 seconds and then perform the FFT on that array of numbers which basically consists of the amplitude of lets say a 11025 sampling rate in that 0.1 seconds.  I was then plotting the result of the FFT after computing the magnitude.  After this process, I would then record another 0.1 seconds and so on.  This was being done in an infinite loop in order to try to achieve a real time result. I know that this is not a spectrogram is just a different representation of this information.  The problem with this is that I am not getting a very good results from this calculation.  For example I was giving a certain tone using a frequency tone generator, and I was seeing a peak at just some instances which shows that somewhere the algorithm is failing.  I do not have to use MATLAB, I could also use other programming languages such as Java so I prefer if I do not utilize a ready made function such as 'spectrogram' which is only present in MATLAB.

So can someone tell me on how a real time FFT of audio should be performed please? So how real time spectrum analyzer achieve that quality and they are real time so if they are taking a short sample of time it must be really short and still manage to get a good representation out of it.


texts:
The signal that I produce above. What is the reason for it to slide to the right? In oversampling at Nyquist rate can I make like below picture ? do you think the signal i produced at nyquist rate is correct, why so on the right? I was expecting to draw as below picture.
(Blue is the my signal, Red ones sampling and Yellow is the reconstruction using sinc.)
If needed I can share my all code.
Thank you all.


texts:
I am calculating a time partitioned Cross Ambiguity Function (CAF) by adding the surfaces of different time-sectioned CAFs together. Meaning, I calculate a CAF using 10 seconds of IQ data, calculate a second CAF using another 10 seconds of IQ data, square the values and add the signals together.

If I have a single CAF surface, I identify a peak by applying an SNR threshold of 18dB to the surface. 18dB is a rule of thumb saying that we are 99% (or some high value) sure the peak is a signal peak instead of a noise peak.

The noise on the CAF surface is a Chi-Squared distribution with 2 degrees of freedom. I am assuming the second CAF's noise is uncorrelated with the first CAF's noise. The noise floor variance and the CAF peak's variance will decrease as I add surfaces together. The below illustrates my thought process so far.

How much can I decrease the threshold value I am using for 1 surface when I add N surfaces together and still maintain my probability of False Alarm? Is it simply a matter of experimenting with different threshold values?

from scipy.stats import chi2
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import style

num_integrations = np.arange(1, 4)
threshold = 18  # dB
un_db = 10**(threshold/20)

deg_of_freedom = 2

num_values = int(1e7)

output = np.zeros((1, num_values))
prob_above_thresh = []
non_noise_prob = []
for index in num_integrations:
    print('Integrations:', index)
    values = chi2.rvs(deg_of_freedom, size=num_values)
    output = output + values

    mean = np.average(output)
    above_thresh = (np.asarray(output/mean) > un_db).sum()

    prob_above_thresh.append(above_thresh/num_values)
    non_noise_prob.append((1 - prob_above_thresh[-1])*100)
    print('Probability non-noise peak =', non_noise_prob[-1], '%')

# make plot
fig, ax = plt.subplots(1, 1)
plt.title('Probability non-noise peak')
plt.plot(num_integrations, non_noise_prob)
plt.grid()
plt.show()


texts: Proof of Forward Euler for discretizing a transfer function

texts:
In Levine book "The control handbook" it is shown that, for discretizing
a transfer function $\frac{1}{s}$ using Forward Euler i simply have to replace s
with $\frac{z-1}{T}$. How can extend the proof and show that the substitution works for
every possible transfer function $G(s)$ ?


texts:
How can I find this all pass filter's phase?

$$H(e^{jw}) =\frac{−a* + e^{-jw}}{1 - a(e^{-jw})}$$
where $a = ρe^{jϴ}$ is the pole.

Then I want to find group delay, I know that the group delay is the derivative of the phase with respect to w but i don't know how to find the phase


texts:
Hi all,

How do we interpret a power spectral density plot. I have used modified covariance and burg methods and plotted using MATLAB. What does the peaks at some frequencies suggest? and what is the difference between positive and negative power in the graph?  how do we know that which frequencies variations are strong and at which frequencies variations are weak.. can anyone help me please..

Thanks


texts: Performed the Danielson-Lanczos shuffling for FFT, but I don't know what to do next

texts:
I'm writing an audio analysis program and need to do some FFT to frames of the data. I've got some code (rather verbose so I'll leave out the details) that successfully performs the shuffling of the data according to the Danielson-Lanczos Lemma through bit reversal of indices. For example the sequence of data 0,1,2,3,4,5,6,7 becomes 0,2,4,6,1,3,5,7 (though I'm working with a larger window than 8 samples!)
The problem is that I'm a little confused on what to do with the resultant vector. I'm just completely lost. I've read something about doing the transform on pairs of data points and then combining them. So would I apply the DFT to 0 and 2, then add the resulting vector with that of the DFT of 4 and 6 (using the above example data points) and add that to (DFT(1,3) + DFT(5,7))?
If it matters, I'm dealing with just the right channel of a wav file, so the signal has no imaginary part.
(I'm developing in Unity with C# and the only libraries j could find are .Net 4.0, and Unity only supports 3.5 right now. Plus I think it's interesting, if not confusing!)


texts:
In my text book, Digital Signal Processing, Principles, Algorithms, and Applications by John Proakis, it asks the question to show how $\delta(n) = u(n) - u(n-1)$.

I can understand how this is true if "n" is an integer, but sometimes I see the step function as a continuous line instead of a fixed point at an instant. In that case, is it incorrect to think of $u(n)$ as something continuous?


texts: Distribution of energy in frequency bands

texts:
On my wav-file (music), I do a short-time Fourier transform (STFT). I have spectrum, which spans from $0\textrm{ Hz}$ to $f_s/2$. I took out the range between $1$ and $1000\textrm{ Hz}$, which I divided in $3$ frequency bands. My STFT is performed every $50\textrm{ ms}$ so I can see the changes over the time.

At this point I am not quite sure, if i am right or wrong. I want to get the overall performance of my frequency band every $50\textrm{ ms}$. Which means, I get $3$ values every $50\textrm{ ms}$ because I have $3$ frequency bands.

I think I need to calculate the bins of my frequency band to do that. Any idea? Btw, my code is in MATLAB.

I see. In my code, i did a full stft, for which i have defined a frequency vector. It looks like this:

f=0:1:fftlen-1;
f=f/(fftlen-1)*fs;

fftlen is 4096 and fs is 44100.
 I have written it so, that i took out 0-1000Hz and divided it up in 3 frequency bands, which for exmaple is a

lowband=(1:200);

and then defined a frequency vector for my lowband, otherwise it wouldn't have worked.(Maybe there is another simpler solution...)
which looks like this:

fL = 1:1:200;

I am not sure if i can see the connection behind this, but fs/fftlen = 10.76660156.... This must mean that 19th bin is about 204.56..., which is close to my predefined frequency vector (200Hz) of my lower band. I got this value by doing 200/(44100/4096), which is 18.5759.. by rounding it off, the 19th bin. Afterwards i multiplied 19 with 10.7666..., which is 204.56..

If i am right then i will simply take all values from the first bin to the 18th bin. And make a arithmetical mean of it. Is my calculation then correct?


texts: Optimal trade-off between oversampling and filter length

texts:
For some sampling-frequency-preserving operations on Nyquist–Shannon sampled signals, such as:

a shift a.k.a. translation, and
differentiation by applying a derivative filter a.k.a. gradient filter,

the ideal filter for each task has an infinite number of taps with weights obtained by sampling the sinc function or its derivative. In practice, finite-impulse-response (FIR) approximations are typically used.

For a given maximum acceptable level of approximation error, the required minimum number of taps in the approximating FIR filter is reduced if there is an overhead $f_B\ldots f_s/2$ between the highest frequency $f_B$ of the signal and half the sampling frequency $f_s$. From filter design perspective, this overhead obtained by oversampling the input signal by a factor $\beta = f_s/(2f_B) > 1$ creates a transition band of non-zero width and relaxes requirements on the filter, as exemplified by the magnitude frequency response of a simple approximative derivative filter decipted in Fig. 1.

Figure 1. Arbitrarily normalized magnitude frequency response of an ideal derivative filter (diagonal red line) and its approximation (black curve) with impulse response $-3/16,$ $31/32,$ $0,$ $-31/32,$ $3/16$. With ideal oversampling, the frequency response above the highest frequency of the signal (vertical blue line) does not contribute to the approximation error.

However, assuming that the output signal is sampled at the same sampling frequency $f_s$ as the input signal, increasing $f_s$ increases the number of output samples, which increases the number of times a dot product between the $N$ filter weights and $N$ signal samples needs to be calculated. In general, for a 1-d signal, $\beta N$ times as many multiply–accumulate operations (MACs) are needed compared to the number of samples in critically sampled (not oversampled) representation of the input and output signals.

For such a task, which oversampling factor $\beta$ minimizes $\beta N$, requiring the least total MACs in FIR filtering without exceeding a given maximum acceptable approximation error measured by a reasonable error metric?

Upsampling to obtain the oversampled input signal shall be considered ideal and not contributing to the MAC count, as if the input signal was obtained perfectly pre-oversampled.


texts:
So this is a relatively complex question I’m sure, as I have no idea what I’m getting myself into here. The gist of the project I would like to undertake is that I want to turn an old AIO PC (computer built into a monitor) into a multi-fx processor. I plan on loading Windows Server onto the machine to reduce the number of background tasks taking up memory and cpu cycles. So as far as the audio side of things, I will have a USB interface plugged into the machine as well as a MIDI controller to send signals to the application to switch effects presets. Now to the questions.

Are there any C/C++ libraries that are able to get an input signal from an audio interface and feed a modified signal to the output of the audio interface? I ask about C/C++ because they’re the only languages I assume would be able to achieve a low latency.
Are there any C/C++ libraries that are able to read input from a MIDI controller or assign callbacks for when a MIDI controller action occurs?
Is there a certain audio interface I should buy for compatibility reasons? Like considering ASIO compatibility, etc.
Will there be any complications regarding signal level? My chain will be guitar->audio interface in->effects processor app->audio interface out->amplifier.


texts:
As novice to OFDM, I have a question, related to modulator. Here, I present modulator block diagram, I found somewhere.

OFDM modulator AFAIK, final output signal has to have frequency spectrum consisted of $f_0, 2f_0, \ldots$ components positioned around $f_c$. Because inverse FFT produces complex numbers at it's output, my opinion is that signal at point A consists of pulses with different amplitudes having some frequency. If I am right so far, than the question is - what's the magic behind DAC block in order for him to have $f_0, 2f_0, \ldots$ components at his output B ?


texts: Matlab: is a highpass filter what I want, to obtain my required spectrogram? How do I design/apply this? (pic included)

texts:
The axes are wrong in the spectrogram. I have an audio wav file, and I know the sampling rate. this is read into the audioData variable. The audio is 1 channel. selected window length I believe (can't remember) is 512. I believe overlap is 50% ( the default?), 1024 fourier points. sampling rate is 250,000.

Using Matlab 2014a.

spectrogram made using this:
    s = spectrogram(audioData, 512, [], 1024, 250e3);

In the spectrogram, the bottom bit is near the 20kHz range and I want to get rid of this and concentrate on the thing at the centre (which is around 25khz). To my knowledge, I need a high pass filter to allow all of the frequencies above 20kHz.
It seems like there are many ways to design filters which involve a lot of parameters and I'm a bit overwhelmed with how to start.

I essentially just want to cut out the bottom bit, so that I can image process the upper bit (ideally kept as close to intact, if not exactly, as possible)


texts: How to find the fundamental frequency of a discrete signal using partial autocorrelation?

texts:
I hope you can help me with this question.

I am trying to calculate the fundamental frequency (to know the beats per minute) of a cardiac pulse signal using partial autocorrelation.
I use a 12-bit ADC and taking 4096 samples at Fs=512 Hz.

Heres what I'm trying:

First I do an offset of -2048 to align the signal to 0 (since the ADC gives me values from 0 to 4096).

Then I multiply it by the Hamming window wich I calculated as

$$ w[n] = 0.54 - 0.46 \cos \left(2 \pi \frac{n}{N} \right) $$

To get this

Then I do the partial autocorrelation like this.

$$ C_{xx}[n] = \frac{1}{N} \sum\limits_{m=0}^{N-1-n} x[m]x[m+n] $$

And finally I look for the maximum peak (that is not in the 0 position).

In this case I'm getting the maximum value at $n$ = 506.

But I don't know what to do with that index of the maximum of 506 if what I'm trying to get are the beats per minute.

Thanks you for your help.


texts: What ICA approach is best-suited for semi-blind convolved source separation?

texts:
I have a mixed discrete signal
$$ A(t_i) = [s(t_i) + a f(t_i+\delta)] \circ g(t_i) $$
for n number of temporal points where $s(t_i)$, $a$, $\delta$ are unknown. $\circ g(t)$ is a convolution, where the shape of $g(t)$ is known, e.g., $g(t)$ is a Gaussian with unknown FWHM. $f(t_i)$ is known. $s(t_i)$ and $f(t_i)$ has Poisson noise.

I have done introductory readings on PCA and ICA and I think ICA techniques can be implemented for this problem. However, given that there is a lot of approaches to ICA geared for different scenarios I am not sure exactly which ICA is best suited for my case. What is the best (ICA or similar) approach to recover the unknown signal $s(t_i) \circ g(t_i)$?


texts:
I am confused about this Q&A :  Interpolation by factor of 2

If my input signal
$$
x[n]= x0,x1,x2,x3
$$
then according to the threads explaination my $v[n]$ will be

$$
v[n]=x0,0,x1,0,x2,0,x3,0
$$

$x[n] \rightarrow$ zeropad $\rightarrow v[n]$

$v[n]\rightarrow$ LPF $\rightarrow y[m]$

My $y[m]$ is the output of LPF which removes aliases. So basically LPF transfer function is given as

$$
y[m] = v[n]*h[n]
$$

i,e. $y[m]=\displaystyle\sum_{n=0}^{\infty}h(m-n)v(n)$

So here $h[m]$ is my filter coefficients and  $v[n]$ is my zero padded input signal...
so, if I multiply zero with my filter coefficients, then my output will also be zero...

If I send 10 input samples, after zero padding I will get 20 samples, out of which 10 will be zero....

So what is the use of getting zero as my output? Correct me if am wrong (I know I am wrong, but please give me some idea how zero padding & LPF is helping in this regard).

For FIR filter: $y(n)=h(0)x(n)+h(1)x(n−1)+....+h(N−1)x(n−N+1)$,
 where $x(n)$ is the input signal,
 $y(n)$ is the output signal,
$h(n)$ is the impulse response,
and $N$ is the filter length.

For simplicity, I am taking order $N=4$,and some random numbers

    (time) n --> [ 0  1  2  3]
         x[n]--> [ 2  4  6  8]
         h[n]--> [.1 .2 .3 .4]

what is $y[2.5]$???

                  n-->[0 0.5 1 1.5 2 2.5 3 3.5]
               v[n]-->[2  0  4  0  6  0  8  0 ] (after zero padding)

Lets calculate for $y[2.5]=h(0)x(2.5)+h(1)x(1.5)+h(2)x(0.5)+h(3)x(-0.5)$

so here $x(2.5)=x(1.5)=x(0.5)=0$

Please answer this to clear my confusion???


texts: What is the difference between continuous, discrete, analog and digital signal?

texts:
It's my first time studying DSP and I've faced a problem finding a convenient definition.

Are the following definitions correct? And if so why there are some resources defining it in other terms such as "Digital signal: is a signal with discrete time and discrete amplitude"

Discrete time signal: X-axis (time) is discrete and Y-axis (amplitude) may be continuous or discrete.
Continuous time signal: X-axis (time) is continuous and Y-axis (amplitude) may be continuous or discrete.
Digital signal: Y-axis (amplitude) is discrete and X-axis (time) may be continuous or discrete.
Analog signal: Y-axis (amplitude) is continuous and X-axis (time) may be continuous or discrete.


texts: Resize High Resolution Camera Capture to Low Resolution Camera Capture?

texts:
Say, you captured a high-res image of a scene and a low-res image of the same scene, using a lower-res camera, ensuring that the lower-res camera is using the same technologies, except for the image sensor's resolution.

If I wanted to drop my higher-res image to the same lower-res image via digitally processing the image, what would be the right approach?

I reckon interpolation or naive downsampling are not the right way-to-go. They seem kinda illogical. I was thinking of using the RAW images and, perhaps, deploying these downsampling therein, and, then, using the pre-processing algorithms for converting the image into the final output. Is there some standard approach available, though?


texts: Sparsity limits of compressed sensing - is this right?

texts:
Compressed sensing (CS) guarantees exact object recovery (or with high probability) given a) sufficient measurements are taken in a sparse basis which is b) incoherent vis-a-vis a given object representation basis.

Does CS theory state anything about reconstruction of successively less sparse signals? That is, if I don't meet the requirements of a) can I say anything about what the reconstruction will look like? I think the answer is No from watching Candes's lectures. But I haven't read this specifically yet. I would appreciate any pointers/references.

EDIT: I think the answer, at least empirically, is shown here for Matrix Completion (long paper), where the x axis shows the sampling ratio and the y axis shows the ratio of degrees of freedom to the number of samples taken. The saw-tooth pattern between black and white areas seems interesting - perhaps suggesting that there are some sample ratios which do better at higher ranks.


texts: Comparison of Baseband simulation results and experimental results at Passband

texts:
Consider that I have simulated a communication system at baseband and would implement the same on hardware but using a carrier at 2.4GHz(Passband conversion).

Would it make sense to compare the simulated results at baseband and the results from the experiment at passband? Or should the simulation also be performed at Passband frequency and then compare the experimental results with the simulated results at Passband?


texts: No cross-correlation between same signal recorded using two different microphones

texts:
I've recorded the same audio signal using two microphones located at the same approximate location. However, when checking the cross-correlation using MATLAB (using the xcorr function) it is negligible, even though the signals look approximately the same and sound the same. The signals were brought to MATLAB using the audioread function. This scenario was repeated using a different set of microphones, achieving the same results.

Did anybody encounter this kind of problem in the past and has a solution?

EDIT:
First of all, thank you all for the help.
This is a scenario of two sources and two microphones in different locations in space. The signals clearly sound mixed (each signal contains both sources) and the microphones are synchronized and at the same sample rate of 44.1kHz.
The code:

[x1,Fs1]=audioread('channel_1.wav');
[x2,Fs2]=audioread('channel_2.wav');
figure; subplot(2,1,1); plot(x1);subplot(2,1,2);plot(x2);
[R_11,lags]=xcorr(x1,x1);
R_22=xcorr(x2,x2);
R_12=xcorr(x1,x2);
figure;plot(lags,R_11);hold on;plot(lags,R_22);plot(lags,R_12);

The correlations:

The signals:


texts: Compensate delay of non-symmetric (non-linear phase) filter

texts:
Lets assume I want to apply a matched filter h which is non-symmetric to my signal x and the output is y in matlab:

y=filter(h,1,x);

Now I am interested in comparing the information between my filtered signal yand my input x. For this I want to compensate for the delay of the filter h.

When googling this topic I found the following tutorial which handles linear-phase fir filters. Obviously in such a case the group delay is $\frac{N-1}{2}$ given that the filter has the length $N$.

%this is the example from matlab
delay = mean(grpdelay(h,1,128));
x = x(1:end-delay);
y(1:delay) = [];

However, I am aware that the group delay of a non symmetric filter is frequency depending and I am not sure how to proceed to align my signals in time to compare them. As I am interested in real time application the function filtfilter is not applicable.

So my question is, how do I estimate in the best way the time delay to align (sync?) my signals in time given the coefficients of a non-symmetric filter h?

delay = .... h ....?
x = x(1:end-delay);
y(1:delay) = [];

The desired output should look like the red curve in the following figure

Here the signal in blue is the input signal x and in green the filtered signal y. However, I would like to to compensate for the delay of the green signal so that the input and output align in time as in the case of the red curve.


texts: Designing digital low pass filter with low pass-band group delay

texts:
I'm interested in specifying a digital low pass filter with low (and near constant) pass band group delay.  I tried python's spicy.signal.minimum_phase to transform a linear phase FIR low pass filter to minimum phase, but there was a steep price in stop-band rejection level.
Is there a "standard" approach to this problem?


texts: How to encode binary sequence if the number of bits are odd to e.g. 4-PAM? (Beginner)

texts: I'm new to signal constellation and trying to understand how M-PAM works. If there is a binary sequence that has on odd number of bits and I want to send a 4-PAM signal, there will be one bit left after encoding a symbol by two bits ($k=2$). For example: the sequence $1001001$ will be encoded as $10\rightarrow3$, $01\rightarrow-1$, $00\rightarrow-3$ and the last bit will be by itself. How do I encode the last bit? What about 16-PAM? Will I need to express the sequence in more bits?


texts: Do we assume modulating and carrier signal uncorrelated in AM modulation?

texts:
I am new to communication and studying amplitude modulation. Let us assume an amplitude modulated wave given by
$$\big(m(t)+ A\big) \cos(2\pi f_c t)$$
Now we have formula for efficiency as
$$ \eta=\text{useful power / Total power}=\frac{\overline{m(t)^2}/2}{A^2/2+\overline{m(t)^2}/2}$$
I am not able to understand why total power is not equal to $$\overline{(m(t)+ A)^2}$$ where $\bar{.}$ denotes average power. I mean where does the term for $A^2\overline{m(t)^2}$ go in the denominator of the efficiency expression. Do we assume modulating signals and carrier signal to be uncorrelated?


texts: Standard Deviation of Character Gradients in a Document Image

texts:
I have the paper titled "CG-DIQA: No-reference Document Image Quality Assessment Based on Character Gradient". It is all about assessing the quality of the document image based on its blurriness. To compute the overall quality score s of a document image, below are the summary of the steps done:

An eligible image character patch c is convolve with a horizontal filter fx  and a vertical filter fy, which outputs an array of gradient magnitudes. The gradient magnitude of c at position (i,j) is denoted by mc(i, j).

Get the average gradient magnitude of a specific document image denoted by ma, where N is the total number of pixels present in all character patches of a specific document.

Lastly, to the compute the overall quality score s of a document image, standard deviation of the
character gradients will be determined.

Now my questions are :

What does it mean when standard deviation is small and big? Does it mean the document image is blurry when the standard deviation is small or vice versa?
How can I normalize the standard deviation outputs , to give it a value of 1 when it is not blurry or less than 1 when its blurry.

Thanks.


texts: I am sampling a sine wave of 50Hz(stepped down from 230V) at the rate of 500KHz. For identifying disturbances in the wave, i was thinking of comparing a cycle of incoming sine values with reference sine values(pure sine wave). But will the method be accurate? one of my friends told that there will be loss of synchronization and so number of samples in one cycle wont be the same every time we measure and comparison will give wrong answer. If so, could anyone suggest some method for doing the same? Also,how to detect the zero crossing point without using any hardware?


texts: What is the maximum data rate a wireless link can support using BPSK for given BER and SNR?

texts:
What is maximum data rate a wireless link can support using BPSK for 10^-6 BER, Bandwidth of channel is 200 kHz and SNR 21.335dB ?
As per my understanding , Eb/No can be calculated for BPSK for given BER using curves and value found is 11.29dB, and after that we can use relation

Eb/No = S/N * W/R

R comes out to be around 2 Mbps! Is it correct? Need your input!


texts: Taking fft of real values of positions and momenta for a 1-d fermi pasta ulam problem

texts:
I am trying to understand the code that implements taking the fft for a 1-d FPU problem. Y is a matrix of real values by real values. Basically the first dimension is time and the second dimension is position or momenta. YX and YV are taken as follows. and xXF is computed by laying out values of YX from 1 to N+1, followed by 0, followed by negative values of YX in the opposite order. I am trying to understand why this is done? By this- I mean, how the values YX are followed by 0 followed by negative values in the opposite order. Why is this done?
Also, instead of imaginary of fft, can I instead take abs of fft?
YX(IT, 1:N+1) = [0 Y(IT, 1:N)];
YV(IT, 1:N+1) = [0 Y(IT, N+1:2*N)];
sXF(IT, :) = imag( fft( [YX(IT, 1:N+1 ) 0 -YX( IT, N+1:-1:2)] ))/sqrt(2*(N + 1));


texts: How can I correct the settling time when implementing a pre-filter (reference filtering)?

texts:
I have designed a controller for the speed of a motor, I calculated that for a settling time $0.1 \; s$, it works when I test it without pre-filtering. However, I need $0$ overshoot, so I implemented a pre-filter. But this filter makes my settling time larger (like $1\; s$).
I wish to know if there is anyway to implement a pre-filter without affecting my settling time that much, or not affecting it at all.


texts: Confusion regarding Nyquist Sampling Theorem

texts:
The first time Nyquist Theorem was mentioned in class. It stated that we should sample at twice the highest frequency content of the signal. Example: If we wanted to sample $\cos(2 \pi f_0 t)$, the sampling frequency should be at least $2f_0$.

However, in another course. The Nyquist Theorem was stated as such: the sampling frequency should be at least twice the bandwidth of the signal.
Isn't the bandwidth of a single tone cosine 0? which makes the two definition contradictory.


texts: Decibels conversion into amplitude ratio

texts:
I want to convert db into amplitude ratio.

I did some research but I only found online convertor, and I don't understand what's on Wikipedia very well...

Here is a little of backstory :
I am a programmer and I have to code an Equalizer; the problem is, I'm new to this DSP world.
I'm using a small documentation that an audio engineer in my company made a while ago and there are stuffs that I don't understand in it. (He's obviously not in the company anymore...)

In his documentation, he writes that the equalization is made step by step with an incrementation of ±0.1 dB.

So here are my questions :

What's the formula to convert dB into a percentage ?
On Wikipedia, there is 10 log10(x), but x is the power ratio, and I don't know how to get that either...
Does processing step by step is the best/only solution ?
Or can I calculate the ratio that I need each time (to limit the number of measures needed) ?

Thanks for you time.


texts: Remove aliasing caused by scanning a wave file at arbitrary playback rates

texts:
I am writing a sound generator that needs to scan through audio samples at an arbitrary rate. When the sample is played at it's original rate, it sounds fine. But when I change the playback speed, it produces aliasing noise.

I read this answer and it seems that I need to use Lanczos resampling to get a better outcome (I have tried the linear interpolation suggested in the answer. It improved the issue but still not optimal).

Based on Wikipedia's info about Lanczos, to calculate the value for sample at position x, I'll need the samples between x - a and x + a:

In the following example, the system periodically calls the function processAudio to get the next chunk of audio to playback. I applied the Lanczos function to the sample calculation, but the aliasing isn't improved at all, and it sounds worse than linear interpolation. Is there something wrong with my approach?

float samplePlaybackSpeed = 1.25f;
float currentPlayHead = 0.0f;
int filterFactor = 2;
// system callback function to fetch the next chunk of audio
void processAudio(float[] data)
{
    // output data is stereo
    for (int i = 0; i < data.Length; i += 2)
    {
        int flooredIndex = (int)Mathf.Floor(currentPlayHead);
        for (int j = flooredIndex - filterFactor + 1; j < flooredIndex + filterFactor; ++j)
        {
            if (j >= 0 && j < sampleLength)
            {
                float value = lanczos(currentPlayHead - j);
                // left channel
                data[i] += samples[j * 2] * value;
                // right channel
                data[i + 1] += samples[j * 2 + 1] * value;
            }
        }

        // round the playhead to the beginning when exceeding the sample length
        currentPlayHead = (currentPlayHead + samplePlaybackSpeed) % sampleLength;
    }
}

float lanczos(float pos)
{
    if (pos == 0)
        return 1;

    return filterFactor * Mathf.Sin(Mathf.PI * pos) * Mathf.Sin(Mathf.PI * pos / filterFactor)
            / (Mathf.PI * Mathf.PI * pos * pos);
}


texts: Is my solution to the DTFT of a delta function correct?

texts:
I am newer to signal processing math and just figured out something cool (hopefully). I was trying to see how the DTFT of the delta function is 1, because thats what my book says. I could only find youtube tutorials that didnt really explain it mathmatically, so i tried to do it on my own. Is my process correct? See pic.
Thanks!
-Dom


texts: Envelope of time domain signal // Hilbert transform

texts:
to get the envelope of a time domain signal, s(t), I use the absolute of its analytical time domain signal. But there occur the problem that sometimes the envelope is not as desired a true envelope but it follows more or less the original time domain signal.

Just for illustration some python code where the plot looks good:

from pylab import *
import numpy
import scipy.signal.signaltools as sigtool

x = linspace(0,5,1e4)

s= numpy.sin(2*numpy.pi*x)*numpy.exp(-x**2/2)
env = numpy.abs(sigtool.hilbert(s)) # hilbert(s) actually returns the analytical signal

plot(x,s,label='Time Signal')
plot(x,env,label='Envelope')
legend()
show()

By changing the data for example to (taking abs):

s = numpy.abs(numpy.sin(2*numpy.pi*x)*numpy.exp(-x**2/2))

the resulting envelope is following the "ripples" instead of being an envelope.

--- WHY? ---


texts:
The classical definition of orthogonality in linear algebra is that two vectors are orthogonal, if their inner product is zero.

I thought this definition might be applied to signals as well, but then I thought about the following example:

Consider a signal in the form of a sine-wave, and another signal in the form of a cosine-wave. If I sample both of them, I obtain two vectors. While sine and cosine are orthogonal functions, the product of the sampled vectors is almost never zero, nor does their cross-correlation function at t=0 vanish.

So how, then, is orthogonality defined in this case? Or is my example off?


texts:
In the origin paper on Synchrosqueezing Wavelet Transform, the phase transform, used to extract the instantaneous frequency of a signal $f(t)$, is defined as
$$
\omega (a, b) = -j[W_\psi f(a, b)]^{-1} \frac{\partial}{\partial b} W_\psi f(a, b), \tag{1}
$$
where $W_\psi f$ is the CWT of $f(t)$. $\psi$ is assumed analytic, or having support on non-negative frequencies: $\hat \psi (\omega < 0) = 0$ (hat = $\mathcal F$). Then, $(1)$ can be interpreted in an example:

Differentiating w.r.t. $b$, $j\Omega$ is extracted from blue, the rest (red) kept the same. $\Omega$ is thus obtained by dividing out red and $j$, which is what $(1)$ does. But what if the CWT never yielded blue, or a term from which $\Omega$ is 'nicely' extracted? $f$ isn't nice at all in practice. Then a more general, log-derivative, or $f'/f$, interpretation is needed:

this is the infinitesimal relative change in $f$; that is, the infinitesimal absolute change in $f$, namely $f'$, scaled by the current value of $f$

But that's too general. Is there a more specific interpretation in context? i.e. extracting instantaneous frequency via CWT, or more generally log-derivative of a frequency-domain representation.


texts: How Can I Use MATLAB to Solve a Total Variation Denoising / Deblurring Problem?

texts:
The Total Variation Denoising Problem is given by:

$$ \arg \min_{x} \frac{1}{2} {\left\| A x - y \right\|}_{2}^{2} + \lambda \operatorname{TV} \left( x \right) $$

Where $ \operatorname{TV} \left( \cdot \right) $ is the Total Variation Norm.

How could one solve this using MATLAB?


texts: Calculation of the salience function (Klapuri 2006)

texts:
I am reading this paper here and I wanted to check my understanding regarding the salience function:
$$
\hat{s}(\tau)=\sum_{m=1}^M g(\tau, m) \max_{k\in \kappa_{\tau, m}}\lvert Y(k)\rvert
$$

Where the set $\kappa_{\tau, m}$ defines a range of frequency bins in the vicinity of the $m^{\rm th}$ overtone partial of the F0 candidate.

We want to find the maximum of $Y(k)$ for those k. But k is a frequency. And Y is, according to Klapuri the discrete STFT of the signal. I don't understand what the STFT on a given frequency is.

The STFT represents a 2D vector so $Y(k)$ must be a vector, right?
How do we find the max of list of vectors?
Is something in my understanding wrong?

So let's say we are testing the salience of the period 0.002. We start with $m=1$, and get $g(\tau, m)$. Then what?


texts: Why does this Fourier series give lower amplitude for max value of signal?

texts:
I want to approximate below signal using Fourier series on Matlab.

My code is below
close all
clear all
clc
a_0 = 0
t=-10:0.001:10
x_t = 2/5
T = 10;
w0 = 2*pi/T
numOfTerms = 100
plot(t, x_t);

for k=1:numOfTerms-1
   a_k = (1/(w0*i*k*T))*(  exp(-1*i*k*w0)-exp(-3*i*k*w0)+ exp(-7*i*k*w0)- exp(-9*i*k*w0))
   x_t = x_t + a_k * exp(i*k*w0*t)
   plot(t, x_t);
   title(['Number Of Terms = ',num2str(k+1)]);
   pause(0.1);
end

You see that min point of this signal above zero and max point below 1. How can I solve this problem? Why it gives such result?


texts:
I'm implementing a very basic forward and inverse DWT, based on Mallat's book. Nothing fancy, simple inefficient matlab code (proof-of-concept more than runtime necessary, so I'm not focusing on optimisation). It almost works. I'm getting a distortion along the top and left edges. I'll post link to (need 10 points to post) some pictures of lichtenstein to exhibit the behaviour.

http://postimg.org/image/igy8cv7hn/
From top-to-bottom:
* After 5 iterations.
* After some unpacking iterations, you can see the distortion along the top and left edges growing.
* Unpacked and distorted.

I'm using symmetric boundary conditions (I've implemented both whole and half, it doesn't make much of a difference) and Haar. Although using CDF has the same effect (the distortion is a little different, but same location along the entire edge). Since the rest of the picture is transformed and inverted perfectly, there is most likely nothing wrong with the implementation as a whole. It must be some kind of index offset. It is clear that the expansion of the distortion is dyadic - it doubles in size for every step of the inverse loop. Two days and lots of index changing has led to no breakthroughs.

I've pasted the code here (I realise it's unlikely people will want to preuse 100 lines of foreign code, but I'm a little desperate). It's pretty simple to run (although like I said it's slow - can take up to a minute to run):

runbackward(runforward(rgb2gray(imread('lichtenstein.png')), 5),5)

Any code-based help or high-level diagnostic ideas would be appreciated.


texts: Obtaining beat histogram using Tzanetakis algorithm

texts:
I am working to make a music player with automatic genre classification application in Java.
On Google searches I mostly found the works of George Tzanetakis who describe an algorithm from Music Genre Automatic Classification. I have big problems with obtaining the beat histogram.

http://dspace.library.uvic.ca:8080/bitstream/handle/1828/1344/tsap02gtzan.pdf?sequence=1  this is one of the documents that describes the algorithm and includes a flow diagram for beat analysis.

I have implemented all the functions from that flow diagram: the Full Wave Rectification, Low Pass Filtering, Downsampling, Normalization and Autocorrelation. I am pretty sure that these are correct because i found plenty of implementations and formulas in the internet.

What I find difficult is how to link these together to obtain the beat histogram.

What I do not figure is how to make the processing of those octaves and how to sum them. I understood that octaves are same thing as in music. I implemented the DWT transform that as it is described in this document and used the wikipedia page about DWT  implementation that luckily is written in Java, just like my application.

What I think my problem is  that I  did not understand properly how to get the octaves from the DWT transform. I obtain a waveform just like in : http://en.wikipedia.org/wiki/File:Haar_DWT_of_the_Sound_Waveform_%22I_Love_Wavelets%22.png

After that DWT transform I have split the transform just like in the wiki page with waveform for that audio sample: second half is first octave and just like in wiki example it looks like the original signal. First half  i split again and its second half is second octave and so on.   Am I doing wrong at this stage? For about two weeks I was sure I did it correctly and now that I get a wrong signal after autocorrelation, with no peaks as it should be.

How I did to sum the octaves after processing each of them as in the diagram: I first took the largest one,  and for the second one which is half size of first octave I added to the large one every second index in the array. From the third I added the values to every 4th index in the array and so on.  I got about 6-7 octaves in total. And this is where I think I may be wrong again. Because those octaves are arrays with different sizes(each is half size of the other one) and had to split the smaller ones over the larger octave. Have I done wrong? I  very much believe that the fact that my octaves arrays have different sizes could be where I am wrong.

Please tell me where I may be wrong in what I described about how I tried to implement that algorithm. I very much think that I did not understood what octaves  and I should not have arrays with different sizes after the DWT transform.

After the autocorrelation I should have a signal with peaks while I have something linear so I cannot make Peak Detection(last stage of the algorithm) with this.

One more thing I would like to ask is how would I get that bpm from the signal after the autocorrelation? I have an array with size of 2048  because I started with 131072 samples and did a downsampling to have 65536 values as in the documentation(my wav files have 44100 frequency while in document they had 22050). After dwt and getting first octave I had 32768 samples for first octave and 2048 after the downsampling by 16. In the beat histograms shown in this document they have bpm values from 60 to 200. How am I obtaining those values? I understand that bpm is almost same thing as frequency but I do not know how to get frequency from this transform.

Edit

After summing the octaves, using the sample from the answer, I got something like this:

They are a bit different because I used DWT as filterbank. After I apply the usual autocorrelation I get something like this:

But the problem is that Tzanetakis used the enhanced autocorrelation which is a bit different and is based on Tolonen and Karjalainen   algorithm.


texts: Low frequency and high frequency noise of ecg

texts: Is baseline wander in ecg is low frequecny noise in ecg and power line interference is high frequency noise in ecg? Is both the artifacts present in EMG signal?


texts: STFT overlap add method - What am i doing wrong?

texts:
i am trying to implement a short time fourier transform of an audio signal to do some filtering (subtract another stft signal using spectral subtraction). I am using a hamming window function with 50% overlap. Additional the size of my FFT is twice the window size, zeros at the end of the signal in time domain.

mic is the input and output signal for in-place filtering

here is my code for so far:

    stftWindowSize = 256;
    stftWindowSizeOver2 = stftWindowSize/2;
    stftN = 512;
    stftLog2n = log2(stftN);
    stftNOver2 = stftN/2;
    stftSetup = vDSP_create_fftsetup (stftLog2n, FFT_RADIX2);

//length is the complete signal to be processed
for(i = 0;i<(length/stftWindowSizeOver2)-1;i++){

    //apply hamming window and copy to complex arrays
    vDSP_vmul(&mic[i*stftWindowSizeOver2],1,stftHamming,1,stftTmpStorage,1,stftWindowSize);
    vDSP_ctoz((DSPComplex *)stftTmpStorage, 2, &stftMic, 1, stftWindowSize);

    //fft
    vDSP_fft_zrip(stftSetup, &stftMic, 1, stftLog2n, FFT_FORWARD);

    //here shold the filtering happen right?

    //inverse fft
    vDSP_fft_zrip(stftSetup, &stftMic, 1, stftLog2n, FFT_INVERSE);

    //scale back
    float scale = 2*stftN;
    vDSP_vsdiv(stftMic.realp, 1, &scale, stftMic.realp, 1, stftNOver2);
    vDSP_vsdiv(stftMic.imagp, 1, &scale, stftMic.imagp, 1, stftNOver2);

    //mic data back to real, clear original signal and add overlapping data back in
    vDSP_ztoc(&stftMic, 1, (COMPLEX *)stftTmpStorage, 2, stftWindowSizeOver2);

    //set old signal to zero in non overlapping area and add
    if(i==0)
        vDSP_vclr(mic, 1, stftWindowSize);
    else
        vDSP_vclr(&mic[(i+1)*stftWindowSizeOver2], 1, stftWindowSizeOver2);

    vDSP_vadd(stftTmpStorage,1,&mic[i*stftWindowSizeOver2],1,&mic[i*stftWindowSizeOver2],1,stftWindowSize);
}

basically what im trying to do here is:

get chunk of float data of length: stftWindowSize (only half the data is "new" due to 50% overlap with previous chunk) from input/output signal mic
apply hamming window
compute FFT of the chunk + zeros at the end of signal with overall length: stftN
compute inverse FFT
scale back as a result of the FFT
clear non overlapping area in innput/output signal mic.
add my processed iFFT data back into mic with a 50% overlap with previous chunk data.

My Problem:
as i'm not doing anything with my FFT-data the sound should be the same as before, but unfortunately it isn't. It sounds somewhat modified and especially low frequencies look significantly changed when i look at the spectrum of the signal before and after my STFT.

What am i doing wrong? have i misunderstood the zero padding? is this method suited for filtering (especially spectral subtraction)?
i hope you can help me!


texts: Time delay estimation of signals increasingly decorrelated

texts:
The problem may be summarized as follows: I have a stochastic signals and I want to measure an increasing delay, as depicted in the following picture. The picture represents the signal as it is being delayed. I pick one acquisition as a reference (e.g. black signal), and then cross-correlate with later acquisitions (red and green) to find the delay.

As the signal is delayed, however, it progressively decorrelates with respect to the first measurement, which we take as reference. This deteriorates TDE performance (due to worse cramer-rao), leading to gradually worse performance and ultimately, to anomalous estimates.

The solution that we have currently implemented is to make a qualitative measurement of cross-correlation between two signals (checking the amplitude ratio between the main cross-correlation lobe and secondary lobes), and once it crosses a certain threshold we update the reference signal to the current one.

There are a couple of problems with this approach, which pose a trade-off: First, before updating, as the signal gets increasingly decorrelated, the performance of TDE is gradually worse due to decorrelation between both signals. On the other hand, updating the reference implies attributing to the last measurement a reference time-delay value, which will have its own associated estimation error. Therefore, every time the reference signal is updated, we are effectively integrating estimation errors, which ultimately present themselves as 1/f noise.

The question, in this case, is whether there is a smarter way to track the signal and minimize reference updates, or address the onset of 1/f noise in any way.
Also, as a side-note, what would be a good measurement for correlation quality between two delayed signals?


texts: Are there equations for placing sounds in the stereo field using delays?

texts:
I'm thinking of the typical stereo widener (haas, binaural) effects here, those that extend from the typical pan knob to create "out of the headphones" -experience.

These processors can be automated to move sounds around, but I was wondering whether there was mathematics that described how to set the delays in order to move the sound into a certain spot in an angle -like fashion.

Such as in this plug-in:

What about modelling the "distance" from the listener?


texts:
I'm trying to find an efficient way to compute maximum of a signal using its DFT. More formally:

$$\max\left\{ \mathcal F^{-1}\left(X_k\right)\right\}, X_k\text{ is the DFT of the signal and } \mathcal F^{-1} \text{ is the IDFT}$$

The original signal $x(n)$ is real, and it has some noise when sometimes there are wide peaks.

I'm looking for a solution that is quicker than the actual IFFT since the signal is very long (but we have its DFT).


texts: Examples of Independent and uncorrelated data in real-life, and ways to measure/detect them

texts:
We always hear about this vector of data VS this other vector of data being independent from each other, or uncorrelated, etc, and while it is easy to come across the math regarding those two concepts, I want to tie them into examples from real-life, and also find ways to measure this relationship.

From this stand point, I am looking for examples of two signals that are of the following combinations: (I will start with some):

Two signals that are independent AND (necessarily) uncorrelated:

The noise from a car engine (call it $v_1[n]$) and your voice ($v_2[n]$) as you are talking.
A recording of humidity every day ($v_1[n]$) and the dow-jones index ($v_2[n]$).

Q1) How would you measure/prove that they are independent with those two vectors in hand? We know that independence means that the product of their pdfs equals their joint pdf, and thats great, but with those two vectors in hand, how does one prove their independence?

Two signals that are NOT independent, but still uncorrelated:

Q2) I cant think of any examples here ... what would some examples be? I know we can measure correlatedness by taking the cross-correlation of two such vectors, but how would we prove that they are also NOT independent?

Two signals that are correlated:

A vector measuring an opera singer's voice in the main hall, $v_1[n]$, while someone records her voice from somewhere inside the building, say in the rehearsal room ($v_2[n]$).
If you continuously measured your heart rate in your car, ($v_1[n]$), and also measured the intensity of blue lights impinging on your rear windshield ($v_2[n]$)... I am guessing those would be very correlated... :-)

Q3) Related to q2, but in the case of measuring cross-correlation from this empirical stand point, is it enough to look at the dot product of those vectors (since that is the value at the peak of their cross-correlation)? Why would we care about other values in the cross-corr function?

Thanks again, the more examples given the better for building of the intuition!


texts: What's this discrete latch operation called?

texts:
I have a picture in my head of a specific DSP operation, but I don't know what it's called or how to google for it. I'm pretty sure it's a fairly common operation, however I have no idea what to call it.

Consider a discrete event that occurs at time interval (Excuse the ascii art):

                          |
              |           |
x       |     |  |        |
     _  |  _  |  |  _  _  |  _  _
     0  1  2  3  4  5  6  7  8  9
                     t

What I have is two vectors descibing this waveform.

x = [2,3,2,4]
t = [1,3,4,7]

What I want to do, is 'latch' the most recent signal over time, like this:

                          |  |  |
              |           |  |  |
x       |  |  |  |  |  |  |  |  |
     _  |  |  |  |  |  |  |  |  |
     0  1  2  3  4  5  6  7  8  9
                     t

Which would produce this waveform:

x = [0,2,2,3,2,2,2,4,4,4]
t = [0,1,2,3,4,5,6,7,8,9]

In electrical terms, this would be a memory element which remembers the most recent signal received. It also would be some crude interpolate function, however all the interpolates I know about (linear, cubic) fill in the in-between with more complicated functions.

I'd like to recreate this behaviour in Matlab but don't know how to google for what I want. So what's this called?


texts: Correlation: A Magnitude or Power quantity?

texts:
I am confused about the units we would refer to with a correlation result in that if it would be a magnitude or power quantity (and therefore specifically when using ratios in dB would we use 10Log or 20Log?).
I have since confirmed as detailed in this post that the normalized correlation coefficient $\rho$ is a magnitude quantity in that the relationship between SNR and $\rho$ repeated here is:
$$\text{SNR} = 10\log_{10}\frac{\rho^2}{1-\rho^2}$$
Where in this case for an SNR relationship to $\rho$, the correlation involved is the correlation of $x(t)$ being a reference waveform as signal to $y(t)$ which is the same signal with added noise. (So that the SNR of $y(t)$ is determined in this case).
However I also understand and see directly from the math that the autocorrelation (at $\tau=0$ if we are referring to the autocorrelation function) is the variance (scaled by the number of samples), which is a power quantity, and we see the sum of products in the general expression for correlation suggesting a sum of powers.  How do we reconcile all this?
Is it that the normalized coefficient through it's normalization process:
$$\rho = \frac {\operatorname*{cov}(x,y)}{\operatorname*{stddev}(x)\operatorname*{stddev}(y)} $$
Has this converted the power quantity of the numerator back to a magnitude quantity, and therefore correlation on its own (the numerator) IS a power quantity, while the correlation coefficient IS a magnitude quantity? If so, I don't yet quite see how. Or is it something else entirely?


texts: Very simple problem regarding shifting of a signal

texts:
I have this simple $x(t)$ graph, and I have some confusion regarding time shifting.

What is the graph of $x(1-t)$ ?


texts: I am trying to use fixed point to implement the function 1/x for the integer from 1 to 2048. My plan is that I use fixed point representation for some picked integers as entries in one lookup table and use linear interpolation obtain missing integers. About picking integers, more integers will be selected at high curvature regions. I am using Matlab to achieve the goal. I have few experience of converting one function from floating point to fixed point. Currently I am working on the first step. It seems it is not an easy task. Can anyone give some ideas or links to useful information?


texts:
I need a tool or code for extract not blurry images from video (it can be used for panorama or SFM building from video)

something like
http://research.microsoft.com/en-us/um/redmond/groups/ivm/sharppanoramas/
(It is worth noting that software for building panorama from video is already exist, but I don't know why they don't use it for SFM)

I want to get images from video and put them to vsfm

For example virtualdub gives blurry images when I try to convert video to images.


texts: Periodicity of complex exponential in continuous and discrete time (Eq 1.51, Signals and Systems by Oppenheim & Wilsky)

texts:
Hi All: This is very basic but I've always wondered about it and now I see it in print in a textbook so I may as well ask. In Signals and Systems on page 26, it says
$$e^{j(\omega_0 + 2\pi)n} = e^{j2\pi n} e^{j\omega_0 n} = e^{j\omega_0 n}     \tag{1.51} $$
Then it says:

From eq. (1.51), we see that that the exponential at frequency $\omega_{0} + 2\pi$ is the same as that at frequency $\omega_{0}$. Thus, we have a very different situation from the continuous time case in which the signals $e^{j\omega_{0} t}$ are all distinct for distinct values of $\omega_{0}$. In discrete time, these signals are not distinct, as the signal with frequency $\omega_{0}$ is identical to the frequencies with $\omega_{0} \pm 2\pi$, $\omega_{0} \pm 4\pi$
and so on.

The reason why the concept above has always confused me is because if we replace $n$ with $t$, then it is true for integer values of $t$ also. Why does this not matter ? I know  that  concept also has to do with why aliasing cannot exist in the continuous case so, if I can understand this, a lot of things would get clear for me. Thanks for your help and the great answers in general from many.


texts:
I have a raster image (A) of size 20x20 and I want to scale it down to a size of 10x10 (B).

Naturally in the resulting picture B one pixel will represent 4 pixels shaped 2x2 from A.

Is it possible to give a canonical answer to how the pixel values of B have to be calculated if no neighbouring pixels (surrounding the 2x2 subset) in A should be taken into account? Mean, maximum or something else?


texts: Difference between step,ramp and Impulse response

texts: As, we can determine the response of the system by its 'impulse response' then why we use 'step response' and 'ramp response'. Is there any difference between all these response?


texts: Discretizing my continuous system in Matlab

texts:
I was hoping someone could help me with conducting my discretization in MATLAB.
I have a linear system with known data: sampling interval $T$, system matrix $\mathbf{A}$, input matrix $\mathbf{B}$, output matrix $\mathbf{C}$ and direct feed-through $\mathbf{D}$.

Now I need to manually compute the discrete system in MATLAB, I know that:
$x[k+1] = \phi x[k]+\gamma u[k]$

Now the question is how to compute $\phi$ and $\gamma$ in MATLAB, I hope someone can help me there, I know that $\phi = e^{\mathbf{A}T}$ and $\gamma = \int_0^T e^{\mathbf{A}x}\mathbf{B}dx$.
I am not very familiar anymore with MATLAB syntax, it would be huge help if someone could show me how to type this in MATLAB, then I can start analyzing the system for myself. Thanks in advance :)


texts: Are discrete wavelet transform based statistical features invariant to rotation/translation/scale?

texts:
I'm reading a paper where image classification is done. Their approach is to use the discrete wavelet transform with bi-orthogonal wavelets of degree 3.5 and decomposition of level 3 on images. Based on the 2d coefficients gotten from the DWT they calculate statistical features such as standard deviation, skew, kurtosis, mean, absolute deviation. These statistical features are used as input for classification.

My question is now, are these statistical features based on the DWT rotation/scale/translation invariant ? I personally do not think so. But I can't motivate my answer. Can someone explain this, I'd appreciate if you can quote a source if you anwer.


texts: Scikit-Image, Numpy, and Selecting Colors (python)

texts:
I'm trying to mask colored features from a photograph so that I can do some other processing on them. I've played with a few packages (scikit-image, mahotas, and openCV) and have settled on Scikit-image because it plays well with scikit-learn.

I'd like to accomplish two things, eventually: (1) get colored features so that I can compute things like length, and (2) remove colored features from the image while retaining the white spidering-looking veins (the lattice-looking stuff around the margin of the image will need to go, but that can be a later endeavour).

I'm new to image processing in Python, and I think I've mislead myself by using strange color spaces. Perhaps it would have been better to define an upper and lower boundary for each colour, and mask the image array? I'm definitely open to any flexible solution to the problem. Eventually I'll be applying this to hundreds of photos..

Original Photo

Code

from skimage import io, img_as_float, color, exposure

img = img_as_float(io.imread('./images/testimage2.JPG'))

# Isolate paint marks

# Put image into LAB colour space
image_lab = color.rgb2lab(img)
img = exposure.rescale_intensity(img)

# Colours of interest
color_array = np.array([
        [[[255, 255, 0.]]],    # Yellow stuff
        [[[255, 190, 200.]]],    # Pink stuff
        [[[255, 165, 0.]]],    # Orange stuff
        [[[255, 0, 0.]]],    # Red stuff
        ])

# Loop through the color array and pick out the colored features
for i in range(0,color_array.ndim):
    # Compute distance between the color of interest and the actual image
    # http://scikit-image.org/docs/dev/api/skimage.color.html#skimage.color.deltaE_cmc
    # "The usual values are kL=2, kC=1 for “acceptability”"
    distance_color = color.deltaE_ciede2000(color_array[i], image_lab, kL=2, kC=1, kH=0.5)

    # Normalise distance
    distance_color = exposure.rescale_intensity(distance_color)

    # Mask image
    image_filtered = img.copy()
    image_filtered[distance_color > 0.5] = 0

    # Plot it up
    print ("Filtered to: ", color_array[i])
    f, (ax0, ax1, ax2) = plt.subplots(1, 3, figsize=(20, 10))
    ax0.imshow(img)
    ax1.imshow(distance_color, cmap='gray')
    ax2.imshow(image_filtered)
    plt.show()

Results


texts: How to find the inflection point in a noisy curve?

texts:
I have the the noisy curve defined by numpy 2D array:

As you can see, it has the first flat segment, then rise, peak and decay phases. I need to find the starting point of the rise phase, marked here by the red dot. What algorythm can I use for that? I need it to be as noise-tolerant as possible.


texts: detect and distinguish driving maneuvers via smartphone sensors

texts:
I want to do some driving style analysis via smartphone.
Therefore, I programmed an app that records a 2D acceleration (when accelerating/braking and turning left/right). The app calibrates itself in a way that the initial misalignment between the reference systems of the car and the smartphone, that is fixed in the car while driving, is corrected.

For the start of my analysis, I want to focus on the longitudinal acceleration value. I want to distinguish between harsh acceleration and normal acceleration as well as harsh braking and normal braking (or even coasting). If I would be able to do that, I could determine over time whether a person is driving aggressive or not.

How can I distinguish harsh acceleration and normal acceleration as well as harsh braking and normal braking (or even coasting) in real-time?


texts:
I'm new to signal processing and I need your help: I have an array of 128 elements (call it Window) filled with 128 samples taken from a sensor. I was wondering how to find the derivative of this digital signal. I found this formula on wikipedia:

m = F[n] - F[n-1]

where, for me, F[n] is Window[n]. I'd like to obtain an array M filled with all the derivatives. But there's something I miss: The first step would be:

M[0] = Window[0] - Window[-1]

and I haven't Window[-1]. How can I manage this issue? Thank you in advance.

https://en.wikibooks.org/wiki/Digital_Signal_Processing/Discrete_Operations#Derivatives


texts: Invariances of FFT-based Image-Registration vs. SIFT-Features

texts:
TL;DR: I don't understand how invariant FFT-based image-registration techniques are to object alterations (scratches, marks etc.) in comparison to SIFT-features.
I want to build kind of a feature-matching-like system to detect and compare objects from the same production line. The objects have a granular surface structure, therefore matching surface-features already yields good results.
Here are two sample images of objects I would try to identify:

The extracted features should be invariant against translation, rotation, illumination and partial object-alterations, because one use-case could be failure analysis.
Until now I have realized the matching-process by using SIFT or ORB and matching the descriptors of a query-image against a Database of previously extracted descriptors. If I then iterate over the whole database and count the number of good features (using ratio-test, RANSAC or alike) I can find the matching object by searching for the maximum number of good features.
However this process takes a long time due to the high count of descriptors. That's why I looked into techniques that would generate a hash-string or some comparable vector. I found this paper which seems to accomplish a very similar goal to mine. It's based on this paper, which seems to be kind of reference-paper in the field of image registration. There are some implementations available for the latter, however they always solve the problem of rotated/translated template matching (and here).
Finding out how to do feature extraction with these libraries (as in [1]) would be possible (I guess), but I don't understand whether these processes are also invariant to object-alterations! How would the extracted fft-features look, if I alter the object (scratches, marks, dents etc.)? Would I still be able to match them properly?
Another idea would be to extend the existing feature-matching with Bag of Features to speed up the matching process. Would this be more suitable? Is there another, "better" approach that I haven't considered yet?


texts:
A library defines periodize_filter_fourier, which is an equi-spaced averaging formulated by
$$
v_f[k] = \sum_{i=0}^{\text{n_periods}-1} h_f[i\cdot N + k],
$$
where $v_f$ is periodization of $h_f$, $N=\text{len}(h_f)/\text{n_periods}=\text{len}(v_f)$, $k=[0,1,...,N-1]$, and $1/\text{n_periods}$ seems missing.
It's applied on the frequency-domain (DFT) Morlet wavelet. What's the purpose, and what's "periodizing" to do with it?

Example with h = [1, 2, 3, ..., 12]:
# n_periods == 2
v_f = [[1, 2, 3, 4, 5, 6],
       [7, 8, 9, 10, 11, 12]].mean(axis=0)
    = [4, 5, 6, 7, 8, 9]

# n_periods == 3
v_f = [[1, 2, 3, 4],
       [5, 6, 7, 8],
       [9, 10, 11, 12]].mean(axis=0)
    = [5, 6, 7, 8]


texts: What is the advantage of using Bessel function as the basis in a Hankel Transform?

texts: I came across literature which says that the Fourier - Bessel (Hankel) transformation is better than a STFT or a Wigner - Ville distribution as the Bessel function forms an orthonormal basis and they occupy finite bandwidth. This is supposed to translate into better time and frequency resolutions. Isn't it the same with the regular fourier transform ? so why not use an STFT itself to transform the signal into time frequency domain ?


texts: Is there any way to make a sampling rate reduction in the frequency domain?

texts:
Is there any way to take advantage of the frequency domain to make a clean/nice sampling rate reduction effect ? and how ?

Basically, deducted from my tests:

if I set to 0 the magnitude uppon a certain threshold I only get a filter(quite obvious...)
if I set to 0 one sample over 2 before the buffer transfrom it's not at all some freq domain processing ( if I do the same on the transformed buffers it's also a filter)

Is it possible to make SR reduction in the freq domain ? (actually I have some overlapped phase and magnitude arrays...)


texts: Remove high resolution spurious peaks from sinusoidal signal

texts:
I have the current from a LEM transducer measured. The measurement is taken on the output of a transformer. The signal is a 50 Hz signal, measured at 100kHz. When the demand of the system is increased the current increases and therefore the amplitude of the sinusoidal gets bigger. I am looking for the maximum currents and the period over which this occurred.

Unfortunately the data is not the best quality. In some files the transducer connections appear to be bad as a signal sometimes will jump and cause a spike but the spike has many data points so using a median filter or similar is not helping me rid my system of the spikes.

I had initially applied a moving RMS filter to the signals (I have 50 different test files) and then taking the maximum of the signal to get the value and time where it occurred. However with the spikes it throws this out.

I thought about downsmapling the signal to reduce the resolution and hence the number of samples in the spikes and then doing a moving RMS but I would prefer to keep the resolution as per the original dataset.

Does anyone have any suggestions that I could try?


texts: Google's self-driving car and LIDAR interference

texts:
Firstly: I hope this isn't the wrong place to ask. I'm usually over in the coding forums. But this seemed like the appropriate forum for the question.

It occurred to me that if several of Google's self-driving cars were lined up together at each side of an intersection, there would be tons of untimed backscatter across anything between them, that would make it all but impossible to determine the exact location of an obstacle.

Is there a way for them to put a unique signature on each radar signal so it isn't muddied up by others?

Also, what would be the effect of someone painting one of these cars with a radar gun?

And lastly - and I know this is definitely outside the scope of this forum - is there any biological consequence to crossing an intersection where you're being painted by several dozen LIDAR beams?


texts: How to find output signal in multipath ray tracing system?

texts:
I have a channel response of a multipath ray tracing system (so the delays, the attenuated amplitudes and powers if I put an input Dirac pulse) that works for a given frequency (I can change it). I have to put an UWB modulated signal in input and I want to find the output (the convolution between the CIR and the input signal).
But if the bandwidth of the modulated input signal is very large how I can find the output signal if the channel parameters are evaluated only for the carrier frequency?
For example I compute the channel response at 200 GHz, the input signal has a bandwidth from 150 GHz to 250 GHz (carrier frequency at 200 GHz), the channel response is valid only near the 200 GHz value but not for the all bandwidth, so if I do the convolution, frequencies of the signal far from the 200 GHz are valued with the effects of 200 GHz channel.


texts: Correlated fading channel: transmit and receive antenna correlation matrices

texts:
I am trying to create a non-i.i.d channel: correlated Rayleigh fading channel.
$$ H= R_H \cdot H_o,$$
where $H_o$ is i.i.d. channel ( uncorrelated) and $ R_H$ is a channel correlation matrix, is defined as
$$ R_H= R_T^T \otimes R_R,$$
with $R_R$ receive antenna and  $ R_T$ transmit antenna correlation matrices.

My question is how to find $R_T$ and $R_R$, if numbers transmit and receive antennas are given only?
Can I assume them as identity matrices?


texts: How to Generate White Gaussian Noise with Known PSD in MATLAB

texts:
I want to generate white Gaussian noise with known PSD. Using wgn I can generate noise with specific power (dBW) but I want to generate a white noise with constant or know PSD.

Can anyone give me some idea.
Thanks
Franklin


texts: Why does slowing down audio introduce aliasing?

texts:
I have an 8khz mono buffer of samples, and I am trying to manipulate the playback speed of it by modifying the number of samples in it.  When slowing down (a speedScale value of 0.5 for example) then the values are repeated-- a buffer of samples: [0.1, 0.2, 0.3..] becomes [0.1, 0.1, 0.2, 0.2, 0.3, 0.3 ..].  When I do this, although the speed has slowed down correctly, I am noticing aliasing happening.  I was under the impression that repeating samples like this would not require low pass filtering to avoid aliasing.  Am I doing something wrong?

Here's the code for slowing-down/speeding-up:

function process(buffer, speedScale) {
    size = ceil(buffer.size / speedScale);

    counter = 0.0;
    ratio = 1 * speedScale;
    processed = [];

    for (i = 0; i < size; i++) {
        index = floor(counter);
        processed[i] = buffer.samples[index];
        counter += ratio;
    }
    return processed;
}


texts:
I'm trying to test my ear frequency range by using MATLAB. The thing I could not understand is that I can hear the frequencies above 20 kHz. My sampling frequency is enough to satisfy the Nyquist criteria (80 kHz which is limit for MATLAB). So there is no possibility to have an aliasing. What can be the problem? Thank you for any help.
Here is my code:

K               = 1000; % kilo
sampling_freq   = 80*K; % 80KHz sampling for sin wave
sampling_period = sampling_freq^(-1);
f               = 20*K; %kilohertz
t               = 0:sampling_period:5; % 5 second sin signal
testing_sound   = sin(2*pi*f*t);
plot(t,testing_sound)
sound(testing_sound,sampling_freq);


texts: Is it true that each and every signal has multiple frequency components?

texts:
Usually when we observe spectrum of a signal,we see multiple frequency components, each having different contribution to amplitude

But is it true that each and every signal has multiple frequency components? For example common AC power has frequency 60 Hz, if we observe its spectrum, will we observe only one frequency components or multiple components?  Why if we observe multiple frequency components,despite the fact as we know beforehand that ac power has frequency 60 hz?