Recording RGB video with PyOpenNI - python

I have installed PyOpenNI on my computer, and I want to record RGB videos with my camera.
On this link, https://github.com/jmendeth/PyOpenNI/blob/master/examples/record.py, it shows how to record depth video.
But I don't need depth video. I need image video. And I couldn't find any API tutorial for that.
How can I record an image video with this damn OpenNI?
Thanks,

If you need only RGB video, why are you going for pyopenni or openni? Even if you haven't installed openni drivers, the computer treats a kinect as a standard usb camera. I tried that after a fresh install of opencv and it worked. The code contained a image display program for standard usb camera.

Related

zsh: illegal hardware instruction mediapipe and openCV error

I keep running into this error and can't fix it. I spoke with many people and they are not sure what to do. My code is below. This is very simple code that should open my webcam and display the live video. I am using python 3.8.0 on a M1 Mac 64 bit Ventura 13.2 using VsCode with the latest version of openCv, Mediapipe, and numpy. I have tried different IDE's and no luck.
import cv2
import mediapipe as mp
import numpy as np
mp_drawing = mp.solutions.drawing_utils
mp_pose = mp.solutions.pose
#VIDEO FEED
cap = cv2.VideoCapture(0)
while cap.isOpened():
ret, frame = cap.read()
cv2.imshow('Mediapipe Feed', frame)
if cv2.waitKey(10) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
I got this code to work the first time I ran it. I ran it a few times, then connected my laptop via HDMI to a TV that has a camera built into it and then disconnected my laptop from the TV and now my code doesn't work. I think it has something to do with not being able to find the camera on my laptop but I can't figure it out. Any help would be great! I have tried changing the argument inside the .VideoCapture() from -10 to 10 and still no luck.
I had conflicting packages. I installed a bunch of packages via homebrew and pip3. I installed everything I am not using or going to use and that solved the issue. OpenCv works now, but I can't install mediapipe or mediapipe-silicon for my M1 mac. If I fix this, I will let everyone know.
This seems to be a problem caused by the M1 CPU with macOS. You need to compile OpenCV by yourself or download a compiled OpenCV by others for M1. Then the mediapipe for sure. Welcome to the world of Mx CPU.

OpenCV wrong image reading with VideoCapture() when switching to OpenCV 4 (aliasing)

I'm working on Ubuntu 16.04 LTS and trying to read and external camera (Leopard Imaging - Autonomous Camera)
My code is simple:
import cv2
cap = cv2.VideoCapture(0)
ret, frame = cap.read()
cv2.imwrite("output.jpg",frame)
cap.release()
When I run this with python 2.7 and OpenCV 3.4.1 I got the correct output:
When I run this with python3.7.10 and OpenCV 4.5.3 I got the following output:
I've also run the same code with OpenCV 4.5.3 but capturing images from an storaged video (mp4) and the first frame of the video is showing correctly.

Changing camera default from depth to rgb with OpenCV (intel RealSense)

W10, Python 3.6, OpenCV 4.3.0, Spyder 4.0.1
I'm using the code from this post to take snap shots from my Intel(R) Realsense(TM) 3D Camera (Front F200).
The problem is that it is defaulting to Depth mode and not RGB.
Is there a way of switching between the two modes from my code?

Kaggle Opencv restarts Notebook

I am using Kaggle Python and I am trying to edit images with OpenCV. I am simply trying to crop the image.I am able to do it with Matplotlib but I want to use OpenCv. When I excecute the code, it does not give me any message and it deletes all variables. It is like restarting the whole kernel. The varialbe img is not created and even variables created previously are deleted. Any idea is very appreciated.
import cv2
img = cv2.imread("/kaggle/input/global-wheat-detection/train/07479da31.jpg")
crop_img = img[715:834, 108:176]
cv2.imshow("cropped", crop_img)
cv2.waitKey(0)
You cannot use cv2.imshow in a Kaggle notebook. It requires a Qt backend which the Kaggle notebook is not set up for which is why your notebook is crashing. In addition, cv2.imshow opens up a separate window which of course the notebook environment is also not set up for. Therefore, you unfortunately cannot use OpenCV windowing or interactive functionality in the notebook. Since Matplotlib is working for you, you need to use that.

How to get video in coral dev board using OPENCV?

How trigger the coral dev board camera from opencv
cv.VideoCapture(0)
i am using this command to trigger the camera in opencv python. unfortunately it is giving error. not triggering the camera.
please let me know code for opencv python in coral dev board.
If you are using usb camera you should use;
cv.VideoCapture(1)
I'm from the coral team, just wanted to update on the issue here so that other can reference.
This is not caused by OpenCV, I have a full code with errors and it looks fine.
The usage of the library is correct.
The error is due to cv not able to read any data off from /dev/video0. At this stage I believe it's just bad connection between the camera sensors and the camera board. A command to take a picture from the camera failed.

Categories

Resources