Ask Your Question

WasBlindButNowIC++'s profile - activity

2015-06-12 07:32:44 -0500 received badge  Scholar (source)
2015-06-12 07:32:31 -0500 commented answer OpenCV 3.0 Header Confusion

Thank you Steven, that helps alot. I ended up finding and using cap.set(CV_CAP_PROP_SETTINGS,1); and while looking through the options I found that exposure was not an option, which makes sense because it wasn't throwing an error every time, it just wasn't doing anything. Is there a way to make the camera keep the settings set up in its own API/software?

as far as the old headers being in /include/opencv/ though, many of the headers in the opencv2 subfolders that I look through say that they are deprecated. calib3d for example, I suppose it simply loads the new header though. My confusion here is why are certain functions in my code not recognized when I can "peek definition" and they are in a header that I have indeed included.

2015-06-12 07:20:19 -0500 received badge  Supporter (source)
2015-06-11 14:54:38 -0500 asked a question OpenCV 3.0 Header Confusion

I am new to OpenCV and have been trying to figure everything out through tutorials and online documentation but I have run into a bit of an issue, most likely stemming from my imperfect understanding of how Visual studio grabs and uses header files.

My end goal is simply to adjust the exposure time of a video stream so that it will be lighter and I can actually track the objects I want. It has gotten me deeper into trying to understand everything though so here is my issue.

  1. I understand that the old C API headers are obsolete now and that I should be using the C++ API. I also know they are in the same folder for compatibility. My confusion is in whether both old and new headers will be loaded when i set the path to build\include\opencv2 and whether that will cause issues. I have been looking around for the code to change exposure and have found many different functions but none seem to have worked. I tried

set(CV_CAP_PROP_EXPOSURE, 150); cap.set(CV_CAP_PROP_EXPOSURE, 150); cvSetCaptureProperty(cap, CV_CAP_PROP_EXPOSURE, 480);

  1. among others. any help on which is current would be great

My code is below. Sorry for the length of post. I am happy to put in the work but I have run into a wall. I have loaded and moved the headers several times trying to figure out.

  1. Also, if a header is linked in the Solution Explorer does that mean you don't have to "#include<module.hpp>" it?

    //#include < opencv\cv.h>
    //#include < opencv\highgui.h>
    #include < opencv2\opencv.hpp>
    //#include < opencv2\core\cvdef.h>
    
    //#define CV_WRAP
    
    using namespace cv;
    
    using namespace std;
    int main()
    {
    //create matrix to store image
    Mat image;
    //initialize capture
    
    VideoCapture cap;
    cap.open(0);
    
    //create window to show image
    cvNamedWindow("window", WINDOW_NORMAL);
    
    cap.set(CV_CAP_PROP_FRAME_WIDTH, 2048);
    cap.set(CV_CAP_PROP_FRAME_HEIGHT, 1536);
    
    
    while (1){
    
        //copy webcam stream to image
    
        cap >> image;
    
        //print image to screen
        imshow("window", image);
    
        //part I'm struggling with
        set(CV_CAP_PROP_EXPOSURE, 150);
    
        //delay 33ms
        waitKey(33);
    
        //print camera brightness setting
        switch (waitKey(10)){
    
        case 27:
            //'esc' has been pressed (ASCII value for 'esc' is 27)
            //exit program.
            return 0;
        }
    }
     return 0;}