This repository has been archived by the owner on Jul 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
67 changed files
with
1,194 additions
and
403 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/** | ||
* @copyright Copyright (c) 2017 B-com http://www.b-com.com/ | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#ifndef SOLARCORNERREFINEMENTOPENCV_H | ||
#define SOLARCORNERREFINEMENTOPENCV_H | ||
|
||
#include "xpcf/component/ConfigurableBase.h" | ||
#include "SolAROpencvAPI.h" | ||
#include "api/features/ICornerRefinement.h" | ||
#include "opencv2/core.hpp" | ||
#include <vector> | ||
|
||
namespace SolAR { | ||
namespace MODULES { | ||
namespace OPENCV { | ||
|
||
/** | ||
* @class SolARCornerRefinementOpencv | ||
* @brief <B>Refine the corner locations.</B> | ||
* <TT>UUID: ddae46ca-1657-4301-a87d-f2dcfa6265d0</TT> | ||
* | ||
*/ | ||
|
||
class SOLAROPENCV_EXPORT_API SolARCornerRefinementOpencv : public org::bcom::xpcf::ConfigurableBase, | ||
public api::features::ICornerRefinement | ||
{ | ||
public: | ||
/// @brief SolARCornerRefinementOpencv constructor | ||
SolARCornerRefinementOpencv(); | ||
|
||
/// @brief SolARCornerRefinementOpencv default destructor | ||
~SolARCornerRefinementOpencv() = default; | ||
|
||
/// @brief This method refines the corner locations | ||
/// @param[in] image Input image on which we are extracting keypoints. | ||
/// @param[in,out] corners Initial coordinates of the input corners and refined coordinates provided for output. | ||
void refine(const SRef<datastructure::Image> image, std::vector<datastructure::Point2Df> & corners) override; | ||
|
||
org::bcom::xpcf::XPCFErrorCode onConfigured() override final; | ||
|
||
void unloadComponent () override final; | ||
|
||
private: | ||
uint32_t m_nbMaxIters = 40; | ||
float m_minAccuracy = 0.01; | ||
cv::TermCriteria m_termcrit; | ||
uint32_t m_winSize = 5; | ||
cv::Size m_subPixWinSize; | ||
}; | ||
|
||
} | ||
} | ||
} | ||
|
||
#endif // SOLARCORNERREFINEMENTOPENCV_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
SolARFramework|0.9.0|SolARFramework|SolARBuild@github|https://github.com/SolarFramework/SolarFramework/releases/download | ||
SolARFramework|0.9.1|SolARFramework|SolARBuild@github|https://github.com/SolarFramework/SolarFramework/releases/download |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/** | ||
* @copyright Copyright (c) 2017 B-com http://www.b-com.com/ | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include "SolARCornerRefinementOpencv.h" | ||
#include "SolARImageConvertorOpencv.h" | ||
#include "SolAROpenCVHelper.h" | ||
#include "core/Log.h" | ||
#include <opencv2/imgproc.hpp> | ||
namespace xpcf = org::bcom::xpcf; | ||
|
||
XPCF_DEFINE_FACTORY_CREATE_INSTANCE(SolAR::MODULES::OPENCV::SolARCornerRefinementOpencv) | ||
|
||
namespace SolAR { | ||
using namespace datastructure; | ||
namespace MODULES { | ||
namespace OPENCV { | ||
|
||
SolARCornerRefinementOpencv::SolARCornerRefinementOpencv() :ConfigurableBase(xpcf::toUUID<SolARCornerRefinementOpencv>()) | ||
{ | ||
declareInterface<api::features::ICornerRefinement>(this); | ||
declareProperty("nbMaxIters", m_nbMaxIters); | ||
declareProperty("minAccuracy", m_minAccuracy); | ||
declareProperty("winSize", m_winSize); | ||
LOG_DEBUG(" SolARFiducialMarkerPoseEstimatorOpencv constructor") | ||
} | ||
|
||
xpcf::XPCFErrorCode SolARCornerRefinementOpencv::onConfigured() | ||
{ | ||
m_termcrit = cv::TermCriteria(cv::TermCriteria::COUNT | cv::TermCriteria::EPS, m_nbMaxIters, m_minAccuracy); | ||
m_subPixWinSize = cv::Size(m_winSize, m_winSize); | ||
LOG_DEBUG(" SolARCornerRefinementOpencv configured"); | ||
return xpcf::XPCFErrorCode::_SUCCESS; | ||
} | ||
|
||
void SolARCornerRefinementOpencv::refine(const SRef<datastructure::Image> image, std::vector<datastructure::Point2Df>& corners) | ||
{ | ||
// transform all SolAR data to openCv data | ||
SRef<Image> convertedImage = image; | ||
if (image->getImageLayout() != Image::ImageLayout::LAYOUT_GREY) { | ||
// input Image not in grey levels : convert it ! | ||
SolARImageConvertorOpencv convertor; | ||
convertedImage = xpcf::utils::make_shared<Image>(Image::ImageLayout::LAYOUT_GREY, Image::PixelOrder::INTERLEAVED, image->getDataType()); | ||
convertor.convert(image, convertedImage); | ||
} | ||
cv::Mat imageOpencv; | ||
SolAROpenCVHelper::mapToOpenCV(convertedImage, imageOpencv); | ||
|
||
std::vector<cv::Point2f> cornersOpencv; | ||
for (const auto &cor : corners) | ||
cornersOpencv.push_back(cv::Point2f(cor.getX(), cor.getY())); | ||
|
||
// refine | ||
cv::cornerSubPix(imageOpencv, cornersOpencv, m_subPixWinSize, cv::Size(-1, -1), m_termcrit); | ||
|
||
// return output | ||
corners.clear(); | ||
for (const auto &cor : cornersOpencv) | ||
corners.push_back(datastructure::Point2Df(cor.x, cor.y)); | ||
} | ||
|
||
} | ||
} | ||
} | ||
|
Oops, something went wrong.