COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### Sobel Edge Detection

• Follow

```After using sobel edge detection on an image..

I plotted a graph of pixel values vs pixel position (for one row of the image)..

The link of the graph is attached here: http://farm5.static.flickr.com/4010/4423446095_1f8d52cc4a_b.jpg

I located all the edge positions and plotted them on the same graph using marker 'o'

I am confused on one thing.. probably I do not have a deeper understanding on edge detection...

Is it only 1 edge lies between a local maxima and minima?

In my graph, 2 edges (E1 & E2) lie in between the same local maxima and minima.. is it possible?

```
 0
Reply Avengeline 3/11/2010 4:27:04 AM

```Sure it's possible.  When you threshold the edge image (which is
normally a  gray scale image except if you use the MATLAB edge()
function which thresholds and thins it for you), you will possibly get
thick edges.  If you want them thinner, call bwmorph with the 'skel'
option to thin them down to single lines.
```
 0
Reply ImageAnalyst 3/11/2010 11:20:48 AM

```ImageAnalyst <imageanalyst@mailinator.com> wrote in message <d9a137cb-9fef-433f-ba7e-27a13e3fa204@u9g2000yqb.googlegroups.com>...
> Sure it's possible.  When you threshold the edge image (which is
> normally a  gray scale image except if you use the MATLAB edge()
> function which thresholds and thins it for you), you will possibly get
> thick edges.  If you want them thinner, call bwmorph with the 'skel'
> option to thin them down to single lines.

Hi. Thanks.. I tried with..

BW = edge(Y,'sobel',[], 'vertical');
B1 = bwmorph(BW,'skel',Inf);

....but still no difference. Any other suggestion?
```
 0
Reply Avengeline 3/11/2010 1:54:08 PM

```On Mar 11, 8:54=A0am, "Avengeline " <avengeline....@gmail.com> wrote:
> BW =3D edge(Y,'sobel',[], 'vertical');
> B1 =3D bwmorph(BW,'skel',Inf);
>
> ...but still no difference. Any other suggestion?
---------------------------------------------------------------------------=
--------------
Yes - that's not surprising.

Apparently you didn't read or understand what I said about the built-
in edge() function automatically thresholding and skeletonizing the
gray scale edge image.  So it makes sense (now that you know this)
that skeletonizing an already skeletonized image will make no
difference.

I'm not sure what you want to do.  Do you want thin edges or thick
edges?

If you want the original, un-processed edge image, you should look up
fspecial() and imfilter().

And like Ashish recommended, posting an image somewhere (like http://drop.i=
o)
might help in this conversation.

```
 0
Reply ImageAnalyst 3/11/2010 2:56:42 PM

```ImageAnalyst <imageanalyst@mailinator.com> wrote in message <87b76e9b-a30a-4b52-a3e4-2924dac10e8d@e7g2000yqf.googlegroups.com>...
> On Mar 11, 8:54 am, "Avengeline " <avengeline....@gmail.com> wrote:
> > BW = edge(Y,'sobel',[], 'vertical');
> > B1 = bwmorph(BW,'skel',Inf);
> >
> > ...but still no difference. Any other suggestion?
> -----------------------------------------------------------------------------------------
> Yes - that's not surprising.
>
> Apparently you didn't read or understand what I said about the built-
> in edge() function automatically thresholding and skeletonizing the
> gray scale edge image.  So it makes sense (now that you know this)
> that skeletonizing an already skeletonized image will make no
> difference.
>
> I'm not sure what you want to do.  Do you want thin edges or thick
> edges?
>
> If you want the original, un-processed edge image, you should look up
> fspecial() and imfilter().
>
> And like Ashish recommended, posting an image somewhere (like http://drop.io)
> might help in this conversation.

I guess I dont have a deeper understanding on the edge() function..

Anyway,.. in your point of view...

from this graph... http://farm5.static.flickr.com/4068/4426963732_90f9fd0658_o.jpg

I know it is possible to have an edge like E2..

How about for E1 and E3?

The y-axis is the gray value.. x-axis is the column position of the image..
this graph is plotted based on one row of image... but till column 15..
```
 0
Reply Avengeline 3/12/2010 10:14:06 AM

```I suppose.  Why don't you post an image and see what we can do with
that?
```
 0
Reply ImageAnalyst 3/12/2010 11:49:20 AM

