I am building an app where you can upload pictures, they are sent to a server where an object is detected on the image and the position of the object in the image is returnd. Now i want to mark the area with the detected object in the image, but i am struggeling with Javascript and Vue here a little bit.
Here is the code from my vue component:
<b-card title="Result" class="box">
<span v-if="upload_success">
<b-img v-bind:src="'http://localhost:5000/' + image_url" fluid-grow alt="Fluid-grow image" id="c"></b-img>
<p>Category: {{ product_category }}</p>
</span>
</b-card>
and my draw method:
draw () {
let c = document.getElementById('c')
let ctx = c.getContext('2d')
this.canvas = ctx
this.canvas.beginPath()
this.canvas.rect(this.box[0], this.box[1], this.box[2], this.box[3])
this.canvas.stroke()
}
testing this results in the following Error:
Uncaught (in promise) TypeError: c.getContext is not a function
pointing me to the draw function. what am i doing wrong here? thanks!!