Specific color area extraction

less than 1 minute read

Specific color area extraction



1. Detection matrix elements in specific range

cv2.inRange(src,lowerb,upperb,dst=None) -> dst
  • src : input matrix
  • lowerb : lower bound matrix or scalar
  • upperb : upper bound matrix or scalar
  • dst : mask video of same size as input video


2. Histogram backprojection

  • The method that check how much the histogram model given by each pixel of video matchs.

1) Calculate specific color histogram from standart video and mask video. 2) Select the pixel corresponded to specific color histogram that calculated pre-acuired color.

cv2.calcBackProject(images,channels,hist,ranges, scale, dst=None) -> dst
  • images : input video list
  • channels : channels number list to use backprojection calculate
  • hist : input histogram (numpy. ndarray)
  • ranges : list composisted to max value and min value from each dimension histogram
  • scale : additionally multiple value to output backproject matrix
  • dst : output backprojection video

Leave a comment