Cannot access usb webcam through OpenCV, Cygwin - opencv

I've downloaded and installed cygwin for windows, I downloaded opencv (ported version for cygwin) and installed it successfully and my code compiles.
The problem I have is that CvCapture* capture = cvCreateCameraCapture(-1); is always null!
The usb webcam is connected and is not in use.
Why I can't access my webcam in cygwin? (Is there any particular reason like for example I should mount the device first, If this is the case I have no knowledge about it)
Please advice

Related

Unable to run cameras under Opencv 4.1.2 and MacOS Catalina

I am unable to open a camera on the network using Catalina, Python 3.7 and OpenCV 4.1.2.
I am running an IP Webcam app on a phone that exposes an endpoint as: http://192.168.87.26:8080/video. The following command fails:
import cv2
cap = cv2.VideoCapture('http://192.168.87.26:8080/video')
and the error message is:
OpenCV: Couldn't read video stream from file "http://192.168.87.26:8080/video"
At the same time, a video mp4 file works well. I have added permissions in MacOS such that the default webcam also works.
I have tried with both the pip install opencv-python as well as built an opencv from source, but the error for the video stream does not go away.
FFMPEG is installed in the system. FFPLAY on this URL http://192.168.87.26:8080/video works very well.
$ brew info ffmpeg
ffmpeg: stable 4.2.1 (bottled), HEAD
Play, record, convert, and stream audio and video
https://ffmpeg.org/
/usr/local/Cellar/ffmpeg/4.2.1_2 (287 files, 56.6MB) *
What I am missing?
After some more digging around, I was able to make it work. Looks like I had an old version of Intel OpenVINO around from Mojave days that was interfering with any local version of OpenCV that I would install.
During the exercise, I also figured that building OpenCV from scratch is far better than installing it from pip.

converting OpenCV not working with Python-for-android

I have a pretty solidly-functioning Kivy app, written in python and using the OpenCV2 library. having gotten it working on my laptop (windows) I then tried to convert it into an android APK using the python-for-android VM. after some issues (including adding more space to the VM and installing OpenCV on it) I managed to compile the APK successfully.
however, when running the app on android, the opencv part doesn't seem to be working. the kivy menus and such work fine, but loading the video - the job that opencv handles - simply doesn't happen. I'm going to try and connect the android device to the VM directly in order to try and get some debug information, but for now, can anyone think of any reasons why I might be having these issues?
thanks.

OpenCV OSX Mavericks video codec issue

Firstly, I've installed ffmpeg using
sudo port install ffmpeg
on my Macbook OSX 10.9 and XCode 5.1. I've done the same for OpenCV
sudo port install opencv
and I got face detect working using this SO answer. However, when trying to open a video file in the source code folder using VideoCapture I get the error "WARNING: Couldn't read movie file Alireza_Day1_001.avi". Has anyone faced the same issue? (FYI VideoCapture from my webcam is working fine, but tried opening a .mov and .avi file without luck) Any help is much appreciated!

BeagleBone, OpenCV and webcam issue

I've been trying to get BeagleBone work with OpenCV and a capture camera, but I couldn't manage to do it so far. I use Logitech C270 webcam. Here is what I did so far:
I installed OpenCV binaries and tried my camera. Capture didn't work. I downloaded the latest version from Git and compiled it. Then it worked on my desktop.
Since Ångström have pre-installed OpenCV, I directly tried to connect the webcam. But I had "select timeout" errors and when I saved the captured image, it was all black.
I deleted OpenCV from Ångström (opkg remove opencv and opencv-dev). It said it worked, but libraries were still in /usr. So I deleted them manually and copied libraries that I cross-compiled in my host. But now, I cannot even connect to camera. Capture returns null again.
I checked opkg list-installed, still OpenCV 2.4 is listed there. However, libraries in /usr/lib and include are the ones that I copied. How can I fix this problem?
Note: Webcam is recognized by Ångström, and dmesg shows successful connection to the webcam.
It seems something was wrong on installation of Linux itself. I re-compiled the latest Ångström and installed it to BeagleBone. Everything worked fine as it should. It seems sometimes it's better to take the hard way.

Getting webcam to work in OpenCV 2.3 with Cygwin

I have a problem trying to get a webcam in OpenCV 2.3 to work with Cygwin. I have a Windows 7 64-bit system and I use Notepad++ and cygwin compilers to do my C++ programming. I have seen other posts with similar problems:
Getting Webcam to work in OpenCV
Can't access webcam with OpenCV
I first tried installing OpenCV via the Cygwin Ports. This is rather easy to install, but alas I run into the webcam problem (always returns false when trying to find a device). I have also attempted to build OpenCV and install manually using the command line flavor of CMake. I tried adding the HAVE_VIDEOINPUT and HAVE_DSHOW flags, but no dice. All my programs compile nicely and I have all the functionality of OpenCV aside for this webcam thing.
Has anyone successfully built OpenCV 2.3 on Cygwin with webcam working?
It is unlikely that cygwin build of OpenCV will be able to access a webcam. At least it is not possible without hacking OpenCV cmake scripts. Under cygwin OpenCV build always follows the UNIX branch and videoinput/directshow is excluded from build.

Resources