python 将图片转换成像素画_paintingReorganize:使用PCA分析重组像素画变成光滑的调色板...

该博客介绍了一种使用主成分分析(PCA)来重新组织图像像素的方法,从而创造出独特的艺术效果。通过读取输入文件,对像素进行PCA处理,然后逐列组织并检查是否需要翻转以匹配前一列,最终将结果写入输出文件。这种方法适用于不同艺术家的作品,如库普卡、梵高、毕加索和塞尚等。
摘要由CSDN通过智能技术生成

paintingReorganize

To install

pip install -r requirements.txt

If that doesn't work you will have to manually track down and install these pip packages.

To use

python palette.py /path/to/input_file.jpg

Output will be written to output.png

Examples

Input:

Kupka - Mme Kupka Among Verticals

input.jpg

Output:

output.png

Input:

Van Gogh - Starry Night

starry_night.png

Output:

starry_night_palette.png

Input:

Picasso - Demoiselles D'Avignon

demoiselles.jpg

Output:

demoiselles_palette.png

Input:

Cezanne - The Large Bathers

the_large_bathers.jpg

Output:

the_large_bathers_palette.png

How it works

Organize pixels according to their first principal component (the direction along which variance is greatest)

Grab a column of pixels at a time, and organize them according to their first principal component

Use the resulting columns one by one in the final result. With each column, check to see if flipping it upside down gives a better match to the previous column.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值