Blogtrottr
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 發問中
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 發問中
如何以Dev-c++來開啟已有的影像開啟函數(C語言)?
May 27th 2013, 03:06

各位知識家的前輩們好:

小弟有一點C的基礎(使用Dev-C++編譯器),
最近想要來自學一下C語言的影像處理,
因此買了<圖解 數位影像處理 程式範例教本 – 使用 C 語言 >這本書來研讀
(裡面很多範例!開心^^),
https://www.flag.com.tw/book/bookinfo.asp?bokno=F7532

但...一開始的影像讀取部分就碰到了問題Orz...
以下是節錄自書裡的敘述:

<<
本書中所介紹的程式使用以下的指令執行,

[指令名] [影像處理的影像資料檔名稱] [儲存處理結果的影像資料檔案名] [所需要的參數]

也就是說,影像資料是透過檔案來處理的。本書的範例並不會直接呈現影像,
有關處理對象的影像,以及處理結果的影像,請在各自的作業環境下,使用檢視器等工具程式檢視。
>>

本文的最後面附上書上所給的 "BMP檔案的讀取作業" code,
看起來就是一個函數,但我卻不會再自己加指令讓其執行,
我甚至直接照他敘述的指令下法來加在code的前面...

#include <stdio.h>
#include <stdlib.h>
int main(void)
{
[readBMPfile] [C:\A.bmp] [C:\B.bmp];

//[指令名] [影像處理的影像資料檔名稱] [儲存處理結果的影像資料檔案名]
system("pause");
return 0;
}

int readBMPfile(char *fname,ImageData **img) //書中附的code
{
int i,c; //後略,請見附檔

結果當然是沒辦法執行QQ

也上網找了很多資料,
卻還是連第一個範例都執行不起來,真的超沮喪...
希望各位熱心的版友們能指點迷津,幫小弟渡過這個難關><

感激不盡!!!!

// BMP檔案的讀取作業
//(因有字數上限限制,因此只能附上部分code><)
//想要完整code請告訴我信箱,我再寄給你,謝謝!!
int readBMPfile(char *fname,ImageData **img)
{
int i,c;
int errcode=0;
BITMAPFILEHEADER BMPFile;
intfsize;
BITMAPINFOHEADER BMPInfo;
BITMAPCOREHEADER BMPCore;
intcolors;
intcolorTableSize;
intbitsSize;
intBISize;
int x,y;
int mx,my,depth;
int pad;
int mxb,myb;
int isPM=FALSE;
FILE *fp;

WORD HEAD_bfType;
DWORD HEAD_bfSize;
WORD HEAD_bfReserved1;
WORD HEAD_bfReserved2;
DWORD HEAD_bfOffBits;
DWORD INFO_bfSize;
Pixel palet[MAXCOLORS];
Pixel setcolor;

if((fp=fopen(fname,"rb"))==NULL) {
return -1;
}

if(!freadWORD(&HEAD_bfType,fp)) {
errcode=-2;
goto $ABORT;
}
if (HEAD_bfType != 0x4d42) {
errcode=-10;
goto $ABORT;
}

if(!freadDWORD(&HEAD_bfSize,fp)) {
errcode=-10;
goto $ABORT;
}

if(!freadWORD(&HEAD_bfReserved1,fp)) {
errcode=-10;
goto $ABORT;
}

if(!freadWORD(&HEAD_bfReserved2,fp)) {
errcode=-10;
goto $ABORT;
} //未完

This entry passed through the Full-Text RSS service — if this is your content and you're reading it on someone else's site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers. Five Filters recommends: 'You Say What You Like, Because They Like What You Say' - https://www.medialens.org/index.php/alerts/alert-archive/alerts-2013/731-you-say-what-you-like-because-they-like-what-you-say.html

You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions
創作者介紹
創作者 韓國必買2016 , 韓國必買零食 , 韓國必買化妝品 , 韓國必買的東西 , 韓國必買2016零食 , 韓國必買2016美妝 , 韓國必買商品 的頭像
skow

韓國必買2016 , 韓國必買零食 , 韓國必買化妝品 , 韓國必買的東西 , 韓國必買2016零食 , 韓國必買2016美妝 , 韓國必買商品

skow 發表在 痞客邦 留言(0) 人氣( 2 )