...
 
Commits (22)
......@@ -7,6 +7,11 @@ build:
environment:
matrix:
- builder: cmake
PYTHON: "C:\\Python36-x64"
PYTHON_VERSION: "3.6.3"
PYTHON_ARCH: "64"
PIP: "C:\\Python36-x64\\Scripts\\pip"
- builder: scons
init:
......@@ -14,11 +19,13 @@ init:
install:
- SET "PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
- python --version
- python -m ensurepip
- pip install -U setuptools
- pip install -U wheel
- pip install scons==2.4.1
- if "%builder%" == "scons" (
python --version &
python -m ensurepip &
pip install -U setuptools &
pip install -U wheel &
pip install scons==2.4.1
)
- cinst nsis.portable
- hg clone https://bitbucket.org/eigen/eigen external\eigen3
- cd external\eigen3
......@@ -53,7 +60,17 @@ build_script:
- cd ceres-solver
- mkdir build-ceres
- cd build-ceres
- cmake .. -DBUILD_SHARED_LIBS=ON -DMINIGLOG=ON -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF -DCMAKE_INSTALL_PREFIX="..\..\build" -DEIGEN_INCLUDE_DIR="..\..\build\include" -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles"
- cmake .. -DBUILD_SHARED_LIBS=OFF -DMINIGLOG=ON -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF -DCMAKE_INSTALL_PREFIX="..\..\build" -DEIGEN_INCLUDE_DIR="..\..\build\include" -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles"
- nmake /NOLOGO install
- cd ..\..\..
# Install NLOPT
- cd external
- git clone git://github.com/stevengj/nlopt
- cd nlopt
- mkdir build
- cd build
- cmake .. -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX="..\..\build" -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles"
- nmake /NOLOGO install
- cd ..\..\..
......@@ -64,7 +81,7 @@ build_script:
) else (
mkdir build &
cd build &
cmake .. -DEIGEN3_INCLUDE_DIR="external/build/include/eigen3" -Wdev -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles" &
cmake .. -DPython_Version="3.6" -DEIGEN3_INCLUDE_DIR="external/build/include/eigen3" -DCeres_DIR="external/build/CMake" -DNLOPT_INCLUDE_DIRS="../external/build/include" -DNLOPT_LIBRARIES="../external/build/lib/nlopt.lib" -Wdev -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles" &
nmake /NOLOGO &
cd ..
)
......@@ -85,7 +102,7 @@ test_script:
- if "%builder%" == "scons" (
scons --cfg=./configs/scons/config-windows-appveyor.py tests
appveoyr PushArtifact build\sources\tests\*.log
) else
) else (
cd build &
nmake test &
appveyor PushArtifact Testing\Temporary\LastTest.log &
......
......@@ -8,6 +8,7 @@ os:
dist: trusty
sudo: required
addons:
apt:
sources:
......@@ -15,8 +16,9 @@ addons:
packages:
- g++-6
- cmake
- libboost-python-dev
- libeigen3-dev
- libpython3-dev
- python3-numpy
before_install:
- OMP_NUM_THREADS=2
......@@ -24,7 +26,7 @@ before_install:
- echo "${builder}"
- if [ ${TRAVIS_OS_NAME} = 'osx' ]; then
brew update;
brew install scons eigen;
brew install scons eigen ceres-solver;
fi
script:
......@@ -45,5 +47,5 @@ after_failure:
- if [ ${builder} = 'scons' ]; then
cat config.log;
else
cat Testing/Temporary/LastTest.log
cat Testing/Temporary/LastTest.log;
fi
This diff is collapsed.
# Disclaimer: this file is a conversion of the pink-felt measure from the MERL BRDF dataset.
# To Produce this file, we sliced the TH_TD_PD space and converted it to cosine of TH.
#
#DIM 1 3
#PARAM_IN COS_TH
#PARAM_OUT RGB_COLOR
0.999984567305837 0.109704419970512 0.0794405192136765 0.0616232864558697
0.999861097177288 0.109415508806705 0.0792556032538414 0.0616487413644791
0.999614111167918 0.109124042093754 0.0790376961231232 0.0615920946002007
0.999243517688362 0.108446210622787 0.0786190629005432 0.061536181718111
0.998749179142153 0.107993446290493 0.0783058851957321 0.0615566410124302
0.99813091166979 0.107792764902115 0.0781893134117126 0.0615998990833759
0.997388484805763 0.107569366693497 0.0780332610011101 0.0618189573287964
0.996521621047047 0.107486009597778 0.077988974750042 0.062018595635891
0.995529995331161 0.107493788003922 0.0780087187886238 0.0623516552150249
0.994413234421494 0.107571087777615 0.0780458599328995 0.0625105500221252
0.993170916197157 0.107659451663494 0.0781032592058182 0.0626430958509445
0.991802568844179 0.107806459069252 0.0782003998756409 0.0627831444144249
0.990307669944373 0.107948608696461 0.0782987624406815 0.062925823032856
0.988685645457706 0.108142271637917 0.078424833714962 0.0630614832043648
0.986935868593456 0.108299888670444 0.0785255208611488 0.0631896629929543
0.985057658564839 0.108415067195892 0.0785920321941376 0.0633277297019958
0.983050279221209 0.108520194888115 0.0786856263875961 0.0633910968899727
0.980912937551177 0.108454704284668 0.0786107331514359 0.0634618699550629
0.978644782049335 0.1083689853549 0.0785431414842606 0.0634230226278305
0.976244900938401 0.108205251395702 0.078412190079689 0.0633028596639633
0.973712320237757 0.107933804392815 0.0781796500086784 0.0631253346800804
0.971046001668351 0.107692837715149 0.0779741704463959 0.0628371685743332
0.968244840382904 0.107408702373505 0.0777251049876213 0.0625270456075668
0.965307662509144 0.107408702373505 0.0777251049876213 0.0625270456075668
0.962233222492524 0.107108823955059 0.0774955525994301 0.0621995367109776
0.959020200223414 0.10679492354393 0.0772524103522301 0.0619155131280422
0.955667197932154 0.106610268354416 0.077095054090023 0.061657328158617
0.952172736833585 0.106401897966862 0.0769142135977745 0.0614464059472084
0.948535253500656 0.106401897966862 0.0769142434000969 0.0614466667175293
0.944753095944478 0.1062166467309 0.076707512140274 0.0612548999488354
0.940824519375705 0.106060341000557 0.0764804258942604 0.0610731467604637
0.936747681619285 0.106060341000557 0.0764804258942604 0.0610731467604637
0.932520638151464 0.105896301567554 0.0762098208069801 0.0608868412673473
0.928141336724342 0.105708219110966 0.075896829366684 0.0607132688164711
0.923607611539236 0.1054712459445 0.0755570530891418 0.0606150478124619
0.918917176925486 0.1054712459445 0.0755570530891418 0.0606150478124619
0.914067620476147 0.105101473629475 0.0751175209879875 0.0605466179549694
0.909056395586036 0.104629173874855 0.0745838358998299 0.0605513714253902
0.903880813330802 0.104628868401051 0.0745833739638329 0.0605509132146835
0.89853803361792 0.104155287146568 0.0740085691213608 0.0606381744146347
0.89302505553153 0.103705681860447 0.0734329298138618 0.0607827231287956
0.887338706782791 0.103705681860447 0.0734329298138618 0.0607827231287956
0.881475632165488 0.10331816971302 0.0728530660271645 0.060992918908596
0.875432280902907 0.102992787957191 0.0722881555557251 0.0612727217376232
0.869204892755968 0.102992787957191 0.0722881555557251 0.0612727217376232
0.862789482744017 0.102628909051418 0.0716850012540817 0.0615627020597458
0.856181824307894 0.102628909051418 0.0716850012540817 0.0615627020597458
0.849377430719363 0.102243520319462 0.0710649415850639 0.0618781223893166
0.842371534510982 0.101740226149559 0.070366658270359 0.0621939711272717
0.835159064664976 0.101740226149559 0.070366658270359 0.0621939711272717
0.827734621257619 0.101174660027027 0.0696728006005287 0.0625340417027473
0.820092447205582 0.100599631667137 0.0690023079514503 0.0629002749919891
0.812226396700769 0.100599631667137 0.0690023079514503 0.0629002749919891
0.804129899848351 0.100011952221394 0.0683584213256836 0.0632530152797699
0.79579592293593 0.100011952221394 0.0683584213256836 0.0632530152797699
0.787216923656694 0.0995896235108376 0.0678756311535835 0.0636662170290947
0.778384800481289 0.0992531552910805 0.0674958154559135 0.0640639513731003
0.769290835216313 0.0992531552910805 0.0674958154559135 0.0640639513731003
0.759925627593949 0.099026083946228 0.0672563537955284 0.0644847080111504
0.750279020497729 0.0988328531384468 0.0671161785721779 0.0648694112896919
0.740340014130489 0.0988328531384468 0.0671161785721779 0.0648694112896919
0.730096667055235 0.0985650420188904 0.067029133439064 0.0651645883917809
0.719535981564731 0.0985650420188904 0.067029133439064 0.0651645883917809
0.708643770230294 0.0981200486421585 0.0669183656573296 0.0653361678123474
0.69740449970216 0.0974221527576447 0.0667625740170479 0.065307505428791
0.685801106824832 0.0974227264523506 0.0667630434036255 0.0653079375624657
0.673814780810154 0.0965105295181274 0.0666090399026871 0.0652086287736893
0.66142470346445 0.0952053666114807 0.0663411989808083 0.0647694990038872
0.648607737131283 0.0952047556638718 0.066340483725071 0.064768984913826
0.635338046852871 0.0938224047422409 0.0660865381360054 0.0641979947686195
0.621586638924781 0.0925047174096107 0.0659021884202957 0.0636529102921486
0.607320792003303 0.0925049632787704 0.0659018903970718 0.0636526644229889
0.592503348436074 0.0912191867828369 0.0658230483531952 0.0632288604974747
0.577091821303274 0.0900915861129761 0.0657936930656433 0.0629569590091705
0.561037254842339 0.0900915861129761 0.0657936930656433 0.0629569590091705
0.544282749336827 0.0892401412129402 0.0658680275082588 0.0629101619124413
0.5267615209267 0.088495209813118 0.0659526735544205 0.0631125494837761
0.508394303106451 0.0878711715340614 0.0660510286688805 0.0635273680090904
0.489085793835709 0.0878711715340614 0.0660510286688805 0.0635273680090904
0.468719680439648 0.0873925387859344 0.0661816969513893 0.0642244815826416
0.447151476269188 0.0870987623929977 0.0664219781756401 0.0651686266064644
0.424197861176491 0.0871348083019257 0.0668950229883194 0.0664106011390686
0.399620178322411 0.0876283869147301 0.0677251517772675 0.0680295079946518
0.37309761084318 0.0882583409547806 0.0686252191662788 0.0696880668401718
0.344180833734348 0.0893751606345177 0.069906085729599 0.0715314447879791
0.312205291758454 0.0914837941527367 0.0720990896224976 0.0740385502576828
0.276110341879149 0.0947476997971535 0.0753239318728447 0.077694408595562
0.23399738541699 0.100093893706799 0.0803408399224281 0.0829573348164558
0.18172977375786 0.124510735273361 0.100782215595245 0.10350850969553
0.105117666245532 0.14767487347126 0.120244853198528 0.125162586569786
......@@ -287,6 +287,7 @@ bool nonlinear_fitter_nlopt::fit_data(const ptr<data>& d, ptr<function>& fit, co
// Launch minimization
double f_end;
std::cout << p << std::endl;
res = nlopt_optimize(opt, &p[0], &f_end);
if(res > 0)
......
......@@ -287,7 +287,7 @@ static void brdf2data(const ptr<function>& f, ptr<data>& d) {
x[d->parametrization().dimX() + j] = y[j];
}
d->set(i, y);
d->set(i, x);
}
}
......@@ -399,4 +399,4 @@ PYBIND11_MODULE(alta, m) {
m.def("data2data", data2data);
m.def("data2stats", data2stats);
m.def("brdf2data", brdf2data);
}
\ No newline at end of file
}
......@@ -37,6 +37,12 @@ static vec vec_sub(const vec& a, const vec& b) {
return a - b;
}
/* Size of vec
*/
static size_t vec_size(const vec& a) {
return a.size();
}
/* Specific convert a vec to a string
*/
static std::string vec_str(const vec& x) {
......@@ -63,7 +69,7 @@ inline void register_vec(py::module& m) {
}))
.def("__add__", &vec_add)
.def("__sub__", &vec_sub)
// .def("__len__", &vec::size)
.def("__len__", &vec_size)
.def("__getitem__", [](const vec &s, unsigned int i) {
if (i >= s.size()) throw py::index_error();
return s[i];
......
......@@ -55,7 +55,10 @@ Section "ALTA" SecMain
File /nonfatal /r "${ALTADIR}\external\build\bin\*.dll"
SetOutPath $INSTDIR\lib
File /nonfatal /r "${ALTADIR}\build\core\core.lib"
File /nonfatal /r "${ALTADIR}\build\lib\core.lib"
SetOutPath $INSTDIR\include\alta
File /nonfatal /r "${ALTADIR}\sources\core\*.h"
SetOutPath $INSTDIR\plugins
File /nonfatal /r "${ALTADIR}\build\plugins\nonlinear*.dll"
......@@ -64,7 +67,7 @@ Section "ALTA" SecMain
; Python package
SetOutPath $INSTDIR\python
File /nonfatal /r "${ALTADIR}\build\python\alta.dll"
File /nonfatal /r "${ALTADIR}\build\python\alta.pyd"
# Update the ENVIROMNENT
WriteRegStr HKCU "Environment" "ALTA_DIR" '$INSTDIR'
......
......@@ -69,7 +69,7 @@ int main(int argc, char** argv)
arguments args(argc, argv) ;
#ifdef __GLIBC__
feenableexcept(FE_DIVBYZERO | FE_OVERFLOW | FE_INVALID);
// feenableexcept(FE_DIVBYZERO | FE_OVERFLOW | FE_INVALID);
#endif
if(args.is_defined("help")) {
......
......@@ -13,8 +13,8 @@ if args['param'] != 'STARK_2D':
fail = True
if fail:
print "Testing python 'arguments' interface failed!"
print("Testing python 'arguments' interface failed!")
exit(1)
else:
print "Testing python 'arguments' interface passed!"
print("Testing python 'arguments' interface passed!")
exit(0)
......@@ -3,22 +3,22 @@ import sys
# Test a nonlinear_function
# Open a function plugin, then save the function and load it again
print 'Loading a nonlinear_function plugin and testing saving/loading'
print('Loading a nonlinear_function plugin and testing saving/loading')
f1 = alta.get_function('nonlinear_function_diffuse',
alta.parameters(3, 3,
alta.input_parametrization.RUSIN_TH_PH_TD,
alta.output_parametrization.RGB_COLOR))
print "f1 = ", f1
print("f1 = ", f1)
f1.save('test-diffuse.func')
# Test a rational_function
# Open a function plugin, then save the function and load it again
print 'Loading a rational_function plugin and testing saving/loading'
print('Loading a rational_function plugin and testing saving/loading')
f2 = alta.get_function('rational_function_legendre',
alta.parameters(3, 3,
alta.input_parametrization.RUSIN_TH_PH_TD,
alta.output_parametrization.RGB_COLOR))
print "f2 = ", f2
print("f2 = ", f2)
f2.save('test-rat.func')
sys.exit(0)
import alta
import numpy
fail = 0
......@@ -21,7 +20,7 @@ if y[0] != 2.0 and z[0] != 0.0:
fail += 1
# Testing str(vec)
print "Testing 'str' method on variable 'y': " + str(y)
print("Testing 'str' method on variable 'y': " + str(y))
# Testing the length of the vector
if len(y) != 3:
......@@ -35,17 +34,36 @@ for i in range(0,len(y)):
if l[i] != y[i]:
fail += 1
# Print the test result
if fail > 0:
print("Testing python 'vec' interface failed!")
exit(1)
else:
print("Testing python 'vec' interface passed!")
exit(0)
###########################################################
## ##
## SPECIAL TEST: Interoperability with the numpy library ##
## ##
###########################################################
fail = 0
import numpy
# Conversion to a numpy array
na = numpy.array(y)
for i in range(0,len(y)):
if na[i] != y[i]:
fail += 1
# Print the test result
if fail > 0:
print "Testing python 'vec' interface failed!"
print("Testing python 'vec' interface with 'numpy' failed!")
exit(1)
else:
print "Testing python 'vec' interface passed!"
print("Testing python 'vec' interface with 'numpy' passed!")
exit(0)