-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
detection problem with big resolution width #3
Comments
someone found this problem from launchpad https://answers.launchpad.net/artoolkitplus/+question/160544 |
Nice, thanks for that. I downloaded ARToolKitPlus source code and took a look at paramDistortion.cpp file. I see that in floatToFixed and fixedToFloat functions there are some short integer being used and some bitshift operations but I don't really know what to change in there. Any idea @fishkingsin? //
// these functions store 2 values (x & y) in a single 32-bit unsigned integer
// each value is stored as 11.5 fixed point
//
inline
void floatToFixed(ARFloat nX, ARFloat nY, unsigned int &nFixed) {
short sx = (short) (nX * 32);
short sy = (short) (nY * 32);
unsigned short *ux = (unsigned short*) &sx;
unsigned short *uy = (unsigned short*) &sy;
nFixed = (*ux << 16) | *uy;
}
inline
void fixedToFloat(unsigned int nFixed, ARFloat& nX, ARFloat& nY) {
unsigned short ux = (nFixed >> 16);
unsigned short uy = (nFixed & 0xffff);
short *sx = (short*) &ux;
short *sy = (short*) &uy;
nX = (*sx) / 32.0f;
nY = (*sy) / 32.0f;
}
int Tracker::arCameraObserv2Ideal_LUT(Camera* pCam, ARFloat ox, ARFloat oy, ARFloat *ix, ARFloat *iy) {
if (!undistO2ITable)
buildUndistO2ITable(pCam);
int x = (int) ox, y = (int) oy;
fixedToFloat(undistO2ITable[x + y * arImXsize], *ix, *iy);
return 0;
}
void Tracker::buildUndistO2ITable(Camera* pCam) {
int x, y;
ARFloat cx, cy, ox, oy;
unsigned int fixed;
char* cachename = NULL;
bool loaded = false;
if (loadCachedUndist) {
assert(pCam->getFileName() != "");
cachename = new char[strlen(pCam->getFileName().c_str()) + 5];
strcpy(cachename, pCam->getFileName().c_str());
strcat(cachename, ".LUT");
}
// we have to take care here when using a memory manager that can not free memory
// (usually this lookup table should only be built once - unless we change camera resolution)
//
if (undistO2ITable)
delete[] undistO2ITable;
undistO2ITable = new unsigned int[arImXsize * arImYsize];
if (loadCachedUndist) {
if (FILE* fp = fopen(cachename, "rb")) {
size_t numBytes = fread(undistO2ITable, 1, arImXsize * arImYsize * sizeof(unsigned int), fp);
fclose(fp);
if (numBytes == arImXsize * arImYsize * sizeof(unsigned int))
loaded = true;
}
}
if (!loaded) {
for (x = 0; x < arImXsize; x++) {
for (y = 0; y < arImYsize; y++) {
arCameraObserv2Ideal_std(pCam, (ARFloat) x, (ARFloat) y, &cx, &cy);
floatToFixed(cx, cy, fixed);
fixedToFloat(fixed, ox, oy);
undistO2ITable[x + y * arImXsize] = fixed;
}
}
if (loadCachedUndist)
if (FILE* fp = fopen(cachename, "wb")) {
fwrite(undistO2ITable, 1, arImXsize * arImYsize * sizeof(unsigned int), fp);
fclose(fp);
}
}
delete[] cachename;
} Thanks |
I don't notice this bug before... but as i use HD screens with ofxARToolkitPlus addon i'm interested to solve this. But looking at Logitech_Notebook_Pro.cal you see:
maybe changing aspect ratio here solve the issue? |
and maybe it's needed another calibration file? |
My plan is to make a new calibration file for the logitech c920, I currently use. |
good to know! i haven't a HD cam so i can't help you with this...sorry @Meach ! |
Hello,
I am having some trouble using your addons, until today when I tried to use it with a webcam, grabbing at more than 1024xsomething resolution.
I made a post on OF forum, with an image example: http://forum.openframeworks.cc/index.php/topic,12164.0.html
Cheers
The text was updated successfully, but these errors were encountered: