Untitled
unknown
plain_text
4 years ago
571 B
9
Indexable
clc; clear all; cam = webcam('Logitech HD Webcam C270'); %camera name goes here cam.Resolution = '320x240'; %Resolution of images while true I=rgb2gray(cam.snapshot); [Ir, Ic] = size(I); T = rgb2gray(imread('final def.jpg')); %template image goes here [Tr Tc] = size(T); R = normxcorr2(T,I) R = imcrop (R, [Tc Tr Ic Ir]); if max(max(R)) > 0.8 %threshold value [r c v] = find(R == (max(max(R)))) RGB = insertShape(I, 'rectangle', [c r Tc Tr], 'Linewidth', 3); %indicator else RGB = I; end RGB = imresize(RGB, 8); hold on; imshow(RGB);title('Hole'); end
Editor is loading...