错误隐藏学习手记(七)

方法论

        要用硬件实现。虽然整个大的框架我们已经搞定了,但是这算是一个比较大的工程,所以这里我们采用的设计方法其实是Meet-in-the-Middle的方法进行设计,所以我先实现帧内错误隐藏,先对一幅图片进行插值。那么我们需要先显示一幅图片,在这里介绍两个软件给大家。Image2LCD和BmpToMif。(以下两个工具是对于Altera的quartus可用,Xilinx的ram的初始化http://blog.csdn.net/qsj8362234/article/details/6111841)在做这个简单的插值之前我们对整个小的part进行建模。具体建模请见最后。对于不同位图可用同一份代码搞定:http://www.cppblog.com/windcsn/archive/2010/04/23/10608.html


       Xilinx的生成ram的初始化文件其实也是有一个工具的,在我上传的资源中可以下载,非常好用!先用Image2Lcd转化为bin文件再转化为coe文件,可以自定义位宽。

      

       效果演示:


Image2Lcd

Image2Lcd 是一款工具软件,它能使你把各种来源的图片转换成特定的数据格式以用来匹配单片机系统所需要的显示数据格式。Image2Lcd支持的输入图像格式包括: BMP, WBMP, JPG, GIF, WMF, EMF, ICO, 等等。Image2Lcd的输出数据类型包括定制的二进制类型、c语言数组类型和标准的BMP格式、WBMP格式。Image2Lcd能可视调节输入图象的数据扫描方式、灰度(颜色数)、图像数据排列方式、亮度、对比度、等等。对于包含了图像头数据保存的图像数据文件,Image2Lcd能重新打开作为输入图像。

特点:

支持所有的点阵LCD所需要的特殊显示数据格式。

可视调节输出图像效果。

256色模式下支持用户调色板(TIFF格式)。

支持4096色图像输出。

以二进制类型和C语言数组类型(文本)两种方式保存数据,方便单片机开发者的不同需要。

保存的数据支持LSB First/MSB First(很多单片机系统WORD高低字节排列与PC相反)。

可以保存图像为指定颜色数的BMP格式图像。

即时图示当前设置的数据格式。 

使用方法:

Image2Lcd窗口包含工具条、图像设置区、图像显示区、图像调整区、状态条。

工具条:
工具条包含有按钮:打开、保存、设置、重新载入、上一幅、下一幅、帮助、关于。

打开:打开图像文件作为输入图像。

保存:以当前设置的格式保存输出图像数据。

设置:启动设置对话框。

重新载入:重新打开输入图像,并按照当前设置转换成输出图像。

http://www.cr173.com/soft/43222.html


BmpToMif

程序可能显示的是pic2mif,但是意思是一个,Mif文件生成器(BmpToMif)可将图片生成Mif文件,作为FPGA的ram或者rom的输入测试文件,BmpToMif 通过vhdl定制rom 也可以将txt文件转化成mif文件,很是方便。

http://www.7edown.com/soft/down/soft_42333.html


这里推荐一个比较好的画流程图的软件给大家:diagram designer,当然viso也很好用。

对于插值这一块我建的模型如下:


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Bmp To Mif 转换器 // (karimov 2005) // This program was originnaly written by one of the ECE241 students to convert an image // supplied in a BMP file into an MIF file format for use with Quartus II. // // This program has recently been modified to work with the new VGA controller used with the DE2 // board. // // What to do: // 1. Create an image in Microsoft paint (or other program). The image must be 160 pixels wide, 120 pixels high and // use 24-bits to represent colour information. // 2. Once you create the image you need, flip it up-side down. Then save the BMP file. (example: foo.bmp) // 3. Run this converter in command prompt using the name of the BMP file you created as a command-line parameter. // For example: // bmp2mif foo.bmp // 4. The program generates two files: // image.colour.mif - an MIF file with 3 bits colour information obtained from the BMP file you supplied // image.mono.mif - an MIF file containing 1 bit of colour for every pixel on the screen. The dot will either be // black or white. // You can change the file names once they are created, but they should still have the .mif extension. // // 5. Copy the proper MIF file to the directory where your design is located and include it in your project. // 6. Change the BACKGROUND_IMAGE parameter of the VgaAdapter to indicate your MIF file. // 7. The COLOR_CHANNEL_DEPTH parameter must be set to 1 to work with the image.colour.mif file. #include #include #define FLIP_INT(c) ((c >> 24) & 0x000000FF) | ((c & 0x00FF0000) >> 8) | ((c & 0x0000FF00) << 8) | ((c & 0x000000FF) <> 8) | ((c & 0x00FF) << 8) typedef struct s_header { unsigned short bfType; unsigned int bfSize; unsigned short reserved1; unsigned short reserved2; unsigned int offset; } t_bmp_header; typedef struct s_bmp_info { unsigned int biSize; unsigned int biWidth; unsigned int biHeight; unsigned short biPlanes; unsigned short biBitCount; unsigned int biCompression; unsigned int biSizeImage; unsigned int biXPelsPerMeter; unsigned int biYPelsPerMeter; unsigned int biClrUsed; unsigned int biClrImportant; } t_bmp_info; int faprint(FILE *fcol, FILE *fm, const char *pattern) { fprintf(fcol, pattern); return fprintf(fm, pattern); } int main(int argc, char* argv[]) { FILE *f, *fcol, *fm; int y; unsigned int x, c, r, g, b; unsigned int width, height; if (argc != 2) { printf("Usage: bmp2mif \n"); return 0; } else { printf("Input file is: %s\n", argv[1]); } printf("This program converts n x m 24-bit .BMP image to MIF file\n"); printf("There are 2 files produced:\n"); printf("\timage.colour.mif - 8-colour channel, n x m x 3\n"); printf("\timage.mono.mif - black and white image, n x m x 1\n\n"); f = fopen(argv[1], "rb"); fcol = fopen("image.colour.mif", "wb"); fm = fopen("image.mono.mif", "wb"); if (f) { t_bmp_header header; t_bmp_info info; fread(&header, 14, 1, f); /* sizeof(t_bmp_header) returns 16 instead of 14. Should be 14. */ fread(&info, sizeof(t_bmp_info), 1, f); #if !defined (WIN32) header.bfSize = FLIP_INT(header.bfSize); header.bfType = FLIP_SHORT(header.bfType); header.offset = FLIP_INT(header.offset); header.reserved1 = FLIP_SHORT(header.reserved1); header.reserved2 = FLIP_SHORT(header.reserved2); info.biSize = FLIP_INT(info.biSize); info.biWidth = FLIP_INT(info.biWidth); info.biHeight = FLIP_INT(info.biHeight); info.biPlanes = FLIP_SHORT(info.biPlanes); info.biBitCount = FLIP_SHORT(info.biBitCount); info.biCompression = FLIP_INT(info.biCompression); info.biSizeImage = FLIP_INT(info.biSizeImage); info.biXPelsPerMeter = FLIP_INT(info.biXPelsPerMeter); info.biYPelsPerMeter = FLIP_INT(info.biYPelsPerMeter); info.biClrUsed = FLIP_INT(info.biClrUsed); info.biClrImportant = FLIP_INT(info.biClrImportant); #endif printf("Input file is %ix%i %i-bit depth\n", info.biWidth, info.biHeight, info.biBitCount); if (info.biBitCount == 24) { char temp[100]; width = info.biWidth; height = info.biHeight; printf("Converting...\n"); sprintf(temp, "Depth = %i;\r\n",width*height); faprint(fcol, fm, temp); fprintf(fcol, "Width = 3;\r\n"); fprintf(fm, "Width = 1;\r\n"); faprint(fcol, fm, "Address_radix=dec;\r\n"); faprint(fcol, fm, "Data_radix=bin;\r\n"); faprint(fcol, fm, "Content\r\n"); faprint(fcol, fm, "BEGIN\r\n"); sprintf(temp, "\t[0..%i] : 000;\r\n", width*height - 1); fprintf(fcol, temp); sprintf(temp, "\t[0..%i] : 0;\r\n", width*height - 1); fprintf(fm, temp); fseek(f, 54, SEEK_SET); for(y=height-1; y >=0; y--) { x = 0; fprintf(fcol, "\t%i :", y*width+x); fprintf(fm, "\t%i :", y*width+x); for(x=0; x 0) && ((x % 40) == 0)) { fprintf(fcol, ";\r\n\t%i :", y*width + x); fprintf(fm, ";\r\n\t%i :", y*width + x); } #if defined (WIN32) c = ((c >> 24) & 0x000000FF) | ((c & 0x00FF0000) >> 8) | ((c & 0x0000FF00) << 8) | ((c & 0x000000FF) <>= 8; b = (c & 0xFF0000) >> 16; g = (c & 0x00FF00) >> 8; r = (c & 0x0000FF); c = r + g + b; c /= 3; r = (r >= 128 ? 1 : 0); g = (g >= 128 ? 1 : 0); b = (b >= 128 ? 1 : 0); c = (c >= 128 ? 1 : 0); fprintf(fcol, " %i%i%i", r, g, b); fprintf(fm, " %i", c); } faprint(fcol, fm, ";\r\n"); if ((x*3) % 4 != 0) { fread(&c, 4-((x*3) % 4), 1, f); } } faprint(fcol, fm, "End;\r\n"); } else printf("Input file image.bmp is not in a 24-bit colour format!\n"); fclose(fm); fclose(fcol); fclose(f); printf("All done.\n"); } else printf("Cannot open input file. Check for input.bmp\n"); }
《MATLAB GUI设计学习手记 第3版》是一本介绍MATLAB GUI设计的学习手册。本书主要分为几个部分,包括基础知识、常用控件、图形用户界面设计、数据处理及可视化等内容。 在基础知识部分,本书详细介绍了MATLAB GUI设计的背景知识和基本原理,包括MATLAB环境下GUI的概念、常用函数以及GUI设计的基本流程等。通过对基础知识的学习,读者可以对MATLAB GUI设计有一个整体的认识。 在常用控件部分,本书介绍了MATLAB中常用的控件的使用方法,如按钮、文本框、列表框等。对于每种控件,书中都给出了详细的示例代码和运行效果,读者可以通过实践学习掌握这些控件的使用技巧。 在图形用户界面设计部分,本书介绍了如何设计具有良好用户交互性的GUI界面,包括界面布局、颜色和字体设置、事件处理等。通过对这些方面的学习,读者可以设计出美观、易用的GUI界面。 在数据处理及可视化部分,本书介绍了如何使用MATLAB进行数据的读取、处理和可视化,包括数据操作、数据分析以及结果展示等。通过对这些内容的学习,读者可以将GUI和数据处理相结合,实现更加强大的功能。 总之,《MATLAB GUI设计学习手记 第3版》是一本对MATLAB GUI设计进行全面介绍的学习手册,适合对MATLAB GUI设计感兴趣的读者。读者可以通过学习本书,不仅学会了基本的GUI设计技巧,还可以将其应用于实际项目中,提高工作效率。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值