From: Avengeline on
I am working on a project of calculating edge width in an image. I have to scan every row in the image to calculate the edge width. In order to do so, I need to detect several local minima and maxima for each row. An edge exists in between a local maxima and minima. There might be a few edges in one row. Any idea how to detect the local minima and maxima?
From: Oleg Komarov on
"Avengeline "
> I am working on a project of calculating edge width in an image. I have to scan every row in the image to calculate the edge width. In order to do so, I need to detect several local minima and maxima for each row. An edge exists in between a local maxima and minima. There might be a few edges in one row. Any idea how to detect the local minima and maxima?
Help min,max (or nanmin/nanmax). Pay attention to the dim argument.

Oleg
From: Greg Heath on
On Jan 6, 5:45 am, "Avengeline " <avengeline....(a)gmail.com> wrote:
> I am working on a project of calculating edge width in an image. I have to scan every row in the image to calculate the edge width. In order to do so, I need to detect several local minima and maxima for each row. An edge exists in between a local maxima and minima. There might be a few edges in one row. Any idea how to detect the local minima and maxima?

If x(i) = max(x(i-1:i+1)) is a start. However, you still
have to deal with x(i) = x(i-1) and/or x(i) = x(i+1).

Similarly with min.

Hope this helps.

Greg
From: Avengeline on
Greg Heath <heath(a)alumni.brown.edu> wrote in message <6ff94dab-0022-4f8b-86c7-96c931657d20(a)b2g2000yqi.googlegroups.com>...
> On Jan 6, 5:45 am, "Avengeline " <avengeline....(a)gmail.com> wrote:
> > I am working on a project of calculating edge width in an image. I have to scan every row in the image to calculate the edge width. In order to do so, I need to detect several local minima and maxima for each row. An edge exists in between a local maxima and minima. There might be a few edges in one row. Any idea how to detect the local minima and maxima?
>
> If x(i) = max(x(i-1:i+1)) is a start. However, you still
> have to deal with x(i) = x(i-1) and/or x(i) = x(i+1).
>
> Similarly with min.
>
> Hope this helps.
>
> Greg


I still can't detect the local minima & maxima through the edge coordinates I obtained. Example, in one row of the image (let's say row = 200), 3 positions of edges are found after edge detection; which are [200 60], [200 155] and [200 240]. Assuming the image is 240 x 240 pixels. So from these coordinates, I have to determine the local minima and maxima for each coordinates based on the graph I plotted for row = 200 of a grayscale image. I am basically stuck here. Any idea?
From: ImageAnalyst on
On Jan 24, 10:48 am, "Avengeline " <avengeline....(a)gmail.com> wrote:
> I still can't detect the local minima & maxima through the edge coordinates I obtained. Example, in one row of the image (let's say row = 200), 3 positions of edges are found after edge detection; which are [200 60], [200 155] and [200 240]. Assuming the image is 240 x 240 pixels. So from these coordinates, I have to determine the local minima and maxima for each coordinates based on the graph I plotted for row = 200 of a grayscale image. I am basically stuck here. Any idea?
--------------------------------------------------------------------------------------------------------
Avangeline:
You're not describing what you want accurately/specifically enough.
You say you have the positions of the edges. Well the max or min is
simply the value of your edge image at those points. Fore example at
[200,60] it would be edgeImage(200, 60) - simple as that. Because
getting the value of an array at a row,column location is so trivially
obvious, I'm not really sure if this is what you meant. So please
explain better.

If you need help locating the max values in the edge image, you can
use imregionalmax().

Make sure you're using the continuous edge image rather than one
that's already been binarized. For example, use imfilter() rather
than edge() or else you won't know the underlying edge strength
values.

clc;
close all;
clear all;
workspace; % Display workspace panel.
% Read in standard MATLAB demo image.
grayImage = imread('cameraman.tif');
subplot(2, 2, 1);
imshow(grayImage, []);
title('Original Grayscale Image');
set(gcf, 'Position', get(0,'Screensize')); % Maximize figure.

edgeImage = imfilter(grayImage,fspecial('sobel') /8,'replicate');
subplot(2, 2, 2);
imshow(edgeImage, []);
title('Edge Image');

peakEdges = imregionalmax(edgeImage, 8);
subplot(2, 2, 3);
imshow(peakEdges, []);
title('Local Peak (Max) Edges');

minEdgeStrength = 15;
strongEdges = edgeImage > minEdgeStrength;
subplot(2, 2, 4);
imshow(strongEdges, []);
title('Strong Edges');

Good luck,
ImageAnalyst