0

有人可以帮助我将此图像变成黑白图像(非灰度图像),其中粒子是黑色的,背景是白色的? (或签证诗)。将粒子分割成黑白图像

它不像图像阈值那么简单,因为背景强度不同,减去(高斯)模糊版本确实改善了情况,但还不够。

最好

马库斯

enter image description here

+0

是不是已经黑人和白人? –

回答

2

我建议你使用高通滤波以去除缓慢变化研究背景,然后应用阈值。

我试过一个非常简单的高通滤波器形式:用常数矩阵(这是一个低通滤波器)进行卷积,然后从原始图像中删除。

查看示例结果。

im = double(imread('tmp.jpg')); 
im = im./max(im(:)); % normalize original image 

N = 200; % select N of the order of background color spatial variations 
imf = filter2(ones(N)/N^2,im); % normalized low-pass filter 
imf = im - imf; % high-pass filter 
imf = imf-min(imf(:)); % normalize between 0... 
imf = imf/max(imf(:)); % ... and 1 

threshold = .4; % select as appropriate 
imft = imf < threshold; 
imagesc(imft), colormap(gray), axis image 

enter image description here