I\xc2\xb4m 尝试使用测量配置文件来检测一系列管中的荧光,因此我编写了以下代码
\n\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom scipy import ndimage\nfrom skimage.measure import profile_line\nimport os\nimport argparse\nimport string \nfrom PIL import Image\n\n\nplt.rcParams[\'font.size\']=16\nplt.rcParams[\'font.family\'] = \'sans-serif\'\n\n\nap = argparse.ArgumentParser()\nap.add_argument("-i", "--image", required=True, help="Path to the image")\nargs = vars(ap.parse_args())\nimagen = Image.open(args["image"]) \nimagename=args["image"] \n\nimg = np.array(imagen)\n\n#profile position\nstart=(0,35)\nend=(1300,35)\n\n#profile_line\nprofile = profile_line(img,start,end, linewidth=5)\nfig, ax = plt.subplots(2,1,figsize=(15,9))\nax[0].imshow(imagen, cmap=plt.cm.gist_earth, interpolation=\'gaussian\',origin=\'lower\',alpha=1)\nax[0].plot([start[0],end[0]],[start[1],end[1]],\'r-\',lw=3)\nax[1].plot(profile)\nax[1].set_title(\'data points = \'+str(profile.shape[0])+\'\')\nplt.tight_layout()\nplt.savefig("scipy.jpg")\nRun Code Online (Sandbox Code Playgroud)\n\n但我得到了
\n\n\n\n\n