Removing noise from binary iamge
37 ビュー (過去 30 日間)
表示 古いコメント
Hello, there are problems that I faced during extracting the background from the image below. Im using image>background to extract them and change it to a binary image. The binary image shows too much noise that I could not count the number of cars in the image. Is it possible to filter out the image and have only the cars left in the binary image? Could it be the method of extracting the backgrounds are wrong or filtering would work? Thanks in advance.

採用された回答
Matt J
2018 年 7 月 9 日
編集済み: Matt J
2018 年 7 月 9 日
This might help. Basically, the idea is to quantize the background and develop a mask that gets rid of a lot of the extraneous detail around the cars.
C=im2double(imread('Cars.jpg'));
B=im2double(imread('Background.jpg'));
maxchan=max(B,[],3);
threshmax = multithresh(maxchan,4);
Qmax=imquantize(maxchan,threshmax);
bw=bwareafilt( Qmax==2,1);
bw=imclose(bw,strel('disk',10));
D=rgb2gray(bw.*(C-B));
thresh=multithresh(D,2);
result=bwareafilt( imquantize(D,thresh)>1, [10,inf]);
imshow(result)

9 件のコメント
PBM
2020 年 5 月 29 日
Hi Matt,
Thanks for your response. I just did something similar and yes it was trial and error. I will attempt deep learning recognition techniques for a more general solution... thanks!
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!