title: Convert floodfill open cv from c++ to python
body: <p>I am converting an opencv code from c++ to python and stucked somewhere near floodfill.</p>
  
  <p>The c++ implemenation is </p>
  
  <pre><code>Mat floodFilled = cv::Mat::zeros(dilateGrad.rows+2, dilateGrad.cols+2, CV_8U);
  floodFill(dilateGrad, floodFilled, cv::Point(0, 0), 0, 0, cv::Scalar(), cv::Scalar(), 4 + (255 &lt;&lt; 8) + cv::FLOODFILL_MASK_ONLY);
  floodFilled = cv::Scalar::all(255) - floodFilled;
  Mat temp;
  floodFilled(Rect(1, 1, dilateGrad.cols-2, dilateGrad.rows-2)).copyTo(temp);
  </code></pre>
  
  <p>My python implementation </p>
  
  <pre><code>h, w = dilateGrad.shape[:2]
  floodFilled =np.zeros((h+2,w+2),dtype = np.uint8)
  cv2.floodFill(dilateGrad,floodFilled,(0,0),255,cv2.FLOODFILL_MASK_ONLY)
  floodFilled =  np.all(255) - floodFilled
  floodFilled = cv2.rectangle(dilateGrad,1,1,(h-2,w-2),floodFilled,cv2.CV_8U)
  </code></pre>
  
  <p>I am new to opencv in python, anyone's help is appreciated.</p>