I’m trying to capture a single image from H.264 video streaming in my Raspberry Pi. The streaming is using raspivid with websocket. But, cannot show a correct image in imshow(). I also tried to set the .reshape(), but got ValueError: cannot reshape array of size 3607 into shape (480,640,3) In client side, I successfully connect to the video streaming and
Tag: opencv
cv2.imwrite doesn’t save result image but initial only
I have a code: that generates grid like this one: So cv2.imshow shows the grid but cv2.imwrite writes only initial black background not the grid for some reason. How to fix that? Answer You need to scale the color channels: cv2.imwrite(“background.jpg”, background) Alternatively you can create a “white” image with type uint8: img = numpy.ones((255, 465, 3))
Python: Image face detection and sorting into face and no face
I am trying to create a sorting system where an image is sorted based on having a face or not. and it doesn’t seem to run quite as expected. after the first image is sorted, the loop stops working and I can’t seem to figure out what is wrong. (I am aware of how inefficient it is). all in all,
How can I record a video with MJPG instead of YUYV on a raspberry PI 4b with opencv-python code
Good day to you dear developers from stackoverflow. I am currently recording live-video with my usb webcam on my raspberry Pi with the following code: The code doesn’t work anymore, when I use the cap.set(cv.CAP_PROP_FPS, 15) function and I don’t know what I’ve done wrong. I get the following errors: Not the thing is, if I remove the cap.set(cv.CAP_PROP_FPS, 15)
How to find contours in dotted text captcha image
I am newbie to OpenCV. I’m trying to find the contours of the captcha image. It does not work only when my captcha image contains the dotted text. I have done following code for that: Can anyone help in this? Is there any way to find contours in this image? Answer Here is my code and output
cv2 creates a unreadable .mp4v (and .avi) file
I’m trying to create a simple screen recorder with Python. This is the code It doesn’t give any error while it’s going, and it creates a .mp4v file correctly, however when I try to watch the video that was supposed to be recorded, it can’t be opened. I tried with VLC and other apps but it’s unsupported everywhere. Can someone
Nearest Neighbor Search is too long for multiple datas
Firstly, i have an image that I pass in arguments, and i retrieve all of his contours with OpenCV (with the cv.findContours method). I parse this list with my parseArray method to have a well parsed list of x,y contours coordinates of the img [(x1, y1), (x2, y2), …] (The size of this list equals 24163 for my unicorn image)
Can’t convert object of type ‘function’ to ‘str’ for ‘text
Good day everyone I’m sorry I’m new to python programming sorry if I’m asking this even this is basic or not. Someone can help me with this? The problem is I want to put the data that has been read by my Pyserial from my Arduino temperature sensor but I don’t know how. Here code for the Temperature to pyserial:
Pipe and OpenCV to FFmpeg with audio streaming RTMP in Python
I’m trying to stream FFmpeg with audio. I will show my code below: Import module Create variables Command param Create subprocess to ffmpeg command Send frame to RTMP server I hope you can help me to be able to live stream via FFmpeg over RTMP with audio. Thanks! Answer Assuming you actually need to use OpenCV for the video, you
Pass video uploaded via django to cv2
I am uploading video via django and want to process it using cv2. This is how video uploaded via django is accessed. Next i want to pass it to opencv. I dont want to save video in disk first and then acess it via cv2 using following code I tried passing this video_obj to VideoCapture this way But i got