Identifying objects in a picture containing several objects

9 vues (au cours des 30 derniers jours)
Bünyamin Ergezgin
Bünyamin Ergezgin le 31 Oct 2022
I am trying to find a object inside an image and I wrote code like down below, but I think in some part I made a mistake. It's showing me a different object than what I want.
Here is my code;
image = imread(['wheres_walle.png']);
bender = imread('bender.png');
imtool(image);
gray_img = rgb2gray(image);
gray_bla = rgb2gray(bode)
imtool(gray_bla);
I = gray_img
object = gray_bla
c = normxcorr2(object(:,:,1),I(:,:,1));
[max_c, imax] = max(abs(c(:)));
[ypeak, xpeak] = ind2sub(size(c),imax(1));
corr_offset = [(xpeak-size(object,2)) (ypeak-size(object,1))];
figure, imshow(I); hold on;
rectangle('position',[corr_offset(1) corr_offset(2) 30 60],'curvature',[1,1],'edgecolor','g','linewidth',2);

Réponses (1)

Image Analyst
Image Analyst le 1 Nov 2022
See my attached demo for finding a template in an image.
Or see examples in the Computer Vision Toolbox.

Catégories

En savoir plus sur Computer Vision with Simulink dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by