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

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
jim-bcom committed Jul 17, 2023
2 parents 2941f24 + 3bd91bc commit 43df082
Show file tree
Hide file tree
Showing 24 changed files with 41 additions and 960 deletions.
4 changes: 1 addition & 3 deletions JenkinsFile
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ node("master") {
moduleName="SolARPipelineFiducialMarker"
dirName="SolARBuild"
buildDir="SolARPipeline_FiducialMarker"
android=true
}

SolArModulePipeline {
moduleName="SolARSample_FiducialMarker"
dirName="SolARBuild"
buildDir="SolARSample_FiducialMarker_Mono,SolARPipeline_FiducialMarker/tests/SolARPipelineTest_FiducialMarker"
android=false
buildDir="SolARPipeline_FiducialMarker/tests/SolARPipelineTest_FiducialMarker"
packageScripts="bundleSamples"
}
}
27 changes: 6 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@
The SolAR **Fiducial Image Marker sample** shows a SolAR pipeline for augmented reality based on a fiducials markers image. This pipeline loads a reference image marker, then tries to detect it on real-time camera images and to estimate the pose of the camera in relation to the coordinate system of the image marker. If the marker is detected, the pipeline over the current camera image renders a 3D cube from a virtual camera which pose corresponds to the one estimated by the pipeline.


| ![](./SolARSample_FiducialMarker_Mono/standalone.jpg) | ![](./SolARPipeline_FiducialMarker/plugin.jpg) |
| ![](./SolARPipeline_FiducialMarker/tests/SolARPipelineTest_FiducialMarker/standalone.jpg) | ![](./SolARPipeline_FiducialMarker/plugin.jpg) |
|:-:|:-:|
| SolARSample_FiducialMarker_Mono | SolARPipeline_FiducialMarker |
| SolARPipelineTest_FiducialMarker | SolARPipeline_FiducialMarker |


## How to run

* To run it, first print the marker [FiducialMarker.gif](./SolARSample_FiducialMarker_Mono/FiducialMarker.gif)
* To run it, first print the marker [FiducialMarker.gif](./SolARPipeline_FiducialMarker/tests/SolARPipelineTest_FiducialMarker/FiducialMarker.gif)

* If you want to change your fiducial marker, you can edit the [fiducialMarker.yml](./SolARSample_FiducialMarker_Mono/fiducialMarker.yml)
* If you want to change your fiducial marker, you can edit the [fiducialMarker.yml](./SolARPipeline_FiducialMarker/tests/SolARPipelineTest_FiducialMarker/fiducialMarker.yml)

* If you want to change the calibration parameters of the camera, edit the [camera_calibration.json](./SolARSample_FiducialMarker_Mono/camera_calibration.json)
* If you want to change the calibration parameters of the camera, edit the [camera_calibration.json](./SolARPipeline_FiducialMarker/tests/SolARPipelineTest_FiducialMarker/camera_calibration.json)

* To change properties of the components of the fiducial pipeline, edit the [SolARSample_FiducialMarker_Mono_conf.xml](./SolARSample_FiducialMarker_Mono/SolARSample_FiducialMarker_Mono_conf.xml) file.
* To change properties of the components of the fiducial pipeline, edit the [SolARPipelineTest_FiducialMarker_conf.xml](./SolARPipeline_FiducialMarker/tests/SolARPipelineTest_FiducialMarker/SolARPipelineTest_FiducialMarker_conf.xml) file.

If you want to run your Fiducial samples after having built them, do not forget to install the required dependencies if not already done:

Expand All @@ -30,21 +30,6 @@ and for debug mode:

