使用 Weka 进行基于直方图的图像分类
我正在做一个基于直方图的图像检索项目,我需要比较一组图像的学习算法。因此,在 MATLAB 中,我将图像(256x256 像素)转换为 HSV,将其量化为 8(H),3(S),3(V) 并创建一个加权和,即 256x256 矩阵。
我想使用这个矩阵(数据集中的所有图像)来创建 ARFF 文件,但我陷入了这一点。任何人都可以帮我解决如何完成它吗?
I am doing a project on histogram based image retrieval, and I need to compare learning algorithms for a set of images. So, in MATLAB, I converted an image (256x256 pixels) into HSV, quantized it to 8(H),3(S),3(V) and created a weighted sum, which is a 256x256 matrix.
I want to use this matrix (of all images in the dataset) to create an ARFF file, and I am stuck at this point. Can anyone help me out with how it has to be done?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我理解你做了什么,你将图像作为输入(256x256 RGB 矩阵)并将其转换为 256x256 矩阵,其中每个位置都是 HSV 值的加权和。
但是,如果您想提取颜色直方图(在本例中,这是 Weka 的适当输入),您应该将向量作为输出,其中每个条目是具有给定 H、S 和L值。
由于 H 有 8 个不同的值(0 到 7),S 有 3 个不同的值(0 到 2),L 有 3 个不同的值(0 到 2),因此向量 V 应该有 8+3+3=14 个条目。为了计算 V,请使用以下算法:
If I understood what you did, you took the image as input (256x256 RGB matrix) and converted it to a 256x256 matrix where each position is a weighted sum of HSV values.
However, if you want to extract a color histogram (which, in this case, is the appropriate input to Weka), you should have as output a vector, where each entry is the count of how many pixels has a given H, S and L value.
Since you have 8 different values for H (0 to 7), 3 for S (0 to 2) and 3 for L (0 to 2), your vector V should have 8+3+3=14 entries. In order to compute V, use the following algorithm: