From: Jonathon H. <js...@ec...> - 2015-06-16 12:29:27
|
Do something like this (will automatically write the complete list of features without need to iterate through them): ByteArrayOutputStream baos = new ByteArrayOutputStream(); org.openimaj.io.IOUtils.writeBinary(baos, features); byte[] bytes = baos.toByteArray(); > On 16 Jun 2015, at 11:19, chalitha udara Perera <cha...@gm...> wrote: > > Hi All, > I have extracted LocalFeaturesList<ByteDSIFTKeypoint> using Pyramid Dense Sift in OpenIMAJ. > As indicated in API documentation, ByteDSIFTKeypoint implements Java Serializable interface and there fore I would like to serialize keypoints for latter use. > I tried to serialize keypoints to get a byte array. But when retrieving key-points from the serialized object it loses all field values associated with it. > > I am using the following code for serialization > > ByteArrayOutputStream baos = new ByteArrayOutputStream(); > > ObjectOutputStream oos = new ObjectOutputStream(baos); > > > LocalFeatureList<ByteDSIFTKeypoint> features = psift.getByteKeypoints(); > > for (ByteDSIFTKeypoint byteDSIFTKeypoint : features) { > > > oos.writeObject(byteDSIFTKeypoint); > > > byte[] bytes = baos.toByteArray(); > > } > > > > Any help regarding how to correctly serialize keypoints is greatly appreciated. > > Thanks, > > Chalitha > > > -- > J.M Chalitha Udara Perera > > Department of Computer Science and Engineering, > University of Moratuwa, > Sri Lanka > ------------------------------------------------------------------------------ > _______________________________________________ > openimaj-discuss mailing list > ope...@li... > https://lists.sourceforge.net/lists/listinfo/openimaj-discuss |