亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? demo.m

?? MatLab圖像傳感器網絡仿真平臺WiSNAP
?? M
字號:
function demo(config);
%Wirless Image Sensor Networks Demo Application.
%   DEMO(CONFIG);
%
%   Input Parameters:
%   ================
%
%      config ------------> Network configuration (positive integer):
%                           1 - Agilent ADCM-1670 camera module on serial port.
%                           2 - Agilent ADNS-3060 mouse sensor on parallel port.
%                           3 - Chipcon CC2420DB wireless mote on serial port,
%                               Agilent ADCM-1670 camera module on serial port, and one
%                               stand-alone Chipcon CC2420DB wireless mote.
%
%   Output Parameters:
%   =================
%
%      NONE.
%
%   See also IMAGE_SENSOR_API, WIRELESS_MOTE_API.
%
%   Instructions:
%   ============
%
%   Press ESC to exit the application.

% Stephan Hengstler
% Stanford Wireless Sensor Networks Lab
% January 11, 2005
%
% Last modified: 03-03-2005

clc, % warning off

%******************* Wireless Image Sensor Networks Demo Application **********************

% parse input arguments (currently not used)
if (exist('arguments') == 1)
   switch arguments(1:2)
   	case '-d'
   		debug 	= 1;
   end
end

%--- Section: System Parameters -----------------------------------------------------------

% choose network configuration
switch (config)
   case 1
      SENSOR					= 'ADCM-1670';		% image sensor device
      SPORT						= 'COM2';			% image sensor port
      Th          			= 256;				% pixel threshold
   case 2
      SENSOR					= 'ADNS-3060';		% image sensor device
      SPORT						= '0378';			% image sensor port
      Th          			= 16;					% pixel threshold
   case 3
      MOTE						= 'CC2420DB';		% wirless mote device
      MPORT						= 'COM1';			% wireless mote port
		PhyInfo.Channel		= 26;					% PHY Layer: ISM channel.
		PhyInfo.Address		= hex2dec('0000');% PHY Layer: Node address.
		PhyInfo.PanId			= hex2dec('2420');% PHY Layer: Personal Area Network (PAN) ID.
      psi         			= 55*pi/180;      % field of view
      SENSOR					= 'ADCM-1670';		% image sensor device
      SPORT						= 'COM2';			% image sensor port
		TxMacPckt.destPanId	= hex2dec('2420');% MAC Layer: Destination PAN ID.
		TxMacPckt.destAddr	= hex2dec('0815');% MAC Layer: Destination node address.
		TxMacPckt.ackRequest	= 1;					% MAC Layer: Acknowledge request.
   otherwise
      disp('ERROR: Invalid network configuration.')
      disp('Type "help main" for more information.')
      return;
end

%--- Section: Application Main ------------------------------------------------------------

% initialize figure (optimal for 1024x768 screen resolution)
figure(1), clf, set(gcf,'Position',[1 29 1024 672])
colormap gray;
release		= version;
if (hex2dec(release(1)) > 5)
   set(gcf,'currentcharacter',' ')
end

%--- Example: Image Sensor - Target Detection ---------------------------------------------

