VB如何二值化图片?
时间:2011-08-01
来源:互联网
一幅BMP图片,需要通过串口发送出去,想到了把图片二值化处理后发出去,但我无法实现。请高手指点方向!
作者: BlueBinaryMan 发布时间: 2011-08-01
VB code
Option Explicit Private Type bitmapfileheader bftype As Integer bfsize As Long bfreserved1 As Integer bfreserved2 As Integer bfoffbits As Long End Type '头信息 Private Type bitmapinfoheader bisize As Long biwidth As Long biheight As Long biplanes As Integer bibitcount As Integer bicompression As Long bisizeimage As Long bixpelspermeter As Long biypelspermeter As Long biclrused As Long biclrimportant As Long End Type Private Type RGBQUAD rgbBlue As Byte rgbReserved As Byte rgbRed As Byte rgbGreen As Byte End Type Dim FileHeader As bitmapfileheader Dim FileInfoHeader As bitmapinfoheader Dim Palettesize As Integer Dim BMPFileToBinary(1024, 1024, 2) As Byte Private Sub btnBMP_Click() Dim lngBMPWidth As Long 'BMP图片的宽 Dim lngBMPHeight As Long 'BMP图片的高 Dim intBMPBitCount As Long 'BMP图片的位数 Dim bytPoint As Byte Dim bytPalentry As Byte Dim bytP As Byte Dim intP As Integer Dim intT As Integer Dim intC As Integer Dim intD As Integer On Error GoTo errSub Open "D:\Test.bmp" For Binary As #1 Get #1, , FileHeader Get #1, , FileInfoHeader lngBMPWidth = FileInfoHeader.biwidth lngBMPHeight = FileInfoHeader.biheight intBMPBitCount = FileInfoHeader.bibitcount For intP = 0 To lngBMPHeight - 1 For intT = 0 To lngBMPWidth - 1 For intC = 0 To 2 Get #1, , bytPoint BMPFileToBinary(intT, intP, intC) = bytPoint Next intC Next intT Next intP Close #1 Exit Sub errSub: End Sub
作者: Veron_04 发布时间: 2011-08-01
二值化发过去,这还能看么?
作者: WallesCai 发布时间: 2011-08-03
学习了,我就需要这个一个二值化,将图像转为黑白的知识,这个在扫描上用处大大的和图像数据库转换和压缩很有用
作者: xiaolinyouni 发布时间: 2011-08-03
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28