如何检测图像是照片,剪贴画还是线条图? [英] How to detect if an image is a photo, clip art or a line drawing?

查看:256
本文介绍了如何检测图像是照片,剪贴画还是线条图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

识别图片类型的最佳方法是什么?



这里有两个我检出的图片:



解决方案

这个问题可以解决通过图像分类,这可能是Google的解决方案。基本上,你要做的是(i)得到一组图像标签为3类:照片,剪贴画和线条画; (ii)从这些图像中提取特征;



功能提取:



在此步骤中,使用图像的特征和标签来训练分类器。您必须提取可能对分类器有用的视觉信息,以区分3种类别的图像:




  • 一个非常基本而有用的视觉特征是图像直方图及其变体。例如,照片的灰度级直方图可能比剪贴画的直方图更平滑,其中您具有可能具有相同颜色值的区域。

  • 可以使用的另一个功能是将图像转换为频域(例如使用 FFT DCT )和测量高频分量的能量。因为线条图可能会有明显的颜色过渡,所以其高频分量将趋向于累积更多的能量。



其他可以使用的特征提取算法



训练分类器:



在特征提取阶段之后,我们将为每个图像创建一个数值向量(我们称之为图像特征向量)元组。这是训练分类器的合适输入。对于分类器,可以考虑神经网络 SVM 其他



分类:



现在我们有一个训练有素的分类器图像(即检测图像类别),我们只需要提取其特征并将其输入到分类器,并且它将返回其预测类别


What is the best way to identify an image's type? rwong's answer on this question suggests that Google segments images into the following groups:

  • Photo - continuous-tone
  • Clip art - smooth shading
  • Line drawing - bitonal

What is the best strategy for classifying an image into one of those groups? I'm currently using Java but any general approaches are welcome.

Thanks!


Update:

I tried the unique colour counting method that tyjkenn mentioned in a comment and it seems to work for about 90% of the cases that I've tried. In particular black and white photos are hard to correctly detect using unique colour count alone.

Getting the image histogram and counting the peeks alone doesn't seem like it will be a viable option. For example this image only has two peaks:

Here are two more images I've checked out:

解决方案

This problem can be solved by image classification and that's probably Google's solution to the problem. Basically, what you have to do is (i) get a set of images labeled into 3 categories: photo, clip-art and line drawing; (ii) extract features from these images; (iii) use the image's features and label to train a classifier.

Feature Extraction:

In this step you have to extract visual information that may be useful for the classifier to discriminate between the 3 categories of images:

  • A very basic yet useful visual feature is the image histogram and its variants. For example, the gray level histogram of a photo is probably smoother than a histogram of a clipart, where you have regions that may be all of the same color value.
  • Another feature that one can use is to convert the image to the frequency domain (e.g. using FFT or DCT) and measure the energy of high frequency components. Because line drawings will probably have sharp transitions of colors, its high frequency components will tend to accumulate more energy.

There's also a number of other feature extraction algorithms that may be used.

Training a Classifier:

After the feature extraction phase, we will have for each image a vector of numeric values (let's call it the image feature vector) and its tuple. That's a suitable input for a training a classifier. As for the classifier, one may consider Neural Networks, SVM and others.

Classification:

Now that we have a trained classifier, to classify an image (i.e. detect a image category) we simply have to extract its features and input it to the classifier and it will return its predicted category

这篇关于如何检测图像是照片,剪贴画还是线条图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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