12

Convolution $(*)$ is associative, so $I_{xx} = K_{sobel} * (K_{sobel} * I) = (K_{sobel} * K_{sobel}) * I$ meaning the convolution of a 1st order Sobel filter kernel with another 1st order Sobel filter gives the filter kernel for a second order filter. So e.g. a 2nd order horizontal Sobel filter kernel is: $\left( \begin{array}{ccc} -1 & 0 & 1 \\ ...


6

Apart from a sign error, your result looks correct. The term with $(1-a_{1k})$ should have a positive sign. Also note that $\text{sgn}(x)$ as the derivative of $|x|$ is of course only valid for $x\neq 0$. If you take this into account, you can write the derivative in vector/matrix notation if you define $\text{sgn}(\mathbf{a})$ to be a vector with elements $\...


6

That's a trick which you will also find in a DSP context, that's why I choose to provide an answer here. It is related to the Wirtinger derivative, and you can find more details about it in this answer over at math.SE. In practice this trick is often used to compute the extremum (minimum or maximum) of a real-valued function depending on a complex variable (...


4

The easiest approach would be writing each case using Matrix Form of the convolution. In this answer we assume the discrete convolution is applied only on valid support (Matching MATLAB's valid parameter for the convolution). Namely, given $ x \in \mathbb{R}^{m \times n} $ and $ h \in \mathbb{R}^{k \times l} $ then $ h \ast x \in \mathbb{R}^{ \left( m - k + ...


4

Unless mentioned otherwise withing the context the classic interpretation of Second Derivative Gaussian Filter is indeed (a) in your question: $$ L \left( x, y, \theta \right) = \cos \left( \theta \right) {g}_{xx} \left( x, y \right) + \sin \left( \theta \right) {g}_{yy} \left( x, y \right) $$


4

I'd say there 3 approaches to do so: Properties of the LMS Filter There is an optimal step size given you know the spectrum of the correlation matrix. You may have a look at Wikipedia's Least Mean Squares Filter at Convergence and Stability in the Mean. Some other approaches related to this might be those from Variable Step Size LMS. You may have a look at ...


3

so with an LMS filter, we have a time-variant $N$-tap FIR filter: $$ y[n] = \sum\limits_{k=0}^{N-1} h_n[k] \, x[n-k] $$ $x[n]$ is the input signal, $y[n]$ is the FIR output, and $h_n[k]$ are the FIR tap coefficients at the time of sample $n$. with an LMS filter, we also have another input called the desired signal: $d[n]$. we want our LMS filter to adapt ...


3

Well, if you go through the documentation of fspecial() you'd see it returns the following filter: h = fspecial('sobel') returns a 3-by-3 filter h that emphasizes horizontal edges using the smoothing effect by approximating a vertical gradient. To emphasize vertical edges, transpose the filter h'. [ 1 2 1 0 0 0 -1 -2 -1 ] Namely in the way you ...


3

I felt I needed to write an additional answer to try to clear my mind about the question. Here is the try, step by step. Caveat: for simplicity, I used the same notation $C$ of a function of reals $u$ and $v$, for its rewriting in $x=u+iv$ and $\bar x$, and on complex $x$ alone. I hope it is not confusing for the reader. Let $C(x)$ be a function (we don't ...


3

I am by no means an expert on total variation, however I think you should check out this Wikipedia page. It doesn't directly answer your question, but I believe the lemma below illustrates the relationship between total variation and divergence. There, it gives a lemma that follows from the Gauss-Ostrogradsky theorem and provides a proof for it, $\int_{\...


3

Indeed, it adds smoothing in the $y$ direction. The Sobel filter is the separable combination of the centered derivative $[−1,\;0,\;1]$ along $x$, and the $3$-point binomial smoother $[1,\;2,\;1]$ along $y$.


3

The quadratic surface is determined by the autocorrelation matrix of the data, which is always positive definite or positive semi-definite. This means that any stationary point is always a minimum. In the worst case, this minimum is not unique if the matrix is singular, but it can never be a saddle point.


3

Pay attention that convolution mean flipping the kernel both on the x and y axis. Hence the first element is a multiplication of $ -1 \cdot -1 $ which yields $ 1 $ as in the answer in the original post. Pay attention that this is a discrete approximation of the gradient based on Finite Differences. This specific one is based on the Sobel 1st derivative ...


2

I wrote a function which solves this in my StackOverflow Q2080835 GitHub Repository (Have a look at CreateImageConvMtx()). Actually the function can support any convolution shape you'd like - full, same and valid. The code is as following: function [ mK ] = CreateImageConvMtx( mH, numRows, numCols, convShape ) CONVOLUTION_SHAPE_FULL = 1; ...


2

You can create your own custom kernel filter using something similar to this example. if you just want to find image gradients there are other options such as sobel and laplace If your aim is edge detection, I find canny is best for this in most cases.


2

To obtain the Gradient of the TV norm, you should refer to the calculus of variations. By examining the TV minimization with Euler-Lagrange equation, e.g,, Eq. (2.5a) in [1], you would see the answer. [1] Nonlinear total variation based noise removal algorithms, 1992.


2

Recursive least squares (RLS) filters don't use gradient descent. As their name suggests, they use a least-squares fit to determine the optimum coefficients at each time step. Via clever formulation of the filter structure, one can use the calculations done from time step $n$ to recursively calculate the updated coefficients for time step $n+1$ without ...


2

I have found an alternate answer which is very simple and comprehensive, so thinking to share with all. In order to differentiate an expression $f(z)$ with respect to a complex $z$, the Cauchy-Riemann equations have to be satisfied: \begin{equation} \label{eq:1} \frac{\partial f(z) }{\partial z} = \frac{\partial \mathbb{R}(f(z)) }{\partial \Re z} + ...


2

Background The Sobel edge detector was introduced back in 1968 by Irwin Sobel and Gary Feldman as the Sobel-Feldman operator. In broad strokes, 'edges' in images are related to gradients, which motivated their development of a discrete differentiation operator. The Sobel-Feldman operator only computes an approximation of the gradient and not the actual ...


2

This is an interesting question since both squared error and absolute error are convex functions, so they are both going to give the optimal solution when minimized. My intuition is that the $\ell_2$-norm (sum of squared values of error) converges to zero more quickly than the $\ell_1$-norm (sum of absolute values of error) when the search direction is right....


2

So, if you're using Matlab, you can do: X = your matrix [gx,gy] = gradient(X); % first order gradient [gxx,gxy] = gradient(gx); % second order gradient [gxy,gyy] = gradient(gy); % second order gradient To find the curvature of features I advise you to look into the eigenvalues and eigenvectors of a Hessian matrix. A hessian matrix is a square matrix of ...


2

Yes, the $1/2$ factor correction could be present, so that the magnitudes between a) the continuous derivative and b) the approximated gradient remain consistent in some way: a (continuous) line with a unit slope will have its discretized version get a unit gradient with the $1/2$ factor. However, as long as the factor is nowhere applied, all gradient ...


2

1-d MMSE derivative filter for uniform spectral prior With some simplifying assumptions about the signal distribution, a filter with least square frequency response error is the Bayesian minimum mean square error (MMSE) filter for a uniform prior of the frequency spectrum. For such 1-d filters, an oversampling factor $\beta \approx 2\ldots2.5$ seems optimal,...


2

The only difference I can see between your gradient3 function and MATLAB's gradient is that the latter returns the horizontal derivative as the first output, and your code returns as "x" derivative the vertical derivative. Note that MATLAB arrays are stored such that the first index is vertical, and the second index is horizontal. Therefore, the code under ...


1

The Discrete Cosine Transform of a discrete sequence $x$ can be defined as: $$ {\tt DCT(}x{\tt )} = X_k = \frac{1}{2} (x_0 + (-1)^k x_{N-1}) + \sum_{n=1}^{N-2} x_n \cos \left[\frac{\pi}{N-1} n k \right] \quad \quad k = 0, \dots, N-1. $$ If, by differentiable, you mean: $$ \frac{\partial {\tt DCT(}x{\tt )}}{\partial x} $$ then isn't it just $$ \frac{\...


1

In real world implementations, is the line: for theta = [theta_min to theta_max ] required? . . . Since we apply Canny edge detector to an image, prior to Hough Transform, we can obtain angle of gradient(θ) for a point (x, y) from Sobel operators. This can be noted down against (x, y) and later used in Hough Transform algorithm, eliminating one for loop. Isn'...


1

Yes, you are correct. The direction of the gradient vector (dx,dy) is (pretty much by definition) the "optimal direction of derivation". The magnitude of the gradient is the "intensity" of the edge, the steepness of the derivative.


1

This is a typical deconvolution problem that you can solve either by transforming to the frequency domain where convolution is a simple multiplication: \begin{equation} F\left \{ {\bf{I}} \right \}= F\left \{ {\bf{z}} \right \} F\left \{ {\bf{f}} \right \}, \end{equation} where ${\mathcal{F}}$ denotes the Fourier transform (or DFT) so $f$ will be: \begin{...


1

What you are looking for is the so-called "Laplacian operator" (http://en.wikipedia.org/wiki/Laplace_operator and http://en.wikipedia.org/wiki/Discrete_Laplace_operator). In image processing, people often use the Laplacian of Gaussian, which is simply the difference between the two results of convolving one input image with two different Gaussian kernels. ...


1

I dont know what this axis([-.76 -.16 -15 5])’ means As far as I am concerned axis([-.76 -.16 -15 5]) set minimal and maximum values for x axis (first and second values) and y axis (third and forth values) in plot. For example: x = linspace (-10, 10, 100); y = x .^ 2; plot (x, y, 'r', "linewidth", 2); title ("S"); xlabel ("x"); ylabel ("y"); x = linspace ...


Only top voted, non community-wiki answers of a minimum length are eligible