segmentFelzenszwalb.m 1.5 KB

12345678910111213141516171819202122232425262728
  1. % function [ segImg, noRegions ]= segmentFelzenszwalb(imgInput, sigma, k, minSize, computeColorOutput, destination, verbose)
  2. %
  3. % BRIEF: segmentFelzenszwalb Run the region segmentation algorithm of Felzenszwalb and Huttonlocher
  4. %
  5. % The function accepts the following options:
  6. % INPUT:
  7. % imgInput -- (string or 3d-matrix over uint8 )
  8. % sigma -- bandwidth of Gaussian kernel to smooth the image (optional, scalar, default: 0.5)
  9. % k -- influences the threshold accept a boundary between regions, larger k -> larger regions,(optional, scalar, default: 500)
  10. % minSize -- minimum component size enforced by post-processing stage (optional, scalar, default: 50)
  11. % computeColorOutput -- compute colored segm output (rgb) or region indicees (gray)? (optional, logical, default: false)
  12. % destination -- filename where the image shell be stored (optional, string)
  13. % verbose -- print additional information (optional, logical, default: false)
  14. %
  15. % OUTPUT:
  16. % segImg -- segmentation result, either colored or with region indicees (optional, 3d-matrix or 2d-matrix over uint8)
  17. % noRegions -- total number of regions (optional, uint8)
  18. %
  19. %
  20. % Example:
  21. % segResult = segmentFelzenszwalb(imgOrig);
  22. % segResult = segmentFelzenszwalb(imgOrig,0.5, 200, 20, true, 0 , true);
  23. %
  24. % Authors: Alexander Freytag
  25. % Copyright (C) 2013 Alexander Freytag
  26. % All rights reserved.