检查图像可见质量[PHP] [英] Check image visible quality [PHP]

查看:130
本文介绍了检查图像可见质量[PHP]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要进行图像质量检查。也许计算一下该质量的一些指标。

I want to make image quality check. Maybe calculate some index of that quality.

例如,假设用户A上传的内容类似于 http://www.hyperconectados.com/wp-content/uploads/2014/03/Selfie.jpg

For example, lets say, user A uploads something like http://www.hyperconectados.com/wp-content/uploads/2014/03/Selfie.jpg

和用户B上传类似 http://www.privatewifi.com/wp-content/uploads/2014/02/selfie.jpg

很明显,B照片专业,品质优良。还有一件事,使用图像大小和重量(?)是不好的,因为B图像可以调整大小,照片或其他东西(丢失一些图像数据)。

It's obvious, that B photo is professional and in good quality. There's another thing, that it's not good to use image size and weight(?) because B image could be resized, photoshoped or something else (lost some image data).

有没有办法发现这种差异? :)任何想法?

Is there a way to detect that difference? :) Any ideas?

推荐答案

我仍然在考虑进一步的指标,但目前......

I am still thinking of further indicators, but for the moment...

IPTC简介和/或版权

我想说大多数专业摄影师都不会让在没有IPTC资料和版权声明的情况下出门。

I would say that most professional photographers wouldn't let an image out the door without an IPTC profile and Copyright notice.

你可以用ImageMagick找到这样的:

You can find that with ImageMagick like this:

identify -verbose image.jpg | grep -i profile

你的第二个图片出现了

Profile-8bim: 104 bytes
Profile-iptc: 92 bytes

你实际上可以读取这样的个人资料:

You can actually read the profile like this:

convert b.jpg 8BIMTEXT:-

8BIM#1028="IPTC"
2#103#Original Transmission Reference="53616c7465645f5fb085443d8e4c5898afc929fa83c3cc27d7bf6da5d5f63efdf47888b1a19ac93e"
2#0="�"

convert b.jpg IPTCTEXT:-

2#103#Original Transmission Reference="53616c7465645f5fb085443d8e4c5898afc929fa83c3cc27d7bf6da5d5f63efdf47888b1a19ac93e"
2#0="�"

分辨率(dpi)

另一种判别可能是决议。大多数手机,业余爱好者和基于网络的图像的分辨率为72dpi或96dpi。大多数专业摄影师倾向于使用300dpi进行高质量打印,因此我可能会达到150dpi左右的阈值。你可以得到这样的分辨率:

Another discriminant would probably be the resolution. Most mobile phones, and amateurs, and web-based images have a resolution of 72dpi or 96dpi. Most professional photographers would tend to favour 300dpi for high quality printing, so I would probably threshold at around 150dpi. You can get the resolution like this:

identify -verbose image.jpg | grep -i resolution

或更快更简洁

identify -format %x image.jpg
300

我注意到你的第一张图片有72dpi,第二张图片有300dpi。

I note your first image has 72dpi and the second one has 300dpi.

增强的范围

我想到的另一个想法是,如果你尝试以数字方式增强图像,然后看到增强图像和原始图像之间的差异,并尝试从中推断出某些东西,会发生什么。据推测,专业编辑的图像不应该在它应该已经好的基础上易于增强。所以,假设我们选择ImageMagick的 -enhance 选项,并增强两个图像,然后查看原始图像和增强图像之间的差异。我将切换到无损 PNG 格式,以避免 JPEG 量化效果。

Another idea, which I am thinking about is what happens if you try to enhance the image digitally, and then see the differences between the enhanced image and the original and try to deduce something from that. Presumably, a professionally edited image will not be as susceptible to enhancement on the basis it should already be "good". So, let's say we choose ImageMagick's -enhance option, and enhance your two images and then look at the differences between the original and the enhanced images. I am going to switch to lossless PNG format to avoid JPEG quantisation effects.

# Make PNG
convert a.jpg a.png

# Enhance "a.png" and save as "ae.png"
convert a.png -enhance ae.png

# Compare "a.png" with "ae.png"
compare -metric rmse a.png ae.png -format "%[distortion]" resa.png
360.479 (0.00550055)0.00550055

< img src =https://i.stack.imgur.com/w1Blo.jpgalt =在此处输入图像说明>

现在执行相同的程序,专业形象:

Now do same procedure for second, professional image:

# Make a comparably sized PNG
convert b.jpg -resize 1200x1200 b.png

convert b.png -enhance be.png
compare -metric rmse b.png be.png -format "%[distortion]" resb.png
421.08 (0.00642527)0.00642527

我仍在考虑abo这个......

I am still thinking about this...

这篇关于检查图像可见质量[PHP]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