About 1,860,000 results
Open links in new tab
  1. python - How can I install cv2? - Stack Overflow

    Sep 11, 2019 · pip install opencv-python. opencv-python. If you need support for working videos: pip install opencv-contrib-python. opencv-contrib-python. If you need a non-GUI OpenCV: pip install opencv-python-headless. opencv-python-headless. If you need to install specific version you can use == to check the available version first like

  2. python - import opencv vs import cv2 - Stack Overflow

    Apr 30, 2018 · The Python import was now called cv2, and carried the old C API in the cv2.cv namespace. The 2 basically just means "The new API". Since then, versions 3.x and 4.x, "the C++ API" is still the primary API, and currently the only API, because the C API was removed.

  3. python - How do I install opencv using pip? - Stack Overflow

    Aug 15, 2018 · I need to install cv2 for a script that has been written for me. I tried pip install cv2 and pip install open_cv and got the same problem - a warning message from dist.py and complains about zlib being not found. No cv2 installed. I also tried pyopenvc and pip install opencv-python. So, I went to the opencv site and downloaded the relevant exe.

  4. python - OpenCV - Apply mask to a color image - Stack Overflow

    Here, you could use cv2.bitwise_and function if you already have the mask image. For check the below code: img = cv2.imread('lena.jpg') mask = cv2.imread('mask.png',0) res = cv2.bitwise_and(img,img,mask = mask) The output will be as follows for a lena image, and for rectangular mask.

  5. Using openCV to overlay transparent image onto another image

    Dec 1, 2016 · import numpy as np import cv2 fsize = 600 img = cv2.imread('football_stadium.png') overlay_t = cv2.imread('football_3.png',-1) # -1 loads with transparency overlay_t = cv2.resize(overlay_t, (fsize, fsize)) def overlay_transparent(background_img, img_to_overlay_t, x, y, overlay_size=None): """ @brief Overlays a transparant PNG onto another image ...

  6. Writing an mp4 video using python opencv - Stack Overflow

    May 28, 2015 · This is the default code given to save a video captured by camera. import numpy as np import cv2 cap = cv2.VideoCapture(0) # Define the codec and create VideoWriter object fourcc = cv2.VideoWriter_fourcc(*'XVID') out = cv2.VideoWriter('output.avi',fourcc, 20.0, (640,480)) while(cap.isOpened()): ret, frame = cap.read() if ret==True: frame = cv2.flip(frame,0) # write the flipped frame out.write ...

  7. Python: how to capture image from webcam on click using OpenCV

    Jan 4, 2016 · I want to capture and save a number of images from my webcam using OpenCV. This is my code currently: import cv2 camera = cv2.VideoCapture(0) for i in range(10): return_value, image = camera....

  8. Python - Extracting and Saving Video Frames - Stack Overflow

    Oct 29, 2015 · So I've followed this tutorial but it doesn't seem to do anything. Simply nothing. It waits a few seconds and closes the program. What is wrong with this code? import cv2 vidcap = cv2.VideoCapture('

  9. Create a new RGB OpenCV image using Python? - Stack Overflow

    Jan 15, 2023 · import cv2 # Not actually necessary if you just want to create an image. import numpy as np blank_image = np.zeros((height,width,3), np.uint8) This initialises an RGB-image that is just black. Now, for example, if you wanted to set the left half of the image to blue and the right half to green , you could do so easily:

  10. python - No module named 'cv2' - Stack Overflow

    Cannot import cv2 in python in OSX. Related. 470. Cannot find module cv2 when using OpenCV. 3.

Refresh