Open CV (Python) - 脑肿瘤的异常形状斑点检测

问题描述 投票:0回答:2

我正在尝试通过 Open CV 中的斑点检测来识别脑肿瘤,但到目前为止,Open CV 只能检测到大脑 MRI 中的微小圆圈,而不能检测到肿瘤本身。

代码如下:

import cv2
from cv2 import SimpleBlobDetector_create, SimpleBlobDetector_Params
import numpy as np

# Read image
def blobber(filename):
    im = cv2.imread(filename, cv2.IMREAD_GRAYSCALE)

    # Set up the detector with default parameters.
    detector = cv2.SimpleBlobDetector_create()

    params = cv2.SimpleBlobDetector_Params()

    # Filter by Area.
    params.filterByArea = True
    params.minArea = 50

    # Filter by Circularity
    params.filterByCircularity = True
    params.minCircularity = 0

    # Filter by Convexity
    params.filterByConvexity = True
    params.minConvexity = 0.1

    # Create a detector with the parameters
    ver = (cv2.__version__).split('.')
    if int(ver[0]) < 3 :
        detector = cv2.SimpleBlobDetector(params)
    else : 
        detector = cv2.SimpleBlobDetector_create(params)

    # Detect blobs.
    keypoints = detector.detect(im)

    # Draw detected blobs as red circles.
    # cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS ensures the size of the circle corresponds to the size of blob
    im_with_keypoints = cv2.drawKeypoints(im,keypoints,np.array([]),(0,0,255),cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)

    # Show keypoints
    cv2.imshow("Keypoints", im_with_keypoints)
    cv2.waitKey(0)

当我向程序提供黑白对比大脑图像时,会发生以下情况(我对大脑进行了对比,因此肿瘤将显示为黑色,而大脑的其余部分大部分为白色):

无论如何,肿瘤都不是一个完美的圆形,但它显然是大脑中最大的“斑点”。打开CV无法拾取它,我怀疑是因为它有黑色外壳和白色核心。

只有当我选择一个更容易区分的肿瘤,没有大的白色内核时,它才能拾取肿瘤。

有什么建议吗?我需要能够将这些斑点(一旦它们准确工作)从原始图片中剥离出来,并使用它们的关键点从每个切片中的 2D 肿瘤重建大脑中的整个 3D 肿瘤。我离这一步有点远,但这个斑点检测器问题是 2D 和 3D 之间的关键联系。感谢所有帮助!

python opencv image-processing mesh
2个回答
0
投票
当您尝试传递文件名时,它可能是大脑的黑白图像,因此我认为每个图像在不同位置都会有不同的斑点,因此您可能需要将 params.minArea =50 值更改为每个图像的不同值。所以我建议你使用其他 ML 模型而不仅仅是 OpenCV 来检测 blob。


-1
投票
最大的斑点可能是头骨本身。 如果你分散最大的斑点,并保留下一个大的东西,请使用轮廓作为外部

© www.soinside.com 2019 - 2024. All rights reserved.