how to inverse the output image to show image like sketch
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Image Analyst
el 6 de Ag. de 2020
To invert the image subtract from 1:
FMag = 1 - FMag;
0 comentarios
Ver también
Categorías
Más información sobre Convert Image Type en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!