本文介绍了在MATLAB中形成集群的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究切换双边滤波器。在此,他们已形成像素簇以检测图像中的边缘。他们使用了Sorted Quadrant Median Vector。

I am working on a switching bilateral filter.. In this, they have formed clusters of pixels to detect the edges in the image. They have used Sorted Quadrant Median Vector.

代码:

%群集的形成

 if((((m1 < avg) && (m4 < avg))&&((m2 >= avg) && (m3 >= avg))) || (((m2 < avg) && (m3 < avg))&&((m1 >= avg) && (m4 >= avg))))
     p=i+2;
     q=j+2;
     vec=[L(p-2,q) L(p-1,q) L(p+1,q) L(p+2,q)]; % Vertical edge
     dav=double(sum(vec)/4);
     %disp('vertical edge');

 elseif((((m3 < avg) && (m4 < avg))&&((m1 >= avg) && (m2 >= avg))) || (((m1 < avg) && (m2 < avg))&&((m3 >= avg) && (m4 >= avg))))
     p=i+2;
     q=j+2;
     vec=[L(p,q-2) L(p,q-1) L(p,q+1) L(p,q+2)]; % Horizontal edge
     dav=double(sum(vec)/4);
     %disp('horizontal edge');

 elseif((((m1 < avg) && (m3 < avg))&&((m2 >= avg) && (m4 >= avg))) || (((m2 < avg) && (m4 < avg))&&((m1 >= avg) && (m3 >= avg))))
     p=i+2;
     q=j+2;
     vec=[L(p-1,q+1) L(p-1,q-1) L(p+1,q-1) L(p+1,q+1)]; % Diagonal line
     dav=double(sum(vec)/4);
     %disp('diagonal line');

 end

m1,m2,m3和m4是中位数..以这种方式进行是否正确?

m1,m2,m3 and m4 are the medians.. Is it correct to proceed this way?

请解释这些并向我推荐一本与MATLAB中图像处理相关的书籍/指南

推荐答案

我在这里假设,m1,m2,m3,m4取自你之前的一个问题,意思是
他们是中位数5x5窗口的3x3子窗口。

I assume here, m1, m2, m3, m4 are taken from one of your previous questions, meaning thatthey are medians of 3x3 subwindows of a 5x5 window.

也就是说,它们形成如下矩阵:

That is, they form a matrix like this:

m1 m2
m4 m3

或某些类似的配置。

也就是说,第一个if分支意味着:如果m1和m4中位数都小于平均值,m2和m3都是更大(或完全相反),在特定的5x5子窗口中,从左到右应该有一个陡峭的变化。 (请记住,中位数滤除任何单个峰值,这意味着即使图像有噪声也不会检测到太多的假边缘。)至于vec,

That is, the first "if" branch means: if both the m1 and m4 medians are smaller than the average and m2 and m3 are greater (or the full opposite of this happens), there should be a steep change from left to right in that particular 5x5 subwindow. (Remember that medians filter out any single peak value which means that there will be not so many false edges detected even if the image is noisy.) As for vec,

vec=[L(p-2,q) L(p-1,q) L(p+1,q) L(p+2,q)]; % Vertical edge

只存储搜索窗口的垂直中间点。我不认为它会以这种形式起作用,我认为存储边缘索引会更有意义:

just stores the vertical middle points of the search window. I don't think it would work in this form, I would think storing the edge indices would make more sense here:

vec=[[i:i+4]', repmat(j+2, 5, 1)]; 

这将是五个边缘点的坐标,其中边缘被假定为从顶部到在当前搜索窗口的中间。 (您也可以手动检查。)

It would be the coordinates of the five edge points, where the edge is assumed to go from top to down in the middle of the current search window. (You can check this manually too.)

else if的工作方式类似。

The "else if"'s work similarly.

As对于图像处理的起点,我可以推荐一本名为学习OpenCV的书,由Gary Bradski和Adrian Kaehler编写,虽然这不是一本Matlab书。如果你没有阅读本书中的C ++程序和关于OpenCV的详细描述,你仍然可以获得关于图像处理的一个很好的综合知识 - 或者至少你会熟悉主要概念。

As for a starting point on image processing I can recommend you a book called "Learning OpenCV" by Gary Bradski and Adrian Kaehler although that is not a Matlab book. If you do not read the C++ programs in the book and the detailed description about OpenCV, you will still get quite a nice general round-up knowledge about image processing -- or at least you'll get familiar with the main concepts.

至于Matlab的细节,我建议您阅读有关图像处理工具箱的完整帮助。好像听起来一样,我认为只有很难学习图像处理。

As for Matlab specifics, I recommend you reading through the entire help on image processing toolbox. As though as it might sound, I think there is only hard way to learn image processing.

这篇关于在MATLAB中形成集群的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-27 02:23