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 件のコメント
採用された回答
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.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Image Processing Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!