code: def draw_pose3d(
      image,
      pose3d,
      pose2d=None,
      visual_thread=0.6,
      save_name="pose3d.jpg",
      returnimg=True,
  ):
      try:
          import matplotlib.pyplot as plt
          import matplotlib
  
          plt.switch_backend("agg")
      except Exception as e:
          logger.error(
              "Matplotlib not found, please install matplotlib."
              "for example: `pip install matplotlib`."
          )
          raise e
  
      if pose3d.shape[0] == 24:
          joints_connectivity_dict = [
              [0, 1, 0],
              [1, 2, 0],
              [5, 4, 1],
              [4, 3, 1],
              [2, 3, 0],
              [2, 14, 1],
              [3, 14, 1],
              [14, 16, 1],
              [15, 16, 1],
              [15, 12, 1],
              [6, 7, 0],
              [7, 8, 0],
              [11, 10, 1],
              [10, 9, 1],
              [8, 12, 0],
              [9, 12, 1],
              [12, 19, 1],
              [19, 18, 1],
              [19, 20, 0],
              [19, 21, 1],
              [22, 20, 0],
              [23, 21, 1],
          ]
      elif pose3d.shape[0] == 14:
          joints_connectivity_dict = [
              [0, 1, 0],
              [1, 2, 0],
              [5, 4, 1],
              [4, 3, 1],
              [2, 3, 0],
              [2, 12, 0],
              [3, 12, 1],
              [6, 7, 0],
              [7, 8, 0],
              [11, 10, 1],
              [10, 9, 1],
              [8, 12, 0],
              [9, 12, 1],
              [12, 13, 1],
          ]
      else:
          print(
              "not defined joints number :{}, cannot visualize because unknown of joint connectivity".format(
                  pose.shape[0]
              )
          )
          return
  
      def draw3Dpose(
          pose3d,
          ax,
          lcolor="#3498db",
          rcolor="#e74c3c",
          add_labels=False,
      ):
          #    pose3d = orthographic_projection(pose3d, cam)
          for i in joints_connectivity_dict:
              x, y, z = [
                  np.array([pose3d[i[0], j], pose3d[i[1], j]])
                  for j in range(3)
              ]
              ax.plot(-x, -z, -y, lw=2, c=lcolor if i[2] else rcolor)
  
          RADIUS = 1000
          center_xy = 2 if pose3d.shape[0] == 14 else 14
          x, y, z = (
              pose3d[center_xy, 0],
              pose3d[center_xy, 1],
              pose3d[center_xy, 2],
          )
          ax.set_xlim3d([-RADIUS + x, RADIUS + x])
          ax.set_ylim3d([-RADIUS + y, RADIUS + y])
          ax.set_zlim3d([-RADIUS + z, RADIUS + z])
  
          ax.set_xlabel("x")
          ax.set_ylabel("y")
          ax.set_zlabel("z")
  
      def draw2Dpose(
          pose2d,
          ax,
          lcolor="#3498db",
          rcolor="#e74c3c",
          add_labels=False,
      ):
          for i in joints_connectivity_dict:
              if pose2d[i[0], 2] and pose2d[i[1], 2]:
                  x, y = [
                      np.array([pose2d[i[0], j], pose2d[i[1], j]])
                      for j in range(2)
                  ]
                  ax.plot(x, y, 0, lw=2, c=lcolor if i[2] else rcolor)
  
      def draw_img_pose(
          pose3d,
          pose2d=None,
          frame=None,
          figsize=(12, 12),
          savepath=None,
      ):
          fig = plt.figure(figsize=figsize, dpi=80)
          # fig.clear()
          fig.tight_layout()
  
          ax = fig.add_subplot(221)
          if frame is not None:
              ax.imshow(frame, interpolation="nearest")
          if pose2d is not None:
              draw2Dpose(pose2d, ax)
  
          ax = fig.add_subplot(222, projection="3d")
          ax.view_init(45, 45)
          draw3Dpose(pose3d, ax)
          ax = fig.add_subplot(223, projection="3d")
          ax.view_init(0, 0)
          draw3Dpose(pose3d, ax)
          ax = fig.add_subplot(224, projection="3d")
          ax.view_init(0, 90)
          draw3Dpose(pose3d, ax)
  
          if savepath is not None:
              plt.savefig(savepath)
              plt.close()
          else:
              return fig
  
      def fig2data(fig):
          """
          fig = plt.figure()
          image = fig2data(fig)
          @brief Convert a Matplotlib figure to a 4D numpy array with RGBA channels and return it
          @param fig a matplotlib figure
          @return a numpy 3D array of RGBA values
          """
          # draw the renderer
          fig.canvas.draw()
  
          # Get the RGBA buffer from the figure
          w, h = fig.canvas.get_width_height()
          buf = np.fromstring(
              fig.canvas.tostring_argb(), dtype=np.uint8
          )
          buf.shape = (w, h, 4)
  
          # canvas.tostring_argb give pixmap in ARGB mode. Roll the ALPHA channel to have it in RGBA mode
          buf = np.roll(buf, 3, axis=2)
          image = Image.frombytes("RGBA", (w, h), buf.tostring())
          return image.convert("RGB")
  
      fig = draw_img_pose(pose3d, pose2d, frame=image)
      data = fig2data(fig)
      if returnimg is False:
          data.save(save_name)
      else:
          return data
  
file_path: PaddleDetection/ppdet/utils/visualizer.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import os
  import numpy
  from PIL import Image, ImageDraw, ImageFont
  import cv2
  import math
  from .colormap import colormap
  from ppdet.utils.logger import setup_logger
  from ppdet.utils.compact import imagedraw_textsize_c
  from ppdet.utils.download import get_path
label_desc: Use image node_id 7 for calling a global function with example usage: draw_pose3d(image, pose3d, pose2d, visual_thread, save_name, returnimg) and returns: image, data, fig