Skip to content
This repository was archived by the owner on Jul 20, 2023. It is now read-only.

Commit 65892a0

Browse files
author
BCOM\nduong
committed
Merge remote-tracking branch 'origin/0.10.0' into feature/Stereo
2 parents 8fc40be + 7b96386 commit 65892a0

File tree

57 files changed

+336
-67
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+336
-67
lines changed

SolARModuleOpenCV.pro

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ CONFIG -= qt
66
INSTALLSUBDIR = SolARBuild
77
TARGET = SolARModuleOpenCV
88
FRAMEWORK = $$TARGET
9-
VERSION=0.9.3
9+
VERSION=0.10.0
1010

1111
DEFINES += MYVERSION=$${VERSION}
1212
DEFINES += TEMPLATE_LIBRARY
@@ -59,6 +59,7 @@ macx {
5959
QMAKE_CXXFLAGS += -mmacosx-version-min=10.7 -std=c11 -std=c++11 -O3 -fPIC#-x objective-c++
6060
QMAKE_LFLAGS += -mmacosx-version-min=10.7 -v -lstdc++
6161
LIBS += -lstdc++ -lc -lpthread
62+
LIBS += -L/usr/local/lib
6263
}
6364

6465
win32 {

bcom-SolARModuleOpenCV.pc.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ libdir=${exec_prefix}/lib
55
includedir=${prefix}/interfaces
66
Name: SolARModuleOpenCV
77
Description:
8-
Version: 0.9.4
8+
Version: 0.10.0
99
Requires:
1010
Libs: -L${libdir} -l${libname}
1111
Libs.private: ${libdir}/${pfx}${libname}.${lext}

interfaces/SolARKeypointDetectorOpencv.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class SOLAROPENCV_EXPORT_API SolARKeypointDetectorOpencv : public org::bcom::xpc
104104

105105
int m_id;
106106
cv::Ptr<cv::Feature2D> m_detector;
107-
cv::KeyPointsFilter kptsFilter;
107+
cv::KeyPointsFilter m_kptsFilter;
108108
int m_nbGridWidth = 20;
109109
int m_nbGridHeight = 20;
110110
float m_borderRatio = 0.01f;

packagedependencies.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
SolARFramework|0.9.3|SolARFramework|SolARBuild@github|https://github.com/SolarFramework/SolarFramework/releases/download
1+
SolARFramework|0.10.0|SolARFramework|SolARBuild@github|https://github.com/SolarFramework/SolarFramework/releases/download

src/SolARCameraOpencv.cpp

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,33 @@ namespace OPENCV {
6363
LOG_INFO("Camera using {} * {} resolution", m_parameters.resolution.width ,m_parameters.resolution.height)
6464
if (m_is_resolution_set)
6565
{
66-
m_capture.set(cv::CAP_PROP_FRAME_WIDTH, m_parameters.resolution.width );
67-
m_capture.set(cv::CAP_PROP_FRAME_HEIGHT, m_parameters.resolution.height );
66+
bool setResolutionFailed = false;
67+
68+
auto setResolution = [&]
69+
(cv::VideoCaptureProperties dimensionProp,
70+
uint32_t value,
71+
const std::string& dimensionName)
72+
{
73+
bool setResDimOk = m_capture.set(dimensionProp, value);
74+
75+
if (!setResDimOk || m_capture.get(dimensionProp) != value)
76+
{
77+
setResolutionFailed = true;
78+
LOG_ERROR("Cannot set camera {} to {}", dimensionName, value);
79+
if (!setResDimOk)
80+
{
81+
LOG_WARNING( "Note: cv::VideoCapture::set() returned 'true'");
82+
}
83+
}
84+
};
85+
86+
setResolution(cv::CAP_PROP_FRAME_WIDTH, m_parameters.resolution.width, "width");
87+
setResolution(cv::CAP_PROP_FRAME_HEIGHT, m_parameters.resolution.height, "height");
88+
89+
if ( setResolutionFailed )
90+
{
91+
return FrameworkReturnCode::_ERROR_;
92+
}
6893
}
6994
else {
7095
// set default resolution : get camera resolution ? or force camera resolution from default resolution values ?

src/SolARImagesAsCameraOpencv.cpp

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ namespace OPENCV {
4343
if(!cvFrame.data)
4444
return FrameworkReturnCode::_ERROR_LOAD_IMAGE;
4545

46+
unsigned int w=cvFrame.cols;
47+
unsigned int h=cvFrame.rows;
48+
if(w!=m_parameters.resolution.width || h!=m_parameters.resolution.height)
49+
cv::resize(cvFrame, cvFrame, cv::Size((int)m_parameters.resolution.width,(int)m_parameters.resolution.height), 0, 0);
50+
4651
return SolAROpenCVHelper::convertToSolar(cvFrame,img);
4752
}
4853

@@ -58,8 +63,28 @@ namespace OPENCV {
5863
{
5964
if (m_is_resolution_set)
6065
{
61-
m_capture.set(cv::CAP_PROP_FRAME_WIDTH, m_parameters.resolution.width );
62-
m_capture.set(cv::CAP_PROP_FRAME_HEIGHT, m_parameters.resolution.height );
66+
LOG_INFO("Camera using {} * {} resolution", m_parameters.resolution.width ,m_parameters.resolution.height)
67+
68+
auto setResolution = [&]
69+
(cv::VideoCaptureProperties dimensionProp,
70+
uint32_t value,
71+
const std::string& dimensionName)
72+
{
73+
bool setResDimOk = m_capture.set(dimensionProp, value);
74+
75+
if (!setResDimOk || m_capture.get(dimensionProp) != value)
76+
{
77+
LOG_WARNING("Cannot set camera {} to {}. Will fallback to cv::resize() each frame", dimensionName, value);
78+
if (!setResDimOk)
79+
{
80+
LOG_WARNING( "Note: cv::VideoCapture::set() returned 'true'");
81+
}
82+
}
83+
};
84+
85+
setResolution(cv::CAP_PROP_FRAME_WIDTH, m_parameters.resolution.width, "width");
86+
setResolution(cv::CAP_PROP_FRAME_HEIGHT, m_parameters.resolution.height, "height");
87+
6388
}
6489
return FrameworkReturnCode::_SUCCESS;
6590
}

src/SolARKeypointDetectorOpencv.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ void SolARKeypointDetectorOpencv::detect(const SRef<Image> image, std::vector<Ke
180180
setType(stringToType.at(this->m_type));
181181
}
182182
m_detector->detect(img_1, kpts, Mat());
183-
// fix scale
183+
// fix scale due to downscaling
184184
for (auto& keypoint : kpts) {
185185
keypoint.pt.x = keypoint.pt.x * ratioInv;
186186
keypoint.pt.y = keypoint.pt.y * ratioInv;
@@ -205,7 +205,7 @@ void SolARKeypointDetectorOpencv::detect(const SRef<Image> image, std::vector<Ke
205205
int countCell(0);
206206
for (auto& it: gridKps) {
207207
int nbKpPerCell = static_cast<int>((m_nbDescriptors - kpts.size()) / (nbCells - countCell));
208-
kptsFilter.retainBest(it.second, nbKpPerCell);
208+
m_kptsFilter.retainBest(it.second, nbKpPerCell);
209209
kpts.insert(kpts.end(), it.second.begin(), it.second.end());
210210
countCell++;
211211
}

src/SolARVideoAsCameraOpencv.cpp

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,27 @@ using namespace datastructure;
6666
{
6767
if (m_is_resolution_set)
6868
{
69-
m_capture.set(cv::CAP_PROP_FRAME_WIDTH, m_parameters.resolution.width );
70-
m_capture.set(cv::CAP_PROP_FRAME_HEIGHT, m_parameters.resolution.height );
69+
LOG_INFO("Camera using {} * {} resolution", m_parameters.resolution.width ,m_parameters.resolution.height)
70+
71+
auto setResolution = [&]
72+
(cv::VideoCaptureProperties dimensionProp,
73+
uint32_t value,
74+
const std::string& dimensionName)
75+
{
76+
bool setResDimOk = m_capture.set(dimensionProp, value);
77+
78+
if (!setResDimOk || m_capture.get(dimensionProp) != value)
79+
{
80+
LOG_WARNING("Cannot set camera {} to {}. Will fallback to cv::resize() each frame", dimensionName, value);
81+
if (!setResDimOk)
82+
{
83+
LOG_WARNING( "Note: cv::VideoCapture::set() returned 'true'");
84+
}
85+
}
86+
};
87+
88+
setResolution(cv::CAP_PROP_FRAME_WIDTH, m_parameters.resolution.width, "width");
89+
setResolution(cv::CAP_PROP_FRAME_HEIGHT, m_parameters.resolution.height, "height");
7190
}
7291
return FrameworkReturnCode::_SUCCESS;
7392
}
File renamed without changes.

tests/SolARTest_ModuleOpenCV_CameraCalibration/SolARTest_ModuleOpenCV_CameraCalibration.pro

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ CONFIG -= qt
44

55
## global defintions : target lib name, version
66
TARGET = SolARTest_ModuleOpenCV_CameraCalibration
7-
VERSION=0.9.3
7+
VERSION=0.10.0
88

99
DEFINES += MYVERSION=$${VERSION}
1010
CONFIG += c++1z
@@ -75,9 +75,21 @@ android {
7575
ANDROID_ABIS="arm64-v8a"
7676
}
7777

78-
config_files.path = $${TARGETDEPLOYDIR}
79-
config_files.files= $$files($${PWD}/SolARTest_ModuleOpenCV_CameraCalibration_conf.xml)
80-
INSTALLS += config_files
78+
linux {
79+
run_install.path = $${TARGETDEPLOYDIR}
80+
run_install.files = $${PWD}/../run.sh
81+
CONFIG(release,debug|release) {
82+
run_install.extra = cp $$files($${PWD}/../runRelease.sh) $${PWD}/../run.sh
83+
}
84+
CONFIG(debug,debug|release) {
85+
run_install.extra = cp $$files($${PWD}/../runDebug.sh) $${PWD}/../run.sh
86+
}
87+
INSTALLS += run_install
88+
}
89+
90+
configfile.path = $${TARGETDEPLOYDIR}/
91+
configfile.files = $${PWD}/SolARTest_ModuleOpenCV_CameraCalibration_conf.xml
92+
INSTALLS += configfile
8193

8294
DISTFILES += \
8395
packagedependencies.txt

0 commit comments

Comments
 (0)