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

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Clusters and Clouds에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by