i am working on a project related to template matching image processing , i have done the matching algorithm but the problem i am facing that , template matcher always yeilds the best co-relation matched in source image of template image but i want to notify or respond only when the desired output comes neither on false output. i want to serially communicate MATLAB code with arduino board UNO R3 which will generate the pulse birectionaly when the output comes ? so what should i supposed to do ? this is the code :
cam=videoinput('winvideo',2,'YUY2_320x240');
start(cam);
preview(cam);
set(cam,'ReturnedColorSpace','RGB');
get=input('get frame ???');
frame=getsnapshot(cam);
imwrite(frame,'got.jpg');
I=imread('D:\Template matcher\got.jpg');
H_Eq=vision.HistogramEqualizer;
Temlate_matcher=vision.TemplateMatcher;
Temlate_matcher.Metric='Maximum absolute difference';
Temlate_matcher.OutputValue='Metric matrix';
marker_inserter=vision.MarkerInserter('Size',30,'Fill',false,'FillColor','White','Opacity',0.75);
I=rgb2gray(I);
I=step(H_Eq,I);
Template1=imread('D:\Template matcher\ge.jpg');
Template1=rgb2gray(Template1);
H_Eq=vision.HistogramEqualizer;
Template1=step(H_Eq,Template1);
Location1=step(Temlate_matcher,I,Template1);
marker_inserter.Shape='Square'
output_image=step(marker_inserter,I,Location1);
figure();imshow(output_image);