函数:cvResize 拉伸图片
函数分类:tsimg.so
函数功能:从图片创建拉伸后的图片对象
引擎版本:iOS v3.0.5,Android v3.0.1 以上
函数方法
cvResizeMat,msg = image.cvResize(imge,width,heigth)
| 参数 | 类型 | 必填 | 说明 | 
|---|---|---|---|
| img | usedata | 是 | 需要操作的图片对象 | 
| width | number | 是 | 横向拉伸后图片的宽度 | 
| heigth | number | 是 | 纵向拉伸后图片的高度 | 
| 返回值 | 类型 | 说明 | 
|---|---|---|
| cvResizeMat | usedata/nil | 拉伸后的图片对象,失败显示空 | 
| msg | nil/string | 成功返回空,失败返回失败原因 | 
函数用例
local image = require("tsimg")  
snapshot("cvResize1.png", 0, 0, 100, 100)
--将图片转换为图片对象
local newImage,msg = image.loadFile(userPath() .. "/res/cvResize1.png") 
if image.is(newImage) then
    --将图片对象转换为宽度为 200,高度为 200 的图片的对象
    local cvResizeMat,msg = image.cvResize(newImage,200,200)
    if image.is(cvResizeMat) then        
        --获取图片尺寸
        local w,h = image.size(cvResizeMat)
        dialog("width= "..w.." heigth="..h)
    else
        dialog("拉伸失败 : " .. msg)
    end
else
    dialog(msg,3)
end
注意事项
Android 仅支持 v3.0.1 及其以上引擎版本。
安卓普通版需要登录账号、购买 VIP 并且在调用过程中账号需要保持登录状态否则会导致调用失效。
Android 真机与模拟器 tsimg.so 文件不同,需要按照设备类型进行下载。
点击 使用方法、tsimg.so 下载 查看使用方法及下载地址。