detecting and labeling an object from an image

조회 수: 1 (최근 30일)
Maria Kanwal
Maria Kanwal 2016년 3월 10일
댓글: Image Analyst 2016년 3월 10일
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