使用 FLEX 測試 GOOGLE MAP API ,簡單的導航功能的應用。
線上DEMO:
http://www.asn.com.tw/flex/GoogleMapTest/GoogleMapTest.html
20110827連結更新…
http://www.vercenter.nknu.edu.tw/flex/GoogleMapTest/GoogleMapTest.html
mxml 原始碼:
http://docs.google.com/Doc?docid=0AQb8tm8yloBcZGZ2NnhuNWRfMTgwN2Q5NjlkcWNq&hl=zh_TW
參考教學:
http://code.google.com/intl/zh-TW/apis/maps/documentation/flash/
關鍵字:Marker,Directions,ClientGeocoder
2010年4月29日 星期四
2010年4月27日 星期二
2010年3月19日 星期五
FLEX AIR 包裝應用程式 ICON 的問題
在開發 AIR 應用程式後,若要包裝自己的應用程式,並且加上自訂的圖示的話,可以到 project\src\your-app.xml 找到…
<!-- <icon>
<image16x16></image16x16>
<image32x32></image32x32>
<image48x48></image48x48>
<image128x128></image128x128>
</icon> -->
修改成…
<icon>
<image32x32>images/icon.png</image32x32>
</icon>
要注意,若你只有一個 32x32 的 ICON 就只要留下 <image32x32></image32x32> 這行即可,千萬別把其它留空白,否則會包裝失敗還一直查不出原因…錯誤示範如下…
<icon>
<image16x16></image16x16>
<image32x32>images/icon.png</image32x32>
<image48x48></image48x48>
<image128x128></image128x128>
</icon>
<!-- <icon>
<image16x16></image16x16>
<image32x32></image32x32>
<image48x48></image48x48>
<image128x128></image128x128>
</icon> -->
修改成…
<icon>
<image32x32>images/icon.png</image32x32>
</icon>
要注意,若你只有一個 32x32 的 ICON 就只要留下 <image32x32></image32x32> 這行即可,千萬別把其它留空白,否則會包裝失敗還一直查不出原因…錯誤示範如下…
<icon>
<image16x16></image16x16>
<image32x32>images/icon.png</image32x32>
<image48x48></image48x48>
<image128x128></image128x128>
</icon>
FMS串流撥放FLV(或RTMP)時截取其BITMAP的方式
在透過 FMS 撥放 rtmp 串流影音時,若你的 CLIENT 端除了撥放,還要抓圖作處理的話,會遇到如下的例外…
SecurityError: Error #2123: Security sandbox violation:
BitmapData.draw: file:///xxx/xxx/xxx.swf
cannot access rtmp://xxx.xxx.xxx/live. No policy files granted access.
解決方式如下…
1. COPY 安裝範例 C:\Program Files\Adobe\Flash Media Server 3.5\samples\applications\vod 到你自己的應用程式。(有興趣可以研究看看其寫法)
2. 修改 Application.xml 檔,在 <client></client> 區間加入…
<Access>
<VideoSampleAccess enabled="true">/</VideoSampleAccess>
</Access>
3. 修改 main.asc (即 Server-side-code)…
找到 application.onConnect = function( p_client, p_autoSenseBW )
這邊是用來處理當有 client 連到這個 server app 時的對應函式,幾個相關參數設定如下…
writeAccess:
若你有用到 shared object 或 live streams,就把它註解掉
//p_client.writeAccess = ""; // prevents creating shared object or live streams.
audioSampleAccess:
允許 client side 直接抓取音效 raw data,利用 SoundMixer.computeSpectrum() 處理音效
p_client.audioSampleAccess = "/";
audioSampleAccess:
允許 client side 直接抓取影片 raw data,利用 BitmapData.draw() 抓圖
p_client.videoSampleAccess = "/";
參考這篇: http://www.thebluepipe.com/Developer/tutorials/as3/Crossdomain-Video-Snapshot-Fixing-BitmapData-draw-Security-Sandbox-Violation.html
SecurityError: Error #2123: Security sandbox violation:
BitmapData.draw: file:///xxx/xxx/xxx.swf
cannot access rtmp://xxx.xxx.xxx/live. No policy files granted access.
解決方式如下…
1. COPY 安裝範例 C:\Program Files\Adobe\Flash Media Server 3.5\samples\applications\vod 到你自己的應用程式。(有興趣可以研究看看其寫法)
2. 修改 Application.xml 檔,在 <client></client> 區間加入…
<Access>
<VideoSampleAccess enabled="true">/</VideoSampleAccess>
</Access>
3. 修改 main.asc (即 Server-side-code)…
找到 application.onConnect = function( p_client, p_autoSenseBW )
這邊是用來處理當有 client 連到這個 server app 時的對應函式,幾個相關參數設定如下…
writeAccess:
若你有用到 shared object 或 live streams,就把它註解掉
//p_client.writeAccess = ""; // prevents creating shared object or live streams.
audioSampleAccess:
允許 client side 直接抓取音效 raw data,利用 SoundMixer.computeSpectrum() 處理音效
p_client.audioSampleAccess = "/";
audioSampleAccess:
允許 client side 直接抓取影片 raw data,利用 BitmapData.draw() 抓圖
p_client.videoSampleAccess = "/";
參考這篇: http://www.thebluepipe.com/Developer/tutorials/as3/Crossdomain-Video-Snapshot-Fixing-BitmapData-draw-Security-Sandbox-Violation.html
2010年1月12日 星期二
PHP中計算某一周的起始及結束日期
以星期日為一周起始,函式傳入年份及第幾周,函式傳出開始及結束日期。
function findWeekPeriod( $week, $year )
{
$aPeriod = array();
$first_day = strtotime($year."-01-01");
$is_week_first_day = date("w", $first_day) == 0;
$is_weekone = strftime("%V", $first_day) == 1;
if($is_weekone)
{
$week_one_start = $is_week_first_day ? strtotime("last sunday",$first_day) : $first_day;
}
else
{
$week_one_start = strtotime("next sunday", $first_day);
}
$aPeriod['start'] = date("Y年m月d日", $week_one_start+(3600*24*7*($week-1)) );
$aPeriod['end'] = date("Y年m月d日", $week_one_start+(3600*24*(7*$week-1)) );
return $aPeriod;
}
例如…
$week=date('W');
$year=date('Y');
$wPeriod=findWeekPeriod( $week, $year );
/// 傳回當周的起始結束日期。
function findWeekPeriod( $week, $year )
{
$aPeriod = array();
$first_day = strtotime($year."-01-01");
$is_week_first_day = date("w", $first_day) == 0;
$is_weekone = strftime("%V", $first_day) == 1;
if($is_weekone)
{
$week_one_start = $is_week_first_day ? strtotime("last sunday",$first_day) : $first_day;
}
else
{
$week_one_start = strtotime("next sunday", $first_day);
}
$aPeriod['start'] = date("Y年m月d日", $week_one_start+(3600*24*7*($week-1)) );
$aPeriod['end'] = date("Y年m月d日", $week_one_start+(3600*24*(7*$week-1)) );
return $aPeriod;
}
例如…
$week=date('W');
$year=date('Y');
$wPeriod=findWeekPeriod( $week, $year );
/// 傳回當周的起始結束日期。
2010年1月5日 星期二
AS3 Face Detection 練習
臉部辨識練習。
測試影片:
http://www.youtube.com/watch?v=EHocW-Bkqkc
線上DEMO:(需有 Webcam 視訊,正面對鏡頭)
http://www.asn.com.tw/flex/FaceDetector/FaceDetectorXML.html
參考網站:
http://www.squidder.com/2009/02/26/realtime-face-detection-in-flash/
這個網站以 OpenCV 為基礎,改寫成 flash 版本,效能不錯。
這邊還有一個網站有把它作些優化…
http://www.quasimondo.com/archives/000687.php
主要是 haarcascade 檔的載入把它轉成一個靜態的類別,但這樣變成只能作臉部辨識,haarcascade 就不能動態載入了。
*haarcascade 檔是拿來述描所要辨識的影像的特徵集。
squidder 載入的 haarcascade 檔是一個包含 Adler-32 Checksum 的 ZIP 壓縮檔,使用上比較不方便,我用了 nochump 的 ZIP LIB 寫了一個簡單的 ZipLoader.as 來給這個 DEMO 使用,好方便載入不同的 haarcascade 檔,使用時只要把 HaarCascadeLoader.as 原始檔中的 "import jp.maaash.net.ZipLoader" REMARK 掉即可(當然,你還要有 nochump 的 ZIP LIB)。
有試過安裝 OpenCV 並使用它的其它 haarcascade 檔,例如手部、眼睛…,可惜沒有辨識成功~"~,還需要再研究。
ZipLoader.as...
package
{
import nochump.util.zip.*;
import flash.events.EventDispatcher;
import flash.events.Event;
import flash.net.URLRequest;
import flash.utils.IDataInput;
import flash.utils.ByteArray;
import flash.net.URLLoader;
import flash.net.URLLoaderDataFormat;
public class ZipLoader extends EventDispatcher{
private var debug:Boolean;
private var _url:String;
private var req:URLRequest;
private var data:ByteArray;
public function ZipLoader(d:Boolean=false){
debug = d;
req = new URLRequest;
}
public function load():void{
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE, onLoadXML);
xmlLoader.dataFormat = URLLoaderDataFormat.BINARY;
xmlLoader.load(req);
}
public function onLoadXML(e:Event):void
{
var zipFile:ZipFile = new ZipFile(e.target.data);
var entry:ZipEntry = zipFile.entries[0];
//trace(entry.name);
// extract the entry's data from the zip
data = zipFile.getInput(entry);
//trace(data.toString());
dispatchEvent( e.clone() );
}
public function set url(u:String):void{
_url = u;
req.url = _url;
}
public function getContentAsString():String{
return data.toString();
}
private function logger(... args):void{
if(!debug){ return; }
log(["[ZipLoader]"+args.shift()].concat(args));
}
}
}
測試影片:
http://www.youtube.com/watch?v=EHocW-Bkqkc
線上DEMO:(需有 Webcam 視訊,正面對鏡頭)
http://www.asn.com.tw/flex/FaceDetector/FaceDetectorXML.html
參考網站:
http://www.squidder.com/2009/02/26/realtime-face-detection-in-flash/
這個網站以 OpenCV 為基礎,改寫成 flash 版本,效能不錯。
這邊還有一個網站有把它作些優化…
http://www.quasimondo.com/archives/000687.php
主要是 haarcascade 檔的載入把它轉成一個靜態的類別,但這樣變成只能作臉部辨識,haarcascade 就不能動態載入了。
*haarcascade 檔是拿來述描所要辨識的影像的特徵集。
squidder 載入的 haarcascade 檔是一個包含 Adler-32 Checksum 的 ZIP 壓縮檔,使用上比較不方便,我用了 nochump 的 ZIP LIB 寫了一個簡單的 ZipLoader.as 來給這個 DEMO 使用,好方便載入不同的 haarcascade 檔,使用時只要把 HaarCascadeLoader.as 原始檔中的 "import jp.maaash.net.ZipLoader" REMARK 掉即可(當然,你還要有 nochump 的 ZIP LIB)。
有試過安裝 OpenCV 並使用它的其它 haarcascade 檔,例如手部、眼睛…,可惜沒有辨識成功~"~,還需要再研究。
ZipLoader.as...
package
{
import nochump.util.zip.*;
import flash.events.EventDispatcher;
import flash.events.Event;
import flash.net.URLRequest;
import flash.utils.IDataInput;
import flash.utils.ByteArray;
import flash.net.URLLoader;
import flash.net.URLLoaderDataFormat;
public class ZipLoader extends EventDispatcher{
private var debug:Boolean;
private var _url:String;
private var req:URLRequest;
private var data:ByteArray;
public function ZipLoader(d:Boolean=false){
debug = d;
req = new URLRequest;
}
public function load():void{
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE, onLoadXML);
xmlLoader.dataFormat = URLLoaderDataFormat.BINARY;
xmlLoader.load(req);
}
public function onLoadXML(e:Event):void
{
var zipFile:ZipFile = new ZipFile(e.target.data);
var entry:ZipEntry = zipFile.entries[0];
//trace(entry.name);
// extract the entry's data from the zip
data = zipFile.getInput(entry);
//trace(data.toString());
dispatchEvent( e.clone() );
}
public function set url(u:String):void{
_url = u;
req.url = _url;
}
public function getContentAsString():String{
return data.toString();
}
private function logger(... args):void{
if(!debug){ return; }
log(["[ZipLoader]"+args.shift()].concat(args));
}
}
}
2009年12月30日 星期三
FlarDetector - make a hole underground
http://www.youtube.com/watch?v=CW9imHbbljU
使用 FlarDetector 作成的地洞測試影片,加上在 3DS MAX 作的 miku 動畫、彩虹及程式中運算的 3D 彈跳球。
project source ...
http://code.google.com/p/flardetector/
使用 FlarDetector 作成的地洞測試影片,加上在 3DS MAX 作的 miku 動畫、彩虹及程式中運算的 3D 彈跳球。
project source ...
http://code.google.com/p/flardetector/
訂閱:
文章 (Atom)
VirtualBox 空間減肥
@windows vm sdelete64 -z c: @macos VBoxManage modifymedium disk "/Users/fellow/VirtualBox VMs/Win10/Win10.vdi" --compact *.vdi...
-
ARis... ARis 是日本一間公司出品的產品,應用了 ARToolKit 技術。 展示影片在這… http://www.youtube.com/watch?v=yCCx7zANsGE YouTube上可以找到更多類似的影片。 這邊是我用 FLARToolK...
-
由於ASSEMBLA即將開始收費,因此要把所有的SVN進行大搬家,連帶的一些教學文件也跟著搬家了,看來還是GOOGLE的窩最舒適(重點是免費) FPPA實驗平台教學教材-使用C語言 FPPA實驗平台簡介 實驗(一) 8位元LED輸出單元 與 模組設計總論 實驗(二) 按鍵開關輸入...
-
安裝 ruby 1.9.1 wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p0.tar.gz tar xvf ruby-1.9.1-p0.tar.gz cd ruby-1.9.1-p0 ./configure 失敗 C ...