For more information about how to install remaken on your machine, visit the [install page](https://solarframework.github.io/install/) on the SolAR website.

### SolARSample_FiducialMarker_Mono

* Open a terminal and execute from the `bin/Debug` or `bin/Release` folder:

> #### Windows
>
SolARSample_FiducialMarker_Mono.exe

> #### Linux
>
./run.sh ./SolARSample_FiducialMarker_Mono

* Target your fiducial marker with your camera
* Press `escape` to quit the application

### SolARPipeline_FiducialMarker

* Open a terminal and execute from the `bin/Debug` or `bin/Release` folder:
Expand Down
17 changes: 2 additions & 15 deletions SolARPipeline_FiducialMarker/SolARPipeline_FiducialMarker.pro
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ QMAKE_PROJECT_DEPTH = 0
INSTALLSUBDIR = SolARBuild
TARGET = SolARPipelineFiducialMarker
FRAMEWORK = $$TARGET
VERSION=0.11.0
VERSION=1.0.0

DEFINES += MYVERSION=$${VERSION}
DEFINES += TEMPLATE_LIBRARY
Expand Down Expand Up @@ -51,30 +51,17 @@ unix {
QMAKE_POST_LINK += "make install"
}

unix:!android {
unix {
QMAKE_CXXFLAGS += -Wignored-qualifiers
}

macx {
DEFINES += _MACOS_TARGET_
QMAKE_MAC_SDK= macosx
QMAKE_CFLAGS += -mmacosx-version-min=10.7 -std=c11 #-x objective-c++
QMAKE_CXXFLAGS += -mmacosx-version-min=10.7 -std=c11 -std=c++11 -O3 -fPIC#-x objective-c++
QMAKE_LFLAGS += -mmacosx-version-min=10.7 -v -lstdc++
LIBS += -lstdc++ -lc -lpthread
}

win32 {

DEFINES += WIN64 UNICODE _UNICODE
QMAKE_COMPILER_DEFINES += _WIN64
QMAKE_CXXFLAGS += -wd4250 -wd4251 -wd4244 -wd4275
}

android {
ANDROID_ABIS="arm64-v8a"
}

header_files.path = $${PROJECTDEPLOYDIR}/interfaces
header_files.files = $$files($${PWD}/interfaces/*.h*)

Expand Down
2 changes: 1 addition & 1 deletion SolARPipeline_FiducialMarker/packagedependencies.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
SolARFramework|0.11.0|SolARFramework|SolARBuild@github|https://github.com/SolarFramework/SolarFramework/releases/download
SolARFramework|1.0.0|SolARFramework|SolARBuild@github|https://github.com/SolarFramework/SolarFramework/releases/download
4 changes: 1 addition & 3 deletions SolARPipeline_FiducialMarker/src/PipelineFiducialMarker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ namespace SolAR {
m_img2worldMapper->bindTo<xpcf::IConfigurable>()->getProperty("worldWidth")->setFloatingValue(fiducialMarker->getSize().width);
m_img2worldMapper->bindTo<xpcf::IConfigurable>()->getProperty("worldHeight")->setFloatingValue(fiducialMarker->getSize().height);

m_PnP->setCameraParameters(m_camera->getIntrinsicsParameters(), m_camera->getDistortionParameters());

for(int i=0;i<4;i++)
for(int j=0;j<4;j++)
m_pose(i,j)=0.f;
Expand Down Expand Up @@ -184,7 +182,7 @@ namespace SolAR {
m_cornerRefinement->refine(greyImage, img2DPoints);

// Compute the pose of the camera using a Perspective n Points algorithm using only the 4 corners of the marker
if (m_PnP->estimate(img2DPoints, pattern3DPoints, m_pose) == FrameworkReturnCode::_SUCCESS)
if (m_PnP->estimate(img2DPoints, pattern3DPoints, m_camera->getParameters(), m_pose) == FrameworkReturnCode::_SUCCESS)
{
poseComputed = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
QT -= core gui
CONFIG -= qt

QMAKE_PROJECT_DEPTH = 0

## global defintions : target lib name, version
TARGET = SolARPipelineTest_FiducialMarker
VERSION=0.11.0
VERSION=1.0.0
PROJECTDEPLOYDIR = $${PWD}/../../../deploy

DEFINES += MYVERSION=$${VERSION}
Expand Down Expand Up @@ -43,15 +45,6 @@ unix {
QMAKE_POST_LINK += "make install install_deps"
}

macx {
DEFINES += _MACOS_TARGET_
QMAKE_MAC_SDK= macosx
QMAKE_CFLAGS += -mmacosx-version-min=10.7 -std=c11 #-x objective-c++
QMAKE_CXXFLAGS += -mmacosx-version-min=10.7 -std=c11 -std=c++11 -O3 -fPIC#-x objective-c++
QMAKE_LFLAGS += -mmacosx-version-min=10.7 -v -lstdc++
LIBS += -lstdc++ -lc -lpthread
}

win32 {

DEFINES += WIN64 UNICODE _UNICODE
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0"?>
<xpcf-registry autoAlias="true" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<module uuid="63b4282f-94cf-44d0-8ec0-9e8b0639fff6" name="SolARPipelineFiducialMarker" path="$XPCF_MODULE_ROOT/SolARBuild/SolARPipelineFiducialMarker/0.11.0/lib/x86_64/shared" description="The module embedding a pipeline to estimate the pose based on a squared fiducial marker">
<module uuid="63b4282f-94cf-44d0-8ec0-9e8b0639fff6" name="SolARPipelineFiducialMarker" path="$XPCF_MODULE_ROOT/SolARBuild/SolARPipelineFiducialMarker/1.0.0/lib/x86_64/shared" description="The module embedding a pipeline to estimate the pose based on a squared fiducial marker">
<component uuid="3898cc3b-3986-4edc-b7c8-f4fba0f6c22a" name="PipelineFiducialMarker" description="A pipeline to estimate the pose based on a squared fiducial marker">
<interface uuid="125f2007-1bf9-421d-9367-fbdc1210d006" name="IComponentIntrospect" description="IComponentIntrospect" />
<interface uuid="b5a6225e-6a91-4050-b298-886f4c17d9d2" name="IPoseEstimationPipeline" description="The interface to define a video see-throuh pipeline" />
</component>
</module>
<module uuid="15e1990b-86b2-445c-8194-0cbe80ede970" name="SolARModuleOpenCV" path="$XPCF_MODULE_ROOT/SolARBuild/SolARModuleOpenCV/0.11.0/lib/x86_64/shared" description="OpenCV">
<module uuid="15e1990b-86b2-445c-8194-0cbe80ede970" name="SolARModuleOpenCV" path="$XPCF_MODULE_ROOT/SolARBuild/SolARModuleOpenCV/1.0.0/lib/x86_64/shared" description="OpenCV">
<component uuid="5B7396F4-A804-4F3C-A0EB-FB1D56042BB4" name="SolARCameraOpencv" description="SolARCameraOpencv">
<interface uuid="125f2007-1bf9-421d-9367-fbdc1210d006" name="IComponentIntrospect" description="IComponentIntrospect" />
<interface uuid="5DDC7DF0-8377-437F-9C81-3643F7676A5B" name="ICamera" description="ICamera" />
Expand Down Expand Up @@ -72,7 +72,7 @@
<interface uuid="b485f37d-a8ea-49f6-b361-f2b30777d9ba" name="IProject" description="IProject"/>
</component>
</module>
<module uuid="28b89d39-41bd-451d-b19e-d25a3d7c5797" name="SolARModuleTools" path="$XPCF_MODULE_ROOT/SolARBuild/SolARModuleTools/0.11.0/lib/x86_64/shared" description="Module Tools">
<module uuid="28b89d39-41bd-451d-b19e-d25a3d7c5797" name="SolARModuleTools" path="$XPCF_MODULE_ROOT/SolARBuild/SolARModuleTools/1.0.0/lib/x86_64/shared" description="Module Tools">
<component uuid="a2ef5542-029e-4fce-9974-0aea14b29d6f" name="SolARSBPatternReIndexer" description="SolARSBPatternReIndexer">
<interface uuid="125f2007-1bf9-421d-9367-fbdc1210d006" name="IComponentIntrospect" description="IComponentIntrospect" />
<interface uuid="79c5b810-d557-11e7-9296-cec278b6b50a" name="ISBPatternReIndexer" description="ISBPatternReIndexer" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ int main(){
auto imageViewerResult = componentMgr->resolve<display::IImageViewer>();
auto overlay3DComponent = componentMgr->resolve<display::I3DOverlay>();

// Set camera parameters
// get camera parameters
CameraParameters camParam = pipeline->getCameraParameters();
overlay3DComponent->setCameraParameters(camParam.intrinsic, camParam.distortion);

unsigned char* r_imageData=new unsigned char[camParam.resolution.width * camParam.resolution.height * 3];
SRef<Image> camImage = xpcf::utils::make_shared<Image>(r_imageData, camParam.resolution.width, camParam.resolution.height, Image::LAYOUT_BGR, Image::INTERLEAVED, Image::TYPE_8U);
Expand Down Expand Up @@ -77,7 +76,7 @@ int main(){
for(int j=0;j<3;j++)
s_pose(3,j)=0;
s_pose(3,3)=1;
overlay3DComponent->draw(s_pose, camImage);
overlay3DComponent->draw(s_pose, camParam, camImage);
}

if (imageViewerResult->display(camImage) == SolAR::FrameworkReturnCode::_STOP){
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
SolARFramework|0.11.0|SolARFramework|SolARBuild@github|https://github.com/SolarFramework/SolarFramework/releases/download
SolARFramework|1.0.0|SolARFramework|SolARBuild@github|https://github.com/SolarFramework/SolarFramework/releases/download
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<xpcf-registry>
<module uuid="63b4282f-94cf-44d0-8ec0-9e8b0639fff6" name="PipelineFiducialMarker" path="$XPCF_MODULE_ROOT/SolARBuild/PipelineFiducialMarker/0.9.3/lib/x86_64/shared" description="The module embedding a pipeline to estimate the pose based on a squared fiducial marker">
<module uuid="63b4282f-94cf-44d0-8ec0-9e8b0639fff6" name="SolARPipelineFiducialMarker" path="$XPCF_MODULE_ROOT/SolARBuild/SolARPipelineFiducialMarker/1.0.0/lib/x86_64/shared" description="The module embedding a pipeline to estimate the pose based on a squared fiducial marker">
<component uuid="3898cc3b-3986-4edc-b7c8-f4fba0f6c22a" name="PipelineFiducialMarker" description="A pipeline to estimate the pose based on a squared fiducial marker">
<interface uuid="125f2007-1bf9-421d-9367-fbdc1210d006" name="IComponentIntrospect" description="IComponentIntrospect" />
<interface uuid="b5a6225e-6a91-4050-b298-886f4c17d9d2" name="IPoseEstimationPipeline" description="The interface to define a video see-throuh pipeline" />
<interface uuid="b5a6225e-6a91-4050-b298-886f4c17d9d2" name="IPoseEstimationPipeline" description="The interface to define a video see-through pipeline" />
</component>
</module>
</xpcf-registry>
Binary file removed SolARSample_FiducialMarker_Mono/FiducialMarker.gif
Binary file not shown.
Loading

0 comments on commit 43df082

Please sign in to comment.