欢迎来到冰点文库! | 帮助中心 分享价值,成长自我!
冰点文库
全部分类
  • 临时分类>
  • IT计算机>
  • 经管营销>
  • 医药卫生>
  • 自然科学>
  • 农林牧渔>
  • 人文社科>
  • 工程科技>
  • PPT模板>
  • 求职职场>
  • 解决方案>
  • 总结汇报>
  • ImageVerifierCode 换一换
    首页 冰点文库 > 资源分类 > DOCX文档下载
    分享到微信 分享到微博 分享到QQ空间

    用c语言进行数字图像处理Word文件下载.docx

    • 资源ID:4507789       资源大小:18.95KB        全文页数:30页
    • 资源格式: DOCX        下载积分:3金币
    快捷下载 游客一键下载
    账号登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录 QQ登录
    二维码
    微信扫一扫登录
    下载资源需要3金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

    加入VIP,免费下载
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    用c语言进行数字图像处理Word文件下载.docx

    1、 LONG biHeight; WORD biPlanes; WORD biBitCount; DWORD biCompression; DWORD biSizeImage; LONG biXPelsPerMeter; LONG biYPelsPerMeter; DWORD biClrUsed; DWORD biClrImportant;BITMAPINFOHEADER;typedef struct tagRGBQUAD / rgbq BYTE rgbBlue; BYTE rgbGreen; BYTE rgbRed; BYTE rgbReserved;RGBQUAD;typedef struc

    2、t tagBITMAPINFO BITMAPINFOHEADER bmiHeader; RGBQUAD bmiColors1;BITMAPINFO;#endif / BMP_H_INCLUDED 主程序:main.c #include stdlib.hstring.hmalloc.hctype.hprocess.h#include BMP.hBITMAPFILEHEADER bmfh;BITMAPINFOHEADER bmih;BYTE *imgData;bool bReadBMFH=false;bool bReadBMIH=false;bool bReadPixel=false;/检查路径是

    3、否合法:文件能打开;以 bmp 为后缀名 int CheckFilePath(char *filepath);/读入位图的文件头 int ReadFileHeader(char *filepath,BITMAPFILEHEADER *bmfh);/打印位图的文件头 void PrintFileHeader(BITMAPFILEHEADER *bmfh);/读入位图的信息头 int ReadInfoHeader(char *filepath,BITMAPINFOHEADER *bmih);/打印位图的信息头 void PrintInfoHeader(BITMAPINFOHEADER *bmih)

    4、;/创建 8 位位图的调色板 int CreatePalette(RGBQUAD pal);/读入位图的像素数据 int ReadPixelData(char *filepath,BYTE *imgData);/计算每行像素所占的字节数 LONG GetLineBytes(int imgWidth,int bitCount);/打印位图的像素数据 void PrintPixelData(BYTE *imgData,int width,int height,int bitCount);/打印菜单选项 void PrintMenu();/另存为位图 int SaveAsImage(char *fi

    5、lepath);/显示位图 void ShowImage(char * filepath);/保存文件头 int SaveFileHeader(FILE* fp);/保存信息头 int SaveInfoHeader(FILE* fp);/保存调色板 int SaveColorPalette(FILE *fp);/保存像素数据 int SavePixelData(FILE* fp);int main() char filepath256; char saveasfilepath256; int i; int width; int height; int bitCount; DWORD dwLin

    6、eBytes; int select; int q=0;system(echo off);color 2printf(-TIMimage-nInput the path of the BMP file:ngets(filepath);i=CheckFilePath(filepath);if(i=-1) return -1; do PrintMenu(); scanf(%u,&select); switch(select) case 0: printf(%s,filepath); CheckFilePath(filepath); break; case 1: i=ReadFileHeader(f

    7、ilepath,&bmfh); if(i!=-1) Read the file header successfully.n bReadBMFH=true; else Read the file header failed.n bReadBMFH=false; q=1;case 2: i=ReadInfoHeader(filepath,&bmih);Read the info header successfully.n bReadBMIH=true;Read the info header failed.n bReadBMIH=false;case 3: if(!bReadBMIH) Pleas

    8、e read the info header at first.n height=bmih.biHeight; width=bmih.biWidth; bitCount=bmih.biBitCount; dwLineBytes=GetLineBytes(width,bitCount); imgData=(BYTE*)malloc(dwLineBytes*height*sizeof(BYTE);imgData) Can not allocate memory for the image.n i=ReadPixelData(filepath,imgData); if(i=-1) Read the

    9、pixel data failed.n bReadPixel=false;Read the pixel data successfully.n bReadPixel=true;case 4: if(bReadBMFH) PrintFileHeader(&Please read the file header at first.ncase 5: if(bReadBMIH) PrintInfoHeader(&case 6: if(bReadPixel) PrintPixelData(imgData,width,height,bitCount);Please read the pixel data

    10、at first.n case 7: ShowImage(filepath); case 8:Input the path(ex. d:/poon.bmp) you want to save:,saveasfilepath); i=SaveAsImage(saveasfilepath);Error: failed to save the image.n default: select=9527; while (q=0); return 0;int ReadFileHeader(char *filepath,BITMAPFILEHEADER *bmfh) FILE *fp; fp=fopen(f

    11、ilepath,rbfp) Can not open the file:%sn if(fread(&bmfh-bfType,sizeof(WORD),1,fp)!=1) Can not read bfType in the file header.n fclose(fp);bfSize,sizeof(DWORD),1,fp)!Can not read bfSize in the file header.nbfReserved1,sizeof(WORD),1,fp)!Can not read bfReserved1 in the file header.nbfReserved2,sizeof(W

    12、ORD),1,fp)!Can not read bfReserved2 in the file header.nbfOffBits,sizeof(DWORD),1,fp)!Can not read bfOffBits in the file header.nint ReadInfoHeader(char *filepath,BITMAPINFOHEADER *bmih) fseek(fp,14,SEEK_SET);if(fread(&bmih-biSize,sizeof(DWORD),1,fp)!Can not read biSize in the info header.nbiWidth,s

    13、izeof(LONG),1,fp)!Can not read biWidth in the info header.nbiHeight,sizeof(LONG),1,fp)!Can not read biHeight in the info header.nbiPlanes,sizeof(WORD),1,fp)!Can not read biPlanes in the info header.nbiBitCount,sizeof(WORD),1,fp)!Can not read biBitCount in the info header.nbiCompression,sizeof(DWORD)

    14、,1,fp)!Can not read biCompression in the info header.nbiSizeImage,sizeof(DWORD),1,fp)!Can not read biSizeImage in the info header.nbiXPelsPerMeter,sizeof(LONG),1,fp)!Can not read biXPelsPerMeter in the info header.nbiYPelsPerMeter,sizeof(LONG),1,fp)!Can not read biYPelsPerMeter in the info header.nb

    15、iClrUsed,sizeof(DWORD),1,fp)!Can not read biClrUsed in the info header.nbiClrImportant,sizeof(DWORD),1,fp)!Can not read biClrImportant in the info header.nint CreatePalette(RGBQUAD pal) if(sizeof(pal)/sizeof(RGBQUAD)!=256) The size of the palette must be 256.n for(i=0;ibfOffBits);bfReserved1:bfReserved1); printf(


    注意事项

    本文(用c语言进行数字图像处理Word文件下载.docx)为本站会员主动上传,冰点文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰点文库(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

    copyright@ 2008-2023 冰点文库 网站版权所有

    经营许可证编号:鄂ICP备19020893号-2


    收起
    展开