Python: simple drawings
import cv2; # OpenCV Python
import numbers;
import numpy as np;
import math;
import matplotlib;
import matplotlib.pyplot as plt;
import matplotlib.image as mpimg;
from IPython.display import display, Image img = cv2.imread('9012.JPG');
img=np.zeros((512,512,3),np.uint8); img=cv2.line(img,(0,0),(511,511),(255,0,0),5); img=cv2.rectangle(img,(384,0),(510,128),(0,255,0),3); img=cv2.circle(img,(447,63),63,(0,0,255),-1); img=cv2.ellipse(img,(256,256),(100,50),0,0,180,255,-1); font=cv2.FONT_HERSHEY_SIMPLEX;
cv2.putText(img,'OpenCv',(10,500),font,4,(255,255,255),2,cv2.LINE_AA); pts=np.array([[10,5],[20,30],[70,20],[50,10]],np.int32);
pts=pts.reshape((-1,1,2));
img=cv2.polylines(img,[pts],True,(0,255,255)); cv2.imshow('image',img);
cv2.waitKey(0);
cv2.destroyAllWindows(); print('geovindu'); # print(img);
# display
# imgshow=mpimg.imread('9012.JPG');
# imgplot = plt.imshow(imgshow);
# plt.show(); # display image
im = cv2.imread('9012.JPG');
im_resized = cv2.resize(im, (224, 224), interpolation=cv2.INTER_LINEAR);
plt.imshow(cv2.cvtColor(im_resized, cv2.COLOR_BGR2RGB));
plt.show();
Python: simple drawings的更多相关文章
- python simple factory mode example
Two python simple factory mode examples shown in this section. One is for base operation and another ...
- Python: simple code
# !/usr/bin/env python3.6 # -*- coding: utf-8 -*- # visual studio 2017 # 2019 10 12 Geovin Du print ...
- [译]如何使用Python构建指数平滑模型:Simple Exponential Smoothing, Holt, and Holt-Winters
原文连接:How to Build Exponential Smoothing Models Using Python: Simple Exponential Smoothing, Holt, and ...
- Data manipulation primitives in R and Python
Data manipulation primitives in R and Python Both R and Python are incredibly good tools to manipula ...
- [译]PyUnit—Python单元测试框架(1)
1. 原文及参考资料 原文链接:http://docs.python.org/2/library/unittest.html# 参考文档: http://pyunit.sourceforge.net/ ...
- 实验一个最小的PYTHON服务器编程
没事,玩玩儿~~~:) 按书上的例子来作.. #!/usr/bin/env python #Simple Server - Chapter 1 -server.py import socket hos ...
- python - StringIO文本缓冲
参考:http://pymotwcn.readthedocs.org/en/latest/documents/StringIO.html 类StringIO提供了一个在内存中方便处理文本的类文件(读, ...
- Python in minute
Python 性能优化相关专题: https://www.ibm.com/developerworks/cn/linux/l-cn-python-optim/ Python wikipedi ...
- 我的第一个python web开发框架(6)——第一个Hello World
小白中午听完老菜讲的那些话后一直在思考,可想来想去还是一头雾水,晕晕呼呼的一知半解,到最后还是想不明白,心想:老大讲的太高深了,只能听懂一半半,看来只能先记下来,将明白的先做,不明白的等以后遇到再学. ...
随机推荐
- Polly+AspectCore实现熔断与降级机制
Polly+AspectCore实现熔断与降级机制 https://www.cnblogs.com/edisonchou/p/9159644.html 一.熔断.降级与AOP 1.1 啥是熔断? 在广 ...
- Exploring refit, an automatic type-safe REST library for .NET Standard
自动类型安全的.NET标准REST库refit 在SCOTT HANSELMAN 博客上看到一个好东西<Exploring refit, an automatic type-safe RES ...
- NET Core 2.0 使用支付宝
ASP.NET Core 2.0 使用支付宝PC网站支付 前言 最近在使用ASP.NET Core来进行开发,刚好有个接入支付宝支付的需求,百度了一下没找到相关的资料,看了官方的SDK以及Demo ...
- Even-odd Boxes hackerrank 分类讨论
https://www.hackerrank.com/contests/101hack50/challenges/even-and-odd-boxes/editorial 昨晚做的时候卡了挺久的. 首 ...
- Spark Mllib里如何提取每个字段并转换为***类型(图文详解)
不多说,直接上干货! 具体,见 Hadoop+Spark大数据巨量分析与机器学习整合开发实战的第17章 决策树多元分类UCI Covertype数据集
- 再谈WPF
前几天初步看了一下WPF,按照网上说的一些方法,实现了WPF所谓的效果.但,今天我按照自己的思路设计了一个登陆界面,然后进行登陆验证,对WPF算是有进一步的理解,记录下来,以备后期查看. 首先,在WP ...
- P4869 罪犯分组
思路: 明显的dp,虽然我想到了二进制模拟,想到了转移,但还是先看了题解,原来真是这样,,,,不是第三题吗? 用f[i]表示,对于前i个罪犯最少需要分几组. 对于每个状态用二进制表示,第i位上1,0表 ...
- Spring RestTemplate实现服务间的远程调用完整代码示例
父pom: 服务提供方 pom: provider配置文件: provider启动类: provider实体类: provider Mapper: 内置了增删改查的方法 provider Servic ...
- 对fgets末尾'\0'的处理
之所以要对fgets自动添加的字符进行处理的原因之一是:当你想比较输入的字符时,你会发现输入的字符和源码用来进行对比的字符一模一样,但是使用strcmp比较时就是不一样,原因就是fgets对输入字符添 ...
- 宿主机Windows访问虚拟机Linux文件(二)
上一篇文章中详细讲述FTP服务(基于文件传输协议的服务),本文则介绍另一种能够实现此功能Telnet(Telecommunications network 远程登陆)服务.本文介绍的telnet我常用 ...