Using bagOfFeatures with RosBag data (storage efficiency)?

1 次查看(过去 30 天)
We're working on an application to do feature recognition and SLAM using the bagOfFeatures objects. I was wondering whether there are any ways to do this efficiently as the process seems to be quite inefficient in terms of memory and storage.
  • Data are acquired in a ROS2-RosBag, including the logged imagery.
  • Building the bagOfFeatures requires converting the RosBag into an imageDatastore
  • Building the bagOfFeatues makes another copy of the images, adding them to the BOF structure.
So that's at least three copies of the same data, which for even modest travel distances can get very large. Even if we assume a fairly infrequent keyframe selection, we would still need to convert the RosBag into an imageDatastore before use. Am I missing something obvious?

回答(1 个)

Ninad
Ninad 2024-1-23
Hi John,
I understand that you are using bagOfFeatures objects for feature recognition, and at least three copies of the same images are created.
You can use a custom feature extractor function to extract features from the images in Datastore. This would reduce memory and storage usage, and you can avoid creating a separate copy of the images in the BOF structure.
There is a "CustomExtractor" option in the "bagOfFeatures" object constructor. Upon using the constructor, it will return a bag of features that uses a custom feature extractor function to extract features from images in "imds.extractorFcn" (It is a function handle to a custom feature extraction function).
Please refer the following MATLAB Documentation to understand how to Create a Custom Feature Extractor:
You can also downsample the images before creating the bagOfFeatures object using the "imresize" function in MATLAB.
For more details about the "bagOfFeatures" object, please go through the following MATLAB Documentation:
Hope this helps.
Regards
Ninad
  1 个评论
John
John 2024-1-24
Thanks for your response. I'll have to look at whether the custom extractors will do the job.
The solution might avoid making the third copy, but it still looks like I'd still need to convert the rosbag into an imageDataStore.
And I'd imagine resizing the images may affect the ability to recognize features in the bagOdFeatures. It reduces the size of the BOF object, it's not quite equivalent.
I'll have to play around with these options to see if they perform adequately.

请先登录,再进行评论。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by