How to get camera intrinsics and extrinsics in openni2? - point-cloud-library

I have a primesense carmine 1.08 and carmine 1.09. I need the intrinsic parameters for the RGB and the IR camera and the extrinsics between the two. I use pcl with openni2 support. So I need to know the sensor parameters used by openni2/pcl.
Is there a way in openni2 to find the intrinsics and the extrinsics using openni2/pcl? Libfreenect2 has option to get IR and color camera intrinsics, but are these parameters same as that in openni? Are all these parameters extracated from sensor during runtime?
I tried to get it via pcl, but i get nan for the focal length and the principal points
int main (int argc, char** argv)
{
std::string device_id ("");
pcl::io::OpenNI2Grabber::Mode depth_mode =
pcl::io::OpenNI2Grabber::OpenNI_Default_Mode;
pcl::io::OpenNI2Grabber::Mode image_mode =
pcl::io::OpenNI2Grabber::OpenNI_Default_Mode;
pcl::io::OpenNI2Grabber grabber (device_id, depth_mode, image_mode);
grabber.start();
double fx,fy,px,py;
grabber.getDepthCameraIntrinsics(fx,fy,px,py);
cout << "fx=" << fx << endl;
cout << "fy=" << fy << endl;
cout << "px=" << px << endl;
cout << "py=" << px << endl;
return (0);
}
A similar question has been asked here https://stackoverflow.com/questions/41110791/openni-intrinsic-and-extrinsic-calibration. However it hasnt recieved any answers.

Related

NPP function returns nppiFilterRow_8u_C1R CUDA KERNEL execution error

I am using nvidia nsight application to rotate and blur images. I am using the NPP libraries for the same,
The oDeviceDst gets filled the data from the output of function rotate, which is working fine.The code is shown below: Also note that the below piece of code is in a for loop for some rotation angles.
npp::ImageNPP_8u_C1 oDeviceDst(768 , 768);
Npp32s masksize = (Npp32s)KERNEL_LENGTH;
Npp32s anchor = (Npp32s)KERNEL_RADIUS;
NppiSize SzROI ={(int)oDeviceDst_gauss.width(),(int)oDeviceDst_gauss.height()};
std::cout << " anchor " << anchor << std::endl; std::cout << " masksize " << masksize << std::endl;
NppStatus status2 = nppiFilterRow_8u_C1R(oDeviceDst.data(), oDeviceDst.pitch(), oDeviceDst_gauss.data(), oDeviceDst_gauss.pitch(), SzROI, (Npp32s*)h_Kernel, masksize , anchor, int(sumh));
std::cerr << "status of blur is" << status2 << std::endl;
But as soon as i run it(remote on target), I get a status of -1000.
status of blur is -1000.
logout
Has anyone faced a similar issue in usage of NPP libraries.

!Clipper library Line polygon use offset How it Union

I want Draw Line polygon and Use Offset But it Union
Suppadech, I suggest you pass two closed paths the the ClipperOffset object where the second path is oriented in the opposite direction to the first.
int main()
{
Paths subj(2);
Paths solution;
subj[0] << IntPoint(10,10) << IntPoint(100,10) << IntPoint(100,100) << IntPoint(10,100);
subj[1] << IntPoint(10,10) << IntPoint(10,100) << IntPoint(100,100) << IntPoint(100,10);
ClipperOffset co;
co.AddPaths(subj, jtSquare, etClosedPolygon);
co.Execute(solution, 5.0);
}

Qt or OpenCV: print out the codec of a video file

I'd like to know how i can print out the codec of a video file after opening it with VideoCapture (on OSX or Ubuntu).
The file is correctly loaded and visualized by opencv inside a qt application.
QString filename = QFileDialog::getOpenFileName(...)
cout << filename.size() << endl; // size in byte
VideoCapture cap = VideoCapture(filename.toStdString());
cout << cap.get(CV_CAP_PROP_FRAME_HEIGHT) << endl; // print the height
cout << cap.get(CV_CAP_PROP_FPS) << endl; // print the fps
codec ??
Try
cap.get(CV_CAP_PROP_FOURCC);
to get the codec.
Edit:
I am not a C++ programmer, but this is what I found searching around to change it to a char array:
int ex = static_cast<int>(inputVideo.get(CV_CAP_PROP_FOURCC));
char EXT[] = {ex & 0XFF , (ex & 0XFF00) >> 8,(ex & 0XFF0000) >> 16,(ex & 0XFF000000) >> 24, 0};
See:
http://docs.opencv.org/doc/tutorials/highgui/video-write/video-write.html

Mouse click event in qt 3.0.3

Mouse button clicki am trying to create an automatic mouse click event at a particular co ordinate.
This source code moves the mouse pointer to the co ordinate region but it is not clicking.
please help me to solve this problem or suggest any new idea to automate mouse click event.
Note: i am using QT 3.0.3
void mMouseClickFunction()
{
QWidget *d = QApplication::desktop()->screen();
int w=d->width(); // returns desktop width
int h=d->height();
printf("w=%d\nh=%d\n",w,h);
int x,y;
printf("Enter the points...\n");
scanf("%d%d",&x,&y);
QApplication::desktop()->cursor().setPos(x,y);
QPoint pt(x,y);
std::cout << pt.x() << " " << pt.y() << std::endl;
QMouseEvent *e = new QMouseEvent(QEvent::MouseButtonPress, pt,Qt::LeftButton, 0);
QApplication::sendEvent(d, e);
std::cout << "in contentsMousePressEvent"<< e->x() << " " << e->y() << std::endl;
QMouseEvent *p = new QMouseEvent(QEvent::MouseButtonRelease, pt,Qt::LeftButton, 0);
QApplication::sendEvent(d, p);
std::cout << "in contentsMouseReleaseEvent"<< p->x() << " " << p->y() << std::endl;
}
QApplication::sendEvent sends an event internal to the QApplication, not a system wide event. You probably need to be system specific to send out an event like that. Here is the function call for windows:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms646310(v=vs.85).aspx
But even with that kind of call, you will be limited to certain windows, unless you have UIAccess to be true, and your program is a signed application located in the right part of the harddrive.
EDIT: Here is a page that has some examples for sending input in Linux:
http://www.linuxquestions.org/questions/programming-9/simulating-a-mouse-click-594576/
Hope that helps.

QList memory deallocation

I'm trying to free memory after using QList, but it doesn't seem to work properly.
Here's my code:
QList<double> * myList;
myList = new QList<double>;
double myNumber;
cout << "CP1" << endl;
getchar(); // checkpoint 1
for (int i=0; i<1000000; i++)
{
myNumber = i;
myList->append(myNumber);
cout << myList->size() << endl;
}
cout << "CP2!" << endl;
getchar(); // checkpoint 2
for (int i=999999; i>0; i--)
{
myList->removeLast();
cout << myList->size() << endl;
}
cout << "CP3!" << endl;
getchar(); // checkpoint 3
delete myList;
cout << "CP4!" << endl;
getchar(); // checkpoint 4
Memory usage:
CP1: 460k
CP2:19996k
CP3:19996k
CP4:16088k
So it looks like despite removing of elements and deleting myList still large part of memory is being used. I believe there is a way to handle it but I can't find it.
Thanks in advance for any help.
Pawel
Memory manager is not required to release the memory your program has allocated. There are no problems in your deallocation.
QList is an array based list. The array expands automatically, but does not shrink automatically. Removing elements from the list does not affect the size of the array.
To trim the array down to the actual size, create a new QList and add the contents to it. Then delete the original list.
Unfortunately looks like there is no convenience method to do this, like the List.TrimExcess() in .NET.

Resources