Ejemplo n.º 1
0
                                                    str(subMultipId) + '.jpg',
                                                    rectImg)
                                                mulmsg = CompressedImage()
                                                mulmsg.data = np.array(
                                                    cv2.imencode(
                                                        '.jpg', rectImg)
                                                    [1]).tostring()
                                                mulmsg.header.frame_id = submsg + '/' + str(
                                                    multiPicId) + '/' + str(
                                                        subMultipId
                                                    ) + '-' + str(
                                                        subSingleId
                                                    ) + '-' + box[0]
                                                record_pub.publish(mulmsg)
                                                img, prex, prey, lagerfacter, testid = ct.get_singleimage(
                                                    submsg, ser_dev1,
                                                    ipstream_dev1, msg,
                                                    single_image, picId)
                                                singleBox = yolo_surface.detect(
                                                    img)
                                                single_img = img
                                                resList = []
                                                subSingleId = 0
                                                if len(singleBox) > 0:
                                                    for res in singleBox:
                                                        sig = Roi_cam()
                                                        x1 = getXY(res[2])
                                                        y1 = getXY(res[3])

                                                        x2 = getXY(res[4])
                                                        y2 = getXY(res[5])
Ejemplo n.º 2
0
		                                rectImg=captureimg
		                                if len(surfaceBox)>0:
						    global subMultipId
						    global submsg
						    subMultipId=0
		                                    for box in surfaceBox:
							subMultipId+=1
			    			        msg = Roi_cam()
			    			        msg.begin_x = [box[2]]
			    	                        msg.begin_y = [box[3]]
			    		 	        msg.end_x = [box[4]]
			    			        msg.end_y = [box[5]]
		                                        cv2.rectangle(rectImg,(int(box[2]),int(box[3])),(int(box[4]),int(box[5])),(0,0,255),5)
			    			        cv2.imwrite(MulboardPath+str(multiPicId)+str(subMultipId)+'.jpg',rectImg)	
						    	global picId
			    			        img = ct.get_singleimage(submsg,ser_dev1,ipstream_dev1,msg,single_image,picId,1)
							singleBox=yolo_surface.detect(img)
							single_img=img
							resList=[]
							global subSingleId
							subSingleId=0
							print("singleBox:",singleBox);
							if len(singleBox)>0:
								for res in singleBox:
									subSingleId+=1
									sig=Roi_cam()
									x1=getXY(res[2])
									y1=getXY(res[3])
									
									x2=getXY(res[4])
									y2=getXY(res[5])