detecting and labeling an object from an image

1 visualización (últimos 30 días)
Maria Kanwal
Maria Kanwal el 10 de Mzo. de 2016
Comentada: Image Analyst el 10 de Mzo. de 2016
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 comentario
Image Analyst
Image Analyst el 10 de Mzo. de 2016
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.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Feature Detection and Extraction en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by