GrabCut

less than 1 minute read

GrabCut



1. GrabCut


  • Image segmentaion based algorithm
  • The algorithm estimates the color distribution of the target object and that of the background using a Gaussian mixture model.
  • Automatically distribute when user select rectangle.


  • GrabCut code
cv2.grabCut(img, mask, rect, bgdModel, fgdModel, iterCount, mode=None) -> mask, bgdModel, fgdModel
  • img : Input image
  • mask : Input and Output mask
  • rect : Roi area
  • bgdModel : Temporary background model matrix
  • fdgModel : Temporary foreground model matrix
  • iterCount : Number of iteration
  • mode : Mode constant


image



2. Moment based object detection


  • Moment
    • Real number of expressing the form of image
    • It is calculated to correlation of specific function set
    • image
  • Hu’s seven invariant moments
    • Seven moment value central moment put together nomalizaion under 3-dimension
    • It is unchanging to rotaion, movement, reflection, size of image


  • Moment based object detection code
cv2.matchShapes(contour1, contour2, method, parameter) -> retval


  • contour1 : First outline or grayscale image
  • contour2 : Second outline or grayscale image
  • method : Signify comparision method
  • parameter : Not use
  • retval : Two outline or distance of grayscale image


  • Shape comparision function


image


  • Moment based object detection example


image


Leave a comment