Read a binary descriptor file to cv::Mat

asked 2014-04-28 16:32:28 -0500

Fred Mili gravatar image

updated 2014-04-29 01:07:54 -0500

berak gravatar image

I have a binary file which includes ORB descriptor. I need to read it to a cv::Mat so I can use it for further detection. FileStorage only handles XML and YAML file. How can I read the file?

edit retag flag offensive close merge delete


please explain "binary descriptor file".

berak gravatar imageberak ( 2014-04-29 01:07:25 -0500 )edit

@berak, it's just an ORB descriptor written to a binary file.

Fred Mili gravatar imageFred Mili ( 2014-04-29 01:18:43 -0500 )edit

I guess you have writen it to the binary file, then the other way around should be quite identical. Can you provide the way you stored them?

StevenPuttemans gravatar imageStevenPuttemans ( 2014-04-29 04:15:57 -0500 )edit

@StevenPuttemans, I didn't do that. Somebody else has done it.

Fred Mili gravatar imageFred Mili ( 2014-04-29 06:03:13 -0500 )edit

Well, afaik it all depends how the binary descriptor was written away. If you have no idea about that, I think it is nearly impossible to reconstruct the binary data...

StevenPuttemans gravatar imageStevenPuttemans ( 2014-04-29 06:10:42 -0500 )edit

@StevenPuttemans, thanks a lot. But one question: Is it possible to write an ORB descriptor to XML or YAML file? What would you do if you had to save an ORB Descriptor to a file and read it later on?

Fred Mili gravatar imageFred Mili ( 2014-04-29 06:26:32 -0500 )edit

yes it can be done using serialization included in OpenCV, just look for the FileStorage interface right here. Just create your model, then write it to the file using the assignment operator.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-04-29 06:41:40 -0500 )edit