if ((config == 1) | (config == 2))
   
   % open communications session
   shandle		= image_sensor_api(SENSOR,'open',SPORT);
   
   % check for error
   if ~(shandle > 0)
      error('ERROR: Open communications session failed.')
   end
   
   % initialize image sensor
   status		= image_sensor_api(SENSOR,'init',shandle);
   
   % check for error
   if (status < 0)
      status		= image_sensor_api(SENSOR,'close',shandle);
      error('ERROR: Initialize image sensor failed.')
   end
   
   % initialize frame counter
   frame       = 1;
   
   % initialize memory ping-pong
   pong        = 0;
   
   % repeat until break
   while(1)
      
      % capture current frame
      imager		= image_sensor_api(SENSOR,'frame',shandle);
      
      % check for error (this will not work yet; it is just a place holder at this point)
      if (isempty(imager))
         status		= image_sensor_api(SENSOR,'close',shandle);
         error('ERROR: Capture current frame failed.')
      end
      
      % RGB frame?
      if (size(imager,3) == 3)
         
         % rotate image array
         for i = 1:3
            imager(:,:,i)= rot90(imager(:,:,i));
         end
         
      end
      
      % display image array
      figure(1)
      subplot(2,2,1)
      if (size(imager,3) == 1)
         status      = pcolor(imager);
         shading flat
      else
         status      = image(uint8(imager));
         axis equal
      end
      axis([1 size(imager,1) 1 size(imager,2)])
      title(['\bf',SENSOR,' Image Sensor: Frame = ',int2str(frame)])
      xlabel('\bf--- PRESS ESC TO EXIT ---')
      
      % RGB frame?
      if (size(imager,3) == 3)
         
         % convert to gray scale image
         imager      = sum(imager,3);
         
      end
      
      % store image array in correlation memory
      cmem(:,:,pong+1)  = imager;
      
      % perform target detection function
      if (frame > 1)
         
         % compute difference image
         cmem_dif       = abs(cmem(:,:,not(pong)+1)-cmem(:,:,pong+1));
         
         % determine number of pixels above threshold
         N_E(frame)     = sum(sum(cmem_dif > Th));
         
         % display number of pixels
         subplot(2,2,2)
         plot([0:frame-1],N_E,'bx-')
         grid on
         title(['\bfTarget Detection Using Pixel Differences'])
         xlabel('\bfFrame Number')
         ylabel('\bfNumber of Pixels N_E')
         
      end
      
      % increment frame counter
      frame       = frame + 1;
      
      % allow display to update
      pause(1e-3)
      
      % ping-pong correlation memories
      pong        = not(pong);
      
      % check user input
      key         = double(get(gcf,'currentcharacter'));
      
      % exit loop?
      if (~isempty(key) & (key == 27))
         break
      end
      
   end
   
   % close communications session
   status		= image_sensor_api(SENSOR,'close',shandle);
   
   % check for error
   if (status < 0)
      error('ERROR: Close communications session failed.')
   end
   
%--- Example: Wireless Mote with Image Sensor - Network Localization ----------------------

