- 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互调暂时写这么多。