Arduino file!

adiosrv

 

Start the connection to the Arduino, start the GUI Code!

function [arduino_com, a] = Start_RPTC()
%This program will set up the arduino mega for RPTC
%
%For simplicity, COM port number and arduino pin numbers should edited here
%before another programs.
%
%Note: adiosrv.pde must be installed on target arduino prior to running
%this program.

% Request com port arduino is assigned to.
arduino_com = input(‘Input com port of Arduino MEGA (e.g. “COM1″): ‘, ‘s’);
%Establish coms with arduino mega
a = arduino(arduino_com);

%Set arduino pins to be used
a.pinMode(22,’output’);
a.pinMode(24,’output’);
a.pinMode(26,’output’);
a.pinMode(28,’output’);
a.pinMode(30,’output’);
a.digitalWrite(22,0);
a.digitalWrite(24,0);
a.digitalWrite(26,0);
a.digitalWrite(28,0);
a.digitalWrite(30,0);

a.pinMode(8,’output’);
a.pinMode(9,’output’);
a.pinMode(10,’output’);
a.pinMode(11,’output’);
a.pinMode(12,’output’);
a.digitalWrite(8,0);
a.digitalWrite(9,0);
a.digitalWrite(10,0);
a.digitalWrite(11,0);
a.digitalWrite(12,0);

end

 

GUI Code!

