【问题标题】:Can we convert an image to Avro format in Hadoop?我们可以在 Hadoop 中将图像转换为 Avro 格式吗?
【发布时间】:2013-01-07 13:52:08
【问题描述】:

是否可以在 Hadoop 中将图像转换为 Avro 格式?

【问题讨论】:

    标签: hadoop avro


    【解决方案1】:

    Avro 用于描述独立于平台的数据模式(“数据序列化系统”)。

    图像本身可以以多种格式(PNG、JPEG、BMP、GIF 等)编码,所有这些都可以表示为字节序列。您还可以定义一些关于图像的元数据(可能无论如何都以字节编码,但根据您的用例,提取它可能很有用。

    原始模式可能如下(改编自docs):

    {"namespace": "example.avro",
     "type": "record",
     "name": "Image",
     "fields": [
         {"name": "filename", "type": "string"},
         {"name": "type",  "type": "string"},
         {"name": "data", "type": "bytes"},
         {"name": "width", "type": "int"},
         {"name": "height", "type": "int"}
     ]
    }
    

    【讨论】:

      猜你喜欢
      • 2012-07-31
      • 1970-01-01
      • 2011-09-30
      • 2013-02-14
      • 1970-01-01
      • 1970-01-01
      • 2014-06-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多