Identifying objects in a picture containing several objects
9 次查看(过去 30 天)
显示 更早的评论
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);
0 个评论
回答(1 个)
Image Analyst
2022-11-1
See my attached demo for finding a template in an image.
Or see examples in the Computer Vision Toolbox.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Computer Vision with Simulink 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!