Identifying objects in a picture containing several objects
9 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Image Analyst
on 1 Nov 2022
See my attached demo for finding a template in an image.
Or see examples in the Computer Vision Toolbox.
0 Comments
See Also
Categories
Find more on Computer Vision with Simulink in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!