3

I'm trying to run opencv on colab with c++ after running the commands as mentioned in a tutorial given here. However it is giving error of cvstd.hpp dependency inaccessible on running a sample code.

C++:

%%cu
#include "opencv2/opencv.hpp"
#include <iostream>

using namespace std;
using namespace cv;

int main(){

 VideoCapture cap("/content/drive/My Drive/video.mp4"); 

 if(!cap.isOpened()){
    cout << "Error opening video stream or file" << endl;
    return -1;
 }

while(1){

   Mat frame;
   cap >> frame;

  if (frame.empty())
     break;

   imshow( "Frame", frame );

   char c=(char)waitKey(25);
   if(c==27)
    break;
}

cap.release();

destroyAllWindows();

return 0;
}

Error after running the notebook:

/tmp/tmpmqnpzz6a/118ab454-d448-48e9-9a1d-1f70bf66c348.cu(18): warning: too many characters in character literal -- extra leading characters ignored

/tmp/tmpmqnpzz6a/118ab454-d448-48e9-9a1d-1f70bf66c348.cu(18): error: "cv::String::String(int)" /usr/include/opencv2/core/cvstd.hpp(577): here is inaccessible

1 error detected in the compilation of "/tmp/tmpxft_00006b50_00000000-8_118ab454-d448-48e9-9a1d-1f70bf66c348.cpp1.ii".

My goal is to compare the compilation time of opencv c++ video reading in both cpu and gpu on colab. Any help will be highly appreciated!

Kashan
  • 348
  • 3
  • 19
  • 1
    Could you provide a link to this colab as a minimum reproducible example. The guide you've linked does not represent your exact steps seen as your using https://github.com/andreinechaev/nvcc4jupyter even though the guide builds opencv without CUDA support. – Bryan Oct 12 '19 at 23:16
  • Yes please https://colab.research.google.com/drive/1QzRHti3d7iGaDrBy4OvkPxorIMw1x6OB – Kashan Oct 13 '19 at 13:26

0 Answers0