zoukankan      html  css  js  c++  java
  • 图片文字绘制

    #文字绘制函数:putText(原图像,‘文字内容’,文字坐标,字体,字体大小,颜色,字体粗细,线条类型)
    #图片绘制:将图片缩小一定比例或截取某一部分的图片,用这个新的图片代替原来图片的某一部分
    import cv2
    import numpy as np
    font = cv2.FONT_HERSHEY_SCRIPT_SIMPLEX
    img= cv2.imread('../img/zidan.jpg',1)
    img1= cv2.imread('../img/demo.jpg',1)
    rect = cv2.rectangle(img,(150,20),(300,300),(0,0,255),2)
    cv2.putText(img,'zidan',(150,50),font,1,(255,0,0),2,cv2.LINE_AA)
    height = int(img1.shape[0]*0.2)
    width = int(img1.shape[1]*0.2)
    imgResize = cv2.resize(img1,(width,height))
    for i in range(0,height):
    for j in range(0,width):
    img1[i+200,j+120] = imgResize[i,j]
    cv2.imshow('zidan',img)
    cv2.imshow('resize',img1)
    cv2.waitKey(0)

    文字效果图:

    图片效果图:

  • 相关阅读:
    17种高效选聘方法
    三招让你从求职者中脱颖而出(转)
    仓山有感
    同事就是同事,职场没有兄弟姐妹
    enable worker process
    央企
    关于IIS
    td
    About Application Pool
    iis 7 application pool
  • 原文地址:https://www.cnblogs.com/cxxBoo/p/11464995.html
Copyright © 2011-2022 走看看