clustering based on area

3 ビュー (過去 30 日間)
izyan hanum
izyan hanum 2015 年 3 月 23 日
コメント済み: Image Analyst 2018 年 3 月 2 日
i already measured the area on my sputum cell. now i want to cluster it based on area. area >2000 in figure 1 and area 2000< is in other figure 2. can i know the simple tutorial.? i dont want to use k mean clustering because it very complicated. i only want to cluster them as simple as i can
  4 件のコメント
martin SALGADO
martin SALGADO 2015 年 11 月 12 日
Your code Image Segmentation Tutorial is for segment images, but I want only one way clustering a set of points, and the area that contains the items is less than some value.
izyan hanum
izyan hanum 2015 年 12 月 3 日
you can email me izyanhanum@yahoo.com

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

採用された回答

wil
wil 2015 年 3 月 24 日
Hi, I've looked at the code and I've worked out what you need. Before your final loop "% Loop over all blobs printing their measurements to the command window", add the line
vols = zeros(1,numberOfBlobs); % create list to contain cell areas
and then at the end of the loop (before end), simply add
vols(k) = blobArea; % add area to vols
Then, the code you require to plot two images (one for the smaller, one for the bigger) as binary images. The lists idxs_1 and idx_2 contain the indexes for the cells belonging to each group. You can use this to add more qualifiers, and create different groups if you need to.
idxs_1 = find(vols < 2000); % indexes of vols that are lower than 2000
idxs_2 = find(vols >= 2000);
cells_1 = zeros(size(hImage)); % create blank binary images
cells_2 = zeros(size(hImage));
for i = 1:numel(idxs_1) % add small blobs to image 1
cells_1(blobMeasurements(idxs_1(i)).PixelIdxList) = 1;
end
for i = 1:numel(idxs_2) % add larger blobs to image 2
cells_2(blobMeasurements(idxs_2(i)).PixelIdxList) = 1;
end
% display
figure(4), subplot (2,2,1), imshow(cells_1,[]);
figure(4), subplot (2,2,2), imshow(cells_2,[]);
I hope this solves your problem.
Cheers, Wil
  2 件のコメント
izyan hanum
izyan hanum 2015 年 3 月 24 日
yes sir.............. that i want sir..... im very happy now... thank you may god bless you..
Image Analyst
Image Analyst 2018 年 3 月 2 日
It's simpler to just use bwareafilt().

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

その他の回答 (2 件)

wil
wil 2015 年 3 月 23 日
Hi,
k-means is probably the simplest method of clustering, but if you simply want to sort the regions based on their area, you can use logical indexing or the find() method.
It depends on they type of data your groups are, but if they are simply binary images you can use (assuming the cells are contained in a cell, change as appropriate)
vol = cells{i};
area(i) = numel(vol(vol ~= 0));
to get the area for each cell and sort them using
idxs_1 = find(area < 2000);
idxs_2 = find(area >= 2000);
cells_1 = cells(idxs_1);
cells_2 = cells(idxs_2);
The groups cells_1 and cells_2 now contain your grouped cells.
Hope this helps, let me know if anything needs clarifying.
Wil
  1 件のコメント
izyan hanum
izyan hanum 2015 年 3 月 23 日
i run but still have error :( this is my picture

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


izyan hanum
izyan hanum 2015 年 3 月 23 日
i dont know how to send the code here using microsoft
  1 件のコメント
izyan hanum
izyan hanum 2015 年 3 月 23 日
https://word.office.live.com/wv/WordView.aspx?FBsrc=https%3A%2F%2Fwww.facebook.com%2Fattachments%2Ffile_preview.php%3Fid%3D734274853338438%26time%3D1427127122%26metadata&access_token=100003736390577%3AAVKwfhY8Bg_OXG_qYVHRh4hByGWdBCkH8QqLBSW3UOoxzQ&title=Try+thresholding+in+HSV+color+space+to+get+purple+blobs+but+not+black+blobs+or+yellow+background.docx

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by