features of segmented regions of the approximation matrix in matlab - matlab

I'm using multiresolution approach for segmentation based on wavelet transform and watershed algorithm. To merge the over-segmented regions, i need to calculate the features of each segmented region of the approximation matrix (such as the mean,second and third order central moments). My problem is i don't know how to define each region separately. In other words, i don't success writing these equations with matlab.

Related

Lukas Kanade optical flow: Understanding the math

I found a Matlab implementation of the LKT algorithm here and it is based on the brightness constancy equation.
The algorithm calculates the Image gradients in x and y direction by convolving the image with appropriate 2x2 horizontal and vertical edge gradient operators.
The brightness constancy equation in the classic literature has on its right hand side the difference between two successive frames.
However, in the implementation referred to by the aforementioned link, the right hand side is the difference of convolution.
It_m = conv2(im1,[1,1;1,1]) + conv2(im2,[-1,-1;-1,-1]);
Why couldn't It_m be simply calculated as:
it_m = im1 - im2;
As you mentioned, in theory only pixel by pixel difference is stated for optical flow computation.
However, in practice, all natural (not synthetic) images contain some degree of noise. On the other hand, differentiating is some kind of high pass filter and would stress (high pass) noise ratio to the signal.
Therefore, to avoid artifact caused by noise, usually an image smoothing (or low pass filtering) is carried out prior to any image differentiating (we have such process in edge detection too). The code does exactly this, i.e. apply and moving average filter on the image to reduce noise effect.
It_m = conv2(im1,[1,1;1,1]) + conv2(im2,[-1,-1;-1,-1]);
(Comments converted to an answer.)
In theory, there is nothing wrong with taking a pixel-wise difference:
Im_t = im1-im2;
to compute the time derivative. Using a spatial smoother when computing the time derivative mitigates the effect of noise.
Moreover, looking at the way that code computes spatial (x and y) derivatives:
Ix_m = conv2(im1,[-1 1; -1 1], 'valid');
computing the time derivate with a similar kernel and the valid option ensures the matrices It_x, It_y and Im_t have compatible sizes.
The temporal partial derivative(along t), is connected to the spatial partial derivatives (along x and y).
Think of the video sequence you are analyzing as a volume, spatio-temporal volume. At any given point (x,y,t), if you want to estimate partial derivatives, i.e. estimate the 3D gradient at that point, then you will benefit from having 3 filters that have the same kernel support.
For more theory on why this should be so, look up the topic steerable filters, or better yet look up the fundamental concept of what partial derivative is supposed to be, and how it connects to directional derivatives.
Often, the 2D gradient is estimated first, and then people tend to think of the temporal derivative secondly as independent of the x and y component. This can, and very often do, lead to numerical errors in the final optical flow calculations. The common way to deal with those errors is to do a forward and backward flow estimation, and combine the results in the end.
One way to think of the gradient that you are estimating is that it has a support region that is 3D. The smallest size of such a region should be 2x2x2.
if you do 2D gradients in the first and second image both using only 2x2 filters, then the corresponding FIR filter for the 3D volume is collected by averaging the results of the two filters.
The fact that you should have the same filter support region in 2D is clear to most: thats why the Sobel and Scharr operators look the way they do.
You can see the sort of results you get from having sanely designed differential operators for optical flow in this Matlab toolbox that I made, in part to show this particular point.

Discriminant analysis method to classify data

my aim is to classify the data into two sections- upper and lower- finding the mid line of the peaks.
I would like to apply machine learning methods- i.e. Discriminant analysis.
Could you let me know how to do that in MATLAB?
It seems that what you are looking for is GMM (gaussian mixture model). With K=2 (number of mixtures) and dimension equal 1 this will be simple, fast method, which will give you a direct solution. Given components it is easy to analytically find a local minima (which is just a weighted average of means, with weights proportional to the std's).

MATLAB - Wavelet coefficient based QRS complex classifier

I am new to Wavelet field and I wanted to ask you for a help for an idea.
I am supposed to create QRS complex (certain part of ECG signal wave) wave morphology classifier based on Wavelets in other words, I am supposed to create classifier which will separate waves with similar wave shape to categories, like bins in statistics, but based on signal wavelet coefficients.
I tried MATLAB mdwtdec and used wavelet coefficients on certain level as an input for classifier which calculates distance from each QRS and according to threshold separates to classes.
This approach is rather naive and I guess in order to improve it, I need some other idea or hint.

Hessian Matrix of the image

I am wondering what information does an Hessian Matrix of an image provides? Does it provide the information of the stable points? What is Hessian matrix used for?
Hessian matrix describes the 2nd order local image intensity variations around the selected voxel. For the obtained Hessian matrix, eigenvector decomposition extracts an orthonormal coordinate system that is aligned with the second order structure of the image. Having the eigenvalues and knowing the
(assumed) model of the structure to be detected and the resulting theoretical behavior of the eigenvalues, the decision can be made if the analyzed voxel belongs to the structure being searched.
The figure below illustrates the correspondence between eigenvalues of the hessian operation on the image and the local features (corner, edge, or flat region).
The Hessian operator is also widely used in 3D images, and it can reflect more local features:
It is widely used in vessel detection in medical images. For more details, please see M.Rudzki et al's Vessel Detection Method Based on Eigenvalues of the Hessian Matrix and its Applicability to Airway Tree Segmentation

How to find the correlation between scatter data and theoretical formula MATLAB?

I'm working on my thesis project on financial mathematics. One problem I'm having is that I want to find out if there is some correlation between a theoretical curve and scatter point data.
Here is the scatter data and the theoretical curve that I have.
Is there some easy way of doing this?
Bivariate correlation (usually Pearson correlation) is a statistic that measures linear dependence between two sets of data. The theoretical curve of your link does not seem to consist of discrete data points, therefore it is not possible to calculate correlation between it a and some set of data.
Depending on the model and the research question you have, you might be interested in analyzing the fit of your data to the model, using multivariate regression analysis or general[ized] linear model. These MATLAB commands could be useful: regress (multiple linear regression), regstats (regression diagnostics), glmfit (generalized linear model regression) and glmval (generalized linear model values).