Why I getting natural width 0 for dynamically created image
<p>I am using <a href="https://github.com/jhuckaby/webcamjs" rel="nofollow">Webcam.js</a> for getting images form camera.</p>

<p><code>document.getElementById('cameraImage').src = data_uri;</code>  data_uri gives me the image form capture event of camera.</p>

<p>Then I create Image dynamically in JavaScript like
var img = new Image();
img.src = data_uri;</p>

<p>When I am trying to apply face detection on it using <a href="https://github.com/jaysalvat/jquery.facedetection" rel="nofollow">Facedetection.js</a>
it gives error Failed to execute getImageData on CanvasRenderingContext2D: The source width is 0.</p>

<p>How can i set source width of image so face detection will work</p>