frame tests complete successfully.

This commit is contained in:
Jordan 2024-03-23 10:44:50 -07:00
parent 2e304394e5
commit 3022adcbb7
5 changed files with 23 additions and 13 deletions

View File

@ -62,6 +62,7 @@ add_library(${LIBDART_OPENMVG} SHARED
"frame.cxx" "frame.cxx"
"streamingview.cxx" "streamingview.cxx"
"image.cxx" "image.cxx"
"util.cpp"
) )
set(CEREAL_INCLUDE_DIR ${OpenMVG_DIR}/../../../include/openMVG_dependencies/cereal/include/cereal/) set(CEREAL_INCLUDE_DIR ${OpenMVG_DIR}/../../../include/openMVG_dependencies/cereal/include/cereal/)
@ -100,13 +101,11 @@ target_link_options(${LIBDART_OPENMVG} PRIVATE "-Wl,-Bdynamic")
add_executable( add_executable(
test_image test_image
${CMAKE_CURRENT_SOURCE_DIR}/tests/test_image.cxx ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_image.cxx
${CMAKE_CURRENT_SOURCE_DIR}/util.cpp
) )
add_executable( add_executable(
test_frame test_frame
${CMAKE_CURRENT_SOURCE_DIR}/tests/test_frame.cxx ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_frame.cxx
${CMAKE_CURRENT_SOURCE_DIR}/util.cpp
) )
target_link_libraries( target_link_libraries(

@ -1 +1 @@
Subproject commit 7fd19fc22419a35481d39d2946f77e1dc00df37c Subproject commit aff37dd005f85b3589aa50caca13b74ca7bd57e4

View File

@ -77,6 +77,11 @@ void clean_frame(Frame *f) {
#ifdef __cplusplus #ifdef __cplusplus
DartOpenMvg::Frame::Frame(const DartOpenMvg::Frame &frame) {
cFrame = frame.cFrame;
mRegions = std::unique_ptr<openMVG::features::Regions>(frame.mRegions.get());
}
openMVG::image::Image<u_char> DartOpenMvg::imageFromFrame(const CFrame *frame) openMVG::image::Image<u_char> DartOpenMvg::imageFromFrame(const CFrame *frame)
{ {
rewind(frame->stream); rewind(frame->stream);
@ -112,10 +117,10 @@ void DartOpenMvg::Frames::computeMatches()
// Within openMvg::matching_image_collection::Matcher // Within openMvg::matching_image_collection::Matcher
// they matcha gainst *ALL* images. However, since we know the order of the // they matcha gainst *ALL* images. However, since we know the order of the
// image sequences (video frames), we'll stick to the sequence order. // image sequences (video frames), we'll stick to the sequence order.
for (size_t i = 0; i < this->size() - 1; ++i) for (size_t i = 0; i < mFrames.size() - 1; ++i)
{ {
const Frame &frame1 = this->at(i); const Frame &frame1 = mFrames[i];
const Frame &frame2 = this->at(i + 1); const Frame &frame2 = mFrames[i+1];
auto *regions1 = frame1.mRegions.get(); auto *regions1 = frame1.mRegions.get();
auto *regions2 = frame2.mRegions.get(); auto *regions2 = frame2.mRegions.get();

View File

@ -80,6 +80,7 @@ namespace DartOpenMvg
read_buffer(f->stream, &buffer_data, &len); read_buffer(f->stream, &buffer_data, &len);
mStream = std::stringstream(std::string((char *)buffer_data)); mStream = std::stringstream(std::string((char *)buffer_data));
} }
Frame(const Frame &);
openMVG::image::Image<u_char> getMvgImage(); openMVG::image::Image<u_char> getMvgImage();
void calculateFeatures(); void calculateFeatures();
}; };
@ -87,7 +88,7 @@ namespace DartOpenMvg
typedef std::pair<const Frame &, const Frame &> FrameMatchKey; typedef std::pair<const Frame &, const Frame &> FrameMatchKey;
typedef std::map<std::pair<size_t, size_t>, openMVG::matching::IndMatches> FrameFeatureMatch; typedef std::map<std::pair<size_t, size_t>, openMVG::matching::IndMatches> FrameFeatureMatch;
class Frames : protected std::vector<DartOpenMvg::Frame> class Frames
{ {
protected: protected:
@ -95,7 +96,12 @@ namespace DartOpenMvg
openMVG::tracks::STLMAPTracks mTracks; openMVG::tracks::STLMAPTracks mTracks;
openMVG::sfm::SfM_Data mSfmData; openMVG::sfm::SfM_Data mSfmData;
openMVG::sfm::Bundle_Adjustment_Ceres mAdjustment; openMVG::sfm::Bundle_Adjustment_Ceres mAdjustment;
public: public:
// TODO: make private with accessors
std::vector<Frame> mFrames;
Frames(openMVG::sfm::Bundle_Adjustment_Ceres::BA_Ceres_options &); Frames(openMVG::sfm::Bundle_Adjustment_Ceres::BA_Ceres_options &);
void computeMatches(); void computeMatches();
void buildTracks(); void buildTracks();

View File

@ -71,11 +71,11 @@ void test_calculate_fetures(void) {
void test_compute_matches(void) { void test_compute_matches(void) {
Frame *f1 = get_first_frame(); Frame *f1 = get_first_frame();
Frame *f2 = get_second_frame(); Frame *f2 = get_second_frame();
DartOpenMvg::Frame frame1(f1), frame2(f2); const DartOpenMvg::Frame frame1(f1), frame2(f2);
openMVG::sfm::Bundle_Adjustment_Ceres::BA_Ceres_options opts; openMVG::sfm::Bundle_Adjustment_Ceres::BA_Ceres_options opts;
DartOpenMvg::Frames frames(opts); DartOpenMvg::Frames frames(opts);
frames.insert(frame1); frames.mFrames.push_back(frame1);
frames.insert(frame2); frames.mFrames.push_back(frame2);
} }
int main() int main()