Skip to content

Commit

Permalink
Merge branch 'apib11'
Browse files Browse the repository at this point in the history
  • Loading branch information
meynardc committed Jan 26, 2023
2 parents 2c65c2b + 1ec939f commit 22d9714
Show file tree
Hide file tree
Showing 22 changed files with 531 additions and 108 deletions.
48 changes: 48 additions & 0 deletions MMVII/MMVII-TestDir/Input/Saisies-MMV1/Ground-Pts3D.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" ?>
<DicoAppuisFlottant>
<OneAppuisDAF>
<Pt>0.182895665614618341 -3.78002060469805157 2.56022810571964277</Pt>
<NamePt>Stone-1</NamePt>
<Incertitude>1 1 1</Incertitude>
</OneAppuisDAF>
<OneAppuisDAF>
<Pt>0.234792215591026754 -5.36333800580974884 2.42659720440635063</Pt>
<NamePt>Stone-2</NamePt>
<Incertitude>1 1 1</Incertitude>
</OneAppuisDAF>
<OneAppuisDAF>
<Pt>0.194213046998492761 -4.82293063921051068 1.75377255914109642</Pt>
<NamePt>Stone-3</NamePt>
<Incertitude>1 1 1</Incertitude>
</OneAppuisDAF>
<OneAppuisDAF>
<Pt>0.754045221758523621 0.496427193197002514 0.431416432371162006</Pt>
<NamePt>I-of-I</NamePt>
<Incertitude>1 1 1</Incertitude>
</OneAppuisDAF>
<OneAppuisDAF>
<Pt>0.898750585424819226 1.10409507249266081 0.444680581722013746</Pt>
<NamePt>Acute</NamePt>
<Incertitude>1 1 1</Incertitude>
</OneAppuisDAF>
<OneAppuisDAF>
<Pt>1.31771333753878528 0.989188464947304724 0.370627429238321537</Pt>
<NamePt>Finger-1</NamePt>
<Incertitude>1 1 1</Incertitude>
</OneAppuisDAF>
<OneAppuisDAF>
<Pt>0.150697933447584281 1.10818337179321613 0.773464897817899177</Pt>
<NamePt>Stone-6</NamePt>
<Incertitude>1 1 1</Incertitude>
</OneAppuisDAF>
<OneAppuisDAF>
<Pt>0.256396378205514475 2.35318759021626445 2.23887785258234207</Pt>
<NamePt>Stone-7</NamePt>
<Incertitude>1 1 1</Incertitude>
</OneAppuisDAF>
<OneAppuisDAF>
<Pt>1.40207519252831658 2.1945458898399548 0.40382985984277503</Pt>
<NamePt>Grille</NamePt>
<Incertitude>1 1 1</Incertitude>
</OneAppuisDAF>
</DicoAppuisFlottant>
91 changes: 91 additions & 0 deletions MMVII/MMVII-TestDir/Input/Saisies-MMV1/GroundMeasure.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?xml version="1.0" ?>
<SetOfMesureAppuisFlottants>
<MesureAppuiFlottant1Im>
<NameIm>IMGP4170.JPG</NameIm>
<OneMesureAF1I>
<NamePt>I-of-I</NamePt>
<PtIm>452.278142467572422 808.192805895297056</PtIm>
</OneMesureAF1I>
<OneMesureAF1I>
<NamePt>u-of-You</NamePt>
<PtIm>521.272784862528056 1015.52756464228401</PtIm>
</OneMesureAF1I>
<OneMesureAF1I>
<NamePt>Acute</NamePt>
<PtIm>458.441997415626133 1100.83130652515365</PtIm>
</OneMesureAF1I>
<OneMesureAF1I>
<NamePt>Finger-1</NamePt>
<PtIm>344.785721369910448 1112.92280566175327</PtIm>
</OneMesureAF1I>
</MesureAppuiFlottant1Im>
<MesureAppuiFlottant1Im>
<NameIm>IMGP4168.JPG</NameIm>
<OneMesureAF1I>
<NamePt>I-of-I</NamePt>
<PtIm>430.52658272147653 227.090326619720145</PtIm>
</OneMesureAF1I>
<OneMesureAF1I>
<NamePt>u-of-You</NamePt>
<PtIm>495.717626755149013 454.825546116027397</PtIm>
</OneMesureAF1I>
<OneMesureAF1I>
<NamePt>Acute</NamePt>
<PtIm>431.735281413390453 510.222991095907105</PtIm>
</OneMesureAF1I>
<OneMesureAF1I>
<NamePt>Finger-1</NamePt>
<PtIm>316.373353330086218 471.678176822389275</PtIm>
</OneMesureAF1I>
<OneMesureAF1I>
<NamePt>Stone-6</NamePt>
<PtIm>667.402028214032839 479.731591690534685</PtIm>
</OneMesureAF1I>
<OneMesureAF1I>
<NamePt>Stone-7</NamePt>
<PtIm>1284.05120739189965 981.021140912616147</PtIm>
</OneMesureAF1I>
<OneMesureAF1I>
<NamePt>Grille</NamePt>
<PtIm>362.602015084684353 1078.96450589692108</PtIm>
</OneMesureAF1I>
</MesureAppuiFlottant1Im>
<MesureAppuiFlottant1Im>
<NameIm>IMGP4169.JPG</NameIm>
<OneMesureAF1I>
<NamePt>I-of-I</NamePt>
<PtIm>475.161154787777321 516.404520623212079</PtIm>
</OneMesureAF1I>
<OneMesureAF1I>
<NamePt>u-of-You</NamePt>
<PtIm>538.999416573275425 732.995393503311675</PtIm>
</OneMesureAF1I>
<OneMesureAF1I>
<NamePt>Acute</NamePt>
<PtIm>475.850364860953221 802.548038024082189</PtIm>
</OneMesureAF1I>
<OneMesureAF1I>
<NamePt>Finger-1</NamePt>
<PtIm>362.721106696891582 789.307120972098687</PtIm>
</OneMesureAF1I>
<OneMesureAF1I>
<NamePt>Stone-6</NamePt>
<PtIm>706.139274179003905 741.525951210447488</PtIm>
</OneMesureAF1I>
</MesureAppuiFlottant1Im>
<MesureAppuiFlottant1Im>
<NameIm>IMGP4167.JPG</NameIm>
<OneMesureAF1I>
<NamePt>Stone-6</NamePt>
<PtIm>644.286307996218966 232.6833164507199</PtIm>
</OneMesureAF1I>
<OneMesureAF1I>
<NamePt>Stone-7</NamePt>
<PtIm>1265.36807144116688 735.26882940476105</PtIm>
</OneMesureAF1I>
<OneMesureAF1I>
<NamePt>Grille</NamePt>
<PtIm>322.076097286495724 766.811866179541425</PtIm>
</OneMesureAF1I>
</MesureAppuiFlottant1Im>
</SetOfMesureAppuisFlottants>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@
<DegreeApproxInv>3 1 1</DegreeApproxInv>
</Auxiliary>
<PerfectProj>
<F>2113.26900143641</F>
<PP>857.203461218707 577.076198246255</PP>
<F>2113.29189076302</F>
<PP>857.206754888925 577.075355949847</PP>
</PerfectProj>
<Distorsion>
<Radial>
<K1>-0.0992818343588939</K1> <!--(X,Y) * (X^2+Y^2)-->
<K2>0.105926341210555</K2> <!--(X,Y) * (X^2+Y^2)^2-->
<K3>0.0365920357111148</K3> <!--(X,Y) * (X^2+Y^2)^3-->
<K1>-0.0992778414574082</K1> <!--(X,Y) * (X^2+Y^2)-->
<K2>0.105924077620665</K2> <!--(X,Y) * (X^2+Y^2)^2-->
<K3>0.0366404677720908</K3> <!--(X,Y) * (X^2+Y^2)^3-->
</Radial>
<Decentric>
<p1>6.32129028493475e-05</p1> <!--(3X2+Y2,2XY)-->
<p2>-7.41880900367172e-05</p2> <!--(2XY,X2+3Y2)-->
<p1>6.3479994323078e-05</p1> <!--(3X2+Y2,2XY)-->
<p2>-7.41705215866132e-05</p2> <!--(2XY,X2+3Y2)-->
</Decentric>
<Polynomial>
<b1>-1.24734259119908e-08</b1> <!--(X,0)-->
<b2>4.79395702261653e-07</b2> <!--(Y,0)-->
<b1>-1.62457752333968e-08</b1> <!--(X,0)-->
<b2>4.80179377691907e-07</b2> <!--(Y,0)-->
</Polynomial>
</Distorsion>
<Informations>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="ISO8859-1" standalone="yes" ?>
<MMVII_Serialization>
<NameImage>"IMGP4167.JPG"</NameImage>
<NameInternalCalib>"Calib-PerspCentral-Foc-28000_Cam-PENTAX_K5"</NameInternalCalib>
<Center>5.20644436052294 1.49611001038881 2.11724479232937</Center>
<RotMatrix>
<AxeI>-0.162074830392862 0.0384131738848583 0.986030515463501</AxeI>
<AxeJ>0.0965180346057596 0.995067755113336 -0.0229004744393625</AxeJ>
<AxeK>-0.982046851402196 0.0914581369031654 -0.164983001685735</AxeK>
</RotMatrix>
<EQ>0.645757292454901 -0.0442730622939557 -0.761926109801983 -0.022494852710068</EQ> <!--EigenQuaternion, for information-->
<WPK>-150.998255793775 -79.1267383625106 -149.225556118573</WPK> <!--Omega Phi Kapa in degree, for information-->
<YPR>166.666421173337 -80.4118527918605 -172.097549838315</YPR> <!--Yaw Pitch Roll in degree, for information-->
</MMVII_Serialization>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="ISO8859-1" standalone="yes" ?>
<MMVII_Serialization>
<NameImage>"IMGP4169.JPG"</NameImage>
<NameInternalCalib>"Calib-PerspCentral-Foc-28000_Cam-PENTAX_K5"</NameInternalCalib>
<Center>5.15627029486289 0.215205620108451 2.08689313795566</Center>
<RotMatrix>
<AxeI>-0.176953806326696 0.0409905785444553 0.983365203216529</AxeI>
<AxeJ>0.102280177137307 0.994488561576619 -0.0230492138266792</AxeJ>
<AxeK>-0.978890247061056 0.0965001210561815 -0.180171059953831</AxeK>
</RotMatrix>
<EQ>0.63979756472186 -0.0467137347321854 -0.766748561762124 -0.0239488245862174</EQ> <!--EigenQuaternion, for information-->
<WPK>-151.826374151718 -78.2064061610764 -149.971874858426</WPK> <!--Omega Phi Kapa in degree, for information-->
<YPR>166.957716505788 -79.5347343248668 -172.709771641196</YPR> <!--Yaw Pitch Roll in degree, for information-->
</MMVII_Serialization>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="ISO8859-1" standalone="yes" ?>
<MMVII_Serialization>
<NameImage>"IMGP4170.JPG"</NameImage>
<NameInternalCalib>"Calib-PerspCentral-Foc-28000_Cam-PENTAX_K5"</NameInternalCalib>
<Center>5.05921122405539 -0.271167237239889 2.10496651279359</Center>
<RotMatrix>
<AxeI>-0.166220702212525 0.066458650739172 0.983846495088489</AxeI>
<AxeJ>0.0817737345468281 0.995218720586036 -0.0534111835981814</AxeJ>
<AxeK>-0.982692085291339 0.0715747576805015 -0.170860526654747</AxeK>
</RotMatrix>
<EQ>0.643843438212809 -0.0485311854795092 -0.763593469958542 -0.00594674221196073</EQ> <!--EigenQuaternion, for information-->
<WPK>-157.270824042625 -79.3244958204942 -153.804715242581</WPK> <!--Omega Phi Kapa in degree, for information-->
<YPR>158.207395729614 -79.6876565611983 -162.640699790022</YPR> <!--Yaw Pitch Roll in degree, for information-->
</MMVII_Serialization>
5 changes: 5 additions & 0 deletions MMVII/apib11/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@ Tmp-MM-Dir
*.jpg
*.TIF
*.tif
/dist/
/build/
MMVII.egg-info/
Tmmmp-MM-Dir/
__pycache__
39 changes: 39 additions & 0 deletions MMVII/apib11/MMVII.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import os
import sys
from pathlib import Path

