How to achieve better edge enhancement?
Any suggestion how to enhance the image edges clearly?
I = imread(‘317.jpg’);
% A = rgb2gray(I2);
figure;
imshow(I)
title(‘Original Image’)
%%
% Gaussian LPF
F = fspecial(‘gaussian’);
G = imfilter(I,F);
figure(‘Name’, ‘Gaussian Blur’), imshow(G); title(‘G Image’);
%% Threshold
bw = im2bw(G,0.35);
figure(‘Name’, ‘Binary Image’)
imshow(bw)
% Enhance binary image
kernel = -1*ones(1);
kernel(2,2) = 4;
enhancedImage = imfilter(bw, kernel);
figure(‘Name’, ‘Enhanced’), imshow(enhancedImage); title(‘enhancedImage Image’);
% Crop
D = im2uint8(enhancedImage);
I2 = imcrop(D,[50 68 130 112]);
figure(‘Name’, ‘Cropped’);
imshow(I2)
% User define ROI
r = drawrectangle;
mask = createMask(r);
bw2 = activecontour(I2,mask,30,’Chan-Vese’);
figure(‘Name’, ‘Active Contour’)
imshow(bw2);
hold on;
visboundaries(bw2,’Color’,’r’);
figure(‘Name’, ‘labelOverlay’)
imshow(labeloverlay(I2,bw2));Any suggestion how to enhance the image edges clearly?
I = imread(‘317.jpg’);
% A = rgb2gray(I2);
figure;
imshow(I)
title(‘Original Image’)
%%
% Gaussian LPF
F = fspecial(‘gaussian’);
G = imfilter(I,F);
figure(‘Name’, ‘Gaussian Blur’), imshow(G); title(‘G Image’);
%% Threshold
bw = im2bw(G,0.35);
figure(‘Name’, ‘Binary Image’)
imshow(bw)
% Enhance binary image
kernel = -1*ones(1);
kernel(2,2) = 4;
enhancedImage = imfilter(bw, kernel);
figure(‘Name’, ‘Enhanced’), imshow(enhancedImage); title(‘enhancedImage Image’);
% Crop
D = im2uint8(enhancedImage);
I2 = imcrop(D,[50 68 130 112]);
figure(‘Name’, ‘Cropped’);
imshow(I2)
% User define ROI
r = drawrectangle;
mask = createMask(r);
bw2 = activecontour(I2,mask,30,’Chan-Vese’);
figure(‘Name’, ‘Active Contour’)
imshow(bw2);
hold on;
visboundaries(bw2,’Color’,’r’);
figure(‘Name’, ‘labelOverlay’)
imshow(labeloverlay(I2,bw2)); Any suggestion how to enhance the image edges clearly?
I = imread(‘317.jpg’);
% A = rgb2gray(I2);
figure;
imshow(I)
title(‘Original Image’)
%%
% Gaussian LPF
F = fspecial(‘gaussian’);
G = imfilter(I,F);
figure(‘Name’, ‘Gaussian Blur’), imshow(G); title(‘G Image’);
%% Threshold
bw = im2bw(G,0.35);
figure(‘Name’, ‘Binary Image’)
imshow(bw)
% Enhance binary image
kernel = -1*ones(1);
kernel(2,2) = 4;
enhancedImage = imfilter(bw, kernel);
figure(‘Name’, ‘Enhanced’), imshow(enhancedImage); title(‘enhancedImage Image’);
% Crop
D = im2uint8(enhancedImage);
I2 = imcrop(D,[50 68 130 112]);
figure(‘Name’, ‘Cropped’);
imshow(I2)
% User define ROI
r = drawrectangle;
mask = createMask(r);
bw2 = activecontour(I2,mask,30,’Chan-Vese’);
figure(‘Name’, ‘Active Contour’)
imshow(bw2);
hold on;
visboundaries(bw2,’Color’,’r’);
figure(‘Name’, ‘labelOverlay’)
imshow(labeloverlay(I2,bw2)); image segmentation, edge enhancement, canny, unsharp masking MATLAB Answers — New Questions