Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

反馈几个问题 #9

Open
iycai opened this issue Nov 9, 2022 · 0 comments
Open

反馈几个问题 #9

iycai opened this issue Nov 9, 2022 · 0 comments

Comments

@iycai
Copy link

iycai commented Nov 9, 2022

1、cv2.Mat 和 cv2.MatExpr 库 的库文件名,首字母未改为大写(mat.aardio matExpr.aardio),好像会造成传错参数后,无法弹出错误提示,直接退出的问题。
2、从 bitmap 创建 cv2.Mat 对象时,有些像素格式的图片显示不正常,我使用以下代码显示常见像素格式图片:

    //bitmap传入
    elseif(tArg == type.table && arg[["pBitmap"]]){
        var data = arg.lockMemory(,0x26200A);
        err,ret = dll.core_Mat_new8(arg.height,arg.width,0x18/*_CV_8UC4*/,data.Scan0,data.Stride,{ptr value});
        this.handle = ret.value;
        arg.unlockMemory(data);
    }

3、cv2.Mat 对象 的toBitmap() 好像会造成内存泄漏(即使转换后,手动释放 cv2.Mat对象 和bitmap对象),我使用以下代码实现,暂时未发现内存大幅上涨的现象(转换后,手动释放 cv2.Mat对象 和bitmap对象)

toBitmap = function(){
	if(this.empty() or this.depth() != 0/*_CV_8U*/) return null;
    var pixelFormats = {
    	[1] = 0x30803;
    	[3] = 0x21808;
    	[4] = 0x26200A;
    }
    
    var pixelFormat = pixelFormats[this.channels()];
    var stride = this.step1();
    if(stride % 4 ){
    	stride = stride - (stride % 4 ) + 4;
    }
	return ..gdip.bitmap( this.width,this.height,pixelFormat,this.data,stride );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant