how to inverse the output image to show image like sketch
4 views (last 30 days)
Show older comments
clc;
clear all;
close all;
Im = imread('sketch.jpg');
Im =double(rgb2gray(Im));
X = double([-1 0 1;-2 0 2;-1 0 1]);
X=rot90(X,2);
Y = double([-1 -2 -1; 0 0 0; 1 2 1]);
Y=rot90(Y,2);
I= Im;
[r,c,z]=size(I);
Fx = zeros(r,c);
Fy = zeros(r,c);
I = padarray(I,[1 1]);
for i=2:r-1
for j=2:c-1
Fx(i,j)=sum(sum(X.*I(i-1:i+1,j-1:j+1)));
Fy(i,j)=sum(sum(Y.*I(i-1:i+1,j-1:j+1)));
end
end
Im=uint8(Im);
FMag=mat2gray(sqrt(Fx.^2+Fy.^2));
im1=FMag;
imshow(im1)
0 Comments
Answers (1)
See Also
Categories
Find more on Convert Image Type in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!