Ask Your Question

karlphillip's profile - activity

2019-05-06 19:02:30 -0600 received badge  Popular Question (source)
2017-08-22 22:36:45 -0600 received badge  Nice Answer (source)
2013-08-21 02:22:34 -0600 received badge  Necromancer (source)
2013-04-12 14:59:29 -0600 received badge  Self-Learner (source)
2013-03-30 15:06:50 -0600 commented answer Comparing two images whether same or not

+1 In the future I'll link this answer to any SO answers I might write about this subject. Recursion is awesome.

2013-02-06 11:22:37 -0600 answered a question OpenCV Bounding Box
2013-02-05 18:18:53 -0600 answered a question QTKit didn't find any attached Video Input Devices!

I've solved this issue with a temporary fix.

This problem is probably specific to my system.

2013-02-01 14:35:26 -0600 received badge  Scholar (source)
2013-02-01 12:36:01 -0600 asked a question Build OpenCV without Android

I would like to disable Android support when building OpenCV.

Is it possible? What CMake flags do I need to set to do that?

2013-01-21 20:58:18 -0600 asked a question QTKit didn't find any attached Video Input Devices!

The following error occurs whenever I try to run a simple application to grab frames from the camera of a Macbook Pro 13" (built-in iSight):

QTKit didn't find any attached Video Input Devices!
Warning, camera failed to properly initialize!
Cleaned up camera.

I've tried passing -1, 0, 1 and other values as parameters to cvCreateCameraCapture() and none worked. It's important to say that I used OpenCV 2.3.1 on this machine for quite a while and it worked fine passing -1 as parameter.

This problem seems to happen with OpenCV v2.4.2 and v2.4.3 on Mac OS X 10.7.5.

Any ideas?

2012-10-14 13:32:10 -0600 received badge  Good Answer (source)
2012-10-05 13:06:05 -0600 commented question Video On Label OpenCV Qt :: hide cvNamedWindows

In the future, post the code itself, not an image of it.

2012-10-05 12:56:48 -0600 answered a question Video On Label OpenCV Qt :: hide cvNamedWindows

It's simple: don't call cvNamedWindow(), cvShowImage() and cvDestroyWindow().

In other words, remove all those lines from your code, but leave the call to cvWaitKey(33). This function makes the loop sleep for 33ms before the next frame is retrieved.

2012-10-05 11:54:57 -0600 answered a question How to set resolution of video capture in python with Logitech c910 & c920

Unfortunately, setting the size of the capture doesn't always work. One of the reasons being that sometimes the camera simply doesn't support the dimensions you are trying to set.

According to this thread, you can try to use the old python interface (something like this):

from opencv.cv import *  
from opencv.highgui import *

capture = cvCreateCameraCapture(0)

cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH, 640)
cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_HEIGHT, 480)

If this approach doesn't work, you'll have to resize the captured frame yourself! Check cv2.resize()

2012-10-05 11:43:24 -0600 answered a question Linux users: Stay away from OpenCV Version 2.4.2!

That's not a question and this thread will probably get closed.

I didn't see anything on the release notes that would make me go back to OpenCV 2.4.0.

OpenCV 2.4.2 is the most recent version officially available for download.

If you think you've found a bug, you can post a message about it on the Issue Tracker.

2012-10-05 11:36:09 -0600 commented question Linux users: Stay away from OpenCV Version 2.4.2!

We are going to down vote until you tell us why :)

2012-10-05 02:54:29 -0600 received badge  Nice Answer (source)
2012-10-04 08:22:12 -0600 received badge  Nice Answer (source)
2012-10-04 00:57:22 -0600 received badge  Nice Answer (source)
2012-10-03 18:58:27 -0600 received badge  Supporter (source)
2012-10-03 18:57:59 -0600 commented answer How to directly process ROI of preview data and display the processed data on screen?

+1 I think this solution might be a little slower than the other one, but it's interesting.

2012-10-03 17:26:21 -0600 commented answer How to directly process ROI of preview data and display the processed data on screen?

Hi Rui, thanks. You might be right, but since the OpenCV docs are available, it's merely a matter of translating one language to another. I trust that the user that asked the question can read the docs :D

2012-10-03 10:57:45 -0600 answered a question External integration

I don't think so. You will probably have to download OpenCV sources and do your magic inside OpenCV's CvCapture.

