Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
d0089df
Add Python bindings for jsartoolkitNFT and update .gitignore
kalwalt Feb 20, 2025
fcab895
improved test and solve issue with ARLog's
kalwalt Feb 21, 2025
a0d4d8d
fix for last missed escape characters
kalwalt Feb 21, 2025
85acf85
Update .gitignore and enhance setup.py to download and include libjpeg
kalwalt Feb 21, 2025
c040dc3
Add nftMarker class to Python bindings and enhance test script for NF…
kalwalt Feb 21, 2025
a208c46
Add GitHub Actions workflow for building and testing Python bindings
kalwalt Feb 21, 2025
9bf7d5f
Enhance GitHub Actions workflow by adding submodule update step for b…
kalwalt Feb 21, 2025
2deb11f
Add config.h generation to setup.py for AR video input configuration
kalwalt Feb 21, 2025
74eca3b
Update GitHub Actions workflow to install system dependencies for lib…
kalwalt Feb 21, 2025
0e7e63e
Refactor build process for libjpeg in setup.py and update workflow to…
kalwalt Feb 21, 2025
5e1dd79
Use absolute path for build directory in setup.py
kalwalt Feb 21, 2025
4dd58f3
Add installation of libjpeg9 in GitHub Actions workflow
kalwalt Feb 22, 2025
09b8ab2
Update Python dependencies in GitHub Actions workflow to include numpy
kalwalt Feb 22, 2025
e24726a
Add separate build jobs for Linux and Windows in GitHub Actions workflow
kalwalt Feb 22, 2025
67d1306
Update GitHub Actions workflow to install libjpeg-turbo instead of li…
kalwalt Feb 22, 2025
9b8fff2
Update GitHub Actions workflow to use bash for adding vcpkg to path
kalwalt Feb 22, 2025
0197900
Refactor setup.py to conditionally handle libjpeg build for Windows u…
kalwalt Feb 22, 2025
dfc40bf
Add zlib, libjpeg, and pthread libraries for Windows support; update …
kalwalt Feb 24, 2025
70deb15
Refactor setup.py to use conditional extra_compile_args for Windows b…
kalwalt Feb 24, 2025
7f157c7
Refactor setup.py to conditionally build libjpeg for Linux platforms
kalwalt Feb 24, 2025
efde8d7
Add jconfig.h and jversion.h for libjpeg-turbo support; update extra_…
kalwalt Feb 24, 2025
1f3d30f
Add caching for pip packages and vcpkg in GitHub Actions; update setu…
kalwalt Feb 24, 2025
0d4bdeb
Add pthreads installation to GitHub Actions and update setup.py for l…
kalwalt Feb 24, 2025
15e44b7
Add unit tests for jsartoolkitNFT and update GitHub Actions workflow
kalwalt Feb 24, 2025
36e44d3
Update expected values in unit tests for cameraId and id
kalwalt Feb 25, 2025
96b993e
Update GitHub Actions to use Windows 2022 and enhance unit tests for …
kalwalt Feb 25, 2025
d067b37
Upgrade GitHub Actions to Ubuntu 24.04, update Node.js setup, and mod…
kalwalt Feb 25, 2025
4b31bdd
Add installation of ChromiumHeadless in GitHub Actions workflow
kalwalt Feb 25, 2025
45faee6
Enhance unit tests for NFT data retrieval by adding marker ID checks …
kalwalt Feb 25, 2025
7ce0076
Refactor getNFTMarkerInfo to return a py::dict and update error handling
kalwalt Feb 25, 2025
e02dbd9
Add NFT marker detection and enhance unit tests for marker info retri…
kalwalt Feb 25, 2025
9ba59b7
Enhance output of getNFTMarkerInfo by adding detailed print statement…
kalwalt Feb 25, 2025
f83a027
a raw barebone for publishing to testPyPi
kalwalt Feb 26, 2025
b106927
Update license information in pyproject.toml and setup.py to specify …
kalwalt Feb 26, 2025
c94aab5
Refactor Python bindings structure, update version to 0.0.4, and clea…
kalwalt Feb 27, 2025
701dac7
Bump version to 0.0.5, remove deprecated artoolkitNFT.py, and update …
kalwalt Mar 1, 2025
8da05e0
Fix build workflow to separate wheel creation and installation steps
kalwalt Mar 1, 2025
e5fe97d
Update build workflow to install specific wheel version for consistency
kalwalt Mar 1, 2025
af67ef5
Refactor build workflow to streamline wheel installation process
kalwalt Mar 1, 2025
7468b00
Enhance build workflow by adding pytest for testing, updating package…
kalwalt Mar 2, 2025
0dc37ef
Rename package to 'artoolkitnft', update version to 0.0.6, and add AR…
kalwalt Mar 2, 2025
106b58f
fix for github action issue
kalwalt Mar 2, 2025
c103546
Fix library extension for Windows and clean up library list for non-W…
kalwalt Mar 2, 2025
e9730da
Bump version to 0.0.8 and update setup configuration for zlib depende…
kalwalt Mar 2, 2025
33d681a
Update README for TestPyPI publishing instructions and bump version t…
kalwalt Mar 2, 2025
7eaf2ca
Update README to include TestPyPI installation instructions
kalwalt Mar 2, 2025
11c1018
Update GitHub Actions workflow to dynamically install the wheel based…
kalwalt Mar 3, 2025
05d3aba
Fix syntax for version extraction in GitHub Actions workflow
kalwalt Mar 3, 2025
f249ced
Fix PowerShell syntax for version extraction in GitHub Actions workflow
kalwalt Mar 3, 2025
c8c46ce
Fix PowerShell variable assignment syntax in GitHub Actions workflow
kalwalt Mar 3, 2025
8faef29
Add echo statement for clarity before installing wheel in GitHub Acti…
kalwalt Mar 3, 2025
8af2180
Remove dynamic versioning for wheel installation in GitHub Actions wo…
kalwalt Mar 3, 2025
bd84ca4
Update GitHub Actions workflow to use Python 3.11 and latest action v…
kalwalt Mar 3, 2025
dcdd9e6
Update wheel installation to use Python 3.11 compatible version
kalwalt Mar 3, 2025
feaaa5f
Merge branch 'dev' into feature-pyton-bindings
kalwalt Mar 6, 2025
3356c88
fix for issue https://github.com/webarkit/jsartoolkitNFT/issues/430 i…
kalwalt Mar 6, 2025
c27983a
Refactor ARToolKitNFT_py.cpp to use smart pointers for memory manage…
kalwalt Mar 6, 2025
853ff0b
Enhance ARControllerNFT to support grayscale conversion and improve i…
kalwalt Mar 7, 2025
e6c2d4c
Add image processing test and new test image for ARControllerNFT
kalwalt Mar 7, 2025
9a29dc0
Update Python dependencies and modify test command in CI workflow
kalwalt Mar 7, 2025
ae7d62d
Enhance ARControllerNFT example to support higher resolution and imag…
kalwalt Mar 7, 2025
19157ea
some more tests with the example
kalwalt Mar 7, 2025
9cdd192
fox for codeql script
kalwalt Nov 9, 2025
3886f5a
fix for wrong codeql config path
kalwalt Nov 9, 2025
609a245
chore: update version to 1.7.6, add ES6 Karma configurations, and imp…
kalwalt Nov 9, 2025
b2db9a8
chore: add GitHub Actions workflow for publishing to npm
kalwalt Nov 9, 2025
ec6ff05
merging last changes in feature-python-bindings
kalwalt Nov 9, 2025
d01133e
using zlib version 1.2.11
kalwalt Nov 9, 2025
9d7e065
feat: enhance setup script to support tool installation via winget an…
kalwalt Nov 10, 2025
34d3bf9
trying to debug the issue
kalwalt Nov 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 26 additions & 26 deletions python-bindings/ARToolKitNFT_py.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ARToolKitNFT::ARToolKitNFT()
nearPlane(0.0001), farPlane(1000.0),
patt_id(0) // Running pattern marker id
{
ARLOGi("init ARToolKitNFT constructor...");
ARLOGi("init ARToolKitNFT constructor...\n");
}

