title: Opencv - create binary mask with ones inside a polygon(given its vertices)
body: <p>Requirement: Create a binary mask of 640x360 size. Points lying inside a polygon are marked as 1. Otherwise 0.</p>
  
  <p>Input: Vertices of the polygon. The vertices are obtained when a user marks a polygon on an html page.</p>
  
  <p>Is it possible to do so in opencv in an easy way?</p>
  
  <p>I know of one possible solution. <a href="http://alienryderflex.com/polygon/" rel="nofollow">http://alienryderflex.com/polygon/</a>. This allows to find whether a point lies inside a polygon given its vertices. But it requires me to run through each pixel to find if they lie inside the polygon, which I feel is a lengthy process.</p>