Jelajahi Sumber

Merge branch 'master' of http://116.63.46.168:3000/ADPilot/modularization

liyupeng 1 tahun lalu
induk
melakukan
0eb5581753

+ 3 - 3
src/driver/driver_camera_ioctl/pythonusbcam.py

@@ -17,14 +17,14 @@ def showpic():
     nlen = nlenx()
     mylib.StartCam("/dev/video0",1920,1080,30);
     while i< 10000:
-#    	nRtn = mylib.GetJPEGDataWithWait("/dev/video0",y,nlen,100);
-    	nRtn = mylib.GetJPEGData("/dev/video0",y,nlen);
+    	nRtn = mylib.GetJPEGDataWithWait("/dev/video0",y,nlen,100);
+#    	nRtn = mylib.GetJPEGData("/dev/video0",y,nlen);
         if(nRtn>0):
 		xdata = np.frombuffer(y,count = nlen[0])
 		matx = cv.imdecode(xdata, cv.IMREAD_COLOR );
 		cv.imshow("showing",matx)
 		cv.waitKey(1)
-		print nRtn
+		print(time.time(), nRtn)
 	else :
 		print("no data");
 		time.sleep(0.001);

+ 0 - 32
src/driver/driver_camera_ioctl/usb_cam_python.cpp

@@ -296,38 +296,6 @@ int GetJPEGDataWithWait(char * strvideoname, char * str,int * x,int nwaitms)
 int GetJPEGData(char * strvideoname, char * str,int * x)
 {
     return GetJPEGDataWithWait(strvideoname,str,x,0);
-    std::string strvideo = strvideoname;
-
-    int nsize;
-    int i;
-    iv::threadcam * pthreadcam = NULL;
-    for(i=0;i<nsize;i++)
-    {
-        if(gvectorthreadcam[i]->mstrvideoname == strvideo)
-        {
-            pthreadcam = gvectorthreadcam[i];
-            break;
-        }
-    }
-
-    if(pthreadcam == NULL)
-    {
-        std::cout<<" video device not open."<<std::endl;
-        return 0;
-    }
-
-    int nRtn = 0;
-    pthreadcam->mmutexdata.lock();
-    if(pthreadcam->mbUpdate)
-    {
-//        str.copy(gstrbuf,gnLen);
-        memcpy(str,pthreadcam->mpstr_data.get(),pthreadcam->mndatasize);
-        nRtn = pthreadcam->mndatasize;
-        *x = pthreadcam->mndatasize;
-        pthreadcam->mbUpdate= false;
-    }
-    pthreadcam->mmutexdata.unlock();
-    return nRtn;
 }
 
 int StopCam(char * strvideoname)