コード例 #1
0
    def detect(self, det, ctx):
        """Detect determines which endpoint to used based on the request type"""

        type = det.WhichOneof("request")
        if type == "img_manip_req":
            req = det.img_manip_req
            resp = self._CallEndpoint(self.IMAGE_MANIPULATION, req,
                                      analytic_pb2.ImageManipulation(), ctx)
            det.img_manip.CopyFrom(resp)
        elif type == "vid_manip_req":
            req = det.vid_manip_req
            resp = self._CallEndpoint(self.VIDEO_MANIPULATION, req,
                                      analytic_pb2.VideoManipulation(), ctx)
            det.vid_manip.CopyFrom(resp)
        elif type == "img_splice_req":
            req = det.img_splice_req
            resp = self._CallEndpoint(self.IMAGE_SPLICE, req,
                                      analytic_pb2.ImageSplice(), ctx)
            det.CopyFrom(resp)
        elif type == "img_cam_match_req":
            req = det.img_cam_match_req
            resp = self._CallEndpoint(self.IMAGE_CAMERA_MATCH, req,
                                      analytic_pb2.ImageCameraMatch(), ctx)
            det.CopyFrom(resp)
        elif type == "vid_cam_match_req":
            req = det.vid_cam_match_req
            resp = self._CallEndpoint(self.VIDEO_CAMERA_MATCH, req,
                                      analytic_pb2.VideoCameraMatch(), ctx)
            det.CopyFrom(resp)
        elif type == "img_cam_req":
            req = det.img_cam_req
            resp = self._CallEndpoint(self.IMAGE_CAMERAS, req,
                                      analytic_pb2.ImageCameras(), ctx)
            det.CopyFrom(resp)

        return det
コード例 #2
0
 def DetectVideoCameraMatch(self, req, ctx):
     return self.svc._CallEndpoint(self.svc.VIDEO_CAMERA_MATCH, req,
                                   analytic_pb2.VideoCameraMatch(), ctx)