aardio的opencv库

Overview

opencv_aardio

dll库下载地址:https://github.com/xuncv/opencv-plugin/releases

import cv2
img = cv2.imread("./images/Lena.jpg",1)
img = cv2.medianBlur(img,5)
cv2.imshow( "窗口标题",img )
cv2.imwrite("result.jpg",img)
cv2.waitKey(0)

opencv具有500多个跨平台的图像处理函数,是目前应用最广的数字图像库。opencv历史发展过程中由C接口慢慢转向C++接口,使其他语言(python除外)调用opencv的难度增大。最近找到一个针对.NET的封装库项目OpenCvSharp ,对opencv的接口进行了重新封装,对opencv版本的跟进也很及时。

虽然这个库面向.NET,但其封装的接口对aardio异常友好。使用aardio调用dll时,甚至比.NET更简单方便。

比如Mat类作为参数时,.NET的实现是添加一个CvPtr成员,用来存储Mat指针,然后每次需取一次CvPtr作为dll接口的指针,一次api调用需要封装3次。aardio的实现就非常优雅,在mat类代码中只需修改下属性表,就可以让dll直接使用aardio的mat对象

_metaProperty = ..util.metaProperty(
		_topointer = function(){
			return owner.handle; 
		}
		...
)		

甚至不需要声明API接口,就可以直接调用API。

var imread = dll["imgcodecs_imread"];
imread(srcMat,1);

基于以上几点,我开始尝试使用aardio对opencv进行封装,接口实现上尽量接近opencv-python风格,降低学习成本。

aardio原生支持opencv,我希望能解决以下问题:

  1. 充分融合aardio的胶水特性,增强aardio图像处理能力。
  2. 结合aardio桌面优势,如制作上位机软件时可提高工程进度。
  3. 使opencv项目轻量化。(我的conda文件夹已经10+G了)。
  4. 提高opencv启动速度,在算法测试中提高效率。
  5. 实时窗体显示,便于调参。

2021年4月18日

You might also like...
Comments
  • 下载后提未错误putTextZH为NULL

    下载后提未错误putTextZH为NULL


    aardio:运行时错误

    错误行号:#4 文件:[string "import cv2..."]: 不支持此操作:call 定义类型:method(table) 名字:'putTextZH' 类型:null

    调用栈: [string "import cv2..."]:4: in main chunk

    确定

    opened by kwan3277 2
  • 提示:Cannot load library

    提示:Cannot load library

    已下载DLL放置在\lib\cv2.res,运行时提示:

    aardio:运行时错误

    文件:[string "import cv2..."] 错误行号:#1 错误:import cv2 failed :

    文件:...esktop\opencv_aardio-main\lib\cv2_.aardio 错误行号:#2 错误:Cannot load library '~/lib/cv2/.res/OpenCvSharpExtern.dll'.

    调用栈: [kernel]: in function 'import' [string "import cv2..."]:1: in main chunk

    确定

    是不是因为DLL文件下载的不对?系统win10x64

    opened by kwan3277 2
  • CV2默认库里的bitwise_or,bitwise_xor函数是否有个小BUG?

    CV2默认库里的bitwise_or,bitwise_xor函数是否有个小BUG?

    `bitwise_or = function(src1,src2,mask){ var dst = ..cv2.mat(); mask = mask ? (mask.cvPtr) var err = dll.core_bitwise_or(src1.cvPtr,src2.cvPtr.dst.cvPtr,null); //这里是否应该为:src2.cvPtr,dst.cvPtr,null return dst; }

    bitwise_xor = function(src1,src2,mask){ var dst = ..cv2.mat(); mask = mask ? (mask.cvPtr) var err = dll.core_bitwise_xor(src.cvPtr,src2.cvPtr,dst.cvPtr,null) //这里是否应该为src1.cvPtr,src2.cvPtr,dst.cvPtr,null return dst; }`

    改后调用正常,没改前总报错

    opened by zhhl99 1
  • 反馈几个问题

    反馈几个问题

    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 );
    }
    
    opened by iycai 0
DouZero is a reinforcement learning framework for DouDizhu - 斗地主AI

[ICML 2021] DouZero: Mastering DouDizhu with Self-Play Deep Reinforcement Learning | 斗地主AI

Kwai 3.1k Jan 05, 2023
Creating of virtual elements of the graphical interface using opencv and mediapipe.

