本文介绍了检查图像可见质量[PHP]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我想要进行图像质量检查。也许计算一下该质量的一些指标。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.jpgFor 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 bytesProfile-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.jpg300我注意到你的第一张图片有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 PNGconvert 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.png360.479 (0.00550055)0.00550055现在执行相同的程序,专业形象:Now do same procedure for second, professional image:# Make a comparably sized PNGconvert b.jpg -resize 1200x1200 b.pngconvert b.png -enhance be.pngcompare -metric rmse b.png be.png -format "%[distortion]" resb.png421.08 (0.00642527)0.00642527我仍在考虑abo这个......I am still thinking about this... 这篇关于检查图像可见质量[PHP]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-31 06:36