Hello I have a quick question.

Im trying to do some object tracking with OpenCv library, and at one point I wanted to display a thresholded image, but what I got is black square.
Here is code:
Qt Code:
  1. QImage Camera::captureTrasholdedImage()
  2. {
  3. IplImage* frame = cvQueryFrame( this->captureHandle );
  4. IplImage* frameHSV = cvCreateImage(cvGetSize(frame), IPL_DEPTH_8U, 3);
  5. cvCvtColor(frame, frameHSV, CV_BGR2HSV);
  6.  
  7.  
  8. IplImage* trashold = cvCreateImage(cvGetSize(frame), IPL_DEPTH_8U, 1);
  9. cvInRangeS(frame, cvScalar(170, 160, 160), cvScalar(180,256, 256), trashold);
  10.  
  11.  
  12.  
  13. QByteArray buff(trashold->imageData, trashold->imageSize);
  14.  
  15. int height = trashold->height;
  16. int width = trashold->width;
  17.  
  18. QPixmap pix(width, height);
  19. pix.loadFromData(buff);
  20. return pix.toImage();
  21. }
To copy to clipboard, switch view to plain text mode 

Can someone give me a hint please ?