我只想从意味着活动轮廓的图像(脑肿瘤MRI图像)中分离出肿瘤

时间:2019-12-22 04:29:37

标签: python numpy

只有肿瘤是白色的,而另一部分是黑色的。如何计算肿瘤面积?我使用Windows作为操作系统和python3。如何计算大脑面积?

#Active Countour

image = cv2.imread(args["brain.png"])
shifted = cv2.pyrMeanShiftFiltering(image, 21, 51)
cv2.imshow("Input", image)

gray = cv2.cvtColor(shifted, cv2.COLOR_BGR2GRAY)
thresh = cv2.threshold(gray, 0, 255,
    cv2.THRESH_BINARY | cv2.THRESH_OTSU)[1]
cv2.imshow("Thresh", thresh)
its show:

  File "F:/Semesters/Thesis/New folder (2)/brine.py", line 157, in <module>
    image = cv2.imread(args["brain.png"])

NameError: name 'args' is not defined

3 个答案:

答案 0 :(得分:0)

cv2.imread只需要文件名,只需使用cv2.imread(“ brain.png”)

答案 1 :(得分:0)

尝试一下:

image = cv2.imread("\brain.png")

image = cv2.imread(r" your full path")

答案 2 :(得分:0)

然后尝试此操作,导入argparse并进行设置。 enter image description here