From: Vivian Harvey on
For example,

I=imread('Image.jpg');
I=rgb2gray(I);
I=im2bw(I,threshold);
I=edge(I);

The edges are broken, how do I continue something like a broken line or thicken the edges not working manually
From: Sean on
"Vivian Harvey" <viv_harv(a)yahoo.co.uk> wrote in message <i0iq2i$f9u$1(a)fred.mathworks.com>...
> For example,
>
> I=imread('Image.jpg');
> I=rgb2gray(I);
> I=im2bw(I,threshold);
> I=edge(I);
>
> The edges are broken, how do I continue something like a broken line or thicken the edges not working manually

It's difficult to answer without seeing your image. However, I would guess a morphological dilation would be a good place to start.
>>help imdilate
From: ImageAnalyst on
Vivian Harvey:
You could try using fspecial() and imfilter() and thresholding it on
your own to get thicker edges rather than rely on the built-in
automatic threshold of edge().

Or else just use imclose(), or imdilate() followed by
bwmorph(imageArray, 'skel') on your edge()-generated image.
-Image Analyst
From: David Young on
Rather than post-processing the edges, it might be worth experimenting with a better edge detector in the first place. The default for the edge function is the simple Sobel operator. You could try other options, for example the Canny detector, and also experiment with its smoothing and threshold parameters. This may well give you more continuous edges.
From: Christopher on
"Vivian Harvey" <viv_harv(a)yahoo.co.uk> wrote in message <i0iq2i$f9u$1(a)fred.mathworks.com>...
> For example,
>
> I=imread('Image.jpg');
> I=rgb2gray(I);
> I=im2bw(I,threshold);
> I=edge(I);
>
> The edges are broken, how do I continue something like a broken line or thicken the edges not working manually

It depends on how close your 'breaks' are. Lets say you have two edges that you want to be joined that are separated by 4 pixels of black (non-edges). You can 'join' them by using morphology, as previously suggested. Define a STREL and work on your image:

diskEnt = strel('disk',4); % radius of 4
joinedIm = imclose(unjoinedIm,diskEnt);

However, this has the habit of joining edges that you DON'T want to join. I've used a 'disk' structure because it's independent of the direction. Better yet, if you know that all of your 'breaks' have a particular geometry, you can structure your STREL according to this. That way, you'll minimise the 'false' joins. This kind of scenario is hard to find though - it all depends on the input image.

Passing a filter over it as previously suggested is a good way to thicken the edges but its a bit hit-and-miss with the joining part.

Chris