2015-07-12 21:03:19 -0500 received badge ● Enthusiast 2015-07-10 19:30:36 -0500 received badge ● Editor (source) 2015-07-10 14:34:48 -0500 asked a question Viz3d setCamera() only works the first time it is called The viz3d API allows us to make a cv::viz::Camera with desired intrinsic parameters, and to use the camera by calling setCamera. Two of the intrinsic parameters include fy and fx. These values appear to only "stick" the first time setCamera() is called. In the code below I create my own camera myCam1 with focal lengths fx = fy = 950. Calling getCamera(myCam1) shows these correct values. Setting this camera, followed by getCamera() shows the same correct focal lengths, 950. Next I crate another camera, this time myCam2 with focal lengths 475. The focal lengths of the camera appear correct. After calling setCamera() and getCamera() the focal lengths are 597.128, incorrect, whereas they should be 475. The myCam2 values do not appear to take effect the second time around. I expect that if I create a camera with a given fx and fy, then call setCamera for this camera and then getCamera, then the camera returned by getCamera should have the focal lengths fx and fy. This appears to happen the first time setCamera is called but not the second. (Try swapping the myCam1 and myCam2 sections. The pattern holds - it works the first time, not the second). Anyone know why the specified fx and fy don't take effect??? #include #include int main() { cv::viz::Viz3d myWindow("setCamera() TEST"); // Original Camera // =============== std::cout << "original camera ACTUAL: " << myWindow.getCamera().getFocalLength() << std::endl; // 802.391, 802.391 // cam1 // ==== cv::viz::Camera myCam1(950.0, 950.0, 240.0, 320.0, cv::Size(480, 640)); std::cout << "cam1: " << myCam1.getFocalLength() << std::endl; // 950, 950 = CORRECT myWindow.setCamera(myCam1); std::cout << "cam1 ACTUAL: " << myWindow.getCamera().getFocalLength() << std::endl; // 950, 950 = CORRECT // cam2 // ==== cv::viz::Camera myCam2(475.0, 475.0, 240.0, 320.0, cv::Size(480, 640)); std::cout << "cam2: " << myCam2.getFocalLength() << std::endl; // 475, 475 = CORRECT myWindow.setCamera(myCam2); std::cout << "cam2 ACTUAL: " << myWindow.getCamera().getFocalLength() << std::endl; // 597.128, 597.128 = INCORRECT. Should be 475, 475! }  There are similar threads on this topic that have not received any answer as yet. Viz3d::setCamera crashes the second time it is called. It appears not to be possible to work on the parameters of the virtual camera at run time. Is there anyone that have found a workaround for this? Thanks cv::viz::Viz3d myWindow("myWindow"); myWindow.setCamera(myWindow.getCamera());  Thank you very much. 2015-05-28 09:46:20 -0500 answered a question OpenCV 3-beta points_classifier example fails with DTrees Looks like berak was right (thanks!!!). I switched to opencv-3.0.0-rc1 from beta, for both the platform and the example. I.e., points_classifier.cpp changed between the beta and rc1 release, and the example worked. ANSWER: Abandon opencv-3.0.0-beta and switch to the more robust opencv-3.0.0-rc1. 2015-05-26 00:14:42 -0500 asked a question OpenCV 3-beta points_classifier example fails with DTrees Hi- I'm using precompiled binaries for OpenCV-3.0.0-beta on Windows 7 and trying to run the points_classifier.cpp example in C++. It fails on the DTrees part. To get the example to run without crashing I have to "turn off" parts of the example as follows: define _DT_ 0 define _BT_ 0 define _RF_ 0 define _ANN_ 0 I switched to using my own compiled libs so I could step into the code and narrow down the problem. With the four defines above "turned on", I stepped into the StatModel train function in find_decision_boundary_DT(). I could get into DTreesImpl::train() in tree.cpp. Stepping further into addTree(), once in the for() loop subsets[] had size and capacity both = 0. ssize was also 0, but when trying to memcpy(&subsets[],... at line 300 there was a crash: "Expression: vector subscript out of range" in file c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\vector line 932 Any help would be appreciated.