• opencv基础操作01


    import cv2
    import numpy as np
    # #加载图像
    # # img=cv2.imread("C:/Users/31132/Desktop/login.jpg")
    # # cv2.imshow("Output",img)
    # # cv2.waitKey(1000)
    #
    # #加载视频,网络摄像头
    # cap=cv2.VideoCapture("C:/Users/31132/Desktop/VID_20201024_082711.mp4")
    # #图像显示:遍历帧
    # while True:
    #     success,img=cap.read()
    #     cv2.imshow("Video",img)
    #     if cv2.waitKey(1)&0xFF==ord('q'):e
    #         break;
    # kernel=np.ones((2,2),np.uint8)
    #
    #
    #
    # img=cv2.imread("C:/Users/31132/Desktop/cheliang_fuben.jpeg")
    # #灰度图像
    # imgGray=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
    # #高斯模糊
    # imgBlur=cv2.GaussianBlur(imgGray,(7,7),0)
    # #边缘
    # imgCanny=cv2.Canny(imgBlur,100,100)
    # #膨胀
    # imgDialation=cv2.dilate(imgCanny,kernel,iterations=5)
    # #侵蚀
    # imgEroded=cv2.erode(imgDialation,kernel,iterations=9)
    #
    # # cv2.imshow("Output",imgGray)
    # cv2.imshow("Output2",imgBlur)
    # cv2.imshow("Output3",imgCanny)
    # cv2.imshow("Output4",imgDialation)
    # cv2.imshow("Output5",imgEroded)
    # cv2.waitKey(0)
    
    # img=cv2.imread("C:/Users/31132/Desktop/cheliang_fuben.jpeg")
    # print(img.shape)
    # #Resize
    # imgResize=cv2.resize(img,(300,300))
    # #裁剪
    # imgCroped=img[0:200,0:200]
    # cv2.imshow("YuanShi",img)
    # cv2.imshow("Resize",imgResize)
    # cv2.imshow("croped",imgCroped)
    # cv2.waitKey(0)
    
    # img=np.zeros((512,512,3),np.uint8)
    # print(img.shape)
    #
    # #着色
    # img[0:100,0:100]=0,222,0
    #
    # #画线
    # cv2.line(img,(100,100),(img.shape[0],img.shape[1]),(255,255,0),3)
    # #画矩形
    # cv2.rectangle(img,(100,100),(img.shape[0],img.shape[1]),(255,255,0),2)
    # #画圆
    # cv2.circle(img,(200,200),30,(255,255,255),4)
    # #写字
    # cv2.putText(img,"软工",(200,200),cv2.FONT_ITALIC,1,(0,0,200))
    # cv2.imshow("Black",img)
    # cv2.waitKey(0)
    
    #until 4557
  • 相关阅读:
    Linux 分区注意事项
    wamp2.4-- 为WAMP中的mysql设置密码密码
    转multicast vs broadcast
    转 生成 HTMLTestRunner 测试报告
    Eclipse和PyDev搭建完美Python开发环境(Windows篇)
    转 深入解析浏览器的幕后工作原理
    selenium + python 怎样才能滚到页面的底部?
    Java ZIP压缩和解压缩文件(解决中文文件名乱码问题)
    Java中使用poi导入、导出Excel
    eclipse下的tomcat内存设置大小
  • 原文地址:https://www.cnblogs.com/XiaoGao128/p/13927620.html
Copyright © 2020-2023  润新知