```ImageAnalyst <imageanalyst@mailinator.com> wrote in message <d3f578b7-f1b7-4b37-981e-03cbd706b772@f8g2000yqn.googlegroups.com>...
> I suppose.  Why don't you post an image and see what we can do with
> that?

this is the image: http://drop.io/gyx0i87/asset/img150-bmp

basically, i convert the image to ycbcr.. take y component image..
did sobel edge detection (default threshold) on the y component image..
then...
at row 4, col 767.. an edge is detected..

here is the graph: http://farm3.static.flickr.com/2524/4426368251_9723da179f_o.jpg

yaxis-luminance value..
x-axis-column position from 760 to 768..

if such case happen.. may i know what is the local minima and local maxima for that edge position...

the local maxima is the same as the edge position?
```
 0
Reply Avengeline 3/12/2010 12:41:06 PM

```There are so many edges in this image that it's basically a judgement
call.  There are lots of algorithms that would give different edges on
it.  If you're looking for accuracy - well, they're all accurate, or
none of them are accurate.  It really depends on how YOU want to
define an edge.  So at this point you really have to step back and ask
why you are computing edges.  There must be some reason.  You don't
just find edges for the heck of it.  What are you really after?  Maybe
edges aren't even the way to go.  Maybe you want color classification
or something.
```
 0
Reply ImageAnalyst 3/12/2010 1:08:45 PM

```i just want to find the edge width for every edges.. then divided by the number of edges to obtain a blur metric.. so, what do you say?
```
 0
Reply Avengeline 3/12/2010 1:36:22 PM

```On Fri, 12 Mar 2010 08:36:22 -0500, Avengeline  <avengeline.biz@gmail.com>
wrote:

> i just want to find the edge width for every edges.. then divided by the
> number of edges to obtain a blur metric.. so, what do you say?

It would help if you clarify for us what you mean by an 'edge'.

You first post indicated that you were looking for edges by scanning the
image along a row. This would be useful to detect edges which are
vertical. What do you plan to do when an edge is not vertical? A
non-vertical edge might explain what you see in your graph.

Y=conv_i(:,:,1);
BW = edge(Y,'sobel',[], 'vertical');
imshow(BW)

If you run this, how would you manually define the 'number of edges'? (or
are you looking for the number of disconnected vertical lines in the sobel
filtered image which is longer than a given minimum lenght :) )?

I am not familiar with 'blur metrics', if might help other CSSMers to
elaborate.
```
 0
Reply Ashish 3/12/2010 2:36:16 PM

```On Mar 12, 8:36=A0am, "Avengeline " <avengeline....@gmail.com> wrote:
> i just want to find the edge width for every edges.. then divided by the =
number of edges to obtain a blur metric.. so, what do you say?

---------------------------------------------------------------------------=
--------
How about something like this:

clc;
clear all;
close all;
workspace;
% Get the original image and display it.
filename =3D 'C:\Documents and Settings\tk2013\My Documents\Temporary
stuff\img150.bmp';
subplot(2,2,1);
imshow(rgbImage);
title('Original color Image');
set(gcf, 'Position', get(0,'Screensize')); % Maximize figure.

% Get the luminance channel and display it.
conv_i =3D rgb2ycbcr(rgbImage);
Y =3D conv_i(:,:,1);
subplot(2,2,2);
imshow(Y, []);
title('Y image');

% Create a Sobel filtered image.
sobelFilter =3D fspecial('sobel');
edgeImage =3D imfilter(Y, sobelFilter, 'replicate');

% BW =3D edge(Y,'sobel',[], 'vertical');
% Display Sobel image.
subplot(2,2,3);
imshow(edgeImage, []);
title('Edges of the Y Image');
% Calculate a metric that is related to
% how many edges are in the image and their strength.
sumOfValues =3D sum(edgeImage(:));
message =3D sprintf('The edge parameter for this image is %d',
sumOfValues);
msgbox(message);

Or you could look at the energy in certain ranges of the FFT to
characterize blur.  Usually blur is characterized by the Modulation
Transfer Function (MTF).  You should look that up since it's pretty
much the standard.  But it assumes that you know what the true, blur-
free image looks like.
```
 0
Reply ImageAnalyst 3/12/2010 3:59:30 PM

10 Replies
834 Views

(page loaded in 0.073 seconds)

Similiar Articles:

7/22/2012 10:11:45 AM