Changes to image segmentation

Home Forums SPC Technical Image Processing Changes to image segmentation

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #156
    spcadmin
    Keymaster

    Originally, objects were segmented from the background using a a global threshold computed from the histogram of the input image via Otsu’s Method. This generally worked well but would fail in cases where the foreground object had strong variations in intensity over its body and/or gaps between body parts.

    A possible solution had been implemented and is being tested in the current system. The new method combines two different threshold methods using an OR operation on the binary masks. The first mask uses the same threshold as above while the second computes the median and standard deviation of the pixels in the image and defines the threshold as T = median + 0.8*standard_deviation and selects all pixels greater than or equal to that value. This is implemented in the code below.

    thresh1 = threshold_otsu(gray_hp)
    med_val = np.median(gray_hp)
    std_val = np.std(gray_hp)
    thresh2 = med_val + std_val
    binary = (gray_hp >= thresh1) | (gray_hp >= thresh2) 
    bw_img2 = morphology.closing(binary,morphology.disk(3))
    

    One nice feature of this method is the the median-based threshold helps fill in dark foreground parts of the images that are below the Ostu threshold. This takes advantage of the fact that we know most pixels in the image are background, and the background level does not change much.

    • This topic was modified 7 years, 8 months ago by spcadmin.
    • This topic was modified 7 years, 8 months ago by spcadmin.
    • This topic was modified 7 years, 8 months ago by spcadmin.
    • This topic was modified 7 years, 8 months ago by spcadmin.
Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.