ARToolKitNFT::~ARToolKitNFT() {
Expand Down Expand Up @@ -175,7 +175,7 @@ int ARToolKitNFT::getKpmImageHeight(KpmHandle *kpmHandle) {
int ARToolKitNFT::setupAR2() {
if ((this->ar2Handle = ar2CreateHandleMod(this->paramLT, this->pixFormat)) ==
NULL) {
ARLOGe("Error: ar2CreateHandle.");
ARLOGe("Error: ar2CreateHandle.\n");
kpmDeleteHandle(&this->kpmHandle);
}
// Settings for devices with single-core CPUs.
Expand Down Expand Up @@ -256,7 +256,7 @@ int ARToolKitNFT::setCamera(int id, int cameraID) {

if ((this->paramLT = arParamLTCreate(&(this->param),
AR_PARAM_LT_DEFAULT_OFFSET)) == NULL) {
ARLOGe("setCamera(): Error: arParamLTCreate.");
ARLOGe("setCamera(): Error: arParamLTCreate.\n");
return -1;
}

Expand All @@ -265,15 +265,15 @@ int ARToolKitNFT::setCamera(int id, int cameraID) {

// setup camera
if ((this->arhandle = arCreateHandle(this->paramLT)) == NULL) {
ARLOGe("setCamera(): Error: arCreateHandle.");
ARLOGe("setCamera(): Error: arCreateHandle.\n");
return -1;
}
// AR_DEFAULT_PIXEL_FORMAT
int set = arSetPixelFormat(this->arhandle, this->pixFormat);

this->ar3DHandle = ar3DCreateHandle(&(this->param));
if (this->ar3DHandle == NULL) {
ARLOGe("setCamera(): Error creating 3D handle");
ARLOGe("setCamera(): Error creating 3D handle\n");
return -1;
}

Expand All @@ -288,7 +288,7 @@ int ARToolKitNFT::setCamera(int id, int cameraID) {
int ARToolKitNFT::loadCamera(std::string cparam_name) {
ARParam param;
if (arParamLoad(cparam_name.c_str(), 1, &param) < 0) {
ARLOGe("loadCamera(): Error loading parameter file %s for camera.",
ARLOGe("loadCamera(): Error loading parameter file %s for camera.\n",
cparam_name.c_str());
return -1;
}
Expand Down Expand Up @@ -326,15 +326,15 @@ ARToolKitNFT::addNFTMarkers(std::vector<std::string> &datasetPathnames) {
refDataSet = NULL;

if (datasetPathnames.size() >= PAGES_MAX) {
ARLOGe("Error exceed maximum pages.");
ARLOGe("Error exceed maximum pages.\n");
exit(-1);
}

std::vector<int> markerIds = {};

for (int i = 0; i < datasetPathnames.size(); i++) {
ARLOGi("datasetPathnames size: %i", datasetPathnames.size());
ARLOGi("add NFT marker-> '%s'", datasetPathnames[i].c_str());
ARLOGi("datasetPathnames size: %i\n", datasetPathnames.size());
ARLOGi("add NFT marker-> '%s'\n", datasetPathnames[i].c_str());

const char *datasetPathname = datasetPathnames[i].c_str();
int pageNo = i;
Expand All @@ -344,27 +344,27 @@ ARToolKitNFT::addNFTMarkers(std::vector<std::string> &datasetPathnames) {
KpmRefDataSet *refDataSet2;
ARLOGi("Reading %s.fset3", datasetPathname);
if (kpmLoadRefDataSet(datasetPathname, "fset3", &refDataSet2) < 0) {
ARLOGe("Error reading KPM data from %s.fset3", datasetPathname);
ARLOGe("Error reading KPM data from %s.fset3\n", datasetPathname);
return {};
}
ARLOGi("Assigned page no. %d.", pageNo);
if (kpmChangePageNoOfRefDataSet(refDataSet2, KpmChangePageNoAllPages,
pageNo) < 0) {
ARLOGe("Error: kpmChangePageNoOfRefDataSet");
ARLOGe("Error: kpmChangePageNoOfRefDataSe\nt");
return {};
}
if (kpmMergeRefDataSet(&refDataSet, &refDataSet2) < 0) {
ARLOGe("Error: kpmMergeRefDataSet");
ARLOGe("Error: kpmMergeRefDataSet\n");
return {};
}
ARLOGi("Done.");

// Load AR2 data.
ARLOGi("Reading %s.fset", datasetPathname);
ARLOGi("Reading %s.fset\n", datasetPathname);

if ((this->surfaceSet[i] =
ar2ReadSurfaceSet(datasetPathname, "fset", NULL)) == NULL) {
ARLOGe("Error reading data from %s.fset", datasetPathname);
ARLOGe("Error reading data from %s.fset\n", datasetPathname);
return {};
}

Expand All @@ -376,28 +376,28 @@ ARToolKitNFT::addNFTMarkers(std::vector<std::string> &datasetPathnames) {
this->surfaceSet[i]->surface[0].imageSet->scale[0]->ysize;
this->nft.dpi_NFT = this->surfaceSet[i]->surface[0].imageSet->scale[0]->dpi;

ARLOGi("NFT num. of ImageSet: %i", numIset);
ARLOGi("NFT marker width: %i", this->nft.width_NFT);
ARLOGi("NFT marker height: %i", this->nft.height_NFT);
ARLOGi("NFT marker dpi: %i", this->nft.dpi_NFT);
ARLOGi("NFT num. of ImageSet: %i\n", numIset);
ARLOGi("NFT marker width: %i\n", this->nft.width_NFT);
ARLOGi("NFT marker height: %i\n", this->nft.height_NFT);
ARLOGi("NFT marker dpi: %i\n", this->nft.dpi_NFT);

this->nft.id_NFT = i;
this->nft.width_NFT = this->nft.width_NFT;
this->nft.height_NFT = this->nft.height_NFT;
this->nft.dpi_NFT = this->nft.dpi_NFT;
this->nftMarkers.push_back(this->nft);

ARLOGi("Done.");
ARLOGi("Done.\n");
surfaceSetCount++;
}

if (kpmSetRefDataSet(kpmHandle, refDataSet) < 0) {
ARLOGe("Error: kpmSetRefDataSet");
ARLOGe("Error: kpmSetRefDataSet\n");
return {};
}
kpmDeleteRefDataSet(&refDataSet);

ARLOGi("Loading of NFT data complete.");
ARLOGi("Loading of NFT data complete.\n");

this->surfaceSetCount += markerIds.size();

Expand Down Expand Up @@ -431,7 +431,7 @@ void ARToolKitNFT::setThreshold(int threshold) {
if (threshold < 0 || threshold > 255)
return;
if (arSetLabelingThresh(this->arhandle, threshold) == 0) {
ARLOGi("Threshold set to %d", threshold);
ARLOGi("Threshold set to %d\n", threshold);
};
// default 100
// arSetLabelingThreshMode
Expand All @@ -452,7 +452,7 @@ void ARToolKitNFT::setThresholdMode(int mode) {
AR_LABELING_THRESH_MODE thresholdMode = (AR_LABELING_THRESH_MODE)mode;

if (arSetLabelingThreshMode(this->arhandle, thresholdMode) == 0) {
ARLOGi("Threshold mode set to %d", (int)thresholdMode);
ARLOGi("Threshold mode set to %d\n", (int)thresholdMode);
}
}

Expand All @@ -468,7 +468,7 @@ int ARToolKitNFT::getThresholdMode() {

int ARToolKitNFT::setDebugMode(int enable) {
arSetDebugMode(this->arhandle, enable ? AR_DEBUG_ENABLE : AR_DEBUG_DISABLE);
ARLOGi("Debug mode set to %s", enable ? "on." : "off.");
ARLOGi("Debug mode set to %s\n", enable ? "on." : "off.");

return enable;
}
Expand All @@ -489,7 +489,7 @@ void ARToolKitNFT::setImageProcMode(int mode) {

int imageProcMode = mode;
if (arSetImageProcMode(this->arhandle, mode) == 0) {
ARLOGi("Image proc. mode set to %d.", imageProcMode);
ARLOGi("Image proc. mode set to %d.\n", imageProcMode);
}
}

Expand All @@ -515,7 +515,7 @@ int ARToolKitNFT::setup(int width, int height, int cameraID) {

setCamera(id, cameraID);

ARLOGi("Allocated videoFrameSize %d", this->videoFrameSize);
ARLOGi("Allocated videoFrameSize %d\n", this->videoFrameSize);

return this->id;
}
Expand Down
1 change: 1 addition & 0 deletions python-bindings/ARToolKitNFT_py.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <AR/ar.h>
#include <pybind11/pybind11.h>
#include <pybind11/numpy.h>
#include <pybind11/stl.h>
#include <string>
#include <vector>
#include <unordered_map>
Expand Down
16 changes: 15 additions & 1 deletion python-bindings/test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
import jsartoolkitNFT
import numpy as np

nft=jsartoolkitNFT.ARToolKitNFT()
nft.setup(320,240,0)
cameraId=nft.loadCamera('../examples/Data/camera_para.dat')
width=640
height=480
id=nft.setup(width,height,cameraId)
nft.setupAR2()
camera_mat=nft.getCameraLens()
print(camera_mat)
framesize = width * height
videoLuma = np.zeros((height, width, 1), dtype=np.uint8)

nft.setProjectionNearPlane(0.1)
nft.setProjectionFarPlane(1000)

nft.addNFTMarkers(['../examples/DataNFT/pinball'])
Loading