
How to do a 2D convolution result with the log operator for an Image.
    4 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Westin Messer
 el 21 de En. de 2018
  
    
    
    
    
    Respondida: Image Analyst
      
      
 el 21 de En. de 2018
            Hi, I want to apply an LOG enhancement mask for image enhancement using conv2. The LOG enhancement mask to be convolved with the image is: h = [-1 -1 -1; -1 9 -1; -1 -1 -1]; So far this is the code I have but the image is not enhanced at all. Any help would be appricated.
image = imread('mdb001.jpg');
  imshow(image);
    h = [-1 -1 -1; -1 9 -1; -1 -1 -1]
    grayimage= rgb2gray(image);
    im=grayimage;
    i=conv2(h,im);
    figure()
    imshow(i)
0 comentarios
Respuesta aceptada
  Image Analyst
      
      
 el 21 de En. de 2018
        That has nothing to do with log. That's a standard Laplacian high boost filter. Here, try this:
grayImage = imread('peppers.png');
imshow(grayImage);
% Get the dimensions of the image.
% numberOfColorChannels should be = 1 for a gray scale image, and 3 for an RGB color image.
[rows, columns, numberOfColorChannels] = size(grayImage);
if numberOfColorChannels > 1
  % It's not really gray scale like we expected - it's color.
  % Use weighted sum of ALL channels to create a gray scale image.
  grayImage = rgb2gray(grayImage);
  % ALTERNATE METHOD: Convert it to gray scale by taking only the green channel,
  % which in a typical snapshot will be the least noisy channel.
  % grayImage = grayImage(:, :, 2); % Take green channel.
end
% Display the image.
subplot(2, 1, 1);
imshow(grayImage, []);
title('Original Grayscale Image', 'FontSize', fontSize, 'Interpreter', 'None');
h = [-1 -1 -1; -1 9 -1; -1 -1 -1]
filteredImage = conv2(double(grayImage), h, 'same');
% Display the image.
subplot(2, 1, 2);
imshow(filteredImage, [0, 255]);
title('Filtered Image', 'FontSize', fontSize, 'Interpreter', 'None');

0 comentarios
Más respuestas (0)
Ver también
Categorías
				Más información sobre Image Filtering and Enhancement en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

