フィルターのクリア

Detecting bubbles from images

14 ビュー (過去 30 日間)
Sander Khowaja
Sander Khowaja 2016 年 6 月 28 日
コメント済み: Vidya Viswanathan 2016 年 7 月 11 日
Dear Experts, I am trying to detect bubbles from a glass image which is attached with this post. I have written a piece of code, I am able to detect some bubbles but still some bubbles/circles are left out, somebody can help me out what to do in this case. I am also facing problems while I use different sized image, as the same threshold doesn't work for all images, threshold refers to all the values, related to sensitivity, edge threshold and radius of the circle in this case. Awaiting for the guidance from the experts.
close all clear all clc warning off
image = imread('STILL095.jpg'); % read image
% get image dimensions: an RGB image has three planes % reshaping puts the RGB layers next to each other generating % a two dimensional grayscale image
[height, width, planes] = size(image);
rgb = reshape(image, height, width * planes);
imagesc(rgb); % visualize RGB planes
r = image(:, :, 1); % red channel
g = image(:, :, 2); % green channel
b = image(:, :, 3); % blue channel
threshold = 100; % threshold value
imagesc(b < threshold); % display the binarized image
% apply the blueness calculation
blueness = double(b) - max(double(r), double(g));
imagesc(blueness); % visualize RGB planes
H = fspecial('average',125); % Creating a low pass filter
filtimg = imfilter(blueness,H); % applying a low pass filter to the image
imagesc(filtimg)
hfiltimg = filtimg - blueness; % converting it to a high pass filtered image for enhancing edges
imagesc(hfiltimg)
B = im2bw(hfiltimg); % converting the image in black and white
se = strel('disk',3); % creating a structure element of radius 3
er = imclose(B,se); % perfoming image closing operation
[centersBright2, radiiBright2, metricBright2] = imfindcircles(er,[6 90], ... 'ObjectPolarity','bright','Sensitivity',0.65,'EdgeThreshold',0.4);
imshow(image) %Plotting the circles on the original image
h2 = viscircles(centersBright2, radiiBright2);
  1 件のコメント
Vidya Viswanathan
Vidya Viswanathan 2016 年 7 月 11 日
Hi,
I am not sure if you have come across this already, but for your specific use case, I would suggest you to try out active contour based segmentation technique. The following documentation link has the description of the function and an example for the same:
I hope this helps.
Regards,
Vidya Viswanathan

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by