フィルターのクリア

Trying to mask a bmp image to get rid of bright spots

2 ビュー (過去 30 日間)
Steven Manz
Steven Manz 2020 年 5 月 21 日
コメント済み: Steven Manz 2020 年 5 月 22 日
See the bmp attached to see raw image. There are bright spots on the picture. I can find them by simply asking for the pixels that are less than a certain threshold.
However, when masking to the image, I would like to somehow git rid of the bright spot and then smooth out the values to match the values around it so the picture looks like it would without bright spots. Here is the code I was trying to use:
% prepare directory info
path_info = fullfile(path, '00mm_50.bmp');
dir_info = dir(path_info);
% read images
filename = strcat(path, dir_info.name);
raw_image = imread(filename)';
% Mask
threshold = max(max(raw_image))/2;
M = raw_image < threshold;
figure()
imshow(M)
% figure()
% mesh(raw_image)
% prepare directory info
path_info = fullfile(path, '00mm_170.bmp');
dir_info = dir(path_info);
% read images
filename = strcat(path, dir_info.name);
raw_image = imread(filename)';
% Mask image
raw_image = M & raw_image;
figure()
imshow(raw_image)
When this is ran, the output is a logical image of 0's and 1's. However, i want the original image with pixel values from 0 to 255, where there are no bright spots and the bright spots are smoothed out to match the surrounding values so the image looks like the raw image if the picture was taken with no bright spots.

採用された回答

Image Analyst
Image Analyst 2020 年 5 月 22 日
You need to use regionfill after you've thresholded to find the bright spots. Write back if you can't figure it out.
  1 件のコメント
Steven Manz
Steven Manz 2020 年 5 月 22 日
Yep, that worked great. I was not aware of this tool. Thank you!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by