【发布时间】:2022-12-05 23:21:06
【问题描述】:
我尝试使用以下代码
import cv2
from google.colab import drive
drive.mount('/content/drive')
image = cv2.imread('/content/drive/MyDrive/dusty.jpg') #reads the image
dst = cv2.fastNlMeansDenoisingColored(image, None, 10, 10, 7, 15)
#the meaning of parameters given
p1 = 10 #size of pixels to compute weights of the image
p2 = 10 #to compute the weighted average
p3 = 7 #filter strength for luminescence
p4 = 15 #filter strength for color component
rgb_image = cv2.cvtColor(dst, cv2.COLOR_BGR2RGB)
cv2.imwrite('RGB_/content/drive/MyDrive/dusty.jpg',rgb_image)
new_image = (cv2.medianBlur(rgb_image,5)
> cv2.imwrite('median_blur/content/drive/MyDrive/dusty.jpg',new_image) #error here
>
cv2.imwrite('median_blur/content/drive/MyDrive/dusty.jpg',new_image)
^
SyntaxError: invalid syntax
【问题讨论】:
-
>是代码的一部分吗? -
new_image = (...(...)缺少括号。 -
欢迎来到堆栈溢出!请尝试将您的代码压缩为minimal reproducible example。另见How to Ask。
标签: python