python类似图片查找_如何使用Python和PIL查找具有相似颜色的图像?

1586010002-jmsa.png

I have a lot of images in a folder, and I would like to find images with a similar color to a pre chosen image.

I would like to be able to do something like:

python find_similar.py sample.jpg

and have that return something like:

234324.jpg

55.jpg

9945.jpg

345434.jpg

104.jpg

Is this doable?

解决方案

I cannot give you a canned solution, but here's an angle to tackle the problem. It's not PIL-specific, and it might be entirely bogus, since I have no experience in image processing.

Perform color quantization on the image. That gives you a palette that encodes the color information in the image without any shape information.

Run a principal components analysis to get the dominant components in the color cube. Strictly, you could run this without quantization first, but it might be too expensive.

Do a least-squares fitting on the principal components of different images.

Hope this helps.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值