mmv2_src_relative_path = '../'
mmv2_install_relative_path = '../../../MMVII/MMVII'

mm_data_path = None

# test if run from MMVII sources
test_path = os.path.normpath(os.path.dirname(__file__) + '/' + mmv2_src_relative_path)
if os.path.isfile(test_path + '/bin/MMVII'):
print("Using local MMVII")
mm_data_path = os.path.normpath(os.path.dirname(__file__) + '/' + mmv2_src_relative_path)
#search for .so file
so_path = None
for path in Path('build').rglob('_MMVII.*.so'):
if so_path is None:
so_path = path.parent
else :
print('Warning: multiple _MMVII.*.so files found in build directory')
if so_path is not None:
print("Using _MMVII.*.so file from directory ",so_path)
sys.path = [ str(so_path) ] + sys.path
else:
# test if installed
for p in sys.path:
test_path = os.path.normpath(os.path.dirname(__file__) + '/' + mmv2_install_relative_path)
if os.path.isfile(test_path + '/bin/MMVII'):
mm_data_path = os.path.normpath(os.path.dirname(__file__) + '/' + mmv2_install_relative_path)
break

if mm_data_path is not None:
print('MMVII path:', mm_data_path)
from _MMVII import *
themodule = MM_Module(mm_data_path)
else:
print('Error: impossible to find MMVII binary. Error at installation?')

