从2D图像中提取视网膜区域

时间:2019-07-01 11:26:19

标签: opencv image-processing python-imaging-library scikit-image

我正在研究糖尿病性视网膜病变。该数据库包含看起来像这样的2D图像:

Original Image

现在,我只想从图像中提取视网膜部分,以使最终图像看起来像这样:

New image

我尝试了<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.2/css/bootstrap.min.css" rel="stylesheet" /> <link href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" rel="stylesheet" /> <div class="row tableInvoice" id="commonDvScroll"> <table class="table table-bordered" id="tableInvoice"> <thead> <tr> <th id="itemNameth" class="commanth">Item Name</th> <th id="itemCodeth" class="commanth">Item Code</th> <th id="unitQtyth" class="commanth">Unit Qty</th> <th id="purRateth" class="commanth">Pur.Rate</th> <th id="discPercentageth" class="commanth">Disc%</th> <th id="discAmtth" class="commanth">Disc Amt</th> <th id="gstPercentageth" class="commanth">Gst%</th> <th id="gstAmtth" class="commanth">Gst Amt</th> <th id="totalAmtth" class="commanth">Total Amount</th> </tr> </thead> <tbody> </tbody> </table> </div>Canny,但是失败了。有什么方法可以使用HoughCirclesOpenCvscikit-image提取该区域?

1 个答案:

答案 0 :(得分:1)

由于前景非常明显,因此您可以使用简单的阈值找到它,然后使用regionprops获得所需的作物:

from skimage import io, color, filters, measure

image = io.imread('https://i.stack.imgur.com/kKBiU.jpg')
grayscale = color.rgb2gray(image)
foreground = (grayscale > filters.threshold_otsu(grayscale)).astype(int)
foreground_properties = measure.regionprops(foreground)[0]
cropped = image[foreground_properties.slice]