opencv4android 检测圆,openCV4android检测形状和颜色(HSV)

如果您计划为opencv实现NDK,那么您可以使用他们在OpenCV教程2-Mixedprocessing中使用的相同想法.

// on camera frames call your native method

public Mat onCameraFrame(CvCameraViewFrame inputFrame)

{

mRgba = inputFrame.rgba();

Nativecleshpdetect(mRgba.getNativeObjAddr()); // native method call to perform color and object detection

// the method getNativeObjAddr gets the address of the Mat object(camera frame) and passes it to native side as long object so that you dont have to create and destroy Mat object on each frame

}

public native void Nativecleshpdetect(long matAddrRgba);

在原住民方面

JNIEXPORT void JNICALL Java_org_opencv_samples_tutorial2_Tutorial2Activity_Nativecleshpdetect(JNIEnv*, jobject,jlong addrRgba1)

{

Mat& mRgb1 = *(Mat*)addrRgba1;

// mRgb1 is a mat object which points to the address of the input camera frame, so all the manipulations you do here will reflect on the live camera frame

//once you have your mat object(i.e mRgb1 ) you can implement all the colour and shape detection algorithm you have learnt in opencv book

}

因为所有操作都是使用指针完成的,所以你必须小心处理它们.希望这可以帮助

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值