网站首页 > 脚本专栏 > 按键精灵相关 > 按键精灵Q语言 正文
运行环境:分辨率:1024x768 色深:16位 操作系统:Microsoft Windows XP 按键精灵版本:8.11.7459
@xxchuchu2011/1/14
raGrayLevel = 200 const RedOfRGB = 1 const GreenOfRGB = 2 const BlueOfRGB = 3 Dim GraphicArray( 1000, 1000 ) Dim GrayArray( 1000, 1000 ) //图片特征数组: GraphicArray放的颜色串字符; // GrayArray 放的二值化数字 //定义图形矩形左上角和右下角坐标 Dim RectangleBegin, RectangleEnd RectangleBegin = "315,108" RectangleEnd = "430,132" Dim MyArray, x1, y1, x2, y2 MyArray = split( RectangleBegin, "," ) x1 = CInt( MyArray(0) ) y1 = CInt( MyArray(1) ) MyArray = split( RectangleEnd, "," ) x2 = CInt( MyArray(0) ) y2 = CInt( MyArray(1) ) Call GetGraphic( RectangleBegin, RectangleEnd, ParaGrayLevel ) Dim Str Str = "" For y = y1 to y2 For x = x1 to x2 Str = Str & GrayArray( x, y ) Next Str = Str & vbCrlf Next MessageBox Str Sub GetGraphic( RectangleBegin, RectangleEnd, GrayLevel ) //制作人员:xxchuchu //制作时间:2011.01.10 //功能说明:返回指定矩形[左上角和右下角坐标定义此矩形]范围的颜色字符数组 //这里直接对全局数组变量GraphicArray进行赋值 //参数说明: //GetGraphic 返回值, 格式:nnn 数字型 //RectangleBegin 矩形左上角坐标, 格式:X,Y 字符型 //RectangleEnd 矩形右下角坐标, 格式:X,Y 字符型 Dim MyArray, x1, y1, x2, y2 MyArray = split( RectangleBegin, "," ) x1 = CInt( MyArray(0) ) y1 = CInt( MyArray(1) ) MyArray = split( RectangleEnd, "," ) x2 = CInt( MyArray(0) ) y2 = CInt( MyArray(1) ) For y = y1 to y2 For x = x1 to x2 GraphicArray( x, y ) = GetPixelColor(x,y) GrayArray( x, y ) = PartNumOfRGB( GraphicArray( x, y ), RedOfRGB ) GrayArray( x, y ) = Binarization( GrayArray( x, y ), ParaGrayLevel ) Next Next End Sub Function ConvertGraphicToNum End Function Function Binarization( ParaNum, GrayLevel ) //制作人员:xxchuchu //制作时间:2011.01.10 //功能说明:二值化,返回输入数字 ParaNum 的 经过灰色计算后的值0或1 //参数说明: //Binarization 返回值, 格式:n 数字型, n = 0,1 //ParaNum 10进制数字, 格式:nnnnn 数字型 //GrayLevel 灰度,格式:nnn 数字型,n = 0-999 If ParaNum < GrayLevel Then Binarization = 1 Else Binarization = 0 End If Rem EndOfFunc End Function Function PartNumOfRGB( sColor, PartOfRGB ) //制作人员:xxchuchu //制作时间:2011.01.10 //功能说明:返回颜色字符串 sColor 的 PartOfRGB 部分RGB( Red, Green, Blue ) //参数说明: //PartNumOfRGB 返回值, 格式:nnn 数字型 //sColor 16进制6位数颜色字符串, 格式:xxxxxx 字符型,x=0-9,A-F //PartOfRGB 颜色串中需要取值的部分,格式:n 数字型,n = 1,2,3 Dim MyByte Dim i, NumOfPart //先将16进制数转换成10进制数 NumOfPart = 0 For i = 1 to 6 MyByte = Mid( sColor, i, 1 ) Select Case MyByte Case "A" NumOfPart = ( NumOfPart + 10 ) * 16 Case "B" NumOfPart = ( NumOfPart + 11 ) * 16 Case "C" NumOfPart = ( NumOfPart + 12 ) * 16 Case "D" NumOfPart = ( NumOfPart + 13 ) * 16 Case "E" NumOfPart = ( NumOfPart + 14 ) * 16 Case "F" NumOfPart = ( NumOfPart + 15 ) * 16 Case Else NumOfPart = ( NumOfPart + CInt( MyByte ) ) * 16 End Select Next //上面多乘了16,要去掉 NumOfPart = NumOfPart / 16 // Red + Green*256 + Blue*65536 Select Case PartOfRGB Case 1 NumOfPart = NumOfPart - 65536 * Fix( NumOfPart/65536 ) //去掉Blue色 NumOfPart = NumOfPart - 256 * Fix( NumOfPart/256 ) //去掉Green色 Case 2 NumOfPart = NumOfPart - 65536 * Fix( NumOfPart/65536 ) //去掉Blue色 NumOfPart = Fix( NumOfPart/256 ) //得到Green色 Case Else NumOfPart = Fix( NumOfPart/65536 ) //得到Blue色 End Select PartNumOfRGB = NumOfPart Rem EndOfGetRedOfRGB End Function
- 上一篇: 按键精灵验证码远程代答脚本源码
- 下一篇: 字符过滤易语言源码
猜你喜欢
- 2019-03-19 按键精灵钓鱼脚本源码
- 2019-03-16 按键精灵脚本源码 巨人拉车
- 2019-03-15 按键精灵脚本源码 开心宝贝后台跳绳
- 2019-03-14 按键精灵脚本源码 剑侠情缘-以五行找金
- 2019-03-11 按键精灵开心ol前台打怪脚本源码
- 2019-03-10 按键精灵脚本源码 《龙之刃》自动遇敌左右按键
- 2019-03-09 按键精灵女弓挂精灵脚本源码
- 2019-03-08 按键精灵小号桃源挖矿脚本源码
- 2019-01-25 按键精灵简单技能训练源码
- 2019-01-14 按键精灵单纯挖矿脚本源码
你 发表评论:
欢迎- 百度站内搜索
- 关注微信公众号
- 网站分类
-
- 网站公告
- 电子书书籍
- 程序员工具箱
- 编程工具
- 易语言相关
- 网络相关源码
- 图形图像源码
- 系统工具源码
- 易语言模块源码
- 易语言支持库
- 数据库类源码
- 易语言例程
- 易语言游戏开发
- 易语言模块
- 多媒体类源码
- 易语言资源网
- 易语言视频教程
- JS分析教程
- 易语言图文教程
- 易语言常见问题及笔记
- 工具源码
- 易语言版本
- 网络编程
- javascript
- PHP编程
- html
- 正则表达式
- 面试题
- nodejs
- 其它综合
- 脚本专栏
- python
- 按键精灵相关
- 按键精灵图文教程
- 按键精灵视频教程
- 按键精灵Q语言
- 按键精灵安卓版
- golang
- 游戏安全
- 火山相关
- 火山安卓软件
- 火山常见问题及笔记
- 火山安卓源码
- 火山视频教程
- 火山PC版本下载
- 火山PC视窗例程
- 互联网那些事
- 引流推广
- 项目揭秘
- 网络营销
- 营销软件
- QQ营销软件
- 娱乐软件
- 机器人插件
- 培训教程
- 技术教程
- 活动线报
- 数据库
- Redis
- Access
- MongoDB
- Mysql
- 问答
- 其它
- 易语言
- 需求
- 在线教程
- 多线程培训班
- 觅风易语言教程
- 模拟系列教程
- 集中营易语言教程
- 历史数据
- 随机tag
已有4位网友发表了看法:
火山移动教程网 评论于 [2019-03-12 11:56:50] 回复
按键精灵图形
果子 评论于 [2019-05-03 20:37:32] 回复
按键精灵图形
易语言源码站 评论于 [2019-06-23 20:33:15] 回复
按键精灵图形
编程助手 评论于 [2020-02-18 12:19:53] 回复
按键精灵+图片二值化+处理