Re: Displaying thicker lines on an image [message #76159] |
Sun, 22 May 2011 23:56  |
Bringfried Stecklum
Messages: 75 Registered: January 1996
|
Member |
|
|
wlandsman wrote:
> I have been using edge detection algorithms, so i end up with an image with
> values of 255 on the lines defining the edges, and zeros everywhere else.
> However, when I display the image, the lines don't show up well, so for
> display purposes I want to make the lines thicker. If I had created the
> lines with the PLOT command, I would adjust the THICK keyword. But for an
> image I think I need an algorithm that will identify neighboring pixels to
> the existing lines. Thanks, --Wayne
Dear Wayne,
why don't you just convolve the binary image with a Gaussian kernel of a few
pixels width? You may clip the resulting image at some level chosen to produce
the desired line thickness if it needs to be binary again.
This slight blurring (at the expense of some contrast) is also recommended if
IDL line plots are difficult to discern when presented with a beamer.
Regards, Bringfried
|
|
|
Re: Displaying thicker lines on an image [message #76162 is a reply to message #76159] |
Sat, 21 May 2011 06:49   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
David Fanning writes:
> You might try dilating with a cross as a structuring element.
Here is an example:
image = cgdemodata(21)
edgeImage = (sobel(image) gt 220)
cgdisplay, 800, 400
!p.multi=[0,2,1]
cgimage, edgeImage, /scale
k = intarr(3,3)
k[*,1]=1
k[1,*] = 1
print, k
cgimage, dilate(edgeImage, k), /scale
!p.multi=0
END
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: Displaying thicker lines on an image [message #76163 is a reply to message #76162] |
Sat, 21 May 2011 06:40   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
wlandsman writes:
> I have been using edge detection algorithms, so i end up with an image with values of 255 on the lines defining the edges, and zeros everywhere else. However, when I display the image, the lines don't show up well, so for display purposes I want to make the lines thicker. If I had created the lines with the PLOT command, I would adjust the THICK keyword. But for an image I think I need an algorithm that will identify neighboring pixels to the existing lines.
You might try dilating with a cross as a structuring element.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: Displaying thicker lines on an image [message #76219 is a reply to message #76159] |
Tue, 24 May 2011 07:59  |
wlandsman
Messages: 743 Registered: June 2000
|
Senior Member |
|
|
Thanks David and Bringfried,
Both dilation with a cross and Gaussian smoothing work fine, though the dilation is definitely quicker.
Incidentally, I tried out the new GAUSS_SMOOTH() function introduced in IDL 8.1. (It simply computes a Gaussian kernel and applies the CONVOL function.) I was annoyed to discover that it does nothing to integer images, though no warning is given. The reason is that the kernel data type is forced to match that of the image, and the Gaussian kernel is created with a peak value of 1, so all other kernel pixels are truncated to zero.
Instead, GAUSS_SMOOTH() should convert the input integer data to float, apply the smoothing, and then round back to integer. --Wayne
|
|
|