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

請教連續raw檔在Image上顯示....

答題得分者是:TheMoon
sbkobe
一般會員


發表:3
回覆:3
積分:1
註冊:2004-07-02

發送簡訊給我
#1 引用回覆 回覆 發表時間:2004-10-21 20:00:13 IP:210.64.xxx.xxx 未訂閱
我有一些連續的raw檔 比如說 xxxx000.raw~xxxx294.raw 我要怎樣才可以連續讀出這些檔案 並顯示在Image上面呢 參考某大大的教學 我單張raw檔的讀檔如下    void __fastcall TForm1::SpeedButton1Click(TObject *Sender) {   Byte *ptr;   if(OpenDialog1->Execute())   {     TMemoryStream* bin=new TMemoryStream();     bin->LoadFromFile(OpenDialog1->FileName);     int dwSize=Image1->Height*Image1->Width;     Byte *pixel=new BYTE[dwSize];     bin->Read(pixel, dwSize);        Graphics::TBitmap *bmp = new Graphics::TBitmap();     bmp->PixelFormat=pf24bit;     bmp->Height=Image1->Height;     bmp->Width=Image1->Width;        for(int y=0; yHeight; y ) { ptr=(Byte *)bmp->ScanLine[y]; for(int x=0; xWidth; x ) { ptr[x*3]=pixel[y*Image1->Width x]; ptr[x*3 1]=pixel[y*Image1->Width x]; ptr[x*3 2]=pixel[y*Image1->Width x]; } } Image1->Picture->Assign(bmp); delete bmp; delete bin; } }
TheMoon
中階會員


發表:17
回覆:95
積分:67
註冊:2002-06-05

發送簡訊給我
#2 引用回覆 回覆 發表時間:2004-10-21 20:17:23 IP:202.39.xxx.xxx 未訂閱
如果你的檔名是有順序性的, 可以在最外面加一層迴圈來達成,(依你的檔案數目設定迴圈執行次數) 下面是之前有人發問過的類似問題: http://delphi.ktop.com.tw/topic.php?TOPIC_ID=56270
sbkobe
一般會員


發表:3
回覆:3
積分:1
註冊:2004-07-02

發送簡訊給我
#3 引用回覆 回覆 發表時間:2004-10-21 20:24:10 IP:210.64.xxx.xxx 未訂閱
大大 不好意思 那篇文章我先前有看過了 可是看不太懂其中的意思 能勞煩幫我說明一下嗎?
sbkobe
一般會員


發表:3
回覆:3
積分:1
註冊:2004-07-02

發送簡訊給我
#4 引用回覆 回覆 發表時間:2004-10-21 20:27:16 IP:210.64.xxx.xxx 未訂閱
喔 對了 我想做到的是 可是由程式裡開啟第一個檔 而接下來的連續圖檔就自動播放 比如說我開 xxxx056.raw 它就自動播放 xxxx057.raw~~~~~~~~
TheMoon
中階會員


發表:17
回覆:95
積分:67
註冊:2002-06-05

發送簡訊給我
#5 引用回覆 回覆 發表時間:2004-10-22 10:25:27 IP:202.39.xxx.xxx 未訂閱
引言: 喔 對了 我想做到的是 可由程式裡開啟第一個檔 而接下來的連續圖檔就自動播放 比如說我開 xxxx056.raw 它就自動播放 xxxx057.raw

if(OpenDialog1->Execute())
{
 //前面這段需補上你的檔名解析程式
 //可用ExtractFileName函式及字串相關函式來作,解出start_no的值
 ...
 ...
 //以下是連續讀入並播放圖檔
 AnsiString FileName;
 for(int i = start_no ; i < end_no ; i   )
 {
   FileName.printf("xxxxd",i); //這是在取檔名(xxxx i),檔名是依據i的值來取,若i不滿三位數前面就補上0
   FileName=FileName ".raw"; //加上附檔名,你的程式是要開啟".raw"檔       {//以下這段就是你讀入raw檔的程式
    TMemoryStream* bin=new TMemoryStream();
    bin->LoadFromFile(OpenDialog1->FileName);
    int dwSize=Image1->Height*Image1->Width;
    Byte *pixel=new BYTE[dwSize];
    bin->Read(pixel, dwSize);        Graphics::TBitmap *bmp = new Graphics::TBitmap();
    bmp->PixelFormat=pf24bit;
    bmp->Height=Image1->Height;
    bmp->Width=Image1->Width;        for(int y=0; yHeight; y  )
    {
      ptr=(Byte *)bmp->ScanLine[y];
      for(int x=0; xWidth; x  )
      {
        ptr[x*3]=pixel[y*Image1->Width x];
        ptr[x*3 1]=pixel[y*Image1->Width x];
        ptr[x*3 2]=pixel[y*Image1->Width x];
      }
    }
    Image1->Picture->Assign(bmp);
    Application->ProcessMessages();
    delete bmp;
    delete bin;
   }
 }
}
系統時間:2024-05-14 17:30:05
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!