i have created bounding box in my image, now i want to separate the two of the boxes differently , how could i do so ??

1 view (last 30 days)
i have used regionprops for creation of boundingbox. thnks for the help in advance.
  2 Comments
Image Analyst
Image Analyst on 23 Sep 2018
The boxes are in a structure array. Loop over those structures, making your "score" (whatever that may be) measurements inside the box and keep track of the best one. Start a new question with your own image and your own code if you need more help.

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 22 Mar 2014
Edited: Image Analyst on 23 Sep 2018
What does that mean? Each box IS different. What do you mean by you "want to separate the two of the boxes differently" - I have no idea. Do you want to crop each out into a separate image like I do in my BlobsDemo?
  2 Comments
Image Analyst
Image Analyst on 22 Mar 2014
Did you look at that code? If/when you do, you'll find this code:
message = sprintf('Would you like to crop out each coin to individual images?');
reply = questdlg(message, 'Extract Individual Images?', 'Yes', 'No', 'Yes');
% Note: reply will = '' for Upper right X, 'Yes' for Yes, and 'No' for No.
if strcmpi(reply, 'Yes')
figure;
% Maximize the figure window.
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);
for k = 1 : numberOfBlobs % Loop through all blobs.
% Find the bounding box of each blob.
thisBlobsBoundingBox = blobMeasurements(k).BoundingBox; % Get list of pixels in current blob.
% Extract out this coin into it's own image.
subImage = imcrop(originalImage, thisBlobsBoundingBox);
% Determine if it's a dime (small) or a nickel (large coin).
if blobMeasurements(k).Area > 2200
coinType = 'nickel';
else
coinType = 'dime';
end
% Display the image with informative caption.
subplot(3, 4, k);
imshow(subImage);
caption = sprintf('Coin #%d is a %s.\nDiameter = %.1f pixels\nArea = %d pixels', ...
k, coinType, blobECD(k), blobMeasurements(k).Area);
title(caption, 'FontSize', 14);
end
Please mark the answer as Accepted, though you can still ask questions about your code if you show it to me.. Thanks.

Sign in to comment.

More Answers (0)

Categories

Find more on Image Processing Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!