How do you pass image data from cv2 python to a %%cu file
Closed this issue · 1 comments
I am trying to use this plugin on Google colab. I load the image using cv2 and now i want to do image processing in CUDA kernel. I am at a fix now in how to access the image data loaded from cv2 python to the CUDA cell (%%cu). Can you share a simple example or point me to the relevant references?
If it is possible to read the image file in cu file that would be awesome. Currently, I tried doing this but it fails.
FILE* fp = fopen("/content/logo.raw", "rb");
fread(pData, sizeof(unsigned char), SIZE, fp);
fclose(fp);
Thanks,
MMMovania
OK i figured it out. Basically you can read data directly using the C filiing routines from content or pretty much any folder on colab and it works. You need to ensure that wget or whatever mechanism you use to upload data on google colab, the image or file should be there otherwise the C filing routines silently fail. If better to check for return value of fopen which will be 0 in case when file does not exists or it fails to open. I am closing this issue.