`
文章列表
The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime. There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, and 97. How many circular primes are there below one million? circular primes ,循环的素数。指的是一个 ...
阶乘的和 145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145. Find the sum of all numbers which are equal to the sum of the factorial of their digits. Note: as 1! = 1 and 2! = 2 are not sums they are not included. 145是一个特殊的数字,等于自身每位数的阶乘的和。求出所有类似145的数的和。
The fraction 49/98 is a curious fraction, as an inexperienced mathematician in attempting to simplify it may incorrectly believe that 49/98 = 4/8, which is correct, is obtained by cancelling the 9s. We shall consider fractions like, 30/50 = 3/5, to be trivial examples. There are exactly four non-tr ...
We shall say that an n-digit number is pandigital if it makes use of all the digits 1 to n exactly once; for example, the 5-digit number, 15234, is 1 through 5 pandigitial. The product 7254 is unusual, as the identity, 39 X 186 = 7254, containing multiplicand, multiplier, and product is 1 through 9 ...
In England the currency is made up of pound, £, and pence, p, and there are eight coins in general circulation: 1p, 2p, 5p, 10p, 20p, 50p, £1 (100p) and £2 (200p). It is possible to make £2 in the following way: 1×£1 + 1×50p + 2×20p + 1×5p + 1×2p + 3×1p How many different ways can £2 be made using ...
def primes(n): """ returns a list of prime numbers from 2 to < n """ if n < 2: return [] if n == 2: return [2] # do only odd numbers starting at 3 s = range(3, n, 2) # n**0.5 may be slightly faster than math.sqrt(n) mroot = n ** 0.5 half = ...
ImageDraw 模块为Image类提供了简单的2D图形。可以使用这个模块创建新图像,做注释或者对现有图像进行润饰,使用该模块还可以即时创建图像方便用于web。 PIL的更多高级绘图库,可参见 The aggdraw Module。 例子 在图像上绘制一个灰色的十字 import Image, ImageDraw im = Image.open("lena.pgm") draw = ImageDraw.Draw(im) draw.line((0, 0) + im.size, fill=128) draw.line((0, im.size[1], im.siz ...
Image 模块提供了同名的类用来表示PIL的图像。Image模块还提供了许多工厂(factory)函数,包块从文件加载图像的函数,以及创建新图像的函数。 例子 下面的脚本加载了一个图像,并把它旋转了45度,然后调用外部的查看器(通 ...

PIL概念

    博客分类:
  • PIL
  Python图像库处理光栅图像(raster images);即一个矩形区域的图像数据。 波段(Bands) 一幅图像可以包含一个或多个波段的数据。Python允许你在一幅图像中保存多个波段的数据,但这要求它们有相同的面积和深度。 To get the number and names of bands in an image, use the getbands method. 模式(Mode) 图像的模式定义了图像中像素的类型和深度。当前发布支持下面的标准模式: ·        1 (1-bit pixels, black and white, stored with one ...
使用Image类 Python图像库中最重要的类是Image类,在与之同名的模块中定义。有几种方法可以创建Image类的实例;或者从文件载入一个图像,或者处理其它图像,或者凭空创建一个图像。 可以使用Image模块提供的open函数从文件载入 ...
Java学习从入门到精通 一、 JDK (Java Development Kit) JDK是整个Java的核心,包括了Java运行环境(Java Runtime Envirnment),一堆Java工具和Java基础的类库(rt.jar)。不论什么Java应用服务器实质都是内置了某个版本的JDK。因此掌握JDK是学好Java ...
安装篇 PHP+MySQL+Linux目前已逐渐成为小型web服务器的一种经典组合。在Windows环境下构筑和调试MySQL数据库是许多网站开发者的一种首选。本人在Windows98环境下初学MySQL,现将学习过程与经验总结出来供大家参考。 1、下载mysql-3.23.35-win.zip并解压; 2、运行setup.exe;选择d:\mysql,"tyical install" 3、启动mysql,有如下方法: 方法一:使用winmysqladmin 1)、进入d::\mysql\bin目录,运行winmysqladmin.exe,在屏幕右下角的 ...
学习英语的方法 李阳疯狂英语:每天拿着小卡片到山上(无人的地方)大声朗读 逆向英语学习法:把英语单词和中文意思写上20遍 千万别学英语:听磁带(MP3)约2到3个月,每天听2遍,共1小时。全文抄写3遍能帮助记忆,并且只要背的时间足够长,就一定能背出来。 超右脑英语学习法:求闻持法,将一个包含9个佛教单词的短句念上一百万遍,每天1万遍,坚持100天。据说可以获得过目不忘的超人记忆力。 只有找到自己真正感兴趣的内容和领域,才会真正自己去记单词,去了解所有的细节,才能取得真正的进步。所以,在你学任何材料的时候,要首先问问自己,这是我真正感兴趣的内容和领域吗?这是一个我要终生掌握的材料吗?首先 ...
http://www.sunxin.org/forum/thread/210.html?page=1 作者:虎非龙 第20课 钩子与数据库编程 1.Hook简介:作用是拦截某些消息,关键函数是SetWindowsHookEX() 2.示例程序:   1.新建一基于对话框工程,InnerHook,此过程的钩子是只拦截本进程的。   2.在OnInitDialog()中添加代码:    g_hWnd=m_hWnd; g_hMouse=SetWindowsHookEx(WH_MOUSE,MouseProc,NULL,GetCurrentThreadId());设置了鼠标钩子 g_hKeybo ...
http://www.sunxin.org/forum/thread/210.html?page=1 作者:虎非龙 第19课 DLL编程 1.DLL简介,动态库,静态库。动态库节约磁盘空间,静态库体积大。可以用多种语言编写DLL文件。动态库有两种加载方式:隐式调用和动态加裁! 2.新建一个DLL1的dll工程,加入一源文件名为dll1.cpp,加入add和subtract两个函数,注意此时须在函数名前加_declspec(dllexport),并且编译。用dumpbi -exports dll1.dll查看其导出的函数,发现函数名字已经被改成了 ?add@@YAHHH@Z,这种现象叫做名字粉 ...
Global site tag (gtag.js) - Google Analytics