how can i compare plot of a image of bacteria with different plots of images of microorganism

sir i am talking about plots of images.hope you are getting me comparison simply means in context of shape of image.sir i want to compare two images of different sample and identify the type on basis of shape

 채택된 답변

Extract the blue channel, threshold, call imclearborder to get rid of partial cells, label, then call regionprops and ask for various shape parameters like area, perimeter, EulerNumber, Solidity, etc.

댓글 수: 3

shanu, not sure what happened - maybe you had to leave or couldn't do it or something. Here's what I did for you:
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
imtool close all; % Close all imtool figures if you have the Image Processing Toolbox.
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 20;
folder = 'd:\Temporary stuff';
baseFileName = 'slide2.png';
% Get the full filename, with path prepended.
fullFileName = fullfile(folder, baseFileName);
if ~exist(fullFileName, 'file')
% Didn't find it there. Check the search path for it.
fullFileName = baseFileName; % No path this time.
if ~exist(fullFileName, 'file')
% Still didn't find it. Alert user.
errorMessage = sprintf('Error: %s does not exist.', fullFileName);
uiwait(warndlg(errorMessage));
return;
end
end
rgbImage = imread(fullFileName);
% Get the dimensions of the image. numberOfColorBands should be = 3.
[rows, columns, numberOfColorBands] = size(rgbImage);
% Display the original color image.
subplot(2, 2, 1);
imshow(rgbImage);
title('Original Color Image', 'FontSize', fontSize);
% Enlarge figure to full screen.
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);
% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
% Green channel looks the best, so take that one.
% Display the original color image.
subplot(2, 2, 2);
imshow(greenChannel);
title('Green Image', 'FontSize', fontSize);
% Threshold the image to create a binary image.
binaryImage = greenChannel < 136;
% Get rid of regions touching the edge fothe image because we
% can't know everything about them: area, perimeter, etc. because part is missing.
binaryImage = imclearborder(binaryImage);
subplot(2, 2, 3);
imshow(binaryImage);
title('Binary Image', 'FontSize', fontSize);
% Label each blob with 8-connectivity, so we can make measurements of it
[labeledImage, numberOfBlobs] = bwlabel(binaryImage, 8);
% Apply a variety of pseudo-colors to the regions.
coloredLabelsImage = label2rgb (labeledImage, 'hsv', 'k', 'shuffle');
% Display the pseudo-colored image.
subplot(2, 2, 4);
imshow(coloredLabelsImage);
% Get all the blob properties. Can only pass in originalImage in version R2008a and later.
blobMeasurements = regionprops(labeledImage, greenChannel, ...
'Area', 'Perimeter', 'Centroid', 'Solidity', 'EquivDiameter');
title('Different Blobs Labeled', 'FontSize', fontSize);
for blob = 1 : numberOfBlobs
fprintf('Blob #%d: Area=%.2f, Perim=%.2f, Solidity=%.2f, ECD=%.2f\n', blob,...
blobMeasurements(blob).Area, ...
blobMeasurements(blob).Perimeter, ...
blobMeasurements(blob).Solidity, ...
blobMeasurements(blob).EquivDiameter);
end
msgbox('Done with demo. Look in command window');
Blob #1: Area=22.00, Perim=16.83, Solidity=0.92, ECD=5.29
Blob #2: Area=14735.00, Perim=636.94, Solidity=0.95, ECD=136.97
Blob #3: Area=8.00, Perim=9.41, Solidity=0.89, ECD=3.19
Blob #4: Area=299.00, Perim=76.97, Solidity=0.86, ECD=19.51
Blob #5: Area=26.00, Perim=18.24, Solidity=0.93, ECD=5.75
Blob #6: Area=2.00, Perim=2.00, Solidity=1.00, ECD=1.60
Blob #7: Area=28.00, Perim=25.66, Solidity=0.76, ECD=5.97
Blob #8: Area=8928.00, Perim=502.59, Solidity=0.95, ECD=106.62
Blob #9: Area=2.00, Perim=2.00, Solidity=1.00, ECD=1.60
Blob #10: Area=2.00, Perim=2.00, Solidity=1.00, ECD=1.60
Blob #11: Area=3.00, Perim=4.00, Solidity=1.00, ECD=1.95
Please respond, like marking my answer as "Accepted" if it does what you need.
sir, if i want to compare the shape of two different images of different sample then how could i do that?Please reply soon for this...
You could try morphometrics: http://en.wikipedia.org/wiki/Morphometrics No, I don't have any MATLAB code for that. Or you could calculate other things like the circularity =Perimeter^2/(4*pi*area), Solidity, major and minor axes, etc. I think I've done a great deal for you. Surely you must expect to do some of this yourself and not have me write the whole thing for you for free. I'll give you one more snippet to calculate circularities.
allPerimeters = [blobMeasurements.Perimeter];
allAreas = [blobMeasurements.Area];
circularities = appPerimeters .^ 2 ./ (4*pi*allAreas);
% Perfect circles will be 1 and gets bigger the more tortuous the border is.

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

추가 답변 (0개)

질문:

2014년 1월 25일

편집:

2014년 1월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by