Python:scikit-image Blob Detection

Source: Internet
Author: User

This use case mainly introduces using three kinds of algorithms to detect the image containing the blob. BLOBs, or spots, are bright areas on a dark background on an image. Or a dark area on a bright background can be called a blob.

It mainly uses the contrast between the blob and the background to detect.

This use case introduces three kinds of algorithms;

Laplacian of Gaussian (LoG)
This is the slowest, but the most accurate algorithm. To put it simply, a series of Gaussian filters of different scales are first performed on a picture, and then the filtered image is Laplacian. Overlay all the images. The local maximum is the BLOB to be detected, which is very slow for large blob detection, and the algorithm is suitable for detecting bright blobs in dark backgrounds.

Difference of Gaussian (DoG)
This is a high-speed approximation of the log algorithm, after the Gaussian filtering of the image, do not do Laplacian operations, directly do subtraction. After subtracting the graph do overlay. Find the local maximum, the flaw of this algorithm is similar to log.

Determinant of Hessian (DoH)
This is the fastest algorithm, do not need to long-scale Gaussian filtering, the speed of the natural increase is very much, the algorithm on the dark background of bright blob or bright background on the dark blob can be detected.

The disadvantage is that the small size of the blob detection is inaccurate.

P.s. LoG and DoG False Imagine the detection of dark blobs on the background, to be able to reverse the image, so that the light background becomes a dark background, and the dark blob becomes a bright blob, and then can use these two algorithms, and then after the detection of the reverse back on the good.

 fromMatplotlibImportPyplot asPlt fromSkimageImportData fromSkimage.featureImportBlob_dog, Blob_log, Blob_doh fromMathImportsqrt fromSkimage.colorImportRgb2grayimage = Data.hubble_deep_field () [0: -,0: -]image_gray = Rgb2gray (image) Plt.imshow (image) Blobs_log = Blob_log (Image_gray, max_sigma= -, num_sigma=Ten, threshold=. 1)# Compute Radii in the 3rd column.blobs_log[:,2] = blobs_log[:,2] * SQRT (2) Blobs_dog = Blob_dog (Image_gray, max_sigma= -, threshold=. 1) blobs_dog[:,2] = blobs_dog[:,2] * SQRT (2) Blobs_doh = Blob_doh (Image_gray, max_sigma= -, threshold=.) Blobs_list = [Blobs_log, blobs_dog, blobs_doh]colors = [' Yellow ',' Lime ',' Red ']titles = [' Laplacian of Gaussian ',' difference of Gaussian ',' determinant of Hessian ']sequence = Zip (blobs_list, colors, titles) Fig,axes = Plt.subplots (1,3, sharex=True, sharey=True, subplot_kw={' Adjustable ':' box-forced '}) Axes = Axes.ravel () forBLOBs, color, titleinchSequence:ax = axes[0] Axes = axes[1:] Ax.set_title (title) ax.imshow (image, interpolation=' nearest ') forBlobinchBlobs:y, X, r = Blob c = plt. Circle ((x, y), R, Color=color, linewidth=2, fill=False) Ax.add_patch (c) plt.show ()

Source: http://scikit-image.org/docs/dev/auto_examples/

Original:

Python:scikit-image Blob Detection

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.