線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1030
推到 Plurk!
推到 Facebook!

請問大大如何知道處理一張圖所耗費的時間??

尚未結案
residue
中階會員


發表:90
回覆:153
積分:53
註冊:2003-07-02

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-11-29 14:54:48 IP:203.64.xxx.xxx 未訂閱
請問各位大大們,若小弟把一張圖二值化後在取中心,這個動作小弟要如何知道他耗費多少時間呢??       謝謝   發表人 -
mieng
中階會員


發表:12
回覆:97
積分:81
註冊:2003-10-31

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-11-29 15:19:12 IP:61.221.xxx.xxx 未訂閱
在處理圖檔的前後加上gettime(); 再比較兩次的時間差就可以了, 或是用Timer元件計數,看Timer元件跑了多少就可以知道所花費的時間了 學習中請大家多多指導呦~~ ☆星霧☆(Mineg Chien WU)
taishyang
站務副站長


發表:377
回覆:5490
積分:4563
註冊:2002-10-08

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-11-29 16:44:54 IP:140.135.xxx.xxx 未訂閱
residue您好: 請參考下面連結 http://delphi.ktop.com.tw/topic.php?TOPIC_ID=26721 看看哪一種方式適合您< > 順心< >
residue
中階會員


發表:90
回覆:153
積分:53
註冊:2003-07-02

發送簡訊給我
#4 引用回覆 回覆 發表時間:2003-11-30 01:01:14 IP:218.164.xxx.xxx 未訂閱
引言: residue您好: 請參考下面連結 http://delphi.ktop.com.tw/topic.php?TOPIC_ID=26721 看看哪一種方式適合您< > 順心< >
 
#include < time.h >
float starttime,endtime,totaltime;
starttime=clock();
/*
計算所需時間的程式碼放在這裡
*/
endtime=clock();
totaltime=(endtime-starttime)/CLK_TCK;
Edit1->Text=totaltime;
 
感謝大大的指導請問 上面這段程式求出的時間單位為何呢??? 謝謝!!
arisaka_matsuri
高階會員


發表:25
回覆:205
積分:231
註冊:2003-10-19

發送簡訊給我
#5 引用回覆 回覆 發表時間:2003-11-30 16:00:23 IP:218.166.xxx.xxx 未訂閱
另外補充: 用Windows Multimedia Timers來達成 #include  DWORD timeGetTime(VOID); 範例:
DWORD dwBegin, dwEnd;
dwBegin = = timeGetTime();    // 要計時的程式碼    dwEnd = = timeGetTime();
// 顯示處理時間(單位:milliseconds)
ShowMessage(AnsiString(dwEndTime-dwBeginTime) " ms");
說明(轉載自 Windows Multimedia API 說明文件): Note that the value returned by the timeGetTime function is a DWORD value. The return value wraps around to 0 every 2^32 milliseconds, which is about 49.71 days.This can cause problems in code that directly uses the timeGetTime return value in computations, particularly where the value is used to control code execution. You should always use the difference between two timeGetTime return values in computations. Windows NT: The default precision of the timeGetTime function can be five milliseconds or more, depending on the machine. You can use the timeBeginPeriod and timeEndPeriod functions to increase the precision of timeGetTime. If you do so, the minimum difference between successive values returned by timeGetTime can be as large as the minimum period value set using timeBeginPeriod and timeEndPeriod. Use the QueryPerformanceCounter and QueryPerformanceFrequency functions to measure short time intervals at a high resolution, Windows 95: The default precision of the timeGetTime function is 1 millisecond. In other words, the timeGetTime function can return successive values that differ by just 1 millisecond. This is true no matter what calls have been made to the timeBeginPeriod and timeEndPeriod functions.
taishyang
站務副站長


發表:377
回覆:5490
積分:4563
註冊:2002-10-08

發送簡訊給我
#6 引用回覆 回覆 發表時間:2003-11-30 16:36:41 IP:140.135.xxx.xxx 未訂閱
residue您好:  
引言:上面這段程式求出的時間單位為何呢???
單位:milliseconds 順心 <>~我也是在學習的階段,回答的不好請您多多見諒與指教~
residue
中階會員


發表:90
回覆:153
積分:53
註冊:2003-07-02

發送簡訊給我
#7 引用回覆 回覆 發表時間:2003-12-01 00:16:40 IP:218.164.xxx.xxx 未訂閱
感謝大大們的指導謝謝囉!!
系統時間:2024-05-13 12:07:56
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!