marking on image

1 次查看(过去 30 天)
bahar h
bahar h 2012-4-7
I want to know how can I mark on a threshold segmented image in the segment of it which one of the morphological extracted features is greater than a specified threshold?

采纳的回答

Image Analyst
Image Analyst 2012-4-7
Please look over this demo and see how you use ismember to select objects bigger than 95 pixels, and how you use just normal indexing/assignment to set all those objects to 254 in a single line of code. This is an adaptation of my Image Segmentation tutorial at my File Exchange: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
imtool close all; % Close all imtool figures.
workspace; % Make sure the workspace panel is showing.
fontSize = 20;
% Create sample image.
originalImage = propsSynthesizeImage;
subplot(2, 2, 1);
imshow(originalImage);
impixelinfo; % Allow cursor to show gray levels.
title('Synthetic Image', 'FontSize', fontSize);
% Enlarge figure to full screen.
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);
% Threshold the image to get a binary image (only 0's and 1's) of class "logical."
thresholdValue = 190;
binaryImage = originalImage > thresholdValue; % Bright objects will be the chosen if you use >.
subplot(2, 2, 2);
imshow(binaryImage);
title('Binary Image', 'FontSize', fontSize);
% Label the image.
[labeledImage numberOfOriginalBlobs] = bwlabel(binaryImage, 8); % Label each blob so we can make measurements of it
% Get all the blob properties. Can only pass in originalImage in version R2008a and later.
blobMeasurements = regionprops(labeledImage, originalImage, 'all');
% Now I'll demonstrate how to select certain blobs based using the ismember function.
% Let's say that we wanted to find only those blobs
% with an area greater than 95 pixels.
allBlobAreas = [blobMeasurements.Area];
% Get a list of the blobs that meet our criteria and we need to keep.
allowableAreaIndexes = allBlobAreas > 95; % Take the large objects.
keeperIndexes = find(allowableAreaIndexes);
% Extract only those blobs that meet our criteria, and
% eliminate those blobs that don't meet our criteria.
% Note how we use ismember() to do this.
keeperBlobsImage = ismember(labeledImage, keeperIndexes);
% Re-label with only the keeper blobs kept.
[areasGT95Image numberOfBlobs] = bwlabel(keeperBlobsImage, 8); % Label each blob so we can make measurements of it
% Now we're done. We have a labeled image of blobs that meet our specified criteria.
subplot(2, 2, 3);
% Convert the labeled image back to a binary image.
binary95 = areasGT95Image > 0;
imshow(binary95, []);
title('"Keeper" blobs larger than 95 pixels', 'FontSize', fontSize);
% Make those pixels have a value of 254 in the original image.
outputImage = originalImage; % Make a copy
outputImage(binary95) = 254; % Change the copy.
% Display the final output image.
subplot(2, 2, 4);
imshow(outputImage, []);
title('Original blobs larger than 95 pixels = 254', 'FontSize', fontSize);
  2 个评论
bahar h
bahar h 2012-4-10
Thank you,although it is not exactly what I want , it can help me.
Image Analyst
Image Analyst 2012-4-10
It might have been what you wanted if you said what you wanted. "which one of the morphological extracted features is greater than a specified threshold" is not exactly very specific.

请先登录,再进行评论。

更多回答(3 个)

bahar h
bahar h 2012-4-14
Hi,sorry I was wrong,I checked again and find out that your answer is the exact thing which I expected.thank you,but I have one more question:I wrote my program with 3 different thresholds within each of them 3 features have been extracted on the other hand my output is 9 images that some points are displayed on each of them,now I would like to know how may I show all of these images in one image in order to have all the points that met our criteria on different 9 images,together on one image.I think it is something like superimposing. Thanks again
  1 个评论
Image Analyst
Image Analyst 2012-4-14
I don't know how "some points are displayed" but if you used plot() or some other type of graphics function to put stuff into the overlay, you can just call axes() to set the current axes, then call plot(), then call hold on, then call plot again to plot all your other points that you want to be on the same image. (Don't switch to another axes or else they'll appear there instead.)
On the other hand if you want to superimpose all the images, you can do this:
meanImage = (single(image1) + single(image2) + ..... + single(image9))/9;
imshow(meanImage, []);

请先登录,再进行评论。


bahar h
bahar h 2012-4-15
Hi thank you, I found out I just plus the images and got the result.thanks again

sneha
sneha 2012-4-18
hi expert......... i m working on car license plate recognition...can u tell me how cold i recognize characters fron license plate using OCR...plz ans me
  1 个评论
Image Analyst
Image Analyst 2012-4-18
You're best off searching for license plate or LPR in this forum. This question is asked almost daily here.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 3-D Volumetric Image Processing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by