texts: How to create an echo effect in audio samples?

texts:
I am feeding the samples of pure sin wave to the audio DAC, I would like to create an echo effect. What I am not sure is how to go about it.
I was thinking about superimposing the the current buffer that I am feeding with the delayed version of it with some decaying factor but that does not seem to help at all. I am using FIFO buffer to fill up with the next sample.
Is there any standard approach in creating a good echo effect? How long the delay should be(how many samples)?


texts: After advice about detecting focus quality of objects in a photo detected using YoloV3

texts:
I've spent the last couple of days playing with YoloV3, and have had very good results.  My use case is sports photography, and the object detection for people/bikes etc is very very good, I'm very impressed.  In the future I think I'll train it with my own dataset to improve it further, but out of the box it does a fantastic job already.

What I want to improve:

Once an object has been detected, how can I generate some sort of metric to quantify how well-focused it is?

Past/current approaches

1) My first thought/Google, was "variance".  First I turn the image grayscale, then use a Laplacian convolution to highlight the edges.  Then simply compute the variance of the pixels in the bounding box.  High numbers "probably" mean high contrast i.e. high focus, whereas lower numbers would tend to mean low contrast and probably poor focus.

It works pretty well, but not 100% reliable.  Imagine you have a person stood up with their arms spread wide, against a skilled bokeh background.  Most of the bounding box is blurred background, so the variance ends up being low.

2) To improve upon this, I came to the conclusion that there will almost always there be a significant portion of the object somewhere around the center of the bounding box.  I set my criteria to center square, 20% of the width of the BB and 20% of the height.

Unfortunately this throws up scenarios where that square happens to be 10% background, between someone's arm and body when running around a tight corner facing the camera, etc.

3) "OK, a cross".  Thickness equal to 20% of the BB, up and down through the middle and left and right through the middle.

Not bad, not bad.  Still getting a lot of background on some images though, as the edges of the box are where background is going to tend to reside.

4) "OK, a reduced cross".  Same as above, but only extending from the center 2/3rds of the way out to the edges.

Almost fantastic.  With the caveat that sometimes you end up with just a competitor's chest, and if they're wearing a single-colour top.... the variance isn't all that.

Examples:

In this photo, the motorbike (close enough...) apparently has great focus, while the person isn't so good.  Mainly due to the near-uniformity of his central cross.

Here's a more troubling example.  Look at that variance, 5 FFS!

So I think that's the end of that approach.

The future...

I could go on and on with this, and I'm ALWAYS going to end up with some photos that it just doesn't work well for.

I think a different approach is needed.

One thought is just to take the largest variance over a small region, say a 10% width/height square that roams across the bounding box.

But then if the foreground is completely out of focus, and the background is sharp, we'll get a false positive from the background.

Anyone cleverer/more experienced than me have a fantastic solution for this?

It's clearly possible, not least because http://remove.bg and PhotoShop already do a fanastic job of separating foreground from background.  But how?

EDIT: I completely neglected to mention that I'm using a Laplacian convolution on a grayscale version of the photos before computing the variance, to detect the edges.


texts: How to build a phase shifter with arbitrary phase shift

texts:
Fred, a DSP engineer, goes to his favorite DSP store to do some shopping.

Fred: Hi, I'd like to buy a phase shifter.

Shop assistant: Hmm, what exactly do you mean?

Fred: Well, you know, if you put in a sinusoid like $x(t)=\sin(\omega_0t)$ you get $y(t)=\sin(\omega_0t-\theta)$ at the output, for any $\omega_0$. And of course, $\theta$ must be adjustable.

Shop assistant: Oh, I see. Sorry, no, we don't have those. But I remember other guys needing the same thing, and they always buy a Hilbert transformer, a couple of multipliers, and an adder, and they somehow connect all these things together to make an adjustable phase shifter.

Fred: Oh yes, right!

Fred pretends to understand what the guy is talking about. Of course he has no idea how to do that. He buys everything the guy said he needed, and thinks by himself that he might figure it out at home, or, everything else failing, he could ask it at DSP.SE.

How can Fred build a phase shifter with adjustable phase shift $\theta$ using the components he got at the store?


texts: Why symbols have to be upsampling, if the symbol rate and sample rate is same what happen?

texts: In digital modulation process, after constellation mapping and before pulse shaping, the symbols are upsampled with the number L(samples per symbol). At this moment, why symbol have to be upsampled, if the symbol rate and sample rate is same what happen?


texts: PSD and $\lim_{T\rightarrow \infty} \frac 1 {2T} \int_{-T}^T x(t)\bar y(t)\,dt$

texts:
From Wikipedia, I taken a definition of power spectral density:

For continued signals that describe, for example, stationary physical processes, it makes more sense to define a power spectral density (PSD), which describes how the power of a signal or time series is distributed over the different frequencies, as in the simple example given previously. Here, power can be the actual physical power, or more often, for convenience with abstract signals, can be defined as the squared value of the signal. For example, statisticians study the variance of a set of data, but because of the analogy with electrical signals, it is customary to refer to it as the power spectrum even when it is not, physically speaking, power. The average power P of a signal x(t) is the following time average:
$$P = \lim_{T\rightarrow \infty} \frac 1 {2T} \int_{-T}^T x(t)^2\,dt.$$

I premise that I'm not an expert on the signal theory, therefore I do apologise if this question isn't much precise.
Let $x(t),y(t)$ be two complex signals and denote with $\bar y$ the complex conjugate of $y$. What represents the following formula?
$$\lim_{T\rightarrow \infty} \frac 1 {2T} \int_{-T}^T x(t)\bar y(t)\,dt$$
Is it related to PSD?
Thanks in advance.


texts: Calculating Cross Power Spectral density between two complex signals

texts:
I have a small misunderstanding of cross power spectral density between two complex signals. I know that it is the Fourier transform of cross correlation between two signals. Let's say the complex signals are of the form (a+ib) and (c+id). Then the cross-correlation should result in something like

The real part result => ac - bd i.e. real1*rea12 - imag1*imag2;

complex part result => ad + bc i.e. real1*imag2 + real2 * imag1;

where real1, real2 represents the real part of both the signals and
      imag1, imag2 represents the imaginary part of both the signals.

But my professor said that the cross-correlation should result in

The real part result => ac + bd i.e. real1*rea12 + imag1*imag2;

complex part result => ad - bc i.e. real1*imag2 - real2 * imag1;

Where I am going wrong? Is my understanding of the equation form of cross-correlation correct? And also, I just want to know how to calculate cross PSD from this result. Can I just compute it like

Cross PSD result = |real_part result + imaginary_part result|.^2 ?

or Cross PSD result = |real_part result|.^2 + |imaginary_part result|.^2 ?


texts: Why use both packet detection and symbol timing offset in WLAN 802.11?

texts:
In IEEE 802.11 Wlan, at the receiver side, we first use packets detection algorithm to detect the start of the packets, and then uses fine symbol timing estimation algorithm to find the start of the data symbol.
However, if we can detect the start of the packets, we should be able to find the start of the data symbol since the length of the preamble is known at the receiver, so why would we use still employ the symbol timing estimation algorithm to find the start of the data symbol. The packet structure:

I guess it because the multipath fading or symbol time offset, but I can't figure out why, could any body explain this? I will really appreciate that, thanks in advance.


texts:
How to calculate step response for $y''(t) - y(t) = x'(t) - x(t)$ in time domain? So, without Laplace or Fourier Transforms.

This is what I tried:

The Homogeneous solution of the differential equation would be: $ y_\text{homogeneous} = A*e^t + B*e^{-t}  $.

$u(t)$ is the unit step function.

$$ u(t) \triangleq
\begin{cases}
1, & \text{if }t>0 \\
0, & \text{if }t<0
\end{cases} $$
When I try to fill in the stepfunction for $x: x(t)=u(t)$. So $x'(t) = u'(t) = \delta(t)$

And I try a step response $y(t) = y_\text{homogeneous}(T)*u(t) =  (A*e^t + B*e^{-t})*u(t) $

$$\frac{\partial ^2 (  \left(A e^t+B e^{-t} \right)u(t) )}{\partial t^2}-\left(A e^t+B e^{-t}\right) u(t)=\delta(t)-u(t)$$

So, I will get:

$2 (A-B) \delta(t)-A \delta(t)+A \left( \delta ' (t) \right )+B \delta(t)+B \left( \delta ' (t) \right)=\delta(t)-u(t)$

But there's no $u(t)$ at the left hand side.


texts: Can Morse Code be encoded using "silence" for dots and dashes?

texts:
Morse code dots and dashes are often displayed as a sound, or light that is on for a short or long period of time.

What if the only way to communicate was by knocking.... (or similar encoding) that can only encode using extended (or short) durations of silence.

Is it acceptable to use morse code in this way (where short or long durations of silence are the dots and dashes)?


texts: Reduce "flicker" in spectrum analysis / spectrogram

texts:
I'm performing a series of FFTs on windowed extracts of an input signal, to get a frequency spectrum over time.  This is for a visualisation - I'd like to keep the window small, so the visualisation is fast-moving and responsive.

I'm only interested in the amplitude.  Occasionally, two or more frequencies are close enough that the amplitude flickers wildly with the interference pattern between the two.

What ways are there to reduce this flickering, that will disturb my time-domain responsiveness less than increasing the window length?

