title: OpenCV Error: Assertion failed (L.channels() == 1 && I.channels() == 1) in connectedComponents_sub1
body: <p>I got the following error in OpenCV (python) and have googled a lot but have not been able to resolve.</p>
  
  <p>I would be grateful if anyone could provide me with some clue. </p>
  
  <blockquote>
    <p>OpenCV Error: Assertion failed (L.channels() == 1 &amp;&amp; I.channels() == 1) 
       in connectedComponents_sub1, file /home/snoopy/opencv-
       3.1.0/modules/imgproc/src/connectedcomponents.cpp, line 341
       Traceback (most recent call last):
       File "test.py", line 30, in 
       plant = analyzeplant.analyzeSideView(plant)
       File "/home/snoopy/Desktop/Leaf-201612/my-work-
       editing/ripps/src/analyzePlant.py", line 229, in analyzeSideView
       plant_img = self.__extractPlantArea(plant_img)
       File "/home/snoopy/Desktop/Leaf-201612/my-work-
       editing/ripps/src/analyzePlant.py", line 16, in __extractPlantArea
       output = cv2.connectedComponentsWithStats(plant, 4, cv2.CV_32S)
       cv2.error: /home/snoopy/opencv-
       3.1.0/modules/imgproc/src/connectedcomponents.cpp:341: error: (-215) >    L.channels() == 1 &amp;&amp; I.channels() == 1 in function 
       connectedComponents_sub1</p>
  </blockquote>