Resize image with OpenCV with double scale
<p>I have the following problem. I resize image with OpenCV 1 in this way:</p>

<pre><code>cvResize(img1, img2); 
</code></pre>

<p>where:</p>

<pre><code>img2= cvCreateImage( cvSize(img1-&gt;width * ratioScale + 0.5, img1-&gt;height * ratioScale + 0.5), IPL_DEPTH_8U, 1 );
</code></pre>

<p>Then, I want to fill the half image with 255 (just to test): </p>

<pre><code>for (int j = 0; j &lt; img2-&gt;height; j++){ 
  for (int i = 0; i &lt; img2-&gt;width/2; i++){ 
     img2-&gt;imageData[j*img2-&gt;width + i] = 255;
  }
}
</code></pre>

<p>When <code>ratioScale</code> has precision 1 digit after decimal point(e.g. 1.5), it works correctly. Otherwise(e.g. 1.59), it gives several white diagonals and not half of image. I do not understand why. All images are grayscale.</p>

<hr>

<p><strong>I must use OpenCV 1</strong> because it is obligation from the company.</p>