简体   繁体   English

Hessian矩阵的特征向量和特征值

[英]Eigenvectors and Eigenvalues of Hessian Matrix

I want to extract centreline pixels in vessel. 我想在容器中提取中心线像素。 At first I have seleted a seed point close to a vessel edge using ginput(1) command. 起初,我使用ginput(1)命令选择靠近血管边缘的种子点。 This provides the starting point and specifies the region of interest (ROI) on a vessel segment where the analysis needs to be performed. 这提供了起点并指定了需要进行分析的血管段上的感兴趣区域(ROI)。

figure; imshow(Igreen_eq); % Main green channel Image
p = ginput(1); 

Then the selected seed point is served as centre of a circle with diameter less than the expected diameter of the vessel, in order for the circle not to intersect with the opposite edge. 然后将所选择的种子点用作直径小于容器的预期直径的圆的中心,以使圆不与相对边缘相交。

t = 0:pi/20:2*pi;
d = 0.8*15; %d=80% of minwidthOfVessel so that it wont intesect with opposite edge;
R0=d/2;%radius
xi = R0*cos(t)+p(1);
yi = R0*sin(t)+p(2);
line(xi,yi,'LineWidth',2,'Color',[0 1 0]);
roimask = poly2mask(double(xi), double(yi), size(Igreen_eq,1), size(Igreen_eq,2));
figure; imshow(roimask) % Binary image of region selected
Itry = Igreen_eq; 
Itry(~roimask ) = 0;  
imshow(Itry);
Itry = im2double(Itry);
line(xi, yi,'LineWidth', 2, 'Color', [0 1 0]);
hold on; plot(p(1), p(2),'*r') 

Problem : Hessian matrix is to be computed for the light intensity on the circumference of this circle and the eigenvectors has to be obtained. 问题 :要计算该圆周上的光强度的Hessian矩阵,并且必须获得特征向量。 I have calculated Dxx,Dyy,Dxy using: 我使用以下方法计算了Dxx,Dyy,Dxy:

[Dxx,Dxy,Dyy] = Hessian2D(Itry,2); %(sigma=2)

I need to write a code in MATLAB for following problem" For a point inside the vessel, the eigenvectors corresponding to the largest eigenvalues are normal to the edges and those corresponding to the smallest eigenvalues point to the direction along the vessels. 我需要在MATLAB中编写一个代码来解决以下问题:对于容器内的一个点,对应于最大特征值的特征向量垂直于边缘,而对应于最小特征值的特征向量指向沿着血管的方向。

The first two consecutive vectors on the circle with maximum change in direction are considered as the pixels reflecting the vessel boundaries. 具有最大方向变化的圆上的前两个连续矢量被认为是反映血管边界的像素。 The points on the tracking direction are considered as the centers for the subsequent circles. 跟踪方向上的点被视为后续圆的中心。 Repetition of this process gives an estimate of the vessel boundary. 重复此过程可估算血管边界。

How will I calculate largest eigen values and its correspoinding eigen vector of Hessian matrix to select new seed point as discussed above. 如何计算最大特征值及其对应的Hessian矩阵的特征向量以选择新的种子点,如上所述。


Thanks for your reply . 感谢您的回复 。 I have used eig2image.m to find the eigen vectors at each point on the image (in my image, there is grey values on the concentric circular region and background is black ). 我使用eig2image.m来查找图像上每个点的特征向量(在我的图像中,同心圆区域有灰色值,背景为黑色)。

[Lambda1,Lambda2,Ix,Iy]=eig2image(Dxx,Dxy,Dyy)

where Ix and Iy are largest eigen vectors. 其中Ix和Iy是最大的特征向量。
But when I try to plot eigen vectors using : 但当我尝试使用以下方法绘制特征向量:

quiver(Ix, Iy)

I can also see the vectors on the black background which should be zero !! 我还可以看到黑色背景上的矢量应该为零!!

Can you please reply how can I plot eigen vector on the top of the image. 你能否回答我如何在图像顶部绘制特征向量。

Assuming Dxx, Dyy, Dxy are matrices of second-order partial derivatives of dimensions size(Itry) then for a given point (m,n) in Itry you can do: 假设Dxx, Dyy, Dxy是尺寸的二阶偏导数的矩阵size(Itry)然后对于给定的点(m,n)Itry可以这样做:

H = [Dxx(m,n) Dxy(m,n); Dxy(m,n) Dyy(m,n)];
[V,D] = eig(H); % check by H*V = V*D;
eigenVal1 = D(1,1); 
eigenVal2 = D(2,2);
eigenVec1 = V(1,:); 
eigenVec2 = V(2,:);

This local eigen-decomposition will give you eigenvalues (and corresponding eigenvectors) which you can sort according to magnitude. 这个局部特征分解将给出特征值(和相应的特征向量),您可以根据幅度对其进行排序。 You can loop across image points or for a more compact solution see eig2image.m in FileExchange. 您可以遍历图像点或更紧凑的解决方案,请参阅FileExchange中的eig2image.m .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM