-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.cpp
34 lines (32 loc) · 793 Bytes
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "RV_VideoCapture.h"
#include "RV_RKNN.h"
#include <iostream>
#include <chrono>
#include <thread>
#include "opencv2/opencv.hpp"
using namespace std;
int main(){
MobileNet net("/oem/model/mobilenet.rknn");
net.model_init();
RK_U32 ch_vi = 0;
VideoCapture cap(640, 480, "rkispp_scale0", IMAGE_TYPE_NV12);
cap.start_vi(ch_vi);
while (true)
{
MEDIA_BUFFER mb = cap.getMediaBuffer(RK_ID_VI,ch_vi);
if(!mb){
printf("media buff is empty\n");
}
cv::Mat m = cap.buffConvertToMat(mb);
m = cap.imgProcess(m);
net.forward(m);
if(net.isGlass()){
printf("is glass\n");
}
else{
printf("not glass\n");
}
cap.releaseBuff(mb);
}
return 0;
}