I have written some python code for extracting two frames from a video file using OpenCV. I have tested my code and it works for one video file. However, I have a folder with hundreds of video files and I would like to extract two frames from all the videos in that folder. Is there a method of doing this
Tag: opencv
Reconstruct Image from patches/tiles in python
I have a task where I have tiled an Input image using the code: After that I calculated the sum of all tiles and sort them in ascending order. I’ll take the sum.sorted[-20] as a threshold and set all tiles below that threshold to 0 in order to neglect background. So far everything works fine. Now I need…
Why does saving an image with OpenCV result in a black image?
So, I want to create a 500×500 white image using python Numpy library, though I can easily do it in photoshop. The code below is valid and the image is white (because I saved the image using cv2.imsave function and later I opened it with windows photos viewer). But when I try to display it using the cv2.…
cv2.imshow() giving black screen
I’m converting a image (numpy array) into a string. Then I’m converting this string back to a numpy array of the original dimensions. Hence both the numpy arrays are equal- infact numpy.array_equals() also returns True for the arrays being equal. When I call cv2.imshow() on the original numpy arra…
opencv cascade.detectMultiScale creates error: (-215) !empty()
I am following this tutorial to understand haar features. While writing following code: getting following error: (Sachin is the image i downloaded from google, of size (237,237,3) and after converting gray it is (237,237) with min=23, max=210. I am using opencv 3.1.0 with python 3.6, installed using command c…
sorting out pictures in training data to train a cnn (alexnet)
i’m training a alexnet with footage from playing an emulated nes game (f1 racer), to further on let it play the game by itself. now while i’m capturing the training data, the background of the game is changing heavily when it comes to gray pixel values (like light yellow to black for the same area…
Display an image in a label without saving it
The following lines are in my script: from PyQt5 import QtGui, QtWidgets, QtCore from PyQt5.QtGui import QIcon, QPixmap from PyQt5.Widgets import * import cv2 def positioningCross(Dy, Dx, center, imgCross): if(center[1,0]>=center[0,0]): Dy2 = center[0,0] + np.absolute(Dy) else: Dy2 = center[1,0] + np.absol…
How to merge lines after HoughLinesP?
My task is to find coordinates of lines (startX, startY, endX, endY) and rectangles (4 lines). Here is input file: I use the next code: I get the next results: From the last image you can see big amount of small red lines. Questions: What is the best way to merge small lines? Why there are a lot of small
GLib-GIO-Message: Using the ‘memory’ GSettings backend. Your settings will not be saved or shared with other applications
I am working on python project with opencv on Ubuntu OS when i am running this program then i am getting error can any one please help here, I have follow this answer but its not working for me Answer This fixed the issue for me: See: https://github.com/conda-forge/glib-feedstock/issues/19 for more info.
Access webcam using OpenCV (Python) in Docker?
I’m trying to use Docker for one of our projects which uses OpenCV to process webcam feed (Python). But I can’t seem to get access to the webcam within docker, here’s the code which I use to test webcam access: And here’s what I tried so far, All of these return False, what am I doing …