OpenCV Q&A Forum - RSS feed answersenCopyright <a href="">OpenCV foundation</a>, 2012-2018.Tue, 15 Jan 2019 16:47:59 -0600[Opencv4] Settings.write not working Incorrect element name {; should start with a letter or '_' in function 'operator<<' am just trying to perform chessboard camera calibration based on [camera calibration]( sample. So I am trying to let my QT app save the calibrations settings using Settings class as defined int above code. There is a function for this which is Settings.write but when I call as below it gives me this error: void saveCalibrationSettings(const Settings currentSettings){ FileStorage fs = FileStorage(Ui::calibrationFilename, FileStorage::WRITE); currentSettings.write(fs); fs.release(); } the error is as below: Gtk-Message: 02:56:21.529: Failed to load module "canberra-gtk-module" Input does not exist: images/CameraCalibration/VID5/VID5.xmlterminate called after throwing an instance of 'cv::Exception' what(): OpenCV(4.0.1) /home/mike/opencv-4.0.1/modules/core/src/persistence.cpp:1995: error: (-2:Unspecified error) Incorrect element name {; should start with a letter or '_' in function 'operator<<' I just need my QT GUI application to be able to save a Settings object into a file so that it could follow the correct calibration settings format which then can be fed to the calibration process.mikeitexpertTue, 15 Jan 2019 16:47:59 -0600 do I set exposure time of Logitech C922 webcam on OpenCV? Hello I am writing a code for a project, and it requires some color segmentation which seems to be quite sensitive to the camera settings. I can get the frame size, brightness, autofocus, contrast and etc to set to a certain value, but I can't seem to set the exposure. My webcam always changes to auto exposure, and I prefer to have a set manual exposure. I tried the code below: import cv2 import numpy as np cap = cv2.VideoCapture(1) cap.set(cv2.CAP_PROP_FRAME_WIDTH, 864) cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 480) cap.set(cv2.CAP_PROP_BRIGHTNESS, 0.7) cap.set(cv2.CAP_PROP_AUTOFOCUS,0) cap.set(cv2.CAP_PROP_EXPOSURE,0.5) but as I stated before, it will not change the exposure. Does anyone have any experience with c922 webcams, or have any suggestions? ThankskeyboardwarrirorSun, 13 Aug 2017 09:33:11 -0500 settings Prosilica camera Vimba C++ morning everyone! Currently I have working a prosilica ethernet camera (GC1020C) with API vimba in VS2010. I catch a frame, process it and iterate it. I want change some camera settings. For example I want change the **EXPOSURE TIME**. Someone can help me with this task!?? I can't find a good documentation about this things... THANKS YOU VERY MUCH!!!RiSaMaMon, 03 Nov 2014 04:26:25 -0600 steps of linking openCV Experts, I'm an electronics hobbyist not much experience in software development, i have done some projects in opencv. But all the time i have done for configuring the opencv with an IDE the steps for different IDE like DevCpp,VS etc are different in. may the the thing what we are doing the same but as i don't know much about the linker, compiler configure i'm little confused. What i need is to understand the concept and so that i can link the opencv with any IDE without going through a tutorial steps. The next doubt is the as new versions of openCV comes does the steps change? is need change how to identify that?? I have tried to understand this but failed many time, so kindly help me.SPLaBzSat, 24 May 2014 03:04:34 -0500 would help if your examples were more complete, I'm getting very frustrated because many examples I see leave out A LOT! For example, this one: It declares and uses a class called Settings, but never defines what it is. I've looked everywhere I could think of to find it, but come up with NOTHING. Can anyone please let me know what it is (and probably post it on the website for the next victim)? Thanks.Frustrated KiwiMon, 30 Sep 2013 20:51:00 -0500 Camera Control Settings Issue (OSX - W7) Forum!! I'm writing because I have an strange issue with OCV. First let me set the scenario. I have compile openCV 2.4.4 for Windows 7 for VS Express 2010. Everything was ok. OCV working well. I have compile openCV 2.4.4 for MacOsX 10.6.8 for XCode 3.2.6 Compilation was ok. OCV working well. I have a USB 2.0 camera LI-0V5640 5MP, with 720p and 1080p resolution. I have write a test program like shown: /* * usb-ocv.cpp * ocl_img2 * * Created by SGB on 03/06/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #include <stdio.h> #include <opencv2/opencv.hpp> using namespace cv; #include "usb-ocv.h" #define cameraID 0 // 0, 1 #define width 1280 //1280;//1920;//320; #define height 720 //720;//1080;//240; //720p. 1080p int main (int argc, const char * argv[]) { VideoCapture Cam0;; //Cam0.set(<#int propId#>, <#double value#>); if (!Cam0.isOpened()) { printf("No se puede abrir Cam%i :( \n ", cameraID); return -1; } //-------------------------------------- //propiedades de la camera int Cam0AE = Cam0.get(CV_CAP_PROP_AUTO_EXPOSURE); printf("Cam%i AE: %s \n", cameraID, Cam0AE == 0 ? "NO" : "YES" ); int Cam0BL = Cam0.get(CV_CAP_PROP_BACKLIGHT); printf("Cam%i Back Light: %s \n",cameraID, Cam0BL == 0 ? "NO" : "YES"); int Cam0BR = Cam0.get(CV_CAP_PROP_BRIGHTNESS); printf("Cam%i Bright: %s \n",cameraID, Cam0BR == 0 ? "NO" : "YES"); int Cam0C = Cam0.get(CV_CAP_PROP_CONTRAST); printf("Cam%i Contrast: %s \n",cameraID, Cam0C == 0 ? "NO" : "YES"); int Cam0GN = Cam0.get(CV_CAP_PROP_GAIN); printf("Cam%i Gain: %s \n",cameraID, Cam0GN == 0 ? "NO" : "YES"); int Cam0GM = Cam0.get(CV_CAP_PROP_GAMMA); printf("Cam%i Gamma: %s \n",cameraID, Cam0GM == 0 ? "NO" : "YES"); int Cam0HUE = Cam0.get(CV_CAP_PROP_HUE); printf("Cam%i Hue: %s \n",cameraID, Cam0HUE == 0 ? "NO" : "YES"); int Cam0M = Cam0.get(CV_CAP_PROP_MODE); printf("Cam%i Mode: %s \n",cameraID, Cam0M == 0 ? "NO" : "YES"); int Cam0MONO = Cam0.get(CV_CAP_PROP_MONOCROME); printf("Cam%i Mono: %s \n",cameraID, Cam0MONO == 0 ? "NO" : "YES"); int Cam0SH = Cam0.get(CV_CAP_PROP_SHARPNESS); printf("Cam%i Sharpness: %s \n",cameraID, Cam0SH == 0 ? "NO" : "YES"); int Cam0SS = Cam0.get(CV_CAP_PROP_SETTINGS); printf("Cam%i Settings: %s \n", cameraID, Cam0SS == 0 ? "NO" : "YES"); int Cam0FPS = Cam0.get(CV_CAP_PROP_FPS); printf("Cam%i fps: %s \n",cameraID, Cam0FPS == 0 ? "NO" : "YES"); int Cam0SAT = Cam0.get(CV_CAP_PROP_SATURATION); printf("Cam%i Saturation: %s \n", cameraID, Cam0SAT == 0 ? "NO" : "YES"); int Cam0Exp = Cam0.get(CV_CAP_PROP_EXPOSURE); printf("Cam%i Exposure: %s \n", cameraID, Cam0Exp == 0 ? "NO" : "YES"); int Cam0FM = Cam0.get(CV_CAP_PROP_FOURCC); printf("Cam%i PIM1/MJPG: %s \n", cameraID, Cam0FM == 0 ? "NO" : "YES"); //-------------------------------------- //* Cam0.set(CV_CAP_PROP_FRAME_WIDTH, width); Cam0.set(CV_CAP_PROP_FRAME_HEIGHT, height); Cam0.set(CV_CAP_PROP_SATURATION, 0); //0 - 50 //Cam0.set(CV_CAP_PROP_EXPOSURE, 0); //*/ int Cam0X = Cam0.get(CV_CAP_PROP_FRAME_WIDTH); int Cam0Y = Cam0.get(CV_CAP_PROP_FRAME_HEIGHT); printf("Cam%i x,y: %i %i \n", cameraID, Cam0X, Cam0Y); Mat obtImg1 (height, width, CV_8UC3); Mat buf1 (height, width, CV_8UC3); Mat buf2 (height, width, CV_8UC3); Mat temp1 (height, width, CV_8UC3); namedWindow("USB Cam", 0); int key = 0; while (key != 'q') { Cam0 >> temp1; temp1.copyTo(buf1); //------------------------ //obtNeg2(buf1, buf2); //obtImg1 = buf2; obtImg1 = buf1; //------------------------ imshow("USB Cam", obtImg1); key = cvWaitKey(1); } //Cam0.release(); return 0; } I made some small adaptations to run on VSE 2010. On W7 with VSE 2010 the camera shows the picture and the output on the console we see: ** Cam1 AE: YES Cam1 Back Light: NO Cam1 Bright: YES Cam1 Contrast: NO Cam1 Gain: YES Cam1 Gamma: YES Cam1 Hue: NO Cam1 Mode: NO Cam1 Mono: NO Cam1 Sharpness: YES Cam1 Settings: YES Cam1 fps: NO Cam1 Saturation: YES Cam1 Exposure: YES Cam1 PIM1/MJPG: YES Cam1 x,y: 1280 720 ** On OSX with XCode the camera shows the picture and the output on the console we see: ** [Switching to process 59480] Running… Cam0 AE: NO Cam0 Back Light: NO Cam0 Bright: NO Cam0 Contrast: NO Cam0 Gain: NO Cam0 Gamma: NO Cam0 Hue: NO Cam0 Mode: NO Cam0 Mono: NO Cam0 Sharpness: NO Cam0 Settings: NO Cam0 fps: NO Cam0 Saturation: NO Cam0 Exposure: NO Cam0 PIM1/MJPG: NO Cam0 x,y: 1280 720 Camera dropped frame! ** Sadly, I can´t control the camera settings on OSX for some strange reason. I have compile again OCV on OSX with QT support and happens exactly the same :( any ideas? I will appreciate your help a lot. sgbzonaThu, 27 Jun 2013 22:22:22 -0500 to change contrast/brightness of a CAM using OpenCV 2.4.2, Please let me know how to change the brightness and contrast of a cam using OpenCV 2.4.2. I wrote a code, but there is no impact of using this code. Please let me know how to write the code. I used like this. CvCapture *capture = cvCaptureFromCAM(CV_CAP_DSHOW); if(!cvSetCaptureProperty(capture,CV_CAP_PROP_CONTRAST,0.7)) AfxMessageBox("Not done."); while ( 1 ) { IplImage* frame = cvQueryFrame( capture ); int c; cvNamedWindow("Image Display", CV_WINDOW_AUTOSIZE); while(1) { frame=cvQueryFrame(capture); cvShowImage("Image Display", frame ); } } ThanksGaurangWed, 29 Aug 2012 06:43:12 -0500