java hadoop inputFile作为缓冲区映像
我有一个关于Hadoop开发的问题
我必须训练自己使用Hadoop进行一个简单的图像处理项目。 我只想用Hadoop旋转一个图像(当然我不希望Hadoop使用整个图像)。 我的输入格式有问题。 我该怎么办
我找到的解决办法是:
- 将一个SequenceFile作为inputFormat(但是,我必须先做一个map/reduce作业,然后再做一个来进行旋转?)李>
- 使用I开发的类ImageWriteable扩展FileInputFormat和RecordReader。它包含一个BuffereImage(原始图像)、一个BuffereImage[]和一个int[]像素数组,前者是图像按我们想要的任何数字分割的图像,后者是图像的“序列化”李>
我也不太熟悉java中的泛型,因此我扩展了如下类:
public class ImageInputFormat extends FileInputFormat< IntWritable, ImageWritable>
public class ImageRecordReader extends RecordReader< IntWritable, ImageWritable>
对吗
事实上,我在丛林中迷失了方向,甚至不知道下一步该做什么/用什么。我读了很多关于Hadoop的文章,但我仍然不太明白map/reduce是如何使用inputfile的。 请问这里有人帮我吗
# 1 楼答案
我找了两个星期的帮助,但今天下午,我发现了一个有趣的页面: http://wiki.apache.org/hadoop/HadoopMapReduce?highlight=(inputf)
因此,我探讨了第二点。现在,我可以无误地访问recordReader。 我查看了类文本源代码。这对我真的很有帮助。 这是ImageRecordReader的一部分
下面是使BuffereImage变得可写的主要代码:
剩下的问题是: *我真的不知道它是否仍然正确 *如何对图像进行足够的分割以获得hdfs块大小的小图像
谢谢能帮助我的人