- android log 頭文件
#include "log.h"
#include<android/log.h>
#include <MNN_jni.h>
#define TAG "NDK"
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,TAG ,__VA_ARGS__)
2.打印log
與C中的printf 一樣
LOGD("box pos\n");
LOGD("%f %f %f %f\n",box[0],box[1],box[2],box[3]);
3.保存日誌
/storage/emulated/0 爲手機根目錄
ofstream ofile;
ofile.open("/storage/emulated/0/jpg_1_out.txt");
ofile<<"[";
for (int i = 0;i<coors.size();i+=2)
{
if (i > 0)
ofile<<",";
LOGD("%f,%f\n",coors[i],coors[i+1]);
ofile<<"["<<coors[i]<<","<<coors[i+1]<<"]";
}
ofile<<"]";
ofile.close();
4.char *保存yuv圖片
std::ofstream yuvofile;
yuvofile.open("/storage/emulated/0/input_YUV.yuv");
for (int i = 0;i<width*height*1.5;i++)
{
yuvofile<<buffer[i];
}
yuvofile.close();
android與jni互調暫時寫這麼多。