Virtual GUI Creating of virtual elements of the graphical interface using opencv and mediapipe. Element GUI Output Description Button By default the b

Aleksei 4 Jun 16, 2022
Erosion and dialation using structure element in OpenCV python

Erosion and dialation using structure element in OpenCV python

Tamzid hasan 2 Nov 11, 2021
Demo processor to illustrate OCR-D Python API

ocrd_vandalize/ Demo processor to illustrate the OCR-D/core Python API Description :TODO: write docs :) Installation From PyPI pip3 install ocrd_vanda

Konstantin Baierer 5 May 05, 2022
OCR system for Arabic language that converts images of typed text to machine-encoded text.

Arabic OCR OCR system for Arabic language that converts images of typed text to machine-encoded text. The system currently supports only letters (29 l

Hussein Youssef 144 Jan 05, 2023
This is a project to detect gestures to zoom in or out, using the real-time distance between the index finger and the thumb. It's based on OpenCV and Mediapipe.

Pinch-zoom This is a python project based on real-time hand-gesture detection, to zoom in or out, using the distance between the index finger and the

Harshit Bhalla 6 Jul 11, 2022
Super Mario Game With Python

Super_Mario Hello all this is a simple python program which tries to use our body as a controller for the super mario game Here I have used media pipe

Adarsh Badagala 219 Nov 25, 2022
This is a GUI program which consist of 4 OpenCV projects

Tkinter-OpenCV Project Using Tkinter, Opencv, Mediapipe This is a python GUI program using Tkinter which consist of 4 OpenCV projects 1. Finger Counte

Arya Bagde 3 Feb 22, 2022
OCR, Scene-Text-Understanding, Text Recognition

Scene-Text-Understanding Survey [2015-PAMI] Text Detection and Recognition in Imagery: A Survey paper [2014-Front.Comput.Sci] Scene Text Detection and

Alan Tang 354 Dec 12, 2022
The code of "Mask TextSpotter: An End-to-End Trainable Neural Network for Spotting Text with Arbitrary Shapes"

Mask TextSpotter A Pytorch implementation of Mask TextSpotter along with its extension can be find here Introduction This is the official implementati

Pengyuan Lyu 261 Nov 21, 2022
A simple component to display annotated text in Streamlit apps.

Annotated Text Component for Streamlit A simple component to display annotated text in Streamlit apps. For example: Installation First install Streaml

Thiago Teixeira 312 Dec 30, 2022
Programa que viabiliza a OCR (Optical Character Reading - leitura óptica de caracteres) de um PDF.

Este programa tem o intuito de ser um modificador de arquivos PDF. Os arquivos PDFs podem ser 3: PDFs verdadeiros - em que podem ser selecionados o ti

Daniel Soares Saldanha 2 Oct 11, 2021
The CIS OCR PostCorrectionTool

The CIS OCR Post Correction Tool PoCoTo Source code for the Java-based PoCoTo client enabling fast interactive batch corrections of complete OCR error

CIS OCR Group 36 Dec 15, 2022
A synthetic data generator for text recognition

TextRecognitionDataGenerator A synthetic data generator for text recognition What is it for? Generating text image samples to train an OCR software. N

Edouard Belval 2.5k Jan 04, 2023
📷 Face Recognition using Haar-Cascade Classifier, OpenCV, and Python

Face-Recognition-System Face Recognition using Haar-Cascade Classifier, OpenCV and Python. This project is based on face detection and face recognitio

1 Jan 10, 2022
OpenMMLab Text Detection, Recognition and Understanding Toolbox

Introduction English | 简体中文 MMOCR is an open-source toolbox based on PyTorch and mmdetection for text detection, text recognition, and the correspondi

OpenMMLab 3k Jan 07, 2023
huoyijie 1.2k Dec 29, 2022
Detecting Text in Natural Image with Connectionist Text Proposal Network (ECCV'16)

Detecting Text in Natural Image with Connectionist Text Proposal Network The codes are used for implementing CTPN for scene text detection, described

Tian Zhi 1.3k Dec 22, 2022
Ackermann Line Follower Robot Simulation.

Ackermann Line Follower Robot This is a simulation of a line follower robot that works with steering control based on Stanley: The Robot That Won the

Lucas Mazzetto 2 Apr 16, 2022