elseif (config == 3)
   
   % open communications session
   mhandle		= wireless_mote_api(MOTE,'open',MPORT);
   
   % check for error
   if ~(mhandle > 0)
      error('ERROR: Open communications session failed.')
   end
   
   % open communications session
   shandle		= image_sensor_api(SENSOR,'open',SPORT);
   
   % check for error
   if ~(shandle > 0)
      error('ERROR: Open communications session failed.')
   end
   
   % initialize wirless mote
   status		= wireless_mote_api(MOTE,'init',mhandle,PhyInfo);
   
   % check for error
   if (status < 0)
      status		= image_sensor_api(SENSOR,'close',shandle);
      status		= wireless_mote_api(MOTE,'close',mhandle);
      error('ERROR: Initialize wireless mote failed.')
   end
   
   % initialize image sensor
   status		= image_sensor_api(SENSOR,'init',shandle);
   
   % check for error
   if (status < 0)
      status		= wireless_mote_api(MOTE,'close',mhandle);
      status		= image_sensor_api(SENSOR,'close',shandle);
      error('ERROR: Initialize image sensor failed.')
   end
   
   % initialize frame counter
   frame       = 1;
   
   % initialize memory ping-pong
   pong        = 0;
   
   % repeat until break
   while(1)
      
      % capture current frame
      imager		= image_sensor_api(SENSOR,'frame',shandle);
      
      % check for error (this will not work yet; it is just a place holder at this point)
      if (isempty(imager))
      	status		= wireless_mote_api(MOTE,'close',mhandle);
         status		= image_sensor_api(SENSOR,'close',shandle);
         error('ERROR: Capture current frame failed.')
      end
      
	   % remotely toggle neighboring node's location led
	   TxMacPckt.pPayload	= sprintf('t\n');
	   TxMacPckt.length	= length(TxMacPckt.pPayload);
      timeout		= 0;
	   while (timeout < 5)
         
         % send transmit packet
         status				= wireless_mote_api(MOTE,'send',mhandle,TxMacPckt);
      
	   	% check for received packet
      	RxMacPckt	= wireless_mote_api(MOTE,'recv',mhandle);
         if (isstruct(RxMacPckt))
            break;
         end
         
      	% increment timeout counter
			timeout		= timeout + 1;
      
	   end
      
      % determine received signal strength indicator
      if (isstruct(RxMacPckt))
         rssi(frame)    = RxMacPckt.rssi;
      else
         rssi(frame)    = -128;
      end
      
      % determine neighboring node's distance
      distance(frame)= 3e3*(1/(rssi(frame)+128)^2);
      
      % RGB frame?
      if (size(imager,3) == 3)
         
         % rotate image array
         for i = 1:3
            imager(:,:,i)= rot90(imager(:,:,i),2);
         end
         
      end
      
      % display image array
      figure(1)
      subplot(2,2,1)
      if (size(imager,3) == 1)
         status      = pcolor(imager);
         shading flat
      else
         status      = image(uint8(imager));
         axis equal
      end
      axis([1 size(imager,1) 1 size(imager,2)])
      title(['\bf',SENSOR,' Image Sensor: Frame = ',int2str(frame)])
      xlabel('\bf--- PRESS ESC TO EXIT ---')
      
      % RGB frame?
      if (size(imager,3) == 3)
         
         % use green color layer only
         imager      = imager(:,:,2);
         
      end
      
      % store image array in correlation memory
      cmem(:,:,pong+1)  = flipud(imager);
      
      % perform node localization function
      if (frame > 1)
         
         % compute difference image
         cmem_dif    = abs(cmem(:,:,not(pong)+1)-cmem(:,:,pong+1));
         
         % determine neighboring node's led position
         threshold   = max(mean(mean(cmem_dif))+(std(std(cmem_dif))),0.5*max(max(cmem_dif)));
         [x,y]       = find(cmem_dif > threshold);
         if ((~isempty(x)) & (~isempty(y)))
            d_i(frame)  = mean(y) + j*mean(x);
         else
            d_i(frame)  = -1 - j;
         end
         
         % compute neighboring node's estimated angular orientation
         D           = size(imager,1);
         phi_i(frame)= -atan(2*(real(d_i(frame))-D/2)/D*tan(psi/2));
         
         % display difference image
         subplot(2,2,3)
         status      = pcolor(cmem_dif);
         shading flat
         axis equal
         axis([1 size(imager,1) 1 size(imager,2)])
         title(['\bf',SENSOR,' Difference Image'])
         
         % display received signal strength and estimated angular orientation
         subplot(2,2,2)
         plot([0:frame-1],rssi,'b-',[0:frame-1],phi_i*180/pi,'r-')
         axis([0 frame-1 -psi/2*180/pi +psi/2*180/pi]), grid on
         title(['\bfReceived Signal Strength and Estimated Angular Orientation'])
         xlabel('\bfFrame Number')
         ylabel('\bfSignal Strength/Angular Orientation')
         
         % display network localization
         subplot(2,2,4)
         plot(0,0,'ko',0,0,'kx',[0 0],[0 0.1],'k-',0,0.1,'k^'), hold on
         circle      = distance(frame)*exp(j*2*pi*[0:0.01:1+0.1]);
         if ((real(d_i(frame)) > 0) & (imag(d_i(frame)) > 0))
            plot(real(circle),imag(circle),'r--')
            secant      = sqrt(2)*[0:1]*exp(j*(phi_i(frame)+pi/2));
            plot(real(secant),imag(secant),'r--')
            location    = distance(frame)*exp(j*(phi_i(frame)+pi/2));
            plot(real(location),imag(location),'bo',real(location),imag(location),'bx')
         else
            plot(real(circle),imag(circle),'b-')
         end
         hold off
         axis([-1 +1 -1 +1]), grid on
         title(['\bfNetwork Localization'])
         xlabel('\bfHorizontal Axis [unit length]')
         ylabel('\bfVertical Axis [unit length]')
         
      end
      
      % increment frame counter
      frame       = frame + 1;
      
      % allow display to update
      pause(1e-3)
      
      % ping-pong correlation memories
      pong        = not(pong);
      
      % check user input
      key         = double(get(gcf,'currentcharacter'));
      
      % exit loop?
      if (~isempty(key) & (key == 27))
         break
      end
      
   end
   
   % close communications session
   status		= image_sensor_api(SENSOR,'close',shandle);
   
   % check for error
   if (status < 0)
      status		= wireless_mote_api(MOTE,'close',mhandle);
      error('ERROR: Close communications session failed.')
   end
   
   % close communications session
   status		= wireless_mote_api(MOTE,'close',mhandle);
   
   % check for error
   if (status < 0)
      error('ERROR: Close communications session failed.')
   end
   
