def detect3dblue(self, img1, img2): a1 = image1.pixel2meter(img1) a2 = image1.pixel2meter(img2) blueYZ = a1 * image1.detect_blue(img1) blueXZ = a2 * image2.detect_blue(img2) xyz = np.array([blueXZ[0], blueYZ[0], (blueYZ[1] + blueXZ[1]) / 2]) return xyz
def detect3dyellow(self, img1, img2): a1 = image1.pixel2meter(img1) a2 = image1.pixel2meter(img2) yellowYZ = a1 * image1.detect_yellow(img1) yellowXZ = a2 * image2.detect_yellow(img2) xyz = np.array( [yellowXZ[0], yellowYZ[0], (yellowYZ[1] + yellowXZ[1]) / 2]) return xyz
def detect3dgreen(self, img1, img2): a1 = image1.pixel2meter(img1) a2 = image1.pixel2meter(img2) greenYZ = a1 * image1.detect_green(img1) greenXZ = a2 * image2.detect_green(img2) xyz = np.array([greenXZ[0], greenYZ[0], (greenYZ[1] + greenXZ[1]) / 2]) if (np.array([0, 0, 0]) == xyz).any(): xyz = self.green self.green = xyz return xyz
def detect3dred(self, img1, img2): a1 = image1.pixel2meter(img1) a2 = image1.pixel2meter(img2) redYZ = a1 * image1.detect_red(img1) redXZ = a2 * image2.detect_red(img2) xyz = np.array([redXZ[0], redYZ[0], (redYZ[1] + redXZ[1]) / 2]) if (np.array([0, 0, 0]) == xyz).any(): xyz = self.red self.red = xyz return xyz
def detect3dtarget(self, img1, img2): a1 = image1.pixel2meter(img1) a2 = image1.pixel2meter(img2) targetYZ = a1 * image1.detect_target(img1) targetXZ = a2 * image2.detect_target(img2) if targetYZ[0] == 0 and targetYZ[1] == 0: targetYZ = self.lastYZPosition else: self.lastYZPosition = targetYZ if targetXZ[0] == 0 and targetXZ[1] == 0: targetXZ = self.lastXZPosition else: self.lastXZPosition = targetXZ xyz = np.array( [targetXZ[0], targetYZ[0], ((targetYZ[1] + targetXZ[1]) / 2)]) return xyz