update 加入并行拍照,加入平滑
This commit is contained in:
40
CU/Detect.py
Normal file
40
CU/Detect.py
Normal file
@ -0,0 +1,40 @@
|
||||
from enum import Enum
|
||||
|
||||
import Constant
|
||||
from Model.Position import Real_Position
|
||||
from Trace.handeye_calibration import getPosition
|
||||
from Util.util_time import CClockPulse, CTon
|
||||
|
||||
|
||||
class DetectStatus(Enum):
|
||||
DNone = 0
|
||||
DDetect = 1
|
||||
DOk = 2
|
||||
|
||||
class Detect:
|
||||
def __init__(self,detection):
|
||||
self.detection = detection
|
||||
self.detect_status = DetectStatus.DNone
|
||||
self.detect_position = None
|
||||
def run(self):
|
||||
if self.detect_status == DetectStatus.DNone:
|
||||
return
|
||||
if self.detect_status == DetectStatus.DDetect:
|
||||
|
||||
_, img, xyz, uvw, points = self.detection.get_position(Point_isVision=False, Box_isPoint=True,
|
||||
First_Depth=True, Iter_Max_Pixel=30,
|
||||
save_img_point=0, Height_reduce=30, width_reduce=30)
|
||||
self.detection_image = img.copy()
|
||||
if xyz == None or uvw == None or points == None:
|
||||
self.detect_position = None
|
||||
self.detect_status = DetectStatus.DOk
|
||||
return
|
||||
target_position, noraml_base = getPosition(*xyz, *uvw, None, points)
|
||||
|
||||
position = Real_Position().init_position(*target_position[:3], *noraml_base[:3])
|
||||
position.Z = position.Z + 200
|
||||
self.detect_position = position
|
||||
self.detect_status = DetectStatus.DOk
|
||||
|
||||
if self.detect_status == DetectStatus.DOk:
|
||||
return
|
||||
Reference in New Issue
Block a user