48 changes: 18 additions & 30 deletions MMVII/apib11/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ MMV1_LIBDIR=${MMV1_DIR}/lib
MMV2_DIR=${MMV1_DIR}/MMVII
MMV2_BINDIR=${MMV2_DIR}/bin
MMV2_INCDIR=${MMV2_DIR}/include
MODULE=MMVII$(shell python3-config --extension-suffix)
MODULE_NAME = MMVII

DOC_INCLUDES=../include/MMVII_PCSens.h ../include/MMVII_memory.h ../include/MMVII_AimeTieP.h ../include/MMVII_Geom3D.h ../include/MMVII_Mappings.h



# =========== Includes & Libraries
MMV1_INCLUDES=-I ${MMV1_DIR}/include -I${MMV1_DIR}
MMV2_INCLUDES=-I ${MMV2_DIR} -I ${MMV2_INCDIR} -I ${MMV2_DIR}/ExternalInclude
Expand All @@ -25,49 +24,38 @@ EXT_LIBS=-lpthread -lX11 -lstdc++fs
# =========== Compiler & Flags
CXX=g++
LD=g++
CXXFLAGS=-fopenmp -std=c++17 -Wall -Werror -O3 -fPIC ${MMV2_INCLUDES} ${MMV1_INCLUDES} ${PYBIND_INCLUDES} '-DPYBIND_MMVII_DIR="$(abspath ${MMV2_DIR})"'
LDFLAGS=-fopenmp -shared
CXXFLAGS=-fopenmp -std=c++17 -Wall -Werror -O3 -fPIC ${MMV2_INCLUDES} ${MMV1_INCLUDES} ${PYBIND_INCLUDES}

