0527 commit

main
Heyuxuan 2 years ago
parent 64f45fea21
commit 9d0195ebdc

@ -0,0 +1,16 @@
#导入cv模块
import cv2 as cv
#读入图像
img = cv.imread("pic/img1.jpg")
#窗口名字
cv.namedWindow("Demo",0)
#规定图片大小
cv.resizeWindow("Demo",600,600)
#图片位置坐标
cv.moveWindow("Demo",300,150)
#显示图像
cv.imshow("Demo", img)
#等待
cv.waitKey(0) #>0 等待delay毫秒 =0 无限等待 <0 等待键盘单击
#释放内存
cv.destroyAllWindows() #删除所以窗口

@ -0,0 +1,28 @@
#导入cv模块
import cv2 as cv
#读入图像
img = cv.imread("pic/img1.jpg")
#窗口名字
cv.namedWindow("img",0)
#规定图片大小
cv.resizeWindow("img",600,600)
#图片位置坐标
cv.moveWindow("img",800,150)
#灰度转换
gray_img = cv.cvtColor(img,cv.COLOR_BGR2GRAY)
#显示灰度图片
cv.imshow('img',gray_img)
#保存灰度图片
cv.imwrite("pic/img2.jpg",gray_img)
#窗口名字
cv.namedWindow("Demo",0)
#规定图片大小
cv.resizeWindow("Demo",600,600)
#图片位置坐标
cv.moveWindow("Demo",200,150)
#显示图像
cv.imshow("Demo", img)
#等待
cv.waitKey(0) #>0 等待delay毫秒 =0 无限等待 <0 等待键盘单击
#释放内存
cv.destroyAllWindows() #删除所以窗口

@ -0,0 +1,19 @@
#导入cv模块
import cv2 as cv
#读入图像
img = cv.imread("pic/img1.jpg")
#窗口名字
cv.namedWindow("Demo",0)
#规定图片大小
cv.resizeWindow("Demo",600,600)
#图片位置坐标
cv.moveWindow("Demo",200,150)
#显示图像
cv.imshow("Demo", img)
#等待
while True:
if ord('q') == cv.waitKey(0):
break
#>0 等待delay毫秒 =0 无限等待 <0 等待键盘单击
#释放内存
cv.destroyAllWindows() #删除所以窗口

@ -1,2 +0,0 @@
# pythonProject

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 KiB

Binary file not shown.
Loading…
Cancel
Save