image rendering in PyScript
تبليغيرجى شرح بإيجاز لمإذا تشعر أنك ينبغي الإبلاغ عن هذا السؤال.
after doing lots of research I managed to make open-cv work on Py-Script but it doesn’t render the result.
I have this code here :
<py-script>
import matplotlib.pyplot as plt
import numpy as np
import cv2
image = cv2.imread(‘1.jpg’)
gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
row, col = 1, 2
fig, axs = plt.subplots(row, col, figsize=(15, 10))
fig.tight_layout()
axs[0].imshow(cv2.cvtColor(image, cv2.COLOR_BGR2RGB))
axs[0].set_title(‘Original’)
axs[1].imshow(cv2.cvtColor(gray_image, cv2.COLOR_BGR2RGB))
axs[1].set_title(‘Grayscale’)
plt.show()
</py-script>
and these are my python env and configurations.
<py-env>
– matplotlib
– numpy
– opencv-python
– paths:
– /1.jpg
</py-env>
<py-config>
– autoclose_loader: true
– runtimes:
–
src: “https://cdn.jsdelivr.net/pyodide/dev/full/pyodide.js”
name: pyodide-0.20
lang: python
</py-config>
in console according what I see, there is no problem. but it doesn’t show any image.
the code itself designed to grayscale the photo.
console log of browser:
أضف إجابة