object recognition in image
이전 댓글 표시
I want to know if an object is in a image or not. So i took the contours of this object and also all the contours of objects that are in the other image. But now i would compare the econtour of my object and the contour of the other object. The problem is that the size/position are not the same between my object and the object in the picture. Could you help me on that ?
import de limage et mise en noir et blanc
logo=imread("logo.jpg");
picture = imresize(logo,[500,500]);
picture = rgb2gray(picture);
imshow(picture)
transformation en image binaire
for i= 1:500
for j = 1:500
if picture(i,j)>0
picture(i,j)=1;
end
end
end
imshow(picture,[0,1])
extraction des contours de limage de ref
% Extraction des contours de l'objet
contours_base = bwboundaries(picture);% Affichage de l'image binaire avec les contours
imshow(picture,[0,1])
hold on;
% Tracé des contours
for k = [2,280]
boundary_base = contours_base{k};
plot(boundary_base(:,2), boundary_base(:,1), 'r', 'LineWidth', 2);
end
hold off
import de l'image a test et enlevage de larriere plan
img=imresize(imread("logoreco.jpg"),[500,500]);
forme_image = imbinarize(rgb2gray(img),'adaptive','Sensitivity',0.7);
imshowpair(forme_image,img,'montage')
% Extraction des contours de l'objet
contours = bwboundaries(forme_image);% Affichage de l'image binaire avec les contours
imshow(forme_image,[0,1])
hold on;
% Tracé des contours
for k = 1:length(contours)
boundary = contours{k};
plot(boundary(:,2), boundary(:,1), 'r', 'LineWidth', 2);
end
hold off

logo.jpg

logoreco.jpg
답변 (1개)
Image Analyst
2023년 4월 26일
0 개 추천
Depends on your images and your target object. For widest range of how things look, you should investigate Deep Learning CNN classification.
댓글 수: 3
julien
2023년 4월 26일
Image Analyst
2023년 4월 26일
If the template is the same size you can use normalized cross correlation. See attached demo.
Or try Hu's moments:
Or this:
julien
2023년 4월 29일
카테고리
도움말 센터 및 File Exchange에서 Semantic Segmentation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!