Identifying objects in a picture containing several objects

9 ビュー (過去 30 日間)
Bünyamin Ergezgin
Bünyamin Ergezgin 2022 年 10 月 31 日
編集済み: Image Analyst 2022 年 11 月 1 日
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);

回答 (1 件)

Image Analyst
Image Analyst 2022 年 11 月 1 日
See my attached demo for finding a template in an image.
Or see examples in the Computer Vision Toolbox.

カテゴリ

Help Center および File ExchangeComputer Vision with Simulink についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by