code: def cutPic(self, picUrl):
      # seg = hub.Module(name='WatermeterSegmentation')
      image_name = picUrl
      im = cv2.imread(image_name)
      result = self.predict(images=[im])
  
      # 将多边形polygon转矩形
      contours, hier = cv2.findContours(
          result[0]["label_map"],
          cv2.RETR_EXTERNAL,
          cv2.CHAIN_APPROX_SIMPLE,
      )
      print(type(contours[0]))
      n = 0
      m = 0
      for index, contour in enumerate(contours):
          if len(contour) > n:
              n = len(contour)
              m = index
  
      image = cv2.imread(image_name)
      # 获取最小的矩形
      rect = cv2.minAreaRect(contours[m])
      box = np.int0(cv2.boxPoints(rect))
  
      # 获取到矩形的四个点
      tmp = cv2.drawContours(image, [box], 0, (0, 0, 255), 3)
      imgOutSrc = "result.jpg"
      rotate(image, box[0], box[1], box[2], box[3], imgOutSrc)
      res = []
      res.append(imgOutSrc)
      return res
  
imports: from __future__ import absolute_import
  from __future__ import division
  import os
  import cv2
  import argparse
  import base64
  import paddlex
  from math import *
  import time, math, re
  import numpy
  import paddlehub
  from paddlehub.module.module import moduleinfo, runnable, serving
label_desc: Use image node_id 3 for calling the MODULE obj's underlying member method code with example usage: obj.cutPic(picUrl) and returns: res