Python/OpenCV: Using cv2.resize() I get an error
<p>I'm using python 2.7 and opencv. </p>

<p>I'm trying to use:</p>

<pre><code>cv2.resize(src, dst, Size(), 0.5, 0.5, interpolation=cv2.INTER_LINEAR);
</code></pre>

<p>taken from <a href="http://docs.opencv.org/2.4/modules/imgproc/doc/geometric_transformations.html#resize" rel="nofollow">here</a>. But when I run this code I get <code>NameError: global name 'Size' is not defined.</code></p>

<p>Can you help me please?</p>

<p>You are probably looking at the C++ api of <code>resize</code> method.</p>

<p>The python API looks something like this:</p>

<pre><code>dst = cv2.resize(src, dsize)
</code></pre>

<p>where </p>

<pre><code>src - Original image
dsize - a tuple defining the final size of the image.
</code></pre>

<p>If you want to pass additional parameters then you may use the named parameters of the API as:</p>

<pre><code>dst = cv2.resize(src, dsize, fx = 0.5, fy=0.5, interpolation = cv2.INTER_LINEAR)
</code></pre>

<p>Since dsize is required param but if you still want the <code>resize</code> method to calculate the <code>dsize</code> for you then you may pass the param as <code>None</code>.</p>

<pre><code>dst = cv2.resize(src, None, fx = 0.5, fy=0.5)
</code></pre>

python python-2.7 opencv