function varargout = Del_Gecko_GUI(varargin)
% DEL_GECKO_GUI MATLAB code for Del_Gecko_GUI.fig
% DEL_GECKO_GUI, by itself, creates a new DEL_GECKO_GUI or raises the existing
% singleton*.
%
% H = DEL_GECKO_GUI returns the handle to a new DEL_GECKO_GUI or the handle to
% the existing singleton*.
%
% DEL_GECKO_GUI(‘CALLBACK’,hObject,eventData,handles,…) calls the local
% function named CALLBACK in DEL_GECKO_GUI.M with the given input arguments.
%
% DEL_GECKO_GUI(‘Property’,'Value’,…) creates a new DEL_GECKO_GUI or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before Del_Gecko_GUI_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to Del_Gecko_GUI_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE’s Tools menu. Choose “GUI allows only one
% instance to run (singleton)”.
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help Del_Gecko_GUI

% Last Modified by GUIDE v2.5 22-Nov-2013 14:05:52

% Begin initialization code – DO NOT EDIT
gui_Singleton = 1;
gui_State = struct(‘gui_Name’, mfilename, …
‘gui_Singleton’, gui_Singleton, …
‘gui_OpeningFcn’, @Del_Gecko_GUI_OpeningFcn, …
‘gui_OutputFcn’, @Del_Gecko_GUI_OutputFcn, …
‘gui_LayoutFcn’, [] , …
‘gui_Callback’, []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code – DO NOT EDIT

% — Executes just before Del_Gecko_GUI is made visible.
function Del_Gecko_GUI_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to Del_Gecko_GUI (see VARARGIN)

% Choose default command line output for Del_Gecko_GUI
handles.output = hObject;
global a;
global arduino_com;

[arduino_com,a] = Start_RPTC();

axes(handles.WUAxes);
WUimage = imread(‘WU.jpg’);
imshow(WUimage);

axes(handles.geckoAxes);
imshow(imread(‘gecko.jpg’));

global vidIn;
global filterNum;
global img;

vidIn = videoinput(‘winvideo’, 1, ‘YUY2_640x480′);
src = getselectedsource(vidIn);
vidIn.FramesPerTrigger = 1;
axes(handles.cameraAxes);
axis image;
vidRes = get(vidIn, ‘VideoResolution’);
nBands = get(vidIn, ‘NumberOfBands’);
hImage = image( zeros(vidRes(2), vidRes(1), nBands) );
preview(vidIn, hImage);

% Update handles structure
guidata(hObject, handles);

 

% UIWAIT makes Del_Gecko_GUI wait for user response (see UIRESUME)
% uiwait(handles.RPTC_GUI);

% — Outputs from this function are returned to the command line.
function varargout = Del_Gecko_GUI_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;

% — Executes on button press in captureImage.
function captureImage_Callback(hObject, eventdata, handles)
% hObject handle to captureImage (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global vidIn;
global capturedImage;
global img;
global filterNum;

axes(handles.capturedAxes);
set(vidIn, ‘ReturnedColorSpace’, ‘RGB’);

capturedImage = getsnapshot(vidIn);

imwrite(capturedImage,’image.png’,'png’);

img = imread(‘image.png’);

%filterNum = get(handles.filterLabel, ‘Value’);

final = filterscript(img, filterNum);

imshow(img);
cornerfinder(final);

% — Executes on button press in closeGUI.
function closeGUI_Callback(hObject, eventdata, handles)
% hObject handle to closeGUI (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%%UNCOMMENT THE FOLLOWING
global arduino_com;
display Goodbye
delete(instrfind({‘Port’},{arduino_com}));
close(handles.RPTC_GUI);

% — Executes on slider movement.
function xAxisMotion_Callback(hObject, eventdata, handles)
% hObject handle to xAxisMotion (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global a;

%Set pololu driver to full step
a.digitalWrite(10,0);
a.digitalWrite(11,0);
a.digitalWrite(12,0);

xPosition = get(hObject, ‘Value’);
set(handles.xAxisStopLabel, ‘String’, xPosition);

while xPosition < -0.25 %drive stepper in CCW rotation

a.digitalWrite(9,1); %pololu direction
a.digitalWrite(8,1); %step trigger
a.digitalWrite(8,0); %step trigger

xPosition = get(hObject, ‘Value’); %obtain current slider value
set(handles.xAxisStopLabel, ‘String’, xPosition); %set slider S lable
guidata(hObject, handles); %update structure date with slider value
drawnow;
end

while xPosition > 0.25 %drive stepper in CW rotation

a.digitalWrite(9,0);
a.digitalWrite(8,1);
a.digitalWrite(8,0);

xPosition = get(hObject, ‘Value’);
set(handles.xAxisStopLabel, ‘String’, xPosition);
guidata(hObject, handles);
drawnow;
end
% Hints: get(hObject,’Value’) returns position of slider
% get(hObject,’Min’) and get(hObject,’Max’) to determine range of slider

% — Executes during object creation, after setting all properties.
function xAxisMotion_CreateFcn(hObject, eventdata, handles)
% hObject handle to xAxisMotion (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,[.9 .9 .9]);
end

% — Executes on slider movement.
function yAxisMotion_Callback(hObject, eventdata, handles)
% hObject handle to yAxisMotion (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global a;

a.digitalWrite(26,0);
a.digitalWrite(28,0);
a.digitalWrite(30,0);

yPosition = get(hObject, ‘Value’);
set(handles.yAxisStopLabel, ‘String’, yPosition);

while yPosition < -0.25

a.digitalWrite(24,1);
a.digitalWrite(22,1);
a.digitalWrite(22,0);

yPosition = get(hObject, ‘Value’);
set(handles.yAxisStopLabel, ‘String’, yPosition);
guidata(hObject, handles);
drawnow;
end

while yPosition > 0.25

a.digitalWrite(24,0);
a.digitalWrite(22,1);
a.digitalWrite(22,0);

yPosition = get(hObject, ‘Value’);
set(handles.yAxisStopLabel, ‘String’, yPosition);
guidata(hObject, handles);
drawnow;
end
% Hints: get(hObject,’Value’) returns position of slider
% get(hObject,’Min’) and get(hObject,’Max’) to determine range of slider

% — Executes during object creation, after setting all properties.
function yAxisMotion_CreateFcn(hObject, eventdata, handles)
% hObject handle to yAxisMotion (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,[.9 .9 .9]);
end

% — Executes on slider movement.
function yAxisMotionFine_Callback(hObject, eventdata, handles)
% hObject handle to yAxisMotionFine (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global a;

a.digitalWrite(26,1);
a.digitalWrite(28,1);
a.digitalWrite(30,1);

yPosition = get(hObject, ‘Value’);
set(handles.yAxisStopLabelFine, ‘String’, yPosition);

while yPosition < -0.25

a.digitalWrite(24,1);
a.digitalWrite(22,1);
a.digitalWrite(22,0);

yPosition = get(hObject, ‘Value’);
set(handles.yAxisStopLabelFine, ‘String’, yPosition);
guidata(hObject, handles);
drawnow;
end

while yPosition > 0.25

a.digitalWrite(24,0);
a.digitalWrite(22,1);
a.digitalWrite(22,0);

yPosition = get(hObject, ‘Value’);
set(handles.yAxisStopLabelFine, ‘String’, yPosition);
guidata(hObject, handles);
drawnow;
end
% Hints: get(hObject,’Value’) returns position of slider
% get(hObject,’Min’) and get(hObject,’Max’) to determine range of slider

% — Executes during object creation, after setting all properties.
function yAxisMotionFine_CreateFcn(hObject, eventdata, handles)
% hObject handle to yAxisMotionFine (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,[.9 .9 .9]);
end

% — Executes on slider movement.
function xAxisMotionFine_Callback(hObject, eventdata, handles)
% hObject handle to xAxisMotionFine (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global a;

%Set pololu driver to full step
a.digitalWrite(10,1);
a.digitalWrite(11,1);
a.digitalWrite(12,1);

xPosition = get(hObject, ‘Value’);
set(handles.xAxisStopLabelFine, ‘String’, xPosition);

while xPosition < -0.25 %drive stepper in CCW rotation

a.digitalWrite(9,1); %pololu direction
a.digitalWrite(8,1); %step trigger
a.digitalWrite(8,0); %step trigger

xPosition = get(hObject, ‘Value’); %obtain current slider value
set(handles.xAxisStopLabelFine, ‘String’, xPosition); %set slider S lable
guidata(hObject, handles); %update structure date with slider value
drawnow;
end

while xPosition > 0.25 %drive stepper in CW rotation

a.digitalWrite(9,0);
a.digitalWrite(8,1);
a.digitalWrite(8,0);

xPosition = get(hObject, ‘Value’);
set(handles.xAxisStopLabelFine, ‘String’, xPosition);
guidata(hObject, handles);
drawnow;
end
% Hints: get(hObject,’Value’) returns position of slider
% get(hObject,’Min’) and get(hObject,’Max’) to determine range of slider

% — Executes during object creation, after setting all properties.
function xAxisMotionFine_CreateFcn(hObject, eventdata, handles)
% hObject handle to xAxisMotionFine (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,[.9 .9 .9]);
end

% — Executes on slider movement.
function filterSlider_Callback(hObject, eventdata, handles)
% hObject handle to filterSlider (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global filterNum;
filterNum = get(hObject, ‘Value’);
set(handles.filterLabel, ‘String’, filterNum);
guidata(hObject, handles);

% Hints: get(hObject,’Value’) returns position of slider
% get(hObject,’Min’) and get(hObject,’Max’) to determine range of slider

% — Executes during object creation, after setting all properties.
function filterSlider_CreateFcn(hObject, eventdata, handles)
% hObject handle to filterSlider (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,[.9 .9 .9]);
end

Image Filtering Code!

function IMG_Final = filterscript(IMG,filterLevel)

%hold off;
%Read in original image
%IMG = imread(‘Usable1.png’);
%IMG = imread(‘CamTest.png’);
%Build local variable of different image formats
IMG_Gray = rgb2gray(IMG); %consider using IMG instead of IMG_Gray to save memory

if filterLevel > 0
IMG_Gray = medfilt2(IMG_Gray, [15 15]);
end

if filterLevel > 1
IMG_Gray = medfilt2(IMG_Gray, [15 15]);
end

if filterLevel > 2
IMG_Gray = medfilt2(IMG_Gray, [15 15]);
end

if filterLevel > 3
IMG_Gray = medfilt2(IMG_Gray, [15 15]);
end

%imshow(IMG_Gray);

 

 

 

% Pre-allocate matrix (memory)
IMG_Line = zeros(size(IMG_Gray));

%Determine image size for indexing
[m, n] = size(IMG_Line);

for i = 1:m
for j = 1:n

if IMG_Gray(i,j) > 100

%Set the index to 1 in matrix
IMG_Line(i,j) = 255;

end
end
end

IMG_Red_altered = IMG_Line;

%Find the columns with the number of red pixels > 89.99%
Red_Column_Avg = sum(IMG_Line)/m;

%Fill columns with > 89.99% red to 100%
for i = 1:n

if Red_Column_Avg(i) >= 170

IMG_Red_altered(:,i) = 1;

end
end

%Find the rows with the number of red pixels > 89.99%
Red_Row_Avg = sum(IMG_Line,2)/n;

%Fill row with > 89.99% red to 100%
for j = 1:m

if Red_Row_Avg(j) >= 170

IMG_Red_altered(j,:) = 1;

end
end

%IMG_Red_altered is an indexed matrix with 1 representing a red pixel…
%and 0 representing a white pixel
%imshow(IMG_Red_altered);

IMG_Final = ones(size(IMG_Red_altered));

for i = 1:n

for j = 1:m
if IMG_Red_altered(j,i) == 255

IMG_Red_altered(j,i) = 0;

end

end

end

 

Ctotal = sum(IMG_Red_altered);
Rtotal = sum(IMG_Red_altered,2);

for i = 1:n

if Ctotal(i) < m

IMG_Final(:,i) = 0;

end

end

for j = 1:m

if Rtotal(j) < n

IMG_Final(j,:) = 0;

end

end
%imshow(IMG_Final);

%end of function

 

Corner Finding and Measuring Code!

function meas = cornerfinder(IMG_Final)

%hold off;
%Read in original image
%IMG = imread(‘Usable1.png’);
%IMG = imread(’100×100.bmp’);
%Build local variable of different image formats
%IMG_Gray = rgb2gray(IMG); %consider using IMG instead of IMG_Gray to save memory

%ee = edge(IMG_Gray,’canny’);

%c = corner(IMG_Gray,36, ‘SensitivityFactor’, .04, ‘QualityLevel’, .8);
%find the 9 corners of the image,
%4 points for each corner, due to line thickness

c = corner(IMG_Final,36);

c = sortrows(c);

c = [(c(:,1)+c(:,2)), c(:,1), c(:,2)];

z1 = c(1:6,:);
z2 = c(7:12,:);
z3 = c(13:18,:);
z4 = c(19:24,:);
z5 = c(25:30,:);
z6 = c(31:36,:);

z1 = sortrows(z1);
z2 = sortrows(z2);
z3 = sortrows(z3);
z4 = sortrows(z4); %clean this
z5 = sortrows(z5);
z6 = sortrows(z6);

c(1:6,:) = z1;
c(7:12,:) = z2;
c(13:18,:) = z3;
c(19:24,:) = z4;
c(25:30,:) = z5;
c(31:36,:) = z6;

c = [c(:,2), c(:,3)];

o = c; %make a copy of c, so we can move things around
%without data loss
%figure(943);
%imshow(IMG);

%Truffle Shuffle! (group together each point)
c(3,:) = o(7,:);
c(4,:) = o(8,:);

c(5,:) = o(3,:);
c(6,:) = o(4,:);

c(7,:) = o(9,:);
c(8,:) = o(10,:);

c(9,:) = o(5,:);
c(10,:) = o(6,:);

c(15,:) = o(19,:);
c(16,:) = o(20,:);

c(17,:) = o(15,:);
c(18,:) = o(16,:);

c(19,:) = o(21,:);
c(20,:) = o(22,:);

c(21,:) = o(17,:);
c(22,:) = o(18,:);

c(27,:) = o(31,:);
c(28,:) = o(32,:);

c(29,:) = o(27,:);
c(30,:) = o(28,:);

c(31,:) = o(33,:);
c(32,:) = o(34,:);

c(33,:) = o(29,:);
c(34,:) = o(30,:);
%end the Truffle Shuffle!

p = zeros(9,2);

for i=1:9

p(i,:) = (c(i*4,:) + c(i*4-3,:))/2; %p is 9 points, center of each intersection

end

%find distances

inchvert(1) = p(3,2) – p(1,2);
inchvert(2) = p(6,2) – p(4,2);
inchvert(3) = p(9,2) – p(7,2);

%print distances on figure

v(1,1) = p(1,1) + (p(2,1) – p(1,1))/2;
v(1,2) = p(1,2) + (p(2,2) – p(1,2))/2;
text(v(1,1),v(1,2), num2str((p(2,2) – p(1,2))/inchvert(1)*1000),…
‘FontSize’, 12, ‘FontWeight’, ‘Bold’, ‘BackgroundColor’, ‘w’);
v(2,1) = p(2,1) + (p(3,1) – p(2,1))/2;
v(2,2) = p(2,2) + (p(3,2) – p(2,2))/2;
text(v(2,1),v(2,2), num2str((p(3,2) – p(2,2))/inchvert(1)*1000),…
‘FontSize’, 12, ‘FontWeight’, ‘Bold’, ‘BackgroundColor’, ‘w’);
v(3,1) = p(4,1) + (p(5,1) – p(4,1))/2;
v(3,2) = p(4,2) + (p(5,2) – p(4,2))/2;
text(v(3,1),v(3,2), num2str((p(5,2) – p(4,2))/inchvert(2)*1000),…
‘Color’,'r’,'FontSize’, 12, ‘FontWeight’, ‘Bold’, ‘BackgroundColor’, ‘w’);
v(4,1) = p(5,1) + (p(6,1) – p(5,1))/2;
v(4,2) = p(5,2) + (p(6,2) – p(5,2))/2;
text(v(4,1),v(4,2), num2str((p(6,2) – p(5,2))/inchvert(2)*1000),…
‘Color’, ‘r’,'FontSize’, 12,’FontWeight’, ‘Bold’, ‘BackgroundColor’, ‘w’);
v(5,1) = p(7,1) + (p(8,1) – p(7,1))/2;
v(5,2) = p(7,2) + (p(8,2) – p(7,2))/2;
text(v(5,1),v(5,2), num2str((p(8,2) – p(7,2))/inchvert(3)*1000),…
‘FontSize’, 12, ‘FontWeight’, ‘Bold’, ‘BackgroundColor’, ‘w’);
v(6,1) = p(8,1) + (p(9,1) – p(8,1))/2;
v(6,2) = p(8,2) + (p(9,2) – p(8,2))/2;
text(v(6,1),v(6,2), num2str((p(9,2) – p(8,2))/inchvert(3)*1000),…
‘FontSize’, 12,’FontWeight’, ‘Bold’, ‘BackgroundColor’, ‘w’);

%vertical measurements are meas(1-6)
meas(1) = (p(2,2) – p(1,2))/inchvert(1)*1000;
meas(2) = (p(3,2) – p(2,2))/inchvert(1)*1000;
meas(3) = (p(5,2) – p(4,2))/inchvert(2)*1000;
meas(4) = (p(6,2) – p(5,2))/inchvert(2)*1000;
meas(5) = (p(8,2) – p(7,2))/inchvert(3)*1000;
meas(6) = (p(9,2) – p(8,2))/inchvert(3)*1000;

inchhor(1) = p(7,1) – p(1,1);
inchhor(2) = p(8,1) – p(2,1);
inchhor(3) = p(9,1) – p(3,1);

%horizontal measurements are meas(7-12)
meas(7) = (p(4,1) – p(1,1))/inchhor(1)*1000;
meas(8) = (p(7,1) – p(4,1))/inchhor(1)*1000;
meas(9) = (p(5,1) – p(2,1))/inchhor(2)*1000;
meas(10) = (p(8,1) – p(5,1))/inchhor(2)*1000;
meas(11) = (p(6,1) – p(3,1))/inchhor(3)*1000;
meas(12) = (p(9,1) – p(6,1))/inchhor(3)*1000;

%print distances on figure

h(1,1) = p(1,1) + (p(4,1) – p(1,1))/2;
h(1,2) = p(1,2) + (p(4,2) – p(1,2))/2;
text(h(1,1),h(1,2), num2str((p(4,1) – p(1,1))/inchhor(1)*1000),…
‘FontSize’, 12,’FontWeight’, ‘Bold’, ‘BackgroundColor’, ‘w’);
h(2,1) = p(4,1) + (p(7,1) – p(4,1))/2;
h(2,2) = p(4,2) + (p(7,2) – p(4,2))/2;
text(h(2,1),h(2,2), num2str((p(7,1) – p(4,1))/inchhor(1)*1000),…
‘FontSize’, 12,’FontWeight’, ‘Bold’, ‘BackgroundColor’, ‘w’);
h(3,1) = p(2,1) + (p(5,1) – p(2,1))/2;
h(3,2) = p(2,2) + (p(5,2) – p(2,2))/2;
text(h(3,1),h(3,2), num2str((p(5,1) – p(2,1))/inchhor(2)*1000),…
‘Color’, ‘r’,'FontSize’, 12,’FontWeight’, ‘Bold’, ‘BackgroundColor’, ‘w’);
h(4,1) = p(5,1) + (p(8,1) – p(5,1))/2;
h(4,2) = p(5,2) + (p(8,2) – p(5,2))/2;
text(h(4,1),h(4,2), num2str((p(8,1) – p(5,1))/inchhor(2)*1000),…
‘Color’, ‘r’,'FontSize’, 12,’FontWeight’, ‘Bold’, ‘BackgroundColor’, ‘w’);
h(5,1) = p(3,1) + (p(6,1) – p(3,1))/2;
h(5,2) = p(3,2) + (p(6,2) – p(3,2))/2;
text(h(5,1),h(5,2), num2str((p(6,1) – p(3,1))/inchhor(3)*1000),…
‘FontSize’, 12,’FontWeight’, ‘Bold’, ‘BackgroundColor’, ‘w’);
h(6,1) = p(6,1) + (p(9,1) – p(6,1))/2;
h(6,2) = p(6,2) + (p(9,2) – p(6,2))/2;
text(h(6,1),h(6,2), num2str((p(9,1) – p(6,1))/inchhor(3)*1000),…
‘FontSize’, 12,’FontWeight’, ‘Bold’, ‘BackgroundColor’, ‘w’);

 

 

%plot corners
hold on;
%plot(c(:,1),c(:,2),’r*’);
%plot center points
plot(p(:,1),p(:,2),’g*’);
hold off;

%end of function