detecting and labeling an object from an image

1 次查看(过去 30 天)
I am trying to detect and label some objects of interest from image sequences using feature matching, tried SURF, BRISK, MSER etc. until now but mostly either there are no matched features or I get only 1 or 2 matches with which I can't label the object (mean label all the pixels of that object). Can someone suggest something. Here is code for MSER features and sample images.
Ib=imread('ball.png'); %object image
Is=imread('image_000002.jpg'); % scene image
Ib=rgb2gray(Ib);
Is=rgb2gray(Is);
regionsb = detectMSERFeatures(Ib);
regionss = detectMSERFeatures(Is);
[featuresb, validPtsObjb] = extractFeatures(Ib, regionsb);
[featuress, validPtsObjs] = extractFeatures(Is, regionss);
bPairs = matchFeatures(featuresb, featuress);
matchedBPoints = regionsb(bPairs(:, 1), :);
matchedSPoints = regionss(bPairs(:, 2), :);
figure;
showMatchedFeatures(Ib, Is, matchedBPoints, matchedSPoints, 'montage');
title('Putatively Matched Points (Including Outliers)');
[tform, inlierBPoints, inlierSPoints] = estimateGeometricTransform(matchedBPoints, matchedSPoints, 'affine');
figure;
showMatchedFeatures(Ib, Is, inlierBPoints, inlierSPoints, 'montage');
title('Matched Points (Inliers Only)');
bPolygon = [1, 1;... % top-left
size(Ib, 2), 1;... % top-right
size(Ib, 2), size(Ib, 1);... % bottom-right
1, size(Ib, 1);... % bottom-left
1, 1];
newBPolygon = transformPointsForward(tform, bPolygon);
figure;
imshow(Is);
hold on;
line(newBPolygon(:, 1), newBPolygon(:, 2), 'Color', 'y');
title('Detected Box');
  1 个评论
Image Analyst
Image Analyst 2016-3-10
Is this one improved on the one you posted at virtually the same time? Which of the two discussions is the one you want to keep? I answered the other one.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Feature Detection and Extraction 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by