2012-10-03 10:52:29 -0600 received badge  Editor (source)
2012-10-03 10:49:49 -0600 answered a question How to run slow video processing algorithms in background while showing camera output?

It's not clear if you want to display the processed frames in the video window. So I'll assume you just want to show the original video to the user, and do something else with the processed frame.

The most obvious approach is creating a 2nd thread to do your custom processing.

The idea is that on every iteration of the main loop, your application will perform 2 tasks:

  • display the frame on the screen;
  • and check if the 2nd thread is alive: if it's not, you will start the 2nd thread and pass a copy of the current frame for it to process. When the processing finishes on the 2nd thread the thread will automatically die, but on the next iteration of the main loop it will be started again with a new frame to process.

On this post I share 2 similar solutions, one using Linux pthreads and the other using Windows threads.

2012-10-03 10:30:08 -0600 answered a question Android Target Practice App
2012-10-03 10:21:54 -0600 answered a question OpenCV / C++: Remove or hide cvNamedwindows()

Just don't call OpenCV functions related to displaying images, like cvNamedWindow() and cvShowImage().

To learn how to display OpenCV images on a QLabel, check this thread.

2012-10-03 10:14:50 -0600 received badge  Critic (source)
2012-10-03 10:11:34 -0600 received badge  Autobiographer
2012-10-02 16:34:17 -0600 received badge  Nice Answer (source)
2012-10-02 16:34:04 -0600 received badge  Nice Answer (source)
2012-10-02 15:47:54 -0600 answered a question Does OpenCV support PowerVR SGX540 GPU?

As you've discovered, OpenCV uses CUDA technology to speed up processing on the GPUs. For the moment, CUDA is still only supported by NVIDIA GPUs.

For the moment, the answer is no, you cannot enjoy OpenCV's GPU acceleration with PowerVR GPUs because they don't support CUDA.

However, last year OpenCV started working on a OpenCL module. The module is not yet available on OpenCV 2.4.2 but it seems it will be released soon. This is good news for you because it seems that PowerVR SGX530 supports OpenCL.

2012-10-01 03:38:34 -0600 received badge  Teacher (source)
2012-10-01 00:44:08 -0600 received badge  Necromancer (source)
2012-09-30 19:37:36 -0600 answered a question How to directly process ROI of preview data and display the processed data on screen?

Another approach:

// Assume "box" is a cvRect variable with the ROI dimensions

// Allocate space for a single-channel ROI (to store the grayscale ROI)
IplImage* gray_roi = cvCreateImage(cvSize(box.width, box.height), IPL_DEPTH_8U, 1);

// Allocate space for a temporary 3-channel image
IplImage* rgb_roi = cvCreateImage(cvSize(box.width, box.height), IPL_DEPTH_8U, 3);

// vid_frame is the original image. Let's set the ROI and perform a grayscale conversion.
cvSetImageROI(vid_frame, box);
cvCvtColor(vid_frame, gray_roi, CV_BGR2GRAY);

// Copy the processed image back to the original image
cvCvtColor(gray_roi, rgb_roi, CV_GRAY2BGR);
cvCopy(rgb_roi, vid_frame, NULL);

// Now reset the ROI so cvShowImage displays the full image
cvResetImageROI(vid_frame);
cvShowImage("Example", vid_frame);
2012-09-30 19:01:27 -0600 answered a question Error when running a simple program

There are several problems with your code:

  • Don't release the capture interface inside the loop!!! Do it only at the end of the application;
  • Code defensively: Always initialize your variables and check the return of the functions;
  • Add a call to cvWaitKey() after displaying the image from the camera;

You code would look something like this:

#include <highgui.h>
#include <stdio.h>

int main( int argc, char** argv ) 
{ 
    cvNamedWindow("Example2", CV_WINDOW_AUTOSIZE); 
    CvCapture *capture = cvCreateFileCapture(argv[1]); 
    if (!capture)
    {
         printf("!!! Failed cvCreateFileCapture\n");
         return -1;
    }

    IplImage* frame = NULL;

    while(1) 
    { 
        frame = cvQueryFrame(capture); 
        if (!frame) break; 

        cvShowImage("Example2" , frame); 
        cvWaitKey(33);
    }

    cvReleaseCapture(&capture); 
    cvDestroyWindow("Example2"); 
    return 0;
}