How do I remove grid lines from a JPEG image using Image Processing Toolbox 6.2 (R2008b)?
11 次查看(过去 30 天)
显示 更早的评论
I have a grayscale JPEG image that is largely dark and contains thin gray grid lines. I would like to replace the pixels forming the grid with pixels that fit in with the rest of the image.
采纳的回答
MathWorks Support Team
2013-4-6
The following example code demonstrates one way to remove thin grid lines from an image using erosion and dilation and compares the original image with the processed image.
close all; clear all; clc;
% Create image with light gray grid lines
I = imread('snowflakes.png');
I(:,[100,200,300]) = uint8(200);
I([50,100],:) = uint8(200);
subplot(2,1,1);
imshow(I);
title('Original image');
% Morphologically open image
se = strel('square',2);
I2 = imopen(I,se);
subplot(2,1,2);
imshow(I2);
title('Morphologically opened image');
0 个评论
更多回答(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!