end

% close figure
close(gcf)

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
毛片av一区二区| 亚洲激情图片qvod| 在线亚洲一区二区| 成人av小说网| 91免费观看视频在线| 91污在线观看| 欧美性受极品xxxx喷水| 欧美日韩不卡一区| 日韩一级片网址| 久久综合久色欧美综合狠狠| 亚洲精品一区二区三区香蕉| 国产亚洲一区二区在线观看| 99热国产精品| 91小宝寻花一区二区三区| 在线观看91视频| 欧美成人国产一区二区| 欧美精品一区二区三区视频| 国产日韩精品一区| 亚洲欧洲制服丝袜| 日韩中文欧美在线| 国产一区不卡在线| gogogo免费视频观看亚洲一| 日本伦理一区二区| 欧美r级电影在线观看| 欧美激情一区三区| 亚洲超碰精品一区二区| 国产欧美日韩三区| 精品久久久久av影院| 亚洲国产精品二十页| 亚洲精品成人在线| 国产伦理精品不卡| 一本大道久久a久久精二百 | 成人理论电影网| 91视频国产观看| 欧美电视剧在线看免费| 中文字幕中文字幕一区二区| 精品免费国产一区二区三区四区| 欧美三级韩国三级日本一级| 精品国产一区二区三区四区四 | 美脚の诱脚舐め脚责91 | 午夜影院久久久| 国产一区二区网址| 精品日韩欧美一区二区| 久久精品亚洲乱码伦伦中文 | 欧美巨大另类极品videosbest| av福利精品导航| 日韩一级大片在线| 亚洲欧美国产高清| 国产一区二区成人久久免费影院| 蜜桃视频在线观看一区| 色综合色综合色综合 | 国产成人精品在线看| 在线区一区二视频| 久久久国产午夜精品 | 国产真实乱子伦精品视频| 91免费国产在线观看| 亚洲国产精品成人综合色在线婷婷| 久久香蕉国产线看观看99| 亚洲国产一二三| 亚洲bt欧美bt精品| 91看片淫黄大片一级在线观看| 一本在线高清不卡dvd| 国产精品网站在线| 国产精品1区2区3区| 日韩精品中文字幕一区| 免费在线观看成人| 欧美一级二级三级乱码| 久久久精品免费免费| 综合久久久久久| 播五月开心婷婷综合| 国产日韩高清在线| 亚洲成人动漫在线观看| 色av成人天堂桃色av| 1000部国产精品成人观看| 亚洲午夜一二三区视频| 91久久精品国产91性色tv| 欧美一级淫片007| 久久精品免费看| 久久午夜羞羞影院免费观看| 国产在线视频一区二区三区| 久久久久久一级片| 粉嫩高潮美女一区二区三区 | 欧美性受极品xxxx喷水| 亚洲午夜在线电影| 国产毛片精品一区| 国产欧美日韩另类视频免费观看| 亚洲欧美精品午睡沙发| 欧美综合在线视频| 日韩精品一二三四| 久久久噜噜噜久久中文字幕色伊伊| 亚洲精选一二三| 欧美色图天堂网| 日韩精品久久久久久| 日韩欧美亚洲国产精品字幕久久久 | 国产精品大尺度| 91麻豆精品在线观看| 日韩精品最新网址| 国产91精品一区二区麻豆亚洲| 欧美久久高跟鞋激| 黑人巨大精品欧美一区| 欧美韩日一区二区三区四区| 色狠狠av一区二区三区| 免费欧美在线视频| 国产精品久久久久久亚洲毛片| 亚洲成av人片观看| 国产亚洲视频系列| 在线观看91视频| 狠狠色丁香久久婷婷综合_中| 在线免费观看日本欧美| 亚洲成av人在线观看| 国产日韩精品一区二区浪潮av| 亚洲mv在线观看| 中文成人综合网| 欧美三级电影在线观看| 国产另类ts人妖一区二区| 有坂深雪av一区二区精品| 日韩一区二区三区在线| 成人黄色大片在线观看| 免费人成黄页网站在线一区二区 | 91亚洲精品一区二区乱码| 午夜久久久影院| 欧美精品精品一区| 成人精品免费视频| 三级久久三级久久| 尤物在线观看一区| 国产精品乱码久久久久久| 国产91精品欧美| 日韩av一区二| 一区二区三区日韩欧美| 国产目拍亚洲精品99久久精品| 国内精品写真在线观看| 亚洲国产美女搞黄色| 精品视频在线视频| 色欧美88888久久久久久影院| 中文字幕亚洲在| 国产性天天综合网| 日韩一级完整毛片| 欧美久久久久久久久中文字幕| 麻豆精品新av中文字幕| 久久伊人中文字幕| 成人精品电影在线观看| 久久av中文字幕片| 免费在线观看成人| 婷婷综合另类小说色区| 亚洲不卡在线观看| 午夜精品久久久久久久| 亚洲一二三区在线观看| 亚洲激情图片一区| 亚洲一区二区三区四区五区黄 | www久久精品| 91精品久久久久久久91蜜桃| 欧美日韩国产美| 欧美影视一区在线| 欧美三级中文字| 欧美精品色一区二区三区| 欧美日韩国产一区| 欧美日韩高清一区| 欧美军同video69gay| 91精品国产综合久久精品图片| 久久66热re国产| 国产一区二区三区蝌蚪| 亚洲免费在线播放| 亚洲成人免费视| 麻豆高清免费国产一区| 亚洲欧洲精品天堂一级 | 精品系列免费在线观看| 国产精品美日韩| 亚洲欧美一区二区三区久本道91| 欧美日韩一区二区欧美激情| 欧美唯美清纯偷拍| 日韩一区二区三区高清免费看看 | 亚洲综合一区二区三区| 欧美精品一区二区三区在线播放| 99久久久免费精品国产一区二区| 五月激情综合色| 亚洲欧美一区二区三区久本道91| 精品国产第一区二区三区观看体验 | 国内精品国产成人| 成人app下载| 欧美日韩成人综合在线一区二区| a级精品国产片在线观看| 久久97超碰国产精品超碰| 大尺度一区二区| 欧美午夜电影网| 91免费国产在线| 日韩精品中文字幕一区 | 国产精品欧美综合在线| 欧美成人艳星乳罩| 综合激情成人伊人| 麻豆精品久久久| 99视频精品全部免费在线| 日韩欧美亚洲一区二区| 91精品在线免费观看| 久久精品视频免费| 天天影视网天天综合色在线播放| 亚洲免费观看视频| 韩国av一区二区三区四区 | 亚洲一二三四久久| 亚洲国产视频直播| 国产成人综合在线|