how to enhance edge on images without nearest pixel loss can any one help me?

2 views (last 30 days)
how to enhance edge on images without nearest pixel loss can any one help me?

Accepted Answer

Image Analyst
Image Analyst on 27 Jul 2017
Try filtering with a filter that's all -1 except the center which is positive and equal to one less than the negative sum of the -1 elements.
grayImage = imread('cameraman.tif');
windowWidth = 5; % Whatever. Change for different effects.
kernel = -1 * ones(windowWidth);
kernel(ceil(windowWidth/2), ceil(windowWidth/2)) = -sum(kernel(:)) - 1 + windowWidth^2
kernel = kernel / sum(kernel(:)) % Normalize.
out = imfilter(grayImage, kernel);
imshow(out, []);
  2 Comments
Selva Karna
Selva Karna on 28 Jul 2017
Thanks analysit but i get error , it means i get in loss in edges of image, any other way to enhance image edges after segment.
Image Analyst
Image Analyst on 28 Jul 2017
I just copied and pasted and it ran flawlessly - no error whatsoever. Please post your error - ALL the red text so I can fix your (modified) code.
I don't know what you mean by "get in loss in edges of image" - I thought it threw an error and didn't run. If it did run, then what does "loss" mean to you? The edges will NOT be blurred, then will be accentuated. Just look at the edges (once you've corrected any errors) and you will see they look different. Of course it's not the exact same as the original (if that's what you meant by "loss"), but you didn't want that - you wanted enhanced so that's what it does. There are other ways to enhance edges I suppose but this is the most common. It uses convolution, and as you know, convolution can also be done in the Fourier domain. There are lots of other algorithms that do things like smooth regions except keep edges sharp, like mean shift filter, etc. but I can't give an entire course on image filtering here. Why don't you say WHY you want to enhance edges? I might be able to give a better answer once I know the big picture - the higher level context.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!