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
小白中午听完老菜讲的那些话后一直在思考,可想来想去还是一头雾水,晕晕呼呼的一知半解,到最后还是想不明白,心想:老大讲的太高深了,只能听懂一半半,看来只能先记下来,将明白的先做,不明白的等以后遇到再学. ...
随机推荐
- Linux下无法挂载U盘
大概的错误信息是这样的: Error mounting /dev/sdb4 at /media/xxx/xx: Command-line`mount -t "ntfs" -o&qu ...
- D、Homework of PE 容斥原理
https://scut.online/p/113 终于想懂了这个容斥, 华工4月23号校赛,考虑总的所有情况,设1---n里面含有质数的个数为all,需要固定m个质数.那么有 totSum = C( ...
- fleet - 基于Machine Metadata的任务调度
基于Machine Metadata的任务调度 复杂和特定的要求的应用程序可以针对一个子集的集群调度通过machine metadata.强大的部署拓扑结构,可以实现的基础上的机器的地区,机架位置,磁 ...
- 【持续更新】Java 时间相关
直接上代码: import java.util.*; import java.text.SimpleDateFormat; public class HelloWorld { public stati ...
- hystrix 给方法加断路器
添加依赖 <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>s ...
- Jsp动态生成表格
输入行列: <body> <form action="Train2ResultJsp.jsp"> row:<input type="text ...
- Eclipse IDE配置PHP开发、调试环境
前言 使用java语言开发的朋友想必对Eclipse开发工具已经不陌生了,那么Eclipse作为java主流的开发工具,是否能够开发PHP项目呢?答案如你所想,肯定是可以的!以下就是该IDE下如何配置 ...
- EasyUI:EasyUI-DataGrid多行合并实现
1.首先我们<table>增加一个属性data-options="onLoadSuccess:mergeCells",mergeCells是我们对应的JS方法名,意思就 ...
- CentOS 7安装Docker服务详细过程
---恢复内容开始--- Docker 简介 Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的 Linux 机器上,也可以实现虚拟 ...
- 项目中遇到的bug
1. babel编译转换时发生了报错: BabelLoaderError: SyntaxError: Unexpected token babel预置的转换器是 babel-preset-es2015 ...