PYTHON = python3
PIP = pip3

# =========== Use ccache if found
CCACHE:=${shell which ccache}
ifneq (,${CCACHE})
override CXX:=${CCACHE} ${CXX}
endif

SRCS:=${wildcard *.cpp}

# ============ Targets
.phony: all clean
all: ${MODULE}
.phony: all module clean install uninstall
all: module

clean:
rm -f ${OBJS} ${DEPS} ${MODULE} docstrings.h
clean: uninstall
rm -f docstrings.h
rm -Rf build/ dist/ $(MODULE_NAME).egg-info/ __pycache__/
$(PYTHON) setup.py clean

docstrings.h: ${DOC_INCLUDES} Makefile
pybind11-mkdoc -o $@ ${DOC_INCLUDES} ${CXXFLAGS} >/dev/null

# =========== Build Objs

SRCS:=${wildcard *.cpp}
OBJS:=${SRCS:.cpp=.o}

module: docstrings.h ${SRCS}
CC="${CXX}" $(PYTHON) setup.py build
CC="${CXX}" $(PYTHON) setup.py bdist_wheel

%.o: %.cpp Makefile docstrings.h
${CXX} -c ${CXXFLAGS} $(python3 -m pybind11 --includes) $< -o $@
install: module
$(PIP) install --user dist/*.whl

uninstall:
$(PIP) uninstall -y $(MODULE_NAME)

# ========== Build Module
${MODULE}: ${OBJS} ${MMV2_LIB} ${MMV1_LIBS}
${CXX} ${LDFLAGS} $^ ${EXT_LIBS} -o ${MODULE}


# =========== Auto dependancies
DEPS=${join ${addsuffix ., ${dir ${OBJS}}}, ${notdir ${OBJS:.o=.d}}}

.%.d: %.cpp
@set -e; rm -f $@; \
${CXX} -MM -MP -MT '${patsubst %.cpp,%.o,$<} $@' -MF $@ ${CXXFLAGS} $< 2>/dev/null

ifneq (${MAKECMDGOALS},clean)
-include ${DEPS}
endif
40 changes: 39 additions & 1 deletion MMVII/apib11/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,40 @@
pip3 install pybind11_mkdoc
MicMac v2 Python3 API
=====================

Compilation
-----------

First, compile MMv1 and MMv2.

Then, in 'apib11' directory:

make

The module can be used from this directory without installation (this local version has priority to installed modules).

Installation
------------

make install

Distribution
------------

The file dist/MMVII-*.whl, created at compilation, can be distributed to machines with same OS, arch and python version.

It can be installed with:

pip3 install MMVII-*.whl

Upgrade pip if needed:

python3 -m pip install --upgrade pip

Usage
-----

```python
import MMVII
```

See 'examples' directory for use cases.
Loading

0 comments on commit 22d9714

Please sign in to comment.