![]() Static library files are actually linked with. To sum up, library files are divided into static library files (.lib/.a) and dynamic library files (.dll/.so). Static link library, dynamic link library, and dynamic loading library: static link library, dynamic link library and dynamic loading library The difference between static link library and dynamic link library : static link library and dynamic link library-the difference between C/C It turns out that the execution time of cv::cvtColor() dropped to 0.00132400, which is faster than the cpu program written by myself, but slightly slower than the gpu program it seems that it is indeed caused by the opencv dynamic loading function. ![]() Use the following piece of code to verify the conjecture:ĬvtColor(srcImage, grayImage, CV_BGR2GRAY) //Let cvtColor() dynamically load in first Printf("opencv-cpu exec time is %.8f\n", (double)(end-start)/CLOCKS_PER_SEC) Īs suggested by the great god, the reason why cv::cvtColor() is slow may be the problem of dynamically loading the library, that is, most of the time is spent loading the function into the memory. Printf("cpu exec time is %.8f\n", (double)(end-start)/CLOCKS_PER_SEC) ĬvtColor(srcImage, grayImage, CV_BGR2GRAY) Rgb2grayincpu(srcImage.data, grayImage.data, imgheight, imgwidth) Printf("cuda exec time is %.8f\n", (double)(end-start)/CLOCKS_PER_SEC) ĬudaMemcpy(grayImage.data, d_out, imgheight*imgwidth*sizeof(unsigned char), cudaMemcpyDeviceToHost) If (idx >(d_in, d_out, imgheight, imgwidth) _global_ void rgb2grayincuda(uchar3 * const d_in, unsigned char * const d_out,Ĭonst unsigned int idx = blockIdx.x * blockDim.x threadIdx.x Ĭonst unsigned int idy = blockIdx.y * blockDim.y threadIdx.y #define PAUSE printf("Press Enter key to continue.") fgetc(stdin) ![]() #include "opencv2/highgui.hpp"//Actually under/usr/include
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |