瀏覽代碼

add log 4

DevYK 3 年之前
父節點
當前提交
c6e8f0ce6d
共有 1 個文件被更改,包括 10 次插入10 次删除
  1. 10 10
      src/opencv/image_fingerprint.cpp

+ 10 - 10
src/opencv/image_fingerprint.cpp

@@ -52,11 +52,11 @@ int fingerprintFromFFAVFrame(FILE *file, AVFrame *frame, char buf[64]) {
     printf("fingerprintFromFFAVFrame -3\n");
     SwsContext *conversion = sws_getContext(width, height, (AVPixelFormat) frame->format, width, height,
                                             AVPixelFormat::AV_PIX_FMT_BGR24, SWS_FAST_BILINEAR, NULL, NULL, NULL);
-    if (conversion){
+    if (conversion) {
         printf("fingerprintFromFFAVFrame -4\n");
-        sws_scale(conversion, frame->data, frame->linesize, 0, height, &img.data, cvLinesizes);
+        int ret = sws_scale(conversion, frame->data, frame->linesize, 0, height, &img.data, cvLinesizes);
         printf("fingerprintFromFFAVFrame -5\n");
-        sws_freeContext(conversion);
+//        sws_freeContext(conversion);
         conversion = NULL;
     } else {
         printf("sws_getContext init error .");
@@ -68,22 +68,22 @@ int fingerprintFromFFAVFrame(FILE *file, AVFrame *frame, char buf[64]) {
         return NULL;
     }
     if (file) fprintf(file, "fingerprintFromFFAVFrame 2\n");
-    printf( "fingerprintFromFFAVFrame 2\n");
+    printf("fingerprintFromFFAVFrame 2\n");
 //    std::string str = frame->pts + "";
 //    imshow(str, img);
     int scale_width = 8, scale_height = 8;
     cv::Mat gray, res;
     if (file) fprintf(file, "fingerprintFromFFAVFrame 3\n");
-    printf( "fingerprintFromFFAVFrame 3\n");
+    printf("fingerprintFromFFAVFrame 3\n");
     //缩放成8x8大小灰度图
     resize(img, res, Size(scale_width, scale_height));
     img.release();
     if (file) fprintf(file, "fingerprintFromFFAVFrame 4\n");
-    printf( "fingerprintFromFFAVFrame 4\n");
+    printf("fingerprintFromFFAVFrame 4\n");
     cvtColor(res, gray, COLOR_BGR2GRAY);
     res.release();
     if (file) fprintf(file, "fingerprintFromFFAVFrame 5\n");
-    printf( "fingerprintFromFFAVFrame 5\n");
+    printf("fingerprintFromFFAVFrame 5\n");
     //获取灰度平均值
     cv::Mat mat_mean, mat_stddev;
     meanStdDev(gray, mat_mean, mat_stddev);//求灰度图像的均值、均方差
@@ -95,7 +95,7 @@ int fingerprintFromFFAVFrame(FILE *file, AVFrame *frame, char buf[64]) {
         return -1;
     };
     if (file) fprintf(file, "fingerprintFromFFAVFrame 6\n");
-    printf( "fingerprintFromFFAVFrame 6\n");
+    printf("fingerprintFromFFAVFrame 6\n");
     if (gray.cols * gray.rows < scale_height * scale_width)return NULL;
 //    //得到图像指纹值
     for (int i = 0; i < 8; i++) {
@@ -104,9 +104,9 @@ int fingerprintFromFFAVFrame(FILE *file, AVFrame *frame, char buf[64]) {
         }
     }
     if (file) fprintf(file, "fingerprintFromFFAVFrame 7\n");
-    printf( "fingerprintFromFFAVFrame 7\n");
+    printf("fingerprintFromFFAVFrame 7\n");
     gray.release();
-    printf( "fingerprintFromFFAVFrame 8\n");
+    printf("fingerprintFromFFAVFrame 8\n");
     return scale_width * scale_height;
 }