Ask Your Question

chaanakya's profile - activity

2018-01-04 20:54:36 -0600 received badge  Famous Question (source)
2016-04-13 08:12:17 -0600 received badge  Famous Question (source)
2016-02-01 08:18:37 -0600 received badge  Notable Question (source)
2015-09-02 07:26:02 -0600 received badge  Notable Question (source)
2015-06-15 01:26:19 -0600 received badge  Popular Question (source)
2015-04-29 09:08:30 -0600 received badge  Popular Question (source)
2014-09-12 23:51:33 -0600 received badge  Student (source)
2014-06-16 18:18:36 -0600 commented answer OpenCL in OpenCV 3.0.0

I don't have CUDA, so that program will not work. I have an Intel GPU and I'm using Beignet, which is Intel's implementation of OpenCL. Can you please try your (first) program without CUDA and see how it works? NVIDIA should also have an implementation of OpenCL, so you should be able to use it.

2014-06-16 15:21:31 -0600 commented answer OpenCL in OpenCV 3.0.0

Have you tried using only OpenCL (no CUDA)? I'm having the same issue with your example...

2014-06-14 17:19:30 -0600 received badge  Supporter (source)
2014-06-14 17:16:20 -0600 received badge  Editor (source)
2014-06-14 17:13:11 -0600 commented answer OpenCL in OpenCV 3.0.0

Things are still slowing down to a crawl - please see my revised question with code.

2014-06-14 17:10:39 -0600 received badge  Scholar (source)
2014-05-26 23:07:05 -0600 asked a question OpenCL in OpenCV 3.0.0

I'm attempting to use OpenCV 3.0.0 (yes, I know it's a development version) to work with OpenCL. I'm using the UMat structure instead of the ocl::oclMat structure found in earlier versions. As expected, those matrices are getting created on the GPU side. However, when I attempt to run GaussianBlur for example on those matrices, things slow down to a crawl. Earlier, this would have been solved by using ocl::GaussianBlur, but that does not exist anymore. How is one supposed to achieve this in OpenCV 3.0?

EDIT

Now that I have ostensibly enabled using OpenCL for dealing with UMats, things are still slowing down to a crawl. Here is the code that I am currently using to test this out:

#include "opencv2/opencv.hpp"
#include "opencv2/core/ocl.hpp"
#include <iostream>

using namespace cv;
using namespace std;

int main(int argc, char** argv)
{
  ocl::setUseOpenCL(true);
  Mat gpuFrame;
  UMat gpuBW;
  UMat gpuBlur;
  UMat gpuEdges;
  VideoCapture cap(0); // open the default camera
  if(!cap.isOpened())  // check if we succeeded
    return -1;
  namedWindow("edges",1);
  for(;;)
    {
      cap >> gpuFrame; // get a new frame from camera
      cvtColor(gpuFrame, gpuBW, COLOR_BGR2GRAY);
      GaussianBlur(gpuBW, gpuBlur, Size(1,1), 1.5, 1.5);
      Canny(gpuBlur, gpuEdges, 0, 30, 3);
      imshow("edges", gpuEdges);
      if(waitKey(30) >= 0) break;
    }
  // the camera will be deinitialized automatically in VideoCapture destructor
  return 0;
}

EDIT 2

Changing the gpuFrame to be a regular matrix seems to have solved the issue. Thank you! :)

Edit 3

I seem to have spoken too soon --- changing gpuFrame to a regular Mat object fixed everything because everything then became CPU computations! Why is it that I cannot do multiple computations using OpenCL and not have the GPU freeze up? In my dmesg, it says the following whenever I run my program:

[670017.262677] [drm] Enabling RC6 states: RC6 on, RC6p off, RC6pp off
[670025.273070] [drm] stuck on render ring
[670025.273999] [drm] GPU HANG: ecode 0:0x8fd8ffff, in VideoCapture [26945], reason: Ring hung, action: reset
[670027.274692] [drm] Enabling RC6 states: RC6 on, RC6p off, RC6pp off
[670031.265908] [drm] stuck on render ring
[670031.266856] [drm] GPU HANG: ecode 0:0x8fd8ffff, in VideoCapture [26945], reason: Ring hung, action: reset
[670031.266984] [drm:i915_context_is_banned] *ERROR* gpu hanging too fast, banning!
[670033.267655] [drm] Enabling RC6 states: RC6 on, RC6p off, RC6pp off

This seems to suggest that my loop is going too quickly. But the GPU should be quicker at computations (especially matrix computations) than a CPU, right? So what's going on?

Thank you very much!

Sincerely,

Chaanakya

2014-05-26 23:02:10 -0600 commented question OpenCV + Asus Xtion sensor

Thanks kbarni - I did change that variable and the result does work. How exactly do you do a) though? I'd like to do that if possible. Thanks!

2014-05-18 12:11:25 -0600 commented question OpenCV + Asus Xtion sensor

Does SamplesConfig.xml have anything at all to do with this not working? It seems that it should read /etc/openni/SamplesConfig.xml. However, I don't think it's doing that, since a) PCL worked (and works) just fine and b) nothing I do is actually changing the behavior of OpenCV.

2014-05-17 00:44:39 -0600 asked a question OpenCV + Asus Xtion sensor

Dear all,

I am having trouble getting the Asus Xtion sensor to work with the OpenCV framework. I know (or at least I believe) the problem is not my laptop as I have an example program working with PCL (the Point Cloud Library). I am using Debian Sid with a custom compiled OpenCV (to ensure support for OpenNI and the Xtion sensor). The following code is what should work, but is not:

#include "opencv2/opencv.hpp"
using namespace cv;
using namespace std;

int main(int argc, char* argv[])
{
  VideoCapture capture( CAP_OPENNI_ASUS );
  if (!capture.isOpened())
  {
  exit(1);
  }
  for(;;)
  {
  Mat depthMap;
  capture >> depthMap;

  if( waitKey( 30 ) >= 0 )
    break;
  }
}

This code compiles just fine. When I run it, however, with the Xtion sensor plugged in, it gives me the following output:

CvCapture_OpenNI::CvCapture_OpenNI : Failed to run xml script: Bad Parameter sent to the device!

What exactly is going on and how do I fix it? I have tried searching on Google and haven't found anything useful except for other people with the same problem and no responses.

Thank you very much in advance.

Sincerely,

Chaanakya