NPP function returns nppiFilterRow_8u_C1R CUDA KERNEL execution error - nsight

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.

Related

Point Cloud Library and While Loop

i am new to C++ and PCL. i wish to save the values of pointer in while loop and wanted to display the saved one . Here is part of my code . Please guide how to save the value of "coefficients->values[0] ,coefficients->values[1], coefficients->values[2], coefficients->values[3]" in an array each time loop runs.
// While 20% of the original cloud is still there
while (cloud_filtered->points.size () > 0.20 * nr_points)
{
// Segment the largest planar component from the remaining cloud
seg.setInputCloud (cloud_filtered);
seg.segment (*inliers, *coefficients);
if (inliers->indices.size () == 0)
{
std::cerr << "Could not estimate a planar model for the given dataset." << std::endl;
break;
}
std::cerr << "Model coefficients: " << coefficients->values[0] << " "
<< coefficients->values[1] << " "
<< coefficients->values[2] << " "
<< coefficients->values[3] << std::endl;
}
I am assuming that you are following this example code since the snippet you added in your question is almost to same. If this is the case, then you can declare a std::vector<pcl::ModelCoefficients> just before the while loop and push the coefficients into that like
std::vector<pcl::ModelCoefficients> coeffs;
while(...){
...
coeffs.push_back(*coefficients);
}
Also check the documentation for pcl::ModelCoefficients here which is nothing but a header and a vector of floats. Note that defining the coeffs as a vector of shared pointers and pushing pointers to the coefficients will not work in this case since previously pushed coefficients will be overwritten by seg.segment(*inliers, *coefficients);.

How to get camera intrinsics and extrinsics in openni2?

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.

QImageReader::text() does not work properly

I need to read image description (QImage::text()) without reading whole image. I used QImageReader, but its behaviour is very strange. It does not return text() or textKeys() but QImage does.
Example code:
QImageReader imageReader(filename,0);
QImage image;
bool ok=imageReader.read(&image);
qDebug() << "KEYS_READER: " << imageReader.textKeys() << "\n";
qDebug() << "KEYS_IMAGE: " << image.textKeys() << "\n";
When I try to load data from image which has one text key it prints in the debug window:
KEYS: ()
KEYS0: ("UVFI")
But I need to retrieve keys without reading the whole image data.

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