diff --git a/01读取图片.py b/01读取图片.py new file mode 100644 index 0000000..8868fcb --- /dev/null +++ b/01读取图片.py @@ -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() #删除所以窗口 \ No newline at end of file diff --git a/02灰度转换.py b/02灰度转换.py new file mode 100644 index 0000000..6dced1d --- /dev/null +++ b/02灰度转换.py @@ -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() #删除所以窗口 \ No newline at end of file diff --git a/03修改尺寸.py b/03修改尺寸.py new file mode 100644 index 0000000..de2f4a2 --- /dev/null +++ b/03修改尺寸.py @@ -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() #删除所以窗口 \ No newline at end of file diff --git a/Python程序设计课程设计报告模板 2024年.doc b/Python程序设计课程设计报告模板 2024年.doc new file mode 100644 index 0000000..3339ed9 Binary files /dev/null and b/Python程序设计课程设计报告模板 2024年.doc differ diff --git a/README.md b/README.md deleted file mode 100644 index a4127a6..0000000 --- a/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# pythonProject - diff --git a/pic/img1.jpg b/pic/img1.jpg new file mode 100644 index 0000000..a489eab Binary files /dev/null and b/pic/img1.jpg differ diff --git a/pic/img11.jpg b/pic/img11.jpg new file mode 100644 index 0000000..53b0b32 Binary files /dev/null and b/pic/img11.jpg differ diff --git a/pic/img12.jpg b/pic/img12.jpg new file mode 100644 index 0000000..bf9ec9a Binary files /dev/null and b/pic/img12.jpg differ diff --git a/pic/img13.jpg b/pic/img13.jpg new file mode 100644 index 0000000..22d636e Binary files /dev/null and b/pic/img13.jpg differ diff --git a/pic/img14.jpg b/pic/img14.jpg new file mode 100644 index 0000000..8156cc8 Binary files /dev/null and b/pic/img14.jpg differ diff --git a/pic/img15.jpg b/pic/img15.jpg new file mode 100644 index 0000000..3767bec Binary files /dev/null and b/pic/img15.jpg differ diff --git a/绘图3.eddx b/绘图3.eddx new file mode 100644 index 0000000..cdf1a5b Binary files /dev/null and b/绘图3.eddx differ