File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -253,15 +253,15 @@ cv.imshow('a window name', mat);
253
253
cv .waitKey ();
254
254
255
255
// load base64 encoded image
256
- const base64text = ' data:image/gif ;base64,R0lGO..' ;// Base64 encoded string
256
+ const base64text = ' data:image/png ;base64,R0lGO..' ;// Base64 encoded string
257
257
const base64data = base64text .replace (' data:image/jpeg;base64' ,' ' )
258
258
.replace (' data:image/png;base64' ,' ' );// Strip image type prefix
259
259
const buffer = Buffer .from (base64data,' base64' );
260
260
const image = cv .imdecode (buffer); // Image is now represented as Mat
261
261
262
- // convert Mat to base4 encoded jpg image
262
+ // convert Mat to base64 encoded jpg image
263
263
const outBase64 = cv .imencode (' .jpg' , croppedImage).toString (' base64' ); // Perform base64 encoding
264
- const htmlImg = ' <img src=' data: image/ jpeg;base64," +outBase64 + " ' >' ; // Create insert into HTML compatible <img> tag
264
+ const htmlImg = ' <img src=data:image/jpeg;base64,' + outBase64 + ' >' ; // Create insert into HTML compatible <img> tag
265
265
266
266
// open capture from webcam
267
267
const devicePort = 0 ;
You can’t perform that action at this time.
0 commit comments