[英]How to cluster a set of image files to different folders based on their content
I have a set of images in a folder, where each image either has a square shape or a triangle shape on a white background (like this and this ). 我在文件夹中有一组图像,其中每个图像在白色背景上都具有正方形或三角形(例如this和this )。 I would like to separate those images into different folders (note that I don't care about detecting whether image is a square/triangle etc. I just want to separate those two).
我想将这些图像分离到不同的文件夹中(请注意,我不在乎检测图像是否是正方形/三角形等。我只想将这两个图像分离)。
I am planning to use more complex shapes in the future (eg pentagons, or other non-geometric shapes) so I am looking for an unsupervised approach. 我计划将来使用更复杂的形状(例如五边形或其他非几何形状),因此我正在寻找一种无监督的方法。 But the main task will always be clustering a set of images into different folders.
但是主要任务将始终是将一组图像群集到不同的文件夹中。
What is the easiest/best way to do it? 最简单/最好的方法是什么? I looked at image clustering algorithms, but they do clustering of colors/shapes inside the image.
我研究了图像聚类算法,但是它们在图像内部对颜色/形状进行聚类。 In my case I simply want to separate those image files based on the shapes that have.
就我而言,我只是想根据具有的形状来分离那些图像文件。
Any pointers/help is appreciated. 任何指针/帮助表示赞赏。
You can follow this method: 您可以按照以下方法:
1. Create a look-up tables with shape you are using in the images
2. Do template matching on the images stored in a single folder
3. According to the result of template matching just store them in different folders
4. You can create folders beforehand and just replace the strings in program according to the usage.
I hope this helps 我希望这有帮助
It's really going to depend on what your data set looks like (eg, what your shape images look like), and how robust you want your solution to be. 这实际上取决于数据集的外观(例如,形状图像的外观)以及解决方案的稳定性。 The tricky part is going to be extracting features from each shape image the produce a clustering result that you're satisfied with.
棘手的部分是从每个形状图像中提取特征,以产生您满意的聚类结果。 A few ideas:
一些想法:
You could compute SIFT features for each images and then cluster the images based on those features: http://en.wikipedia.org/wiki/Scale-invariant_feature_transform 您可以为每个图像计算SIFT功能 ,然后基于这些功能对图像进行聚类: http : //en.wikipedia.org/wiki/Scale-invariant_feature_transform
If you don't want to go the SIFT route, you could try something like HOG : http://en.wikipedia.org/wiki/Histogram_of_oriented_gradients 如果您不想走SIFT路线,则可以尝试类似HOG的方法 : http : //en.wikipedia.org/wiki/Histogram_of_ 取向_gradients
A somewhat more naive approach - If the shapes are always the same scale, and the background color is fixed you could get rid of the background cluster the images based on shape area (eg, number of pixels taken up by the shape). 一种比较幼稚的方法-如果形状总是相同的比例,并且背景颜色是固定的,则可以基于形状区域 (例如,形状所占据的像素数)来消除背景群集图像。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.