OpenCV Q&A Forum - RSS feed answersenCopyright <a href="">OpenCV foundation</a>, 2012-2018.Wed, 14 Nov 2018 04:53:18 -0600OpenCV 3 + Python 3 + Firewire Cameras am trying to activate my 2 firewire cameras plugged in to build a depth image from them, but I cannot seem to activate even one: import numpy as np from sklearn.preprocessing import normalize import cv2 # SGBM Parameters ----------------- window_size = 3 # wsize default 3; 5; 7 for SGBM reduced size image; 15 for SGBM full size image (1300px and above); 5 Works nicely left_matcher = cv2.StereoSGBM_create( minDisparity=0, numDisparities=160, # max_disp has to be dividable by 16 f. E. HH 192, 256 blockSize=5, P1=8 * 3 * window_size ** 2, # wsize default 3; 5; 7 for SGBM reduced size image; 15 for SGBM full size image (1300px and above); 5 Works nicely P2=32 * 3 * window_size ** 2, disp12MaxDiff=1, uniquenessRatio=15, speckleWindowSize=0, speckleRange=2, preFilterCap=63, mode=cv2.STEREO_SGBM_MODE_SGBM_3WAY ) right_matcher = cv2.ximgproc.createRightMatcher(left_matcher) # FILTER Parameters lmbda = 80000 sigma = 1.2 visual_multiplier = 1.0 wls_filter = cv2.ximgproc.createDisparityWLSFilter(matcher_left=left_matcher) wls_filter.setLambda(lmbda) wls_filter.setSigmaColor(sigma) camOne = cv2.VideoCapture(cv2.CAP_FIREWIRE + 0) camTwo = cv2.VideoCapture(cv2.CAP_FIREWIRE + 1) while(True): # Capture frame-by-frame retOne, frameOne = retTwo, frameTwo = # Display the resulting frame print('computing disparity...') displ = left_matcher.compute(frameOne, frameTwo) # .astype(np.float32)/16 dispr = right_matcher.compute(frameTwo, frameOne) # .astype(np.float32)/16 displ = np.int16(displ) dispr = np.int16(dispr) filteredImg = wls_filter.filter(displ, frameOne, None, dispr) # important to put "frameOne" here!!! filteredImg = cv2.normalize(src=filteredImg, dst=filteredImg, beta=0, alpha=255, norm_type=cv2.NORM_MINMAX); filteredImg = np.uint8(filteredImg) cv2.imshow('Disparity Map', filteredImg) cv2.waitKey() cv2.destroyAllWindows() which does not work, throwing an error as: Traceback (most recent call last): File "", line 43, in <module> displ = left_matcher.compute(frameOne, frameTwo) # .astype(np.float32)/16 cv2.error: OpenCV(3.4.3) /io/opencv/modules/core/src/parallel.cpp:240: error: (-2:Unspecified error) in function 'finalize' > Exception in parallel_for() body: OpenCV(3.4.3) /io/opencv/modules/core/src/matrix.cpp:669: error: (-215:Assertion failed) nelems <= size_t(INT_MAX)*size_t(INT_MAX) in function 'reserveBuffer' however, I strongly suspect that cameras aren't even opening. Does anyone know how to make firewire cameras work with OpenCV?RakiWed, 14 Nov 2018 04:53:18 -0600 to convert Mono Image to HSV? everyone I am getting frame captures from a Point Grey Chameleon a ***monochromatic*** camera. Everything is done in python. I am getting a video capture using cap = cv2.VideoCapture(0) [This only works after I installed libdc1394 drivers as it is a 1394 camera]. Anyways when I do print cap.shape it only returns a matrix of two elements, i.e. [480, 640] however when I do hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV) it errors out and gives me " OpenCV Error: Assertion failed ((scn == 3 || scn == 4) && (depth == CV_8U || depth == CV_32F)) in cvtColor, file /home/pi/opencv-3.1.0/modules/imgproc/src/color.cpp, line 8141 Traceback (most recent call last): File "", line 14, in <module> hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV) cv2.error: /home/pi/opencv-3.1.0/modules/imgproc/src/color.cpp:8141: error: (-215) (scn == 3 || scn == 4) && (depth == CV_8U || depth == CV_32F) in function cvtColor" From what I understand this is because the cvtColor function expects an image with a matrices of 3 elements instead of my 2 element matrix. How can I fix this problem as I would like to take my mono image and get an HSV image out of it so I can perform better object detection? ThanksidkvinceFri, 02 Dec 2016 18:36:39 -0600 1394 (Point Grey) Camera w/ Python everyone, I have a Point Grey Chameleon Camera and have it working on my Raspberry Pi with OpenCV. To get a videocapture working with OpenCV I installed libdc1394 and had to compile OpenCV with 1394 flag enabled. I have gotten OpenCV and the camera to get a video stream by calling, Videocapture cap(CV_CAP_FIREWIRE + 0) using c++ code. However I want to do my programming in python and I don't know how to call it in python. I have been using the command cv2.videocapture(CV_CAP_FIREWIRE + 0) and it does not produce a video capture. How can I access my camera that is using libdc1394 in python? ThanksidkvinceMon, 21 Nov 2016 18:46:29 -0600 get no video from the camera that is connected with firewire. I have a question. I get no video from the camera that is connected with firewire. ordinary web camera works properly I work with opencv3.0.0 and VS12. there is no error, as if the program does not see the camera with VS10 and Opencv231 everything goes without problem what could be the problem? #include "opencv2/opencv.hpp" using namespace cv; int main() { int c; Mat img; VideoCapture cap(0); while (true) { cap >> img; if(img.empty()){ continue; } //or break; Mat edges; cvtColor(img, edges, CV_BGR2GRAY); Canny(edges, edges, 10, 100); imshow("Canny", edges); imshow("Norm", img); c=waitKey(1); if(c==27) break; } return 0; }MValeriyTue, 01 Dec 2015 05:10:28 -0600 cameras crashing every opencv project, I'm trying to detect objects with a firewire camera but everything crashes because the CPU gets too high. I tried simple object detection and camera calibration and both dont work with the firewire cameras. With normal webcams everything works fine. Any suggestions to solve my problem? I'm using Ubuntu with Eclipse (C++). The Camera: ImagingSource DMK 21F04 (monochrome). I assume the problem is caused by one of the following things: 1) monochrome cameras cannot be processed 2) FPS too high I would be very thankful for every advice I get. Regards Gösta studentunibremen2014Fri, 28 Mar 2014 05:41:32 -0500 to use firewire camera with opencv? I would like to ask how to use firewire camera with opencv? My camera is progres speedxt core5. Normally it is with USB cable but when I was starting the driver installation on windows 7 x64 it was installed T1394bus driver (driver from thesycon). I have tried to open my camera with the standart code. After build execution there were no errors but in the line: imshow("wind1", frame); the program was stopped. I have checked the call stack and I saw that the program was stopped in > ntdll.dll!776615de() [Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll] I have checked the code with a simple webcam and with a specialised usb ueye camera and everything was OK. Unfortunately with the firewire camera it was not possible to work. Could you please help me to resolve the problem. May be it will be necessary to use another software as directshow par example. Here is my code: #include <opencv2\core\core.hpp> #include <opencv2\highgui\highgui.hpp> #include <opencv2\opencv.hpp> #include <opencv2\imgproc\imgproc.hpp> #include <iostream> using namespace cv; using namespace std; int main(){ VideoCapture cap(0);; if (false) { return -1; } namedWindow("wind1", 0); Mat frame; while(1) { cap>>frame; imshow("wind1", frame); int key = cvWaitKey(1); if (key == 27) break; } return 0; } tiho_bgMon, 17 Feb 2014 08:33:37 -0600 from cv2 python binding? there, I have a firewire camera that works fine with the CMU1394 demo software on Windows and want to use it from python cv2.CaptureVideo. I guess the release versions till 2.4.3 do not support CMU1394. I get CaptureVideo(0).isOpened() -> False. My question is if I build with proper CMake options and/or _highgui.h setting, would I be able to use CMU from python? If so, how exactly should I go about? I've read: [C/C+ example for frame acquision with CMU]( and [_highgui.h modification to enable CMU]( But, I cannot even find _highgui.h in git head version. Does it still exist? I also found this in the latest CMakeLists.txt: OCV_OPTION(WITH_1394 "Include IEEE1394 support" ON IF (UNIX AND NOT ANDROID AND NOT IOS AND NOT CARMA) ) Does this mean IEEE1394 is supported only in Linux now? PS I could somehow compile the opencv source on Windows but this did not give me what i wanted. PS Thanks to [motmot project](, I could use **libcamiface and its python binding** and get the frame as numpy array, plug that into cv2 for displaying and saving as avi. But, I am still interested to know if there is CMU or DirectShow option with cv2 python binding.otterbSun, 17 Feb 2013 04:30:50 -0600