How to separate image as like below in the given link?

1 次查看(过去 30 天)
hi FRIENDS,
thanks to all ..i have an image .by applying GAUSSIAN STANDARD SMOOTHING FILTER I HAVE TO GET THE RESULT LIKE
(GAUSSIAN SMOOTHING FILTER)
ORIGINAL IMAGE -----------------------------> SMOOTH PART +EDGES
sigma=5,
I=imread('lena256.jpg');
h=fspecial('gaussian',[10,10],sigma);
figure,surfc(h);
o=imfilter(I,h,'same','conv');
figure,imshow(o);
HOW TO SEPARATE IT ... HERE I HAVE CODE FOR GETTING SMOOTH PART.. HOW TO FOR EDGES PART OF IMAGE ...I HAVE LINK FOR THIS PLEASE GO THROUGH IT.. THEY HAVE GIVEN FOUR FIGURES ..BOTTOM ROW OF FIGURES I WANTED TO GET ...PLEASE ANY ONE HELP ME
  2 个评论
Jan
Jan 2011-9-24
Using standard upper/lower case improves the readability.
krithika P
krithika P 2011-9-25
k thanks for your contribution... i will mind case for my next post ..

请先登录,再进行评论。

采纳的回答

Image Analyst
Image Analyst 2011-9-24
Like it said, just subtract the smoothed image from the original. That will give you the "edges" or higher spatial frequencies. Since you at least gave a shot at it with some code, I'll give you some "corrected" code:
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
imtool close all; % Close all imtool figures.
clear; % Erase all existing variables.
workspace; % Make sure the workspace panel is showing.
fontSize = 15;
% Read in a standard MATLAB color demo image.
folder = fullfile(matlabroot, '\toolbox\images\imdemos');
baseFileName = 'peppers.png';
fullFileName = fullfile(folder, baseFileName);
% Get the full filename, with path prepended.
fullFileName = fullfile(folder, baseFileName);
if ~exist(fullFileName, 'file')
% Didn't find it there. Check the search path for it.
fullFileName = baseFileName; % No path this time.
if ~exist(fullFileName, 'file')
% Still didn't find it. Alert user.
errorMessage = sprintf('Error: %s does not exist.', fullFileName);
uiwait(warndlg(errorMessage));
return;
end
end
rgbImage = imread(fullFileName);
% Get the dimensions of the image. numberOfColorBands should be = 3.
[rows columns numberOfColorBands] = size(rgbImage);
% Display the original color image.
subplot(2, 2, 1);
imshow(rgbImage, []);
title('Original Color Image', 'FontSize', fontSize);
% Enlarge figure to full screen.
% set(gcf, 'Position', get(0,'Screensize'));
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);
sigma = 7;
h=fspecial('gaussian',[35, 35], sigma);
% Display the original color image.
subplot(2, 2, 2);
surfc(h);
title('Gaussian Blurring Kernel', 'FontSize', fontSize);
% Smooth it in RGB space.
smoothedImage = imfilter(rgbImage, h, 'same', 'conv');
% Display the image.
subplot(2, 2, 3);
imshow(smoothedImage, []);
title('Smoothed Color Image (Low Pass Image)', 'FontSize', fontSize);
% Calculate the difference
diffImage = smoothedImage - rgbImage;
% Display the image.
subplot(2, 2, 4);
imshow(diffImage, []);
title('Edges Image (High Pass Image)', 'FontSize', fontSize);
msgbox('Done with demo!');
However, you're probably better off doing it in the V channel of HSV color space, rather than in rgb color space, to avoid color artifacts.
  1 个评论
krithika P
krithika P 2011-9-25
Exactly what i want you have provided...thank you so much ..continue the great job..it is very helpful to me..thanks once again

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by