(For reference, this is the visualisation - I'm not concerned with the "flashes" when something happens in the audio, but the juddering is not good.)


texts:
I need to smooth noisy complex data with a Gaussian filter.

Right now, I apply the filter to real and imaginary part of the data separately, which needs two convolutions. The intended results are the equally smoothed components of the array.

In order to reduce computational load, would it be possible to filter the complex array as a whole and take real and imaginary part after smoothing?


texts: Output of a stable LTI system (discrete)

texts:
Consider an LTI (linear and time invariant) system that is BIBO (bounded input
bounded output) stable and is such that $x[n] = 0$ for all $n < 0$ (note: this is sometimes referred to
as a relaxed system). Show that

Suppose that $x[n] = x_0[n] + au[n]$ for some constant a where $x_0[n]$ is a bounded signal with
$$\lim_{n\rightarrow\infty} x_0[n] = 0.$$ Then $x[n]$ is bounded and tends to a constant (namely, $a$). Show that the
output $y[n]$ will also tend to a constant.

Suppose that $x[n]$ has ﬁnite energy. Show that $y[n]$ will also have ﬁnite energy.

For 1, I'm kinda stuck at the step proving $$\sum_{k=-\infty}^{\infty}|x_0[n]h[n-k]| \rightarrow C $$ where $C$ is a constant. I can prove that it's below ($\le$) a constant, but how do I prove it is actually approach to it when $n \rightarrow \infty$?

For 2, can we do it without using the Fourier transform (continuous version here)?


texts:
So, a frequency bin is centered around an interesting frequency $f_0$. Assume the spectrum is such that there is no spectral leakage from other frequencies to that specific frequency $f_0$. Now. I center a frequency bin around f0. The value (magnitude) of this bin is then the value of EXACTLY this frequency $f_0$ and is not affected by non-zero frequency values (magnitudes) of frequencies that also lie in that bin's range. A frequency bin 'only' covers the value of its center frequency (+ potential spectral leaks to that center frequency).

Is that correct?


texts: Choppy output when trying play through a callback buffer

texts:
I am trying to make a keyboard in python where every note's frequency is a ratio of the previous note but my output is strangely choppy for some reason. Here's an example of what I mean.

I'm using the sounddevice module and playing the sine wave through a callback function, here's what it looks like:

def callback(indata, outdata, frames, time, status):
    if status:
        print(status)

    global pressed
    if pressed:
        global pitched_sine
        global percent_thru_sine

        sine_len = len(pitched_sine)
        starting_index = int(sine_len * percent_thru_sine)
        out = np.concatenate((pitched_sine[starting_index:], pitched_sine[:starting_index - sine_len]))

        percent_thru_sine = (frames + int(percent_thru_sine * sine_len) + sine_len) % sine_len

        while percent_thru_sine > 1:
            percent_thru_sine -= 1

        out = np.resize(out,frames)
        out = np.reshape(out,(1,frames))
        outdata[:] = out.transpose()
    else:
        outdata[:] = None

I thought the choppiness was from the sine wave not starting where the previous one left off, like the end of one buffer having an amplitude of 1.0 immediately followed by the next buffer starting with 0.0, so I save the % through the last sine wave so I can start at that point in the new sine wave.

"pitched_sine" is generated when a keyboard button is pressed by pitch shifting a precalculated sine wave since I figured that calling np.sine() for every sample might have been causing a slowdown responsible for the hiccups in the output.

I also made sure that my pitch shift function or reshaping weren't resulting in weird results by making pyplots at every stage to check for strange looking sine waves but I didn't see any. Those were all the reasons I could think of, does anyone here have any ideas?

Here's the whole script if anyone wants to run it. If you do use the "-p" flag since the other stuff isn't relevant here. You'll also need this to be in the same folder and change the generated filename to "keys", press the spacebar while the program is running to play a note without its pitch changing.

EDIT: The chops correspond to either an "input overflow" or an "output underflow" even though the size of the output is always equal to the number of frames specified to the callback. According to this page I am using too much CPU time. Is there a way to optimize this?

EDIT 2: I figured it out, posted an answer but apparently I can't accept it for two days.


texts: Histogram matching of two images using cdf

texts:
I have already calculated the cdf values of each image now i have to map the reference image values to target .
I cannot use histogram equalization or interpolation
I simply have to map them .

function S = histM(t, target)
 if size(target,2)>1
   %an image, replace the image with its cdf
   target = getImageCDF(target);
 end

%get the CDF for the input image
 tcdf = getImageCDF(t);

% .... what shall be done here to map the values of reference to target

%subfunction: compute the CDF for an image that started as uint8
 function cdf = getImageCDF(img)
 bins = 0:255;
 H = hist(img(:), bins);
 Hmod = H + eps(sum(H));
 cdf = [0, cumsum(Hmod)/sum(Hmod)];


texts: Calculating Transfer Functions From Harmonic Distortion Percentage

texts:
Hi I am working on emulating a piece of analog audio equipment and would like to be able to create a transfer function based on the measured percentages of harmonic distortion.

I know that harmonic distortion can be modeled as follows (assuming range of -1 to 1):

2nd order: y = x - (1/2) * (x^2 * sign)

3rd order: y = x - (1/3) * x^3

The amount of distortion can then be changed by mixing wet and dry signals, and frequency response approximated by filtering the polynomial input.

What I want to know is how to calculate a wet dry mix based on harmonic distortion percentage, and how that applies to these transfer functions. Is there an equation / method I can use to calculate this?


texts: why only impulse signal for convolution?

texts: Why do we only use impulse response for convolution for getting output of LTI systems. why we don't use unit step or any other signal for this purpose?


texts:
Autocorrelation for power signals is defined by $$R_x(\tau)=\lim_{T\to\infty}\frac{1}{2T}\int_{-T}^Tx(t)x^*(t-\tau)dt\tag{1}$$ Is it true that for periodic signals $(1)$ can be computed by $$R_x(\tau)=\frac{1}{T_0}\int_{T_0}x(t)x^*(t-\tau)dt\tag{2}$$What are the other ways for computing $R_x(\tau)$? In this question, it's showed that $$|X(f)|^2 =\sum_{n=-\infty}^\infty |c_n|^2 \delta (f-nf_0)\tag{3}$$
But I don't think that's a valid derivation since, as it's pointed by Matt L, it involves product of  $\delta(f)$'s which is meaningless. So is it possible to prove $(3)$ by other means or it's a false statement? And, in the end, can we conclude that for a periodic power signal $$(\mathcal{F}R_x)(f) = S_x(f) = |X(f)|^2 = \sum_{n=-\infty}^\infty |c_n|^2 \delta (f-nf_0)$$
where $S_x(f)$ is PSD, holds?


texts:
I'm trying to do a spectral analysis in R. I learned it in Python from Allen Downey's ThinkDSP book.

What is the R equivalent of the Python numpy function, numpy.fft.fftfreq?

If you provide a window length and spacing, that function returns the frequency bin centers. I've been hunting through R package documentation and StackOverflow. Is there an equivalent function in R?


texts:
I'm trying to fuse different images of the same scene which each image have a different focus. I've been told that first I have to perform an image registration to the images.
Right now, the result from the registration has errors, which can be seen by "aura" around the objects in the images and shrinking the image edges.

When I'm trying to register images with focuses that their distance is big, I'm getting a result images with much more significant errors.

I'm using the following code (using the Accord library):

 class Registration
{
private List<Image<Bgr, Byte>> myOriginalImages;
private List<Bitmap> registratedImages = new List<Bitmap>();

public Registration(List<Image<Bgr, Byte>> myOriginalImages)
{
    this.myOriginalImages = myOriginalImages;
}

public List<Bitmap> getRegistratedImages()
{
    return registratedImages;
}
public void Run()
{
    int numOfTargetImages = myOriginalImages.Count - 1;
    SpeededUpRobustFeaturePoint[] surfPoints1;
    SpeededUpRobustFeaturePoint[] surfPoints2;
    IntPoint[] correlationPoints1;
    IntPoint[] correlationPoints2;
    MatrixH homography;
    Bitmap registratedImage;

    // first image is the model image - no registration required
    registratedImages.Add(myOriginalImages.ElementAt(0).ToBitmap());
    Bitmap modelImage = registratedImages.ElementAt(0);

    // create the registrated images
    for (int i = 1; i <= numOfTargetImages; i++)
    {
        ExtractFeatures(modelImage, myOriginalImages.ElementAt(i).ToBitmap(), out surfPoints1, out surfPoints2);
        MatchFeatures(surfPoints1, surfPoints2, out correlationPoints1, out correlationPoints2);
        homography = RANSAC(correlationPoints1, correlationPoints2);
        registratedImage = CreateRegisteredImage(modelImage, myOriginalImages.ElementAt(i).ToBitmap(), homography);

        registratedImages.Add(registratedImage);
    }
}
private void ExtractFeatures(Bitmap img1, Bitmap img2, out SpeededUpRobustFeaturePoint[] surfPoints1, out SpeededUpRobustFeaturePoint[] surfPoints2)
{// extract features using SURF detector
    SpeededUpRobustFeaturesDetector surf = new SpeededUpRobustFeaturesDetector();

    surfPoints1 = surf.ProcessImage(img1).ToArray();
    surfPoints2 = surf.ProcessImage(img2).ToArray();
}

private void MatchFeatures(SpeededUpRobustFeaturePoint[] surfPoints1, SpeededUpRobustFeaturePoint[] surfPoints2, out IntPoint[] correlationPoints1, out IntPoint[] correlationPoints2)
{// match the features between the images by using correlation
    KNearestNeighborMatching matcher = new KNearestNeighborMatching(5);
    IntPoint[][] matches = matcher.Match(surfPoints1, surfPoints2);

    correlationPoints1 = matches[0];
    correlationPoints2 = matches[1];
}

private MatrixH RANSAC(IntPoint[] correlationPoints1, IntPoint[] correlationPoints2)
{
    RansacHomographyEstimator ransac = new RansacHomographyEstimator(0.001, 0.99);
    MatrixH homography = ransac.Estimate(correlationPoints1, correlationPoints2);

    return homography;
}

private Bitmap CreateRegisteredImage(Bitmap img1, Bitmap img2, MatrixH homography)
{
    Blend blend = new Blend(homography, img1);
    return blend.Apply(img2);
}

I'm getting the following images:

Sample images were taken from HeliconFocus for homework


texts:
So I am working on a project using digital signal processing, which I am not familiar with at all, and a lot of this is all new to me. I am using SciPy\NumPy to play around with code to understand the Fourier Transform.  Basically, I have been able to read in a wave file and perform an FFT on the data using the following code:

samplerate, data = wavfile.read(sys.argv[1])
fftres = fft(data)

for i in range(1, len(fftres)):
    print i, ",", fftres[i], "\n"

My results look something like this:

(51.0478396084-421.235956694j)
(0.0324635664874+372.476395255j)
(-198.202964067+219.743659247j)

I'm not sure what I'm looking at to be honest.  I need to find the frequencies in my file so I can apply a bandpass filter on the audio signal.  From my output, how do I actually get the frequencies?


texts: Is it possible to open up this particular convolution equation?

texts:
I have three vectors, $x[n]$, $w[n]$, and $z[n]$. I need to compute:

$y[n] = z[n] * \Big(x[n] \cdot w[n] \Big)$.

This is easy to do. However, is there a way I can do this by 'opening' up the bracket?

For example, let us say that I am already given $z[n] * x[n]$. If this was the starting point, what could I do with this and with the three already given vectors to get $y[n]$? The wiki on convolution properties does not seem to have a case for a scenario like this.


texts:
I am trying to get some insight into market data, in this case the stock KO. Here is the chart:

If I take the wignerville of this, I get nonsense:

If I take first differences

Then take the wignerville, I get nonesense:

What is the correct way to preprocess market data so as to feed it into a Time-Frequency algorithm and get a reasonable estimate/detecting and decoding of, cycles of localized frequency in the data?


texts: Why does the flat part of the BER curve appear after the Viterbi decoder (MatLab)?

texts:
I am trying to implement convolutional codes according to this MathWorks example in MatLab 2014a.

clear; close all; clc
rng default
M = 4;                 % Modulation order
k = log2(M);            % Bits per symbol
EbNoVec = (0:20)';       % Eb/No values (dB)
numSymPerFrame = 100000;   % Number of QAM symbols per frame

modul = comm.RectangularQAMModulator(M, 'BitInput', true);
berEstSoft = zeros(size(EbNoVec));

trellis = poly2trellis(7,[171 133]);
tbl = 32;
rate = 1/2;

decoders = comm.ViterbiDecoder(trellis,'TracebackDepth',tbl,...
'TerminationMethod','Continuous','InputFormat','Unquantized');

for n = 1:length(EbNoVec)
    % Convert Eb/No to SNR
    snrdB = EbNoVec(n) + 10*log10(k*rate);
    % Noise variance calculation for unity average signal power.
    noiseVar = 10.^(-snrdB/10);
    % Reset the error and bit counters
    [numErrsSoft, numErrsHard, numBits] = deal(0);

    while numErrsSoft < 100 && numBits < 1e7
        % Generate binary data and convert to symbols
        dataIn = randi([0 1], numSymPerFrame*k, 1);

        % Convolutionally encode the data
        dataEnc = convenc(dataIn, trellis);

        % QAM modulate
        txSig = step(modul, dataEnc);

        % Pass through AWGN channel
        rxSig = awgn(txSig, snrdB, 'measured');

        % Demodulate the noisy signal using hard decision (bit) and
        % soft decision (approximate LLR) approaches.
        demods = comm.RectangularQAMDemodulator(M, 'BitOutput', true, ...
        'DecisionMethod', 'Approximate log-likelihood ratio',...
        'VarianceSource', 'Property', 'Variance', noiseVar);
        rxDataSoft = step(demods, rxSig);

        % Viterbi decode the demodulated data
        dataSoft = step(decoders, rxDataSoft);

        % Calculate the number of bit errors in the frame. Adjust for the
        % decoding delay, which is equal to the traceback depth.
        numErrsInFrameSoft = biterr(dataIn(1:end-tbl), dataSoft(tbl+1:end));

        % Increment the error and bit counters
        numErrsSoft = numErrsSoft + numErrsInFrameSoft;
        numBits = numBits + numSymPerFrame*k;

    end

    % Estimate the BER for both methods
    berEstSoft(n) = numErrsSoft/numBits;
end

semilogy(EbNoVec, berEstSoft,'-o','LineWidth', 1.5)
hold on
legend('Soft','location','best')
grid
xlabel('Eb/No (dB)')
ylabel('Bit Error Rate')

And I am confused about the obtained curve:

Why does not the BER curve decrease exponentially after the 5dB?
Have anybody faced this issue before?


texts: Derivative of mutual information in EMMA algorithm for image alignment

texts:
This question refers to the paper 'Alignment by Maximization of Mutual Information' by Paul Viola and William M. Wells III, published by International Journal of Computer Vision, 24(2) pg 137–154, 1997.

The paper introduces an algorithm EMMA (Empirical entropy manipulation and analysis) which relies on maximizing the mutual information between images in order to align them. Given two images $U$ and $V$ whose data is expressed as $u(x)$ and $v(y)$, find
$$\tag{1}
\hat{T} = \mathrm{arg\,max}_T I(u(x), v(T(x)).
$$
Here $x$ is a random variable over coordinates of the model. In the case of digital images, it is a random variable over allowed indices of the model. The derivative of mutual information between the images with respect to the transformation $T$ is given by
$$\tag{2}
\widehat{\frac{dI}{dT}} = \frac{1}{N_B}\sum_{x_i \in B}\sum_{x_j \in A}(v_i - v_j)^T\left[W_v(v_i, v_j)\psi_v^{-1} - W_{uv}(w_i, w_j)\psi_{vv}^{-1}\right]\frac{d}{dT}(v_i - v_j).
$$
This expression appears as equation (17) in the paper. I am facing difficulty in understanding this equation. If $v \in \mathbb{R}^n$ then $w \in \mathbb{R}^{2n}$ and hence the product
$$
(v_i - v_j)^T\psi_{vv}^{-1}\frac{d}{dT}(v_i - v_j)
$$
is not defined. For $(v_i - v_j)^T$ is a row vector is an $1 \times n$ matrix and $\psi_{vv}^{-1}$ is a $2n \times 2n$ matrix. This is because the paper defines $v = T(u) $ and $w = [u, v]$, where $u$ is one of the images.

I also consulted Paul Viola's Ph.D. thesis. But the equation mentioned in it (topmost equation on page 101) is
$$\tag{3}
\widehat{\frac{dI}{dT}} = \frac{1}{N_B}\sum_{x_i \in B}\sum_{x_j \in A}(v_i, v_j)^T\left[W_v(v_i, v_j)\psi_v^{-1} - W_{uv}(w_i, w_j)\psi_{vv}^{-1}\right]\frac{d}{dT}(v_i - v_j).
$$
In this case, the following terms cannot be evaluated because the matrices involved in their definition are incompatible.

Can anyone please point out where I am going wrong. This is a widely cited paper and there is a good chance that I am making a mistake in understanding it.


texts: Is there a 'Nyquist Criteria' for the minimum samples per chip that are needed for a correlator? I've heard 2, but will 1 work? What are the implications of having less than the minimum (in the context of radar and communications)?


texts: Theory behind Linear Predictive Coding (LPC)

texts:
What is the theory behind LPC?
Why are(were) certain implementations of LPC said to be more tolerant of transmission or encoding errors quantization than other compressed voice encoding schemes?
Can LPC methods also be used for smoothing or short term "prediction" similar to the use of Kalman filter methods?
Under what conditions or constraints is the use of LPC valid?


texts: Calculating the Mean Square Error (MSE) in Wavelet Denoising

texts:
I´m currently reading the paper (to be more precise: it´s a chapter from the book "Shearlets, Multiscale Analysis of Multivariate Data" by Kutyniok and Labate) "Image Processing Using Shearlets" by G.R. Easley and D. (Labate https://www.math.uh.edu/~dlabate/Chap_ImageAppl.pdf). I´m interested in the second part, the "Image Denoising".

I will explain the problem setting in the paper. Then i will share my question.

So the task is, to recover the function $f\in L^2(\mathbb{R}^2)$ from noisy data $y$:
\begin{align}
y=f+n,
\end{align}
where n is Gaussian white noise, with standard deviation $\sigma$.
Hence we want to optimize the estimation $\tilde{f}$ of $f$. This is done by mimimizing the Mean Square Error (MSE), given by
\begin{align}
E[\vert\vert f-\tilde{f}\vert\vert^2],
\end{align}
where $E[.]$ is the expexted value, which is calculated with respect to the probability distribution of the noise $n$.
The idea is to find and estimation $\tilde{f}$, satisfiying the minimax MSE, defined as:
\begin{align}
\text{inf}_{\tilde{f}}\text{sup}_{f\in F} E[\vert\vert f-\tilde{f}\vert\vert^2,
\end{align}
where F are the cartoonlike function (a model class of images) and we allow all measurable estimations in the infimum.
When using Wavelet or Shearlet denoising the procedure is done as follows:

Let $W, W^{-1}$ denote the wavelet and inverse wavelet transform and $T_{N_\sigma}$ be the threshholding operator depending on $\sigma$, then the denoising process is done by:
\begin{align}
\tilde{f}_N=W^{-1}(T_{N_\sigma}(W(y))).
\end{align}
The threshholding operator only keeps the $N_\sigma$ coefficients with the highest absolute value.
When doing denoising with Shearlets, the Wavelet transform is replaced by the Shearlet transform.

It is known, that the wavelet estimator $\tilde{f}_N$ satisfies
\begin{align}
\vert\vert f-\tilde{f}_N\vert\vert^2\leq CN^{-1},\quad as\quad N\to\infty
\end{align}
$C>0$ is a constant independent on $f$ and $f_N$.
Now there is written, that this implies, that the Mean Square Error (MSE) of the wavelet estimator satisfies
\begin{align}
\text{sup}_{f\in F}E[\vert\vert f-\tilde{f}_N\vert\vert^2]=\Theta(\sigma),\quad as\quad \sigma\to 0.
\end{align}

This is what I don´t understand. How does this follow? I think my problem is, that I don´t exactly know how to compute the expected value in this case. I hope someone can help me.

Thank you in advance,

Chris


texts:
I have large database of pictures, about a few million.

I need an algorithm to find pictures which are similar to those in the database, up to a scale factor or a crop and shift (I have only these types of variations).

I know about histogram matching and perceptual hash, but is there a faster algorithm that exist for these purposes?


texts:
How is multi-path delay dealt with in MIMO systems? Most of the theory I have read on MIMO doesn't address multipath delay and assumes the multipath interference is limited to secondary antenna transmitting or receiving(so the MIMO channel is a matrix).

Is multipath delay equalization addressed after the multipath matrix model has been inverted? How does it work?


texts: Where do RBJ's analog shelving filters come from?

texts:
In RBJ's Audio EQ Cookbook, the analog prototype for a low shelf filter is given as such:
$$H(s)=A\cdot\frac{s^2+\left(\frac{\sqrt{A}}{Q}\right)\cdot s + A}{A\cdot s^2 + \left(\frac{\sqrt{A}}{Q}\right)\cdot s + 1}$$
Where does this prototype come from? From what I understand, the lowpass and highpass filters are standard Butterworth filters. But how was this particular transfer function derived? Is it some transformation of a Butterworth filter?


texts: MATLAB: How to filter a signal using Thiran Fractional Delay Filter

texts:
I have generated a Thrian fractional delay filter using (thiran function) in MATLAB

h=thiran(0.3,1)

where 0.3 is the time delay and 1 is the sample time. The output is a discrete time transfer function, the generated filter is all-pass, infinite impulse response (IIR) filter.

The problem is that I could not apply it to a signal x(t). So I would like to know how to filter a signal with the generated thiran filter in MATLAB, what should I use to filter a signal with thiran filter? I can generate thiran filter using (thiran) function and the result will be a discrete time tf, but how to use it to filter a signal. I have tried to use filter, conv and tf functions but they all did not work:

filter and conv functions did not work because they require polynomial coefficients or numerator and denominator coefficients b and a, whereas thiran function generates a discrete transfer function.

[num,den] = tf(d)

function did not work because it can only convert a filter transfer function which is configured by designfilt function, so in this case d cannot be a thiran filter, d can only be configured by designfilt function


texts: What is an algorithm to re-sample from a variable rate to a fixed rate?

texts:
I have a sensor that reports its readings with a time stamp and a value. However, it does not generate readings at a fixed rate.

I find the variable rate data difficult to deal with. Most filters expect a fixed sample rate. Drawing graphs is easier with a fixed sample rate as well.

Is there an algorithm to resample from a variable sample rate to a fixed sample rate?


texts: Multiply signal $x[k]$ with $\cos(2\pi\nu_0k)$, then given $X(\nu)$ draw resulting function in frequency domain?

texts:
Let
$$y[k]=x[k]\cdot \cos(2\pi\nu_0k) .\tag{1}$$

Then, given a signal $x[k]$ with the DTFT $X(\nu)$ according to the following figure

what will the frequency domain for $Y(\nu)$ look like for a given $\nu_o$ in the range $0<\nu_0<a/2$?

According to my calculation, the resulting function $Y(\nu)$ is

$$Y(\nu)= \frac{1}{2}\left ( X(\nu-\nu_0) +X(\nu+\nu_0)  \right ). \tag{2}$$

This since the DTFT of cosine is two unit impulses in $\pm\nu_0$.

Is this correct? And how can this resulting $Y(\nu)$ be drawn in the frequency domain? Thank you! Some explanation with mathematical elements would be appreciated.

Would the following figure for $Y(\nu)$ be correct?


texts: Difference between 2D DFT's and 1D DFT's of Linearized Matrices

texts:
I have recently left the safe and easy MATLAB environment and begun to use CUDA-C/C++ for image processing.   Since CUDA doesn't allow 2D arrays to be passed into kernels I am now used to linearizing my gray-scale images (2D matrices) into 1D arrays before processing them.  I seem to have no problem applying 1D-DFT's to my linearzied arrays.  This leads me to wonder why people use 2D-DFT's at all?   Why not just linearize your matrices into 1D-arrays and apply 1D-DFT's?

Can 1D-DFT's always operate on 2D-data by simply laying the matrix out into a 1D array?


texts: Resource block size in freq-selective channel

texts:
I asked about the basic of a frequency selective channel [here][1]. It was discussed Resource block (adjacent subcarriers and time indices together into "chunks")
what parameters affect the size of the "chunk"? Length of a channel?
PS "chunk" is a block ( resource block which contain $N$ number of adjacent subcarriers)
[1]: Frequency-selective channel: Basic in theory


texts: The description of the MRI signal from the magnetization vector

texts:
I have been working on simulating the MRI signal and what I have done so far is simulate the actions of the RF pulse and the required localization gradients.
So, in the simulation, I am looking at a gradient echo sequence and I have the RF pulse and the slice selection gradient which tips the spin magnetization in the XY plane. This is followed by a rephasing gradient (to take into account the dephasing due to the slice selection gradient).

After this, I have the PE gradient along the Y-direction and the frequency rewinder (to have a symmetrical echo) and the readout gradients along the X-direction.

In the simulator, I am tracking the magnetization vector during the whole process by solving the Bloch equations. Now, the part that I am confused about is how can I convert this to the MRI signal? At the end of the day for each spin, I have its magnetization at every time step. During the readout process, I would like to convert it to the MRI signal and I am not sure how to go about it.


texts:
The autocorrelation function of AWGN is an impulse response at t=0, and its fourier transform or its spectral power density has a flat infinite BW

Now any receiver will have bandpass or low pass filters that will limit the noise BW

Does that mean that in reality we are actually dealing with "colored" noise and considering noise to be "white" within the filter BW is an assumption made for convenience purpose?


texts: What's the difference between using DFT, IDFT or DCT to calculate cepstrum of a power spectrum?

texts:
I've seen different equations that calculate cepstrum from power spectrum, but the equations are not consistent. Some people use Fourier transform, some use the inverse Fourier transform, and some use the Cosine transform. I.e.:

$$ C(k) = IDFT(\log_{10}P(n)) \\
   C(k) = DFT(\log_{10}P(n)) \\
   C(k) = DCT(\log_{10}P(n)) \\
$$

For example to calculate LPCC (Linear Prediction Cepstral Coefficients), I see either IDFT and DFT being used equally commonly, while MFCC (Mel Frequency Cepstral Coefficients) uses DCT exclusively.

Are they different? If so what's the different? If not why is there an inconsistency?


texts: What do cloud-based speech-to-text services upload to the cloud?

texts:
Services like Siri and Google Now perform speech recognition (speech-to-text) on mobile phones by doing part of the computation on a server in the cloud.

What do they upload to the cloud?  Do they upload the raw audio?  Or do they do some feature extraction and only upload features (e.g., MFCC coefficients or something) to the cloud?  Is uploading the full audio important/useful for obtaining the best results (e.g., best accuracy of speech recognition)?

I'm curious about understanding the technical details of what is uploaded to Google/Apple, e.g., to better understand the privacy implications.  Note that I'm not asking about their privacy policy, or what they do with the data, or whether I should be concerned about privacy, or any of that stuff.  My interest is in the technical details of how speech recognition computation is split between your phone and their servers.

The research I've done, and what I've found:

Based on public statements that Apple has made, it appears that Siri works by uploading full audio clips (not just features) to Apple's server.  The article also discusses some speculation about whether doing local processing would be feasible.  (See also here.)
Back in 2011, Applidium reverse-engineered the Siri protocol.  They reported that the phone is uploading a full audio clip to Apple's servers: the only computation done on the phone is to compress the audio using Speex.  The scripts they used to help them are available on Github.
I haven't been able to find anything on Google Now.


texts: How to determine relative distance between 3 in-phase transmitters by analysis of received signal

texts: I would like to determine with high accuracy the relative distances between three RF transmitters a few meters apart by analysis of phase interference in the received wave, the receiver being at an undefined distance a few hundred meters away. Is there a simple method for this? The three RF transmitters can be arranged to transmit the same phase and frequency, or differing frequencies, whatever is required. Is there some kind of radar or reflection interferometry technique that exists and provides the information required, from reflectors?


texts:
I'm trying to generate a buzzer sound like this one in matlab.

When you look at the waveform, it's got sinusoidal notches cut into an otherwise normal looking sinewave.

I generate a sinewave tone,

fs = 44100 ;
t = 0 : (1/fs) : 2 ;
f = 200 ;
y = 0.5*(sin( f*2*pi*t )) ;
sound( y, fs ) ;

I don't know how to cut the notches! How would you do it, so it sounds "buzzy"?

The spectrum:


texts: How to reprocess SDR data to be equal to that captured with a higher RBW

texts:
I have a data set that consists of max hold frequency vs intensity data from an SDR at a specific RBW. I want to reprocess the data as if I sampled it with the larger resolution bandwidth so I can compare what that file might have looked like.
What would be the correct way to go about doing this to get as close to what my SDR's spectrum analyzer would have looked like with the larger RBW.
My approach was going to be using a window function using the size of the larger RBW and recalculating the spectral density in that window.
I am using scipy to process the data.


texts:
I need to find the bandwidth the signal $x = 50 \operatorname{sinc}(125(t-10))^2$.

(Where $\operatorname{sinc}(x)=\dfrac{\sin (\pi x)}{\pi x}$ [normalized] or $\operatorname{sinc}(x)=\dfrac{\sin x}{x}$ [unnormalized])

How would I go about doing this in MATLAB?


texts:
() = cos(200) + 2cos(320). (), is produced by sampling () at sampling frequency $f = 300 Hz$.
Is the signal sampled or aliased and why?


texts:
I have a set of real data (timestamp and value) with an unstable step between samples (5sec, 30sec etc.).
The data is the % of fillage of a vehicle's tank through time.
Due to the harsh volatility of the data, I need to perform fft to transfer my time series to the frequency domain, select a cutoff point to remove all the noise and then transfer back to the time domain.
Is my thought process correct?
I want to use matlab but I cannot figure out what I have to do with my data. The first 10 rows (I have a document with 10ths of thousands of data) are as follows:

I have produced some dummy timestamp data with the same values and with time step at 0.01sec.
After writing the code in matlab I get the following:

My code is:
load input.txt;
plot(input);
figure;
Fs = 1/0.01;
Ts = 1/Fs;
dt = 0:Ts:5-Ts;
x = input(:,1);
y = input(:,2);
nfft = length(y);
nfft2 = 2*nextpow2(nfft);
ff = fft(y,nfft2);
fff = ff(1:nfft2/2);ff
plot(abs(fff));

If you want some data don't hesitate to contact me.
Thank you in advance!


texts: Actual measurements of the influence of fading and multipath on HF radio communication

texts:
I'm looking for papers or books that contain actual measurements of the influence one has to expect in HF radio communication. I'm interested in this, because i've simulated the influence of a physical channel using the Watterson Model on the detection performance of a feature-based approach. The approach is not robust for the parameters I've picked. Now I'm interested in how realistic the Watterson parametrzation I've picked is.
For you information and the sake of completeness, the parameters I picked:

The information I'm gathering serves the purpose of anwering the question:
Is it just the average case of distortion that is to be expected in HF communication or is it a more challening scenario.
EDIT:
PSK,QAM and FSK signals were tested. The bandwidth was between 100 and 1000 Hz.The parametrization was chosen for the frequency range of 3kHZ to 30 MHz.


texts: Measuring group delay through a linear phase filter

texts:
I'm having a difficult time wrapping my head around a phase/ group delay problem and it corresponding to where you start sampling so I built up a system to test some of these issues. The system passes 2 sinusoids through a lowpass FIR filter with linear phase, then I take an NFFT length fft starting at some arbitrary point of my output data, then measure the phase of each sinusoid. The signal flow is as follows:

[Sinusoids] => [FIR (length 65)] => [FFT] => [phase measurement]

I'm trying to use the fact that group delay can be calculated from the phase information  in the fft as:

but this is where I get lost because it seems that where you start sampling at the output would impact the phase measurement. i.e. you can't start at any arbitrary point. But in a black box system where you can't figure out what the correct output sample to start on is how can you accurately measure group delay? Below is my script. My group delay should be 32, but depending on the variable out_start_idx the group delay changes dramatically. Shouldn't it be that regardless of where you start sampling the output, the phase change between two tones should still be constant?

close all
clear all

fs = 1e6;

%GROUP DELAY of filter (N-1)/2 = 32
%since h = length 65
h = remez(2^6, [0 fs*.05 fs*.15 fs/2]/(fs/2), [1 1 0 0]);

%arbitrarily large fft
NFFT = 2^19;

bin_space  = fs/NFFT;

num_tones = 2;
space = 1000; % spacing in bins
for nn = 1:num_tones
 freqs(nn) = space*(nn)*bin_space;
end

%random starting phases between -pi/2 pi/2
phi_start = rand(1,num_tones)*pi-pi/2;
t = 0:999999;

sig = 0;
for nn = 1:num_tones
 sig = sig + exp(1i*2*pi*freqs(nn)*t/fs + phi_start(nn));
end

out = filter(h,1, [sig zeros(1,length(h)+ 10)]);

%{
figure
subplot(211)
plot((-.5:1/NFFT:.5-1/NFFT)*fs, 20*log10(fftshift(abs(fft(h,NFFT)))))
hold on
plot((-.5:1/NFFT:.5-1/NFFT)*fs, 20*log10(fftshift(abs(fft(sig,NFFT)))))
hold off
subplot(212)
plot((-.5:1/NFFT:.5-1/NFFT)*fs, 20*log10(fftshift(abs(fft(out,NFFT)))))
hold on
plot((-.5:1/NFFT:.5-1/NFFT)*fs, 20*log10(fftshift(abs(fft(h,NFFT)))))
hold off
%}
f = 0:fs/NFFT:fs-fs/NFFT;

% take NFFT amount of samples from arbitrary starting point
% in output
out_start_idx = 1;
data_test = out(out_start_idx:out_start_idx+NFFT-1);

% get index of tones
idx_tones = (space:space:space*(num_tones)) + 1

% take fft of data
fft_out = fft(data_test,NFFT);

% get complex output from each tone bin
tone_IQ = fft_out(idx_tones);

% calculate phase of each tone
phi_tones = angle(tone_IQ)*180/pi;

% calculate group delay
phi_2 = diff(fliplr(phi_tones))
phi_1 = diff(fliplr(phi_start)*180/pi);
tau = (-1/360) * (phi_2 - phi_1)./diff(freqs)
grp_delay = tau*fs

% maybe do some extra processing
phi_out = phi_tones;

% linear fit calculated phases
p = polyfit(freqs,phi_out,1);
y = polyval(p, freqs);

% calculate deviation from linear phase
deviation_from_linear_phase = phi_out -y;

% plot deviation / etc
figure
plot(freqs, y)
hold on
plot(freqs, phi_out, 'r*')

figure
stem(deviation_from_linear_phase)


texts: How to simulate Zoom, Pan, Tilt transformations?

texts:
Say we are looking at a football field from a broadcast view. To give us another tool, we also have a transform of that view to a topdown view. So our two views are like so:

How would one simulate zoom/tilt transformations on the broadcast view and/or the topdown view?

To assist, I have the pan transform already. You find the convergence of the long quadrilaterals lines on the topdown view and then rotate the quadrilateral around the convergence. But things get more tricky when you move into zoom/tilt:

Tilt seems to require finding the point of perspective on the broadcast view on a 3D coordinate system? I will try this but are there any simpler methods?

Zoom in seems to require shifting the corner points of the quadrilateral on the topdown view towards the middle of the quadrilateral by the same proportion?

EDIT: I'm doing this to build a tool to match broadcast scenes of a football match to different perspective views of the field. That way we can transform the view into a topdown view using a saved broadcast to topdown-view homography. To do this we need a set of all possible broadcast views of the field... to create those we can just use the different perspective tranforms from a set of original manually created views (retrieved from football broadcasts). Here is a sample paper I'm using through out this.


texts:
I was just wondering if anyone could explain to me the approach one would take to removing striped noise from the fourier domain of an image. I was reading an article about MRI image from 1 just giving a general outline of the location of spatial frequencies, and it had a slide (displayed below) which got me thinking in how I would attempt to remove the striped noise.

My original thought was to just block the given frequency with a mask but if I set the mask to 0 then I would have to be pretty accurate with the mask so I dont block out any other components that may be necessary for the image.

My second idea which I am not sure on is as each point the frequency domain is represented by phase and a modulus could I somehow use that to remove the striped noise?

1 http://mriquestions.com/locations-in-k-space.html


texts: Microscopy crystal particle object length detection

texts:
Hi I  try to detect the particle length size from this image

and I'd like to get the length size of the particle Like this below. and get the histogram of the size of the particle using centroid and detect the line like this below:

I have try to using watershed. But i still low knowledge on this code. What i want to ask are:
1. How to get segmentation like this picture as an example below so I can evaluate my segmentation.. I dont know how to display it (I will share my code)

How to separate the particle that unite with other particle. I got this contour

Here it is my code:

from __future__ import print_function
from imutils import perspective
from imutils import contours
import numpy as np
import argparse
import imutils
import cv2
import scalar
import sys
from scipy.spatial import distance as dist
import scipy.ndimage as ndi
import matplotlib.pyplot as plt
from skimage import filters
from sklearn import cluster
from scipy import ndimage
from skimage.feature import peak_local_max
from skimage.morphology import watershed
from scipy.ndimage import label

img = cv2.imread("C:\\Users\\adiyu\Pictures\\snipping\\c3smeasure.png",
cv2.IMREAD_COLOR)
kernel = np.array([[-1,-1,-1],[-1,9,-1], [-1,-1,-1]])
kernel2 = np.ones((3,3),np.uint8)

img=cv2.filter2D(img,-255, kernel)
img = cv2.medianBlur(img,3)
img_np = np.array(img)
img_np_rgb = cv2.cvtColor(img_np,cv2.COLOR_RGBA2RGB)

#Kmeans cluster using Opencv
Z = img.reshape((-1,3))

# convert to np.float32
Z = np.float32(Z)

# define criteria, number of clusters(K) and apply kmeans()
criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 10, 1.0)
K = 3
ret,label,center=cv2.kmeans(Z,K,None,criteria,10,cv2.KMEANS_PP_CENTERS)
# Now convert back into uint8, and make original image
center = np.uint8(center)

res = center[label.flatten()]
res2 = res.reshape((img.shape))
gray= cv2.cvtColor(res2,cv2.COLOR_BGR2GRAY)
gray = cv2.fastNlMeansDenoising(gray, None, 6,7,21)

cv2.imshow('res2',res2)
cv2.imshow('gray',gray)
thresh = cv2.threshold(gray, 100, 255, cv2.THRESH_BINARY_INV +
cv2.THRESH_OTSU + cv2.THRESH_OTSU)[1]
cv2.imshow('thresh',thresh)
opening = cv2.morphologyEx(thresh, cv2.MORPH_CLOSE, kernel, iterations=2)
cv2.imshow("opening", opening)
closing = cv2.morphologyEx(opening, cv2.MORPH_CLOSE,kernel2, iterations=2)
cv2.imshow("closing", closing)
fg = cv2.erode(closing,None,iterations = 2)
cv2.imshow("fg", fg)

# sure background area
sure_bg = cv2.dilate(opening,kernel,iterations=3)
cv2.imshow("sure_bg", sure_bg)
# Finding sure foreground area
dist_transform = cv2.distanceTransform(opening,cv2.DIST_L2,5)
ret, sure_fg = cv2.threshold(dist_transform,0.1*dist_transform.max(),255,0)

# Finding unknown region
sure_fg = np.uint8(sure_fg)
unknown = cv2.subtract(sure_bg,sure_fg)
cv2.imshow("unknown", unknown)

# Marker labelling
ret, markers = cv2.connectedComponents(sure_fg)

# Add one to all labels so that sure background is not 0, but 1
markers = markers+1

# Now, mark the region of unknown with zero
markers[unknown==255] = 0
markers = cv2.watershed(img,markers)
img[markers == -1] = [255,0,0]

cv2.imshow("img", img)

cv2.waitKey(0)
cv2.destroyAllWindows()enter preformatted text here

any suggestions are welcome..Thank U


texts: Classify areas of an image based on color

texts:
I have some tree canopy images that I would like to process, but not sure how to get started as image processing is a little outside my area of expertise. Any help would be appreciated.

I have tree canopy images with a grid included in the image.

I have converted the image to a five color palette so that sky is easily distinguished from tree cover.

I would like to overlay a series of boxes that line up with the grid (basically a small box under the numbers) and estimate the percentage of pixels within the box that are the "sky" color.

I am not envisioning that this would be fully automated. The workflow would be:

classify image to five color palette,
by hand overlay boxes from a separate file so that the boxes match up with grid in image,
loop through boxes and estimate percentage of underlying colors.

I can code in Python and R, but haven't ever used them to process images.


texts: Generating Kawase Blur Kernels to Approximate a Gaussian Blur on an Image

texts: Is there an algorithm to generate the Kawase Blur Kernels to approximate the actual Gaussian Blur (of a specific kernel size, and if possible, a sigma)?


texts:
In class, we have defined four types of filters: low-pass, high-pass, band-pass and band-stop. I have understood that in order to classify a filter into one of the fourth, one can use the signals:

DC: $1,1,1,\ldots$
Nyquist: $-1,1,-1,1,\ldots$
half-Nyquist: $1, 0, -1, 0, 1,\ldots$

Can you help me understand how to classify $y_n = x_n + x_{n-2}$ as a band stop filter?


texts: Estimating SNR of an Environment where obtaining clean speech is not possible

texts:
is that possible to find SNR of an environment ? ie., i have a outdoor environment where i cannot find the clean speech ,if so i want to measure the signal power to noise power how to do that

can i do some thing like put a voice activity detection and find voice frames and find the voice frames power to non voice frames power will that be SNR of that environment ?

i have seen some tools like baudline giving segmental SNR will they follow the same method i have mentioned or how this actually happen i have also listened to tools like SOX


texts: How do I calculate the eigenvalues of a covariance matrix which contains harmonic functions

texts:
I have read that $ce^{-\frac{\phi_i-\phi_j}{\rho}}$ is a harmonic function of the form $e^{-in\phi_i}$, and therefore it's eigenvalues are one of the Fourier components of $(|\phi_i-\phi_j|)$.

My questions are:

How come $ce^{-\frac{\phi_i-\phi_j}{\rho}}$ has the form of $e^{-in\phi_i}$ if it is a real function?
How do I calculate the eigenvalues of such a function, or, if it is a difficult calculation, is there a known theorem(s) I can base this result on?

I am not an expert in harmonic analysis, but I would like to know more about this subject (without getting into too much details). I need it to my research in neurosciences.

Here is a link to the article I am reffering to: Population coding

Thanks!


texts: What approximations are involved in STFT of a convolution?

texts:
I have two equations in time domain:
$$x_k(t)=\sum_{i=1}^N s_i(t)\star h_{ki}(t)+n^a_k(t)$$
and
$$x_k(t)=\sum_{i=1}^N s_i(t)\star h_{ki}(t)\star n^c_k(t)$$
which explain the additive and convolutive noise models for recorded sounds in microphones when $N$ sources are available.

Using the short-time Fourier transform (STFT) I will have:

$$
X_k(m,f)=\sum_{i=1}^{N} S_i(m,f)\cdot H_{ki}(f)+N^a_k(m,f)
$$
and
$$X_k(m,f)=\sum_{i=1}^{N} S_i(m,f)\cdot H_{ki}(f)\cdot N^c_k(m,f)$$

I assumed that the mixing system, $H(f)$ is time-invariant.
What are the other approximations? The only thing I can think of is that impulse response, $h(t)$ is shortened to the window length in the STFT process.

Regards,
Ati


texts: Filtering relationship for sources propagating over a sensor array

texts:
A sensor array $y$ measures the superposition of $N$ sources $s$, at time $t$ and position $x$ we have : $$y(t,x)=\sum_{i=1}^{N} s_i(t,x)$$
The sources $s$ travel at constant speed over the array of $M+1$ regularly spaced sensors: $$s_i(t,x)= s_i (t+k.\tau_i , x+k.\Delta),k∈⟦1 ; M ⟧$$

$\Delta$: distance between two sensors
$\tau_i$: time taken by source $i$ to travel the distance $\Delta$

It can be shown that :

for a single source ($N=1$), $y(t,x)$ can be reconstructed from an array of a single sensor ($M=1$) with a convolution relation using a single pure phase-shifting filter: $$y(t,x)=y(t,x+\Delta)*\delta(t+\tau_1)$$

for two sources ($N=2$), $y(t,x)$ can be reconstructed from an array of two sensors ($M=2$) with a convolution relation using three pure phase-shifting filters: $$y(t,x)=y(t,x+\Delta)*(\delta(t+\tau_1)+\delta(t+\tau_2))+y(t,x+2.\Delta)*\delta(t+\tau_1+\tau_2)$$

My questions :

What is the minimum number of sensors $M$ required in the case of three sources ($N=3$) and what is the corresponding convolution relation?
Can a general solution be obtained for N sources?


texts: Terminology: spectrum, spectrogram, spectrograph, sonogram, etc

texts:
In term of proper or accepted naming conventions of DSP graphics or instrumentation output, what is the difference between the words spectrum, spectrogram, spectrograph, and similar terms, and what type of chart, graph, CRT display, or etc. does each best describe.

ADDED: Also I found the term sonogram used in a couple books for spectrum-vs-time graphics.  When might thus be appropriate in preference to one of the above terms, or vice versa?


texts: Echo generation of FIR system using Matlab

texts:
How can I generate some echo to the system below?

Here is my code. I would appreciate any help.
% Template for the echo cancelling problem
fs = 8000; % sampling frequency (Hz)
f = 400; % sinusoid frequency (Hz)
Tdur = 0.2; % pulse duration (s)
x = pulse(f, Tdur, fs); % Generates a pulse
x = [x zeros(1, 2*length(x))]; % zero pad for processing
n = 0:length(x)-1; % discrete time vector
t = n/fs; % continuous time vector
plot(t, x); % Plot signal
xlabel('Time (s)')
ylabel('Amplitude')
title(sprintf('Original pulse: %.2f Hz', f))
sound(x, fs); % Play the sound
% Zero-pad original pulse
Nzp = floor(fs*Tzp);
nzp = 1:Nzp;
xzp = [x zeros(1,Nzp-length(x))];
figure(2)
plot(nzp/fs,xzp); xlabel('Time (s)'); ylabel('Amplitude');
title(['Original pulse, zero-padded to ' num2str(Tzp,3) ' s'])
pause; sound(xzp);
% Generate echoes
Tdel = 0.1; % echo delay (s)
alpha = 0.5; % echo gain
Ndel = floor(Tdel*fs); % echo delay (samples)
b= [1 zeros(1,Ndel-1) alpha]; a = 1; % filter coefficients
y = filter(b,a,xzp);
figure(3)
plot(nzp/fs,y); xlabel('Time (s)'); ylabel('Amplitude');
title(['Echoed signal, gain = ' num2str(alpha,3)]);
pause; sound(y);
%% Your code goes here
function x = pulse(f, Tdur, fs)
% Sinusoid multiplied by a Hann window function.
% f sinsusoid frequency (Hz)
% Tdur duration (s)
% fs sampling frequency (Hz)
nmax = floor(Tdur*fs); % duration (samples)
n = [1:nmax]; % discrete time index
x = hann(nmax).'.* cos(2*pi*f*n/fs); % waveform samples
end


texts: the importance of discrete sine transform

texts:
what are the applications of discrete sine transform . can discrete sine transform be used in place of discrete cosine transform ? please state the reason.

can it be used in compression.?

regards,
phani tej


texts: How to amplify regions with specific color in an image?

texts:
I want to amplify regions with a specified color in an image. For this purpose I have defined a simple function

$B(x,y)=s_r(x,y) \cdot w_r + s_g(x,y) \cdot w_g + s_b(x,y) \cdot w_b$

which produces a gray scale image B(x,y).

The weights I have defined with

$w_r \in [-2,2],w_g \in [-2,2], w_b \in [-2,2]$

The channels of the images are the functions $s_x$ for each channel.
I use the result of this amplification for a color thresholding. For example for yellow I have manually defined
$w_r=1$, $w_g=1$ and $w_b = -2$.
My Problem now is, to get "good" values for the weights automatically. First I thought taking the maximal values of histograms would be a good way, but the results are not satisfactorily.

How can I automatically determine the weights for the amplification?

How would you deal with white and black?

Or is there a better way to amplify the regions with a specific color?


texts: Cross Correlation in Java (Android) Using FFT (Frequency Domain Convolution / Correlation)

texts:
I want to implement cross-correlation with the start-symbol and the signal using FFT.

I zero-pad both signals to length N = x.len + y.len -1
Using the convolution theorem:

        corr(x, y) = IFFT( FFT(x_padded) .* conj(FFT(y_padded)))

Do you have any good library recommendations I could use to compute both the FFT and IFFT?
I am running this on an Android app and efficiency is important.

Moreover, the best correlation is the highest peak in the array of the result. How does the index k of the array corr(x,y) relate to x? Does that mean the best alignment is when y lags k samples behind x?


texts: Just a quick question. What Galois Field is best if you need a minimum Hamming distance of $n$? I want to design a BCH generator polynomial that is acccording to this Hamming distance.


texts:
I'm reading a paper -- Common Randomness in Information Theory and Cryptograph-secret.
And I do have trouble in understanding formula (2.6):
$$
\frac {1}{n} H(K)> H-\epsilon \tag{2.6}\label{2.6},
$$
with  $\epsilon>0$ some arbitrary number larger than the probability that two $K$ and $L$ aren't the same and $H$ being called an achievable key rate. $n$ is the length of the product source word, and the statement is that there's an $n$ large enough that this inequality holds.
For 2.4, 2.5 and 2.7, there are explanation in the paper. But the author mentioned nothing about 2.6. As far as I concerned, $H(K)/n$ is like an upper bound of $H$. I'm not sure if $H(K)/n$ is the so called key-capacity. And $H$(achievable rate) should always less than key capacity.


texts: Is there a widely available implementation of an adaptive, recursive, numerically stable IIR filter?

texts:
I need to identify the coefficients of a linear, causal, time-invariant physical system that can be described by a classical state-space formulation.

For the sake of the example, suppose that the system has two states, only one of which is observed, and one input. Suppose that this state-space is described by the following matrices:

  a =
               x1          x2
   x1   -1.25e-05    1.25e-05
   x2   1.389e-05  -2.083e-05

  b =
              u1
   x1          0
   x2  6.944e-06

  c =
       x1  x2
   y1   1   0

  d =
       u1
   y1   0

The discrete, equivalent, zeroth-order-hold transfer function is given by:

  3.481e-05 z + 3.446e-05
  -----------------------
   z^2 - 1.97 z + 0.9704

In filter terminology, this is clearly an IIR filter because of the higher-order coefficients in the denominator.

I'm looking for a suitable adaptive filter algorithm that will:

be numerically stable
allow for online updates, i.e. be recursive

From my research so far, I've read that if you treat the recorded signal values as inputs to this filter, then it's possible to treat this filter as a FIR filter. This is called the equation error approach. One can then apply, for example, the QR-RLS adaptive FIR filter to find the coefficients.

But in my trials on the real system I often find filter coefficients that are not physically possible, and I just don't know if my hand-crafted adaptive filter is correct or not. I would like to try with an "official" implementation of such an adaptive filter.

Therefore, my question is whether there exists (for MATLAB or in C) a freely available implementation of an adaptive IIR filter that has the same advantages of a QR-RLS FIR adaptive filter.


texts: How to find the perfect regularization number?

texts:
I have an issue!

Assume that we are going to solve $Ax=b$ but $x$ contains noise.To minimize that noise we can use regularization:

$$x = (A^TA + \lambda I)^{-1}A^Tb$$

Where $\lambda$ is a small number $> 0$, or sometimes $\lambda$ can be huge!

Here are three pictures of one situation where I solve $Ax=b$ with noise free and one $Ax=b$ with noise and without regularization and one with noise + regularization.

Noise free case: Here we can see that it works smooth. In this case, $x$ is a matrix because it contains two signals.

Here we are using 5% noise, that will cause much trouble. No regularization.

Here we are using 5% noise and a large number for regularization.

Question:

Is there a way to determine an optimized regularization parameter $\lambda$?

Source:
I made a library named Mataveid and it's made for system identification.
I have no problem with the noise actually, but I want to find a way to automize the choice of regularization parameter $\lambda$.


texts: MLE formulation -- confusion regarding the terms in the equation (Part1)

texts:
If $v \sim CN(0,2\sigma^2_v)$ is a circularly complex Gaussian random variable which acts as the measurement noise in this model
$$y_n = x_n + v_n \tag{1} $$ where $x \sim CN(0,2\sigma^2)$, then is the following log-likelihood expression correct?

$$P_x(x_1,x_2,...,x_N) = \prod_{n=1}^N\frac{1}{2\pi \sigma^2_v} \exp \bigg(\frac{-{({y_n-x_n})}^H ({y_n-x_n})}{2\sigma^2_v} \bigg) \tag{2}$$

Confusion:

I am having a doubt whether there will be a 2 in the denominator in (3) from the term $2\sigma^2_v$ or not. Am I doing it correctly? Please help.


texts: Why the Hilbert transform is not correct using the hilbert function in MATLAB?

texts:
I am trying to get the phase of a signal with Hilbert transform. However, I found that the unwrapped phase was not correct because the Hilbert transforming using the hilbert function in MATLAB is not correct. The simulation code shown as below:

t=0:0.001:3;
realphase=30*cos(5*t); %signal phase
x=cos(realphase); %signal
H=hilbert(x);

img=imag(H); %Hilbert transform using hilbert function
real=real(H);
ph=unwrap(atan2(img,real)); %unwrapped phase using hilbert function in MATLAB
ht=sin(realphase); %Hilbert transform of cos is sin
pt=unwrap(atan2(ht,real)); %unwrapped phase

subplot(2,1,1)
plot(img)
hold on
plot(ht)
ylabel('Hilbert transform')
legend('imag(H)','sin(realphase)')

subplot(2,1,2)
plot(realphase)
hold on
plot(ph)
plot(pt)
ylabel('phase')
legend('realphase','ph','pt')

The Hilbert transform of $\cos$ should be $\sin$, but with the hilbert function in MATLAB, it is not a $\sin$, why? Could anyone please help me?


texts: Frequency prewarping of a bilinear transform (Tustin transform)

texts:
sadly I'm not too well aquinted with discretazation methods. At the moment I struggle to reproduce a bilinear transform with frequency prewarping.

I have the following transfer function in the s-domain:

$$\begin{align}
\\
G(s)=\frac{-ms^2}{s^2+2abs+b^2}
\\
\end{align}$$

There m,a,b are just some constants. Now I would like to transform this transfer function into the z-domain. In Matlab I am using the c2d-function. I compared all the available methods with a sampling frequency of 512Hz.

One can clearly see, that with a pole being around 100Hz that is already too close to the Nyquist frequency, so that the Tustin method has to be wrapped in order to give a more accurate result.

Now I tried to reproduce the results from the matlab c2d-function by doing the bilinear transform myself.

I first tried it without prewarping using:

$$\begin{align}
\\
s=A\cdot\frac{z-1}{z+1},  A=\frac{2}{T}
\\
\end{align}$$

Comparing my result with Matlab does look really nice:

Then I tried it with prewarping, using:

$$\begin{align}
\\
s=A\cdot\frac{z-1}{z+1}, A=\frac{b}{\tan(b\cdot\frac{T}{2})},  b=2\pi\cdot100
\\
\end{align}$$

This results in:

With the warping the result doesn't look the same as with the matlab c2d-function. So where is the difference??

In matlab I use:

G(z)=c2d(S,1/512,['Method','tustin', 'PrewarpFrequency', b]);

And I have derived:

$$\begin{align}
\\
G(z)=\frac{-mA^2\cdot z^2+2mA^2\cdot z-mA^2}{(A^2+2abA+b^2)\cdot z^2+(2b^2-2A^2)\cdot z+(A^2-2abA+b^2)}
\\
\end{align}$$

If I put in $A=2/T$ I achieve to get the same result as the Matlab c2d-function. But with $A=b/\tan(\frac{b\cdot T}{2})$ I don't get the same result as the c2d-function in Matlab.

Putting in some values for the constants I get he following:

Tustin wo prewarp using c2d yields: $\frac{-6.781 z^2+13.56 z - 6.781}{z^2-0.8456 z + 0.8669}$

Tustin with prewarp using c2d yields: $\frac{-7.997 z^2+15.99 z-7.997}{z^2-0.615 z+0.8217}$

My self derived Trustin-transform with prewarp yields: $\frac{-6.216 z^2+12.43 z-6.216}{z^2-0.6266 z+0.8599}$

So apparently I am doing something different than the matlab function. Maybe someone can enlighten me by pointing out where I am at odds. I also failed to recreate the discretized transfer function using the matched-method from c2d. Basically my problem is that I need to build nice discrete transfer functions while being unable to use matlab. So I would like to understand how the algorithm works. Thank you in advance for any help.


texts: Support of the convolution of two rectangular signals

texts:
I'm trying to convolve two rectangular signals in the frequency domain $$H_1(\omega) = u[\omega +.2\pi] - u[\omega -.2\pi]$$ and $$H_2(\omega) = u[\omega +.1\pi] - u[\omega -.1\pi]$$

My result is a trapezoid that ranges from $[-.2\pi, .4\pi]$, but I am expecting a trapezoid centered at 0 with range $[-.3\pi, .3\pi]$.

I am pretty sure I'm getting something wrong with the bounds of integration, but I'm not sure what I'm doing wrong. My strategy is to flip $H_{2}$ and slide it from negative infinity through $H_{1}$. What am I missing in determining the bounds correctly?


texts: How Does Gaussian Blur Affect Image Variance

texts:
I am trying to find a way to analytically estimate how the noise (or variance in pixel values) will be affected for a zero-frequency image of random noise after applying a Gaussian blur.

In more detail, say I have an image of pixels with an average $ μ $ and random noise of variance $ σ_{0}^{2} $. The image has no features in it, but is simply that normal noise. I now apply a Gaussian blur (or Gaussian filter) with a kernel of standard deviation $ σ_{G} $. I would like a way to analytically estimate (and I know it will have to be an approximation) what the variance of the pixel values in the filtered image will be ($ σ_{f}^{2} $).

Wikipedia has an equation that clearly states what I need. However, they do not have any references and I will like to have a stronger reference for it. I have been unable to find this anywhere else. Any ideas where I'll be able to find this? Does anyone know if that is the correct equation? And maybe how to derive it?

Thank you in advance for your help! Every little contribution helps!


texts: Determining linearity, causality, memory, and time invariability from a picture of the signal

texts: So, this is a picture of saccadic eye movement reflected by an EOG. How can I determine if the eye movement system is linear, causal, memoryless, and time invariant from this displayed waveform? Please explain.


texts: Why does downsampling increase the phase angle of poles in autoregressive models?

texts:
When reading about autoregressive models (AR), people often "downsample to increase the phase angle of the poles of the corresponding transfer function".

How exactly does downsampling affect the phase angle of the poles?


texts: Apply LTI filter to incoming signal stream

texts:
Typically, when I want to filter a signal with an LTI filter (in this case a low-pass filter), I just convolve the signal with the filter.

However, what do I do if I have a stream of data that I want to filter as it arrives? Do I have to save a certain amount of the signal and filter it? Is there some other approach or theory that applies to this scenario?


texts: How do I use MATLAB to obtain a continuous state equation from a transfer function and ode45 to solve it?

texts:
I have the following transfer function that I am trying to model in MATLAB with some additional unity white noise:

  $$G(s)=\frac{1}{s^3 + \beta s^2}$$

I used the following to obtain the continuous state space equation:

beta = 0.2;
b = [0 0 0 1];
a = [1 beta 0 0];
[A,B,C,D] = tf2ss(b,a);

My understanding is that the tf2ss() function provides me with the values A and B which can be used in the following equation:

  dxdt = Ax + Bu, where x is the initial condition and u is the unity white noise.

Upon running the above code snippet, I obtain the following values for A and B:

A = [-0.2,0,0; 1,0,0; 0,1,0]
B = [1; 0; 0]

Here is where I am running into trouble (although I may have run into an issue before with my assumptions regarding tf2ss()).  I do not understand how to write the differential equation function required to use ode45().  I have tried the following:

function dx = mydiffeq(t,x)
    A = [-0.2,0,0;1,0,0;0,1,0];
    B = [1;0;0];

    dx = A*x + B*randn(1);

end

And then I call it as follows:

tspan = [0 10];
xnot = 100;

[t,y] = ode45(@mydiffeq, tspan, xnot);
plot(t,y);

Obviously, I have a problem due to the size of my A and B matrices.  I know that I am doing this wrong, but I do not know how to fix it.


texts:
I want to stitch 2 images by crosscorrelation measure, but I don't want to use fft.

I tryed this but something seems to be wrong.any suggestions?

void test(IplImage* src,IplImage* temp)
{
double max_peak=0;
                Point pt;
                double per_x=0.5;
                double per_y=0.5;
                for(int cy=-h*per_y;cy<h*per_y;++cy)
                {
                        for(int cx=-w*per_x;cx<w*per_x;++cx)
                        {
                                uchar* s_p= (uchar*) src->imageData;
                                uchar* t_p= (uchar*) temp->imageData;
                                __int64 suma=0;
                                __int64 sumb=0;
                                for(int y=0;y<h;++y)
                                {
                                        for(int x=0;x<w;++x)
                                        {
                                                suma+= s_p[x];
                                                if((y+cy)<h&&(x+cx)<w&&
                                                        (y+cy)>0&&(x+cx)>0)
                                                        sumb+= t_p[x+cx];
                                        }
                                        s_p+=w;
                                        t_p+=w;
                                }
                                int meana = (int)(suma / (w * h)),
                                        meanb = (int)(sumb / (w * h));

                                s_p= (uchar*) src->imageData;
                                t_p= (uchar*) temp->imageData;

                                __int64 corr = 0,
                                        denoma = 0,
                                        denomb = 0;

                                for(int y=0;y<h;++y)
                                {
                                        for(int x=0;x<w;++x)
                                        {
                                                int da = (int)s_p[x] - meana;
                                                int db= 0;
                                                if((y+cy)<h&&(x+cx)<w&&
                                                        (y+cy)>0&&(x+cx)>0)
                                                        db = (int)t_p[x+cx] - meanb;
                                                else
                                                        db= -meanb;

                                                corr += da * db;
                                                denoma += da * da;
                                                denomb += db * db;
                                        }
                                        s_p+=w;
                                        t_p+=w;
                                }

                                double peak= corr / sqrt( (double)denoma * denomb);
                                if (peak>max_peak)
                                {
                                        pt.x= cx;
                                        pt.y= cy;
                                        max_peak=peak;
                                }
                        }
                }
}


texts:
The conventional MEL scale converts the frequency scale using the following formula:

$$M_f = 1127.01048 \cdot \log\left(\frac{f}{700} +1\right)$$

I want to use a reverse scale where resolution is better at higher frequencies only up to $10\textrm{ kHz}$.

In my opinion it will be a s-shaped curve.
Any suggestions?


texts: How can I get the power of a specific frequency band after FFT?

texts:
I need help with my matlab code. I have recorded EEG data and now I want to analyse it in matlab. I want to find the mean power of specific frequency ranges (theta: 4-8 Hz,alpha: 8-12Hz etc.). For that I performed a fft. Next I used the interp1 function to find the amplitudes at specific frequency ranges. But I am not sure if I have done it correctly...It would be great if someone can look at the code.

Thank you for your help!

%p2 is the data in the time domain
% Variables

fftlength = 1024;                                % Set FFT length
stepsize = 32;                                   % Set step size
samples = fftlength:stepsize:length(p2);    % create an index array
c = 1:fftlength;

%Specify hanning window

hanning = [1:fftlength]';
hanning_in = 2* pi() * (hanning - (fftlength+1)/2)/(fftlength+1);

%rescaled x-axis to match sample length?

hanning1 = (sin(hanning_in)./hanning_in).^2;

f=[128/fftlength:128/fftlength:128];   % frequency index for the spectral
array

bp_p2=cell(1,1);

channel=1;

for kk = 1:length(samples)

k = samples(kk);

spectrum = fft(p2(k-fftlength+1:k,:) .* hanning1)/fftlength; % apply window
to filtered data

spectrum2 =(sqrt(spectrum .* conj(spectrum)));  % get magnitude uV

% theta (4-8),alpha (8-12),beta low(12-16), beta high(16-25)

theta=mean(interp1(f,spectrum2(:,channel),[4:f:8]));
alpha=mean(interp1(f,spectrum2(:,channel),[8:f:12]));
betalow=mean(interp1(f,spectrum2(:,channel),[12:f:16]));
betahigh=mean(interp1(f,spectrum2(:,channel),[16:f:25]));

%creating an array
%store all iteration loop outputs in a matrix

m(kk,:)=[theta alpha betalow betahigh];

end


texts: What set of non-intrusive measures (features) would help to identify bad recordings before speech recognition process?

texts:
I'd like to try various non-intrusive features (parameters) that could be calculated from speech recordings (no clean reference) to eliminate bad recordings before doing speech recognition.
What set of parameters (features) could help to classify between good speech recordings that will probably be well recognized and degraded speech recordings that will not be properly recognized because of various distortions (reverberation, various background noises, clicks, pops, too silent, too loud, bad microphone, wrong endpoints, distant talk, nonlinear distortions, ...) ?
I guess at the end the combination of several features will help to identify the answer...
Thanks for advices and hints (would love also pointers to implementations in Matlab or/and Python).
I'will try various SNR measures, then clean to reverberant energy ration, ...
Thanks in advance,
regards,
R.


texts: Convolution for non-signal-processing background

texts:
I am a civil engineer and am analyzing traffic data recorded by capturing vehicle movements over a highway for a specified time period. The database I am dealing with contains observations at every 0.1 seconds (total about 4 million rows) and has some 'noise' in position (lateral and longitudinal) columns. A research paper suggests to 'smooth' the velocity and acceleration data (derived from position) by using following formula:

Someone told me it is a 'convolution'. Since I have no background in electronics/ DSP, I had no idea what convolution is. After studying some online resources I can understand a little about the concept but I need a thorough understanding of this topic from a resource which is targeted towards people who have no background in DSP. Could anyone please guide me to the required resources? I am using R for analysis.


texts:
I understand the advantages of SC-FDMA over OFDM and I also understand the disadvantage of additional complexity (FFT block), are there another disadvantages?

Also, if $N$ has to be bigger than $M$ ($N>M$) then I don't understand why I don't lose rate as a result of padding with zeros instead of transmitting another data subcarriers.


texts:
I have developed an algorithm that counts the number of times a particular block (within a 2D block) crosses zero. Here's an example:

B1 = {  1, 4,
        -1, -3,
        0.12, -2.3
     }

The answer would there for be 3. To do this, what I do is:

Find the signum value of each element within the block (will return "1", "-1", "0") respectively.
If the signum value returns -1 then count increments by 1.

This will repeat until the there is no blocks, however, will only produce 1 value per block.

I am looking for a way to put all this process into an equation so I can demonstrate this rather than having to explain the processes in written text everytime. Is this possible?


texts:
I'm reading a book on linear systems and I can't understand why the unit-time delay is a distributed system. This is the example given in the book:

I understand that the initial state of the system is the input, that is:

$u(t),\,t_0-1\le t<t_0$

However, for me, a distributed system is something like a transmission line, where the parameters can't be modeled accurately by "discrete" and finite elements.

I can't grasp why this system is classified as distributed just because there are an infinite number of points describing the initial state.


texts:
I know that $f = \frac{\text{cycles}}{\text{unit of time}}$  and I know that period $T = \text{time it takes to complete one cycle}$.

So if we take the definition

$f = \frac{1}{T} = \frac{\text{1 cycle}}{\text{time it takes to complete one cycle}}$

So if we have some $x$ cycles we get that $f = \frac{x \text{ cycles}}{\text{time it takes to complete one cycle}}$.

How can we have $x > 1$ if it takes $T$ to complete a cycle? In other words, how could $x > 1$ have completed in the time it takes to complete one cycle?

I’m guessing that $T$ is somehow decoupled from $x$ and I’ve got my definitions mixed up.


texts: I have some questions about background subtraction with Gaussian Mixture Model (GMM)

texts:
I'm learning about Gaussian Mixture Model (GMM) for background subtraction.. And have some questions about it..

In Chris Stauffer paper "Adaptive background mixture models for real-time tracking" Gaussian probability density function is
$$\mathcal{N}(X_t,\mu,\Sigma)=\dfrac{1}{(2\pi)^\frac{n}{2} \left|{\Sigma}\right|^\frac{1}{2}}\exp\left(-\dfrac{1}{2}(X_t-\mu_t)^T\Sigma^{-1}(X_t-\mu_t)\right)$$
where $n$ in multi dimension, is $n$ in 3-D which is pixel position in x,y, and intensity of pixel?
In the same paper, they said:
$$\Sigma_{k,t}=\sigma_k^2.I$$
Is $I$ is Indentity matrix?
They also said red,green, and blue pixel values are independent and have the same variances, if it independent why R,G, and B have same variances? shouldn't it have different variances because the value of each channel is different..
If I set the algorithm with number of distribution is 3, so it's only 1 distribution that chosen as background model and the rest is foreground model? Because they said the first B distribution are chosen as the background model, where
$$B=\arg \min_b(\sum\limits_{k=1}^b w_k>T)$$


texts: Routh's stability criterion: zeros of the auxiliary polynomial and of its derivative

texts:
When using RH criterion and using the auxiliary equation special case, which of the following is true?

The auxiliary equation $A(s)=0$ gives some(or all) of the symmetrical poles.
The differentiated auxiliary equation $\displaystyle \frac{\mathrm{d}A(s)}{\mathrm{d}s}=0$ gives some(or all) of the symmetrical poles.

I have seen both of them mentioned either separately or together in different books. I am really confused on which one is actually correct.

After solving a few problems I have observed that $1$ generally holds, it might be a coincidence. If someone could explain if I am missing something or if either of them(aforementioned cases) is wrong, it would be really helpful.


texts: Deep Learning: Classification vs. Convolution for Signal Restoration

texts:
Assume we have vector $X = [x_1, x_2, x_3, x_4 ,..... x_N], ∈ -1,1$. Therefore the value of $x$ is either 1 or -1.  The vector $X$ is convoluted with random generated vector $Y$ whose length is the same of $X$, so $r = X*Y$ where $*$ denote to the convolution operation.

Is there classification deep learning model which can extract the vector $X$ based on $r$ ?? I mean the input should be the vector $r$ and output the vector $X$.

thank you in advance.


texts: Octave error - STFT parameters when detecting pitch in guitar audio signals

texts:
I am working with this STFT method to detect pitch in monophonic guitar audio signals.

The method is working correctly for medium pitches (above 150Hz). However, in low notes I have some issues.

For example, I have an audio file that had the A2, A#2 and B2 notes played. So, the pitches detected should be approximately 110, 116, 123. When I ran the STFT with 40000 as a sampling rate, there was an octave error in all of them. The notes detected were A3, A#3 and B3.

I though I should see why this happens and I went in my STFT, and printed, for each note played, the 5 strongest bins in terms of magnitude. Those were the results:

First note: [539.49506, 975.88092, 419.11325, 326.00168, 217.16208]

Second note: [0.0, 0.0, 573.76556, 229.9518, 117.29102]

Third note: [0.0, 240.0067, 0.0, 118.64342, 0.0]

As you can see, for the first note, the correct pitch is not even amongst the 5 max. magnitudes. For the second and third notes, they are amongst the top 3 but not enough to become the selected pitches.

I tried to do the same with a sampling rate of 30000, and I still had the same problem, but this time the correct pitch was in the top 5 for the first note.

I know how to fix this problem, so my question is more theoretical. How can the sampling rate affect this? Why did this happen with 40000 and not 30000? In the end, how should I decide on my SR final value?

As a follow-up question, I see that I can also choose on other parameters like the n_fft (number of FFT bins or FFT size) and hop_length. How should I choose on those? What are upsides and downsides for high/low values (if the answer is too long to answer, then a reference would be great).


texts: How does kernel work in unsharp masking?

texts:
I applied the kernel below to the picture for unsharp masking

k = [-1 -1 -1; -1 8 -1; -1 -1 -1]

I got !

Then I changed 8 to 14. And I got
How does kernel work for unsharp masking the original picture and what does exactly do the number in the middle ?


texts: Can I simultaneously remove salt and pepper noise and improve the image resolution?

texts: What should my approach be towards designing a filter that can simultaneously remove salt & pepper noise and improve the resolution?


texts:
I need to convert a polar plot into a short array of 3-5 values. This array should describe the polar plot as best as possible.

For example, I know that I can use the beamwidth which is also known as the half power. This is the angle between the left and right -3 dB point:

I also know that I can use the the ratio between the surface of the polar plot versus the whole 360° plane.

Thus, so long I only have two values in the array:

Beamwidth
Ratio polar plot vs plane

But are there other values that can describe the polar plot ?
And also, how can I have a value which describes second biggest lobe ?


texts: Hilbert transform of symbolic function in Matlab

texts:
I have a signal of the form $f(\omega,x) = g(\omega) e^{i \omega (x +c)},$ for $g: [\omega_1 , \omega_2] \rightarrow C, \, x\in R$ and some constant $c.$  I want to get the function
$$
F (\omega,x) = \mathcal{H} ( \Re \{f(\cdot,x)\}) (\omega),
$$
where $\mathcal{H}$ denotes the Hilbert transform with respect to frequency $\omega,$ and $\Re$ the real part. I need the function $F$ to be again symbolic on $x$ such that I can differentiate it later.

I am trying to implement it in Matlab using:

L = 1e-2; K = 100; c = 1;
omega = (1/L)*(-K:K-1);

g = exp(-omega.^2/4);

syms x; f(x) = real(g.*exp(1i*omega*(x+c)));

but then the hilbert build-in function is not working. Do you have any idea how to do it?


texts:
I would like to transmit a 56 MHz real cosine and receive it using SDR with max complex sample rate equals 61.44MSPS and an analog filter with BW = 56MHz (the transceiver is AD9361). Can I do it? How should I generate its samples? (I think I can't since the RF BW is 112 MHz (full BW) around the center frequency, but am I wrong?)
Are these Tx chain and Rx chains the correct way to implement this transmission?
TX

RX


texts:
I read Digital Signal Processing of author G.Proakis and see this FIR Filter Structure. I understand all about this but I wonder that what is purpose of classification to 4 structures?
Here is this section:


texts: Find the frequencies present when a non-sinusoidal wave is reconstructed

texts:
A 1.6kHz periodic (not sinusoidal) signal contains all its harmonics, both even and odd. The signal is sampled at 3.6kHz and ideally reconstructed. What frequencies are present in the output?
I know that for a sinusoidal wave aliasing occurs, and assuming that the sample is reconstructed at 7.2kHz, the frequencies present would be [(k7.2)+1.6]kHz or [(k7.2)-1.6]kHz where k is an integer. But how do we calculate the same for a non-sinusoidal signal with harmonics? Does the presence pf harmonics change this answer.


texts: Spatial multiplexing MIMO, antenna critical spacing, antenna isolation

texts: How does antenna isolation affect single user spatial multiplexing MIMO performance in an antenna array? Text books talk about a critical antenna spacing of 1/2 of the wavelength  provided that the environment is  a rich scattering one . Would that be the sole criterion? or would the antenna-antenna isolation rather be the criterion to observe?


texts: How to choose one among different types of LPF?

texts:
My signal graph is as follows

I have < 10 reputation, thus cannot post the photo...

The graph are simply roughly the series of -5, 0, +5, 0, -5, 0, +5, 0.... but with sawtooth-like small peaks around the prominent peaks.

I am going to do the peak detection. But what I need to count is the "prominent peaks".

i.e. The "sawtooth" small peaks around the main peaks should not be counted.

I have known that the small peaks are due to high-freq noises.

My range of interest is 0~4Hz.

Thus, before counting the peak number, I have to low pass filter the signal first.

Being a beginner in signal processing, I have no idea which type of filter is the most proper. Chebyshev or Bessel or the classic Butterworth?

Thanks in advance!


texts: FIR filter coefficients from frequency responses

texts:
I have frequency responses of FIR filter of order 13 from obtained 50 frequency samples. How can I get FIR filter coefficients of order 13?

For example, in MATLAB a lot of possible ways I tried ;

I have a frequency samples : w=[0 1] (1x50)

I have frequency responses of FIR filter of order 13: hd (1x50)

b1=fir1(12,wc) % b1:FIR filter ideal coefficients of order 13

hd=freqz(b1,1,w) %hd :FIR filter frequency responses with respect to b1

When I apply inverse fourier transform to FIR filter frequency responses ( ifft(hd,13) ), I don't reach b1. I am supposed to reach b1 coefficients in theory. Am I right?
I apply inverse fft shift for moving to true domain before apply Fourier Transform( ifft( ifftshift(hdg),13) ) but also I don't reach b1. So what else can I do?

There is incompatible things(may be between frequencies and transforms ) I don't understand.


texts: How can I create a histogram showing the RMS amplitude for each frequency bin of an audio file

texts:
Using Python or Matlab, how can I create a histogram in which each bin is equal to a proportional frequency range (e.g. one octave) and the data added to each bin is a count of the number of samples that have any amplitude within that frequency range?
Here's what I have so far:
length = data.shape[0] / Fs
print(f"length = {length}s")

RMS = lambda x: np.sqrt(np.mean(x**2))

sample = np.arange(int(length))
RMS_of_sample = np.zeros(sample.shape)
for ns in sample:
    RMS_of_sample[ns] = RMS(data[ns*Fs:(ns+1)*Fs])

plt.hist(RMS_of_sample, label="Left channel")
plt.show()

But this seems to create a bin equal to the full spectral range, thus only one bar appears in the histogram. I'm also not sure that the data in the bar actually represent counts of amplitude occurrences.


texts: Convert image of an irregular surface to it's signal equivalent

texts:
I want to take the image of an irregular object , say

and then I want to convert the  elevation of the points into a spatial signal. To make my point clear: the signal would be 'height of the object's surface from an assumed datum' vs 'distance'.

For example

this is the kind of signal that I want to construct from my image.

What software/tool can I use to convert my image to it's signal equivalent?


texts: Formula for 2D Image Filter for Scratch Detection

texts:
Consider Multidirectional Scratch Detection and Restoration in Digitized Old Images Research Paper.

In section 4.1 (Preprocessing), they gave us a formula of the kernel,

$$ H(u, v) = \frac{1}{1+0.414 \times \left(\sqrt{\frac{u^*}{D_h}+\frac{v^*}{D_v}}\right)^{2n}} $$

Where,
\begin{split}
t_x & = \mathrm{center} \times \cos(\theta) \\
t_y & = \mathrm{center} \times \sin(\theta) \\
u^* & = \cos(\theta) \times (u+t_x) + \sin(\theta)\times(u+t_y)\\
v^* & = -\sin(\theta) \times (u+t_x) + \cos(\theta)\times(u+t_y)\\
\end{split}

The formula doesn’t look correct to me.

Why would someone apply $\mathrm{sqrt}()$ and subsequently apply a power of $2n$ as it makes the $\mathrm{sqrt}()$ operation redundant?
$H(u,v)$ transfer function looks like a high-pass filter rather than a band-pass filter.
Shouldn’t $\mathrm{center}$ be $\mathrm{center}_x$, and $\mathrm{center}_y?$
Shouldn’t $(u+t_y)$ be $(v+t_y)$?


texts: How to scale the amplitude of an FFT of a chirp signal

texts:
I'm analysing some accelerometer data. The accelerometer was placed on a mechanical shaker and on this shaker a frequency sweep was performed.

When I look at the amplitudes of single sine waves they see to fit in the time and frequency domain. However, if I perform a sweep, the amplitudes are wrong.

The accelerometer data should be scaled right, I think it has to be some MATLAB fft specific stuff. The following code was used to perform the FFT:

nfft= length(signalToAnalyse);
%generate the freqvec
halfn = floor(nfft / 2)+1;
deltaf = 1 / ( nfft / Fs);
freq = (0:(halfn-1)) * deltaf;
% perform FFT
fftRawResult = fft(signalToAnalyse,nfft);
% convert from 2 sided spectrum to 1 sided
magnitude(1) = abs(fftRawResult (1)) ./ (nfft);
magnitude(2:(halfn-1)) = abs(fftRawResult (2:(halfn-1))) ./ (nfft / 2);
magnitude(halfn) = abs(fftRawResult (halfn)) ./ (nfft);

Anybode some Ideas?

Below is the signal in time domain and frequency domain.


texts:
When I do a spectrogram in matlab / octave I can create a swept signal that looks like the RED plot line below.  But how can I create a swept signal like the BLUE line in the 1st plot using the equation below.

thanks to Daniel and David for getting me this far with the code is below

startfreq=200;
fs=44100;
endfreq=20;
dursec= 10;%duration of signal in seconds
t=(0:dursec*fs)/fs; %Time vector
alpha=log(startfreq/endfreq)/dursec;
sig = exp(-j*2*pi*startfreq/alpha*exp(-alpha*t));
sig=(sig/max(abs(sig))*.8); %normalize signal
wavwrite([sig'] ,fs,32,strcat('/tmp/del.wav')); %export file
specgram(sig,150,400);

1st plot

2nd plot

How can I fix the the equation in the variable sig to get it to look like the BLUE line in the 1st plot?

3rd plot


texts:
I have read that variance of a deterministic signal is 0 because it is deterministic and does not vary over time.

In this explanation, I am considering a $\sin(t)$ wave where value at each t is a variable(it will be a random variable when we are doing measurements but I am not sure what to call it here, so just variables). We can have sampled values of $\sin(t)$ for limited number of variables but it is not related to my question.

I understand very well for a single variable that it's variance is zero. For eg: value of sine wave at $t=1$ which is given by $x=\sin(1)$ . Since $\sin(1)$ is constant every time you try to measure it, variance given by the following formula is zero as well:
$$ var(x)= E[(x-\bar x)(x-\bar x)^T] $$
I understand this is zero because $x=\bar x$ every time you calculate x.
Now, suppose you have a deterministic signal($\sin(x)$ from $0$ to $2\pi$). Now, mean of the signal is 0 and variance is just the squared sum of signal values from $0$ to $2\pi$ which is not zero. Even more, this is providing the energy of the signal.
Does that mean variance of a deterministic signal is defined and does not have to be zero. Is variance even defined for a whole signal or is this concept valid only for a single random variable.


texts: How to derive a rate (e.g. water dripping) from an audio file

texts:
I want to learn how to go about analyzing some audio files I have acquired.  Let's say the files contain some sort of repeating sound (e.g., water dripping), and I want to derive the pattern of the repeating sound.  I use R for programming and analysis and have briefly introduced myself to the tuneR and seewave packages, but I am open to any answers about how such an analysis should be conducted.

To make my question more concrete, let's say I have a 2 hour audio file of water dripping and I would like to be able to select some point or interval in the file and know the drip rate.  I will be pursuing further processing (e.g., finding times when the drip rate is most steady, fastest, slowest, etc.), but right now I am looking to learn how to get started with this task.

Specifics of my audio files:
.Wav files
Sampling rate: 44100 Hz
Bits: 16
Stereo

I briefly read about Fourier transforms, but due to my lack of knowledge and my rudimentary understanding of terminology, I am unclear if a Fourier transform would be appropriate starting place for this task.  I also briefly read about subcarriers, envelopes, and autocorrelation, but it quickly became clear to me that I could benefit greatly from some guidance before I start investing too much time learning about and introducing myself to the incorrect topics.


texts: What is the official definition of a feature in signal classification?

texts:
Nowadays read any paper or reference on signal classification scheme you would invariably come across the term "feature". What does feature mean exactly? What is considered a time domain feature, what is considered a frequency domain feature and what is considered a phase domain feature?

I would be glad if someone can clarify this concept for me once and for all.