lhx0011 / javacv

Automatically exported from code.google.com/p/javacv
GNU General Public License v2.0
0 stars 0 forks source link

How can I write keypoint of image to file? #470

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I use javacv to detect keypoint of image, then I want to write this keypoint to 
File by use writeObject method of ObjectOutputStream class, but Keypoint class 
not implement Serializable, so I can't do this. How can I solve this problem?
My code here:
  img = cvLoadImageM("path/to/image",CV_LOAD_IMAGE_GRAYSCALE);
  keypoitns = new KeyPoint(null);
  detector.detect(img,keypoitns, null);
  FileOutputStream fos = new FileOutputStream(file);
  ObjectOutputStream os = new ObjectOutputStream(fos);
  try {
   os.writeObject(listImage);                                     
   os.flush();

  } catch (IOException e) {
    e.printStackTrace();
  }

Original issue reported on code.google.com by kieuanhv...@gmail.com on 8 May 2014 at 12:38

GoogleCodeExporter commented 8 years ago
We can use OpenCV's FileStorage facilities. Example in C++ here:
http://answers.opencv.org/question/4040/to-save-vector-keypoint-to-file-using-bu
iltin/ 

And please post your questions on the mailing list, thank you.

Original comment by samuel.a...@gmail.com on 9 May 2014 at 11:10