clc;
clear all;
CAMERA = videoinput('pointgrey', '1');
start(CAMERA);
for b = 1:8
automate(CAMERA)
pause(8)
end
fclose(ard)
stop(CAMERA);
function[addition] = bodekke(imagename)
im = double(imread(imagename))
bd = [-1 0 1]
cbd = conv2(im,bd)
squaredcbd = cbd.^2
addition = sum(squaredcbd(:))
end
function automate(CAMERA)
ard = serial('COM3','BaudRate',9600);
fopen(ard);
pause(1);
for i = 1:30
filename = sprintf('testtry%02d.jpg',i);
img = im2double(getsnapshot(CAMERA));
img = rgb2gray(img);
imwrite(img,filename)
end
D = 'C:\Users\PRL\Desktop\just';
S = dir(fullfile(D,'*.jpg'));
for k = 1:numel(S)
F = fullfile(D,S(k).name);
addition(k) = bodekke(F);
end
plot(addition);
[m,index] = max(addition)
hold on
plot(index,m,'*')
hold off
title("bodekke with spot images")
fprintf(ard,'%d',index)
end
0 Comments
Sign in to comment.