hi
- User
hi
- Assistant
Hello! How can I assist you today?
- User
// Function to load the image onto the canvas and draw polygon annotation const drawPolygonAnnotation = (mask, imageUrl) => { const canvas = canvasRef.current; const ctx = canvas.getContext("2d");
if (canvas && ctx) { const img = new Image(); img.src = imageUrl; img.onload = () => { ctx.clearRect(0, 0, canvas.width, canvas.height); ctx.drawImage(img, 0, 0, canvas.width, canvas.height); ctx.strokeStyle = "blue"; ctx.lineWidth = 2; ctx.beginPath(); mask.forEach(([x, y], index) => { const scaledX = x * (canvas.width / img.width); const scaledY = y * (canvas.height / img.height); index === 0 ? ctx.moveTo(scaledX, scaledY) : ctx.lineTo(scaledX, scaledY); }); ctx.closePath(); ctx.stroke(); }; img.onerror = () => { console.log("Image not found"); ctx.clearRect(0, 0, canvas.width, canvas.height); ctx.fillStyle = "red"; ctx.font = "16px sans-serif"; ctx.textAlign = "center"; ctx.fillText("Image not accessible or archived" , canvas.width /2 , canvas.height /2); }; } In this code the image is not accessible - Assistant
- User
In console i am getting error like this Annotated polygon 357660104103882_0_2024-09-25_1727288654455.jpg:1
Failed to load resource: net::ERR_NAME_NOT_RESOLVEDwidget.tsx:210 Image not found :3001/experience/0/?…9506-layer-4%3A19:1 Uncaught (in promise) h widget.tsx:109 Cleanup: Destroying JimuMapView.
- Assistant
The
net::ERR_NAME_NOT_RESOLVEDerror indicates that the browser , i.e., it cannot find the server for the image. - User
why my canvas is not visible , my error message in poupup
- Assistant
- User
img.onerror = () => { ctx.clearRect(0, 0, canvas.width, canvas.height); ctx.fillStyle = "red"; ctx.font = "16px sans-serif"; ctx.textAlign = "center"; ctx.fillText( "Image not accessible or archived", canvas.width / 2, canvas.height / 2 ); }; why this is not displayed
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.