EEL5666 Robert Hartwell 12 Mar 2012 1: Sensors • Sensors tested 2: Testing Conditions • Sensor response to conditions 3: Platform Integration • Sensor integration on platform 4:Additional Testing • Additional conditions or aspects that require additional testing. Cell phone • IP Webcam Server Application Color Recognition - Matlab • Colors correspond to menu items Menu Card • Color in the box next to the drink you want % clear all % clc % % % while(1) % order = 0; % % format shortG % prompt={'Vodka','Rum','OJ','Coke'}; % name='Drink Choices'; % lines=1; % def={'1', '1', '1', '1'}; % options.Resize='on'; % answer=inputdlg(prompt,name,lines,def,options); % vodka=str2num(char(answer(1))); % rum=str2num(char(answer(2))); % oj=str2num(char(answer(3))); % coke=str2num(char(answer(4))); % % order = 1 % vodka+rum+oj+coke; % 50 100 150 % % Locatate the IP Camera url = 'http://192.168.1.4:8080/shot.jpg'; % ss = imread(url); % fh = image(ss); 200 % This shows a continuous stream from the IP camera % while(1)%while(order ~= 0) % ss = imread(url); % set(fh,'CData',ss); % drawnow; % end 250 %% %% Find Green Object % This script reads in an image file and then attempts to find a green % object in the image. It is designed to find one green ball and highlight % that ball on the original image %% Read in Image % First we read the specified image from the file and bring it into MATLAB % as a variable. We also display the image to ensure it is correct. % greenBall1 = imread('greenBall1.jpg'); greenBall1 = imread(url); greenBall1 = uint8(greenBall1); imagesc(greenBall1); %% Extract each color % Next we using indexing to extract three 2D matrices from the 3D image % data corresponding to the red, green, and blue components of the image. r = greenBall1(:,:,1); g = greenBall1(:,:,2); b = greenBall1(:,:,3); %% Calculate Green % Then we perform an arithmetic operation on the matrices as a whole to try % to create one matrix that represents an intensity of green. justGreen = 2*g - r - b; colorsPlot(r,g,b,justGreen); %% close %% Threshold the image % Now we can set a threshold to separate the parts of the image that we % consider to be green from the rest. bw = justGreen > 95; imagesc(bw); colormap(gray); %% Remove small groups % We can use special functions provided by the Image Processing toolbox to % quickly perform common image processing tasks. Here we are using % BWAREAOPEN to remove groups of pixels less than 30. ball1 = bwareaopen(bw,30); imagesc(ball1); %% Dilate % We will use IMDILATE to dilate and combine nearby pixels se1 = strel('square',5); ball2 = imdilate(ball1,se1); imagesc(ball2) %% Find center % Now we are using REGIONPROPS to extract the centroid of the group of % pixels representing the ball. s = regionprops(ball2, {'centroid','area'}); if isempty(s) error('No ball found!'); else [maxArea, id] = max([s.Area]); hold on, plot(s(id).Centroid(1),s(id).Centroid(2),'wp','MarkerSize',20,'MarkerFaceColor','r'), hold off disp(['Center location is (',num2str(s(id).Centroid(1),4),', ',num2str(s(id).Centroid(2),4),')']) end %% Show marker on original image % Finally we will plot the center on the original image to clearly evaluate % how well we have found the center. imagesc(greenBall1); hold on, plot(s(id).Centroid(1),s(id).Centroid(2),'wp','MarkerSize',20,'MarkerFaceColor','r'), hold off 300 50 100 150 200 250 300 350 400 450 EVO 3D Ranging IR IR Array Switch General Purpose Color Recognition IR Distance Sensor IR Return Physical Location Contact within Array Detection Radio Comm How it Performs Function Creates Server for IP Cam Emulation IR Return Strength Alters Voltage Signal IR Return Allows toggles Voltage High/Low in Signal Array RF receive and transmit What it Controls Order Confirmation Collision Avoidance Line Following Comm with laptop Docking Radio Frequency Conditions tested in Matlab • Hosting IP webcam server annihilates the phone battery Metric Resolution Quality Equalization Threshold Range (480x320) (640x480) 1-100 NA Color Variable Effect on Large Processing time Minimal Slight Negligible Effect on accuracy Minimal Large Large Large Ideal (480x320) 50 NA TBD Conditions tested with X-CTU • Surprisingly small FoV • FoV skewed left • Ambient lighting had little effect Metric Lights Off Lights On Blinds Open Outside Baseline 250-290 260-290 260-290 TBD Δ 500 Distance ~17 in ~17 in ~17 in TBD Break 1200 ~ 12 in distance ~12 in ~ 12 in TBD FoV @ 12 in ~ 3 in ~ 3 in TBD ~3 in Conditions tested with X-CTU • Ambient lighting had little effect • Very small “sweet spot” Metric Lights Off Lights On Blinds Open Outside Min Range 1/8 in 1/8 in 1/8 in TBD 1 in 1 in TBD Max Range 1 in Conditions tested with Voltmeter and Matlab Metric XBee Switch Closes Switch NA Yes Tx/Rx with Matlab Yes NA • Xbee fully function with Matlab and AVR / Board • Still working debounce routine for switches XBee IR Ranger IR Array Bump Switch