简体   繁体   English

MATLAB-查找边缘图的局部最大值和最小值(逐行)

[英]MATLAB - Find local maximum and minimum of an edge map (row-wise)

I'll start off by saying I'm new to MATLAB, and this is the first time I'm trying an application related to image processing. 首先,我要说我是MATLAB新手,这是我第一次尝试与图像处理有关的应用程序。

I'm building a MATLAB library (which is to be used in a Windows Phone Application), which takes in an edge map of a natural image as input. 我正在构建一个MATLAB库(将在Windows Phone应用程序中使用),该库将自然图像的边缘图作为输入。 I need to traverse the map row-wise. 我需要逐行遍历地图。 If I come across an edge, I need to find the local minimum and local maximum of the edge. 如果遇到边缘,则需要找到边缘的局部最小值和局部最大值。

I need help figuring out how to; 我需要帮助弄清楚如何做; 1) traverse the edge map - row-wise 2) detect an edge 3) find the local minimum and local maximum of the edge 1)遍历边缘图-行2)检测边缘3)找到边缘的局部最小值和局部最大值

Appreciate any help. 感谢任何帮助。 Thanks in advance :) 提前致谢 :)

This is just a summary of my comments. 这只是我的评论的摘要。 I try to answer your 3) questions given above. 我尝试回答您上面给出的3)问题。

1) There is going to be a nice vectorized way but honestly i ain't sure how that would work. 1)将有一种很好的矢量化方式,但老实说,我不确定这将如何工作。 What works is doing it in a loop. 有效的方法是循环进行。 For a mxn Matrix it could look like this: 对于mxn矩阵,它可能看起来像这样:

for k=1:m
  for l=1:n
    new_Matrix(k,n-l+1) = old_Matrix(k,l);
  end
end

As is said this isn't the best way to solve it since loops have negative impact on your runtime but they should do the trick. 众所周知,这不是解决问题的最佳方法,因为循环会对您的运行时产生负面影响,但是循环应该可以解决问题。

2) Edge-detection: 2)边缘检测:

BW1 = edge(new_Matrix,'sobel');%//Sobel
BW2 = edge(new_Matrix,'canny');%//Canny-filter

3) min and max-value row-wise 3)最小和最大值按行

Matrix_transpose = Matrix'; %//transposed matrix
row_wise_min= min(Matrix_transpose);
row_wise_max = max(Matrix_transpose);

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

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