OpenCV

VideoWriter OpenCV - cannot put pipeline to play in function CvVideoWriter_GStreamer::open

馋奶兔 提交于 2021-02-10 15:02:13
问题 Almost exactly the same question : OpenCV error - cannot put pipeline to play in function CvVideoWriter_GStreamer::open Context : I'm trying to create a video and save it in a .avi file with OpenCV 3.3.0 and Python 2.7. Problem : This code : fourcc = cv2.VideoWriter_fourcc(*'XVID') out = cv2.VideoWriter('data/out/output.avi', fourcc, 30, (800, 600)) Raises : (python2.7:12345): GStreamer-CRITICAL **: gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed ** (python2.7:12345):

VideoWriter OpenCV - cannot put pipeline to play in function CvVideoWriter_GStreamer::open

微笑、不失礼 提交于 2021-02-10 15:01:36
问题 Almost exactly the same question : OpenCV error - cannot put pipeline to play in function CvVideoWriter_GStreamer::open Context : I'm trying to create a video and save it in a .avi file with OpenCV 3.3.0 and Python 2.7. Problem : This code : fourcc = cv2.VideoWriter_fourcc(*'XVID') out = cv2.VideoWriter('data/out/output.avi', fourcc, 30, (800, 600)) Raises : (python2.7:12345): GStreamer-CRITICAL **: gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed ** (python2.7:12345):

VideoWriter OpenCV - cannot put pipeline to play in function CvVideoWriter_GStreamer::open

久未见 提交于 2021-02-10 15:01:33
问题 Almost exactly the same question : OpenCV error - cannot put pipeline to play in function CvVideoWriter_GStreamer::open Context : I'm trying to create a video and save it in a .avi file with OpenCV 3.3.0 and Python 2.7. Problem : This code : fourcc = cv2.VideoWriter_fourcc(*'XVID') out = cv2.VideoWriter('data/out/output.avi', fourcc, 30, (800, 600)) Raises : (python2.7:12345): GStreamer-CRITICAL **: gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed ** (python2.7:12345):

Why does openCV store a file larger(kB) than the original?

元气小坏坏 提交于 2021-02-10 14:13:13
问题 I have code that loads and saves the image in two different ways - first using openCV, the second using PIL. import cv2 from PIL import Image img = cv2.imread("/home/myname/png/image.png") cv2.imwrite("/home/myname/png/image_save.png", img) img = Image.open("/home/myname/png/image.png") img.save("/home/myname/png/image_save_pil.png") The original image is 204.6 kB in size. The result obtained with openCV is 245.0 kB, the result of PIL is 204.6 kB. Why does the image saved with openCV have a

How to pass image frames camera to a function in wasm (C++)?

北慕城南 提交于 2021-02-10 13:21:57
问题 I'm trying to build a C++ function and compile it to Wasm using Emscripten. What this function will do is receive an image and do some process on it and return a result. My first POC was successful, the user upload image using file input and I pass the data of the image using FileReader API: const fileReader = new FileReader(); fileReader.onload = (event) => { const uint8Arr = new Uint8Array(event.target.result); passToWasm(event.target.result); }; fileReader.readAsArrayBuffer(file); // I got

OpenCV C++ how to know the number of contours per row for sorting?

最后都变了- 提交于 2021-02-10 12:36:12
问题 I have a binary image: In this image I can easily sort the contours that I found from top to bottom and from left to right using the overloaded std::sort . I first sort from top to bottom via: sort(contours.begin(), contours.end(), top_to_bottom_contour_sorter()); Then I sort from left to right by: for (int i = 0; i < contours.size(); i = i + no_of_contours_horizontally) { sort(i, i + no_of_contours_horizontally, left_to_right_contour_sorter); } Where top_to_bottom and left_to_right are

OpenCV C++ how to know the number of contours per row for sorting?

我怕爱的太早我们不能终老 提交于 2021-02-10 12:34:51
问题 I have a binary image: In this image I can easily sort the contours that I found from top to bottom and from left to right using the overloaded std::sort . I first sort from top to bottom via: sort(contours.begin(), contours.end(), top_to_bottom_contour_sorter()); Then I sort from left to right by: for (int i = 0; i < contours.size(); i = i + no_of_contours_horizontally) { sort(i, i + no_of_contours_horizontally, left_to_right_contour_sorter); } Where top_to_bottom and left_to_right are

How do I use the FPS argument in cv2.VideoWriter?

自作多情 提交于 2021-02-10 12:12:38
问题 Ok, so I am making a video. I want to know exactly how to use the FPS argument. It is a float, so I assumed it was what interval do I want between each frame. Can you give an example? I just want to know how the video would change with varying FPS argument values., because my video I made is way too fast now. Thanks! 回答1: It really is just that - frames per second . In other words, how many frames do you want to display every second? Here is an example: writer = cv2.VideoWriter(filename="my

Why the function cv2.HoughLinesP() has different effects?

徘徊边缘 提交于 2021-02-10 11:13:05
问题 I learn in this link. This is the original picture: My test code: import cv2 import numpy as np img = cv2.imread( 'E:/image/sudoku.png' ) gray = cv2.cvtColor( img,cv2.COLOR_BGR2GRAY ) edges = cv2.Canny( gray,50,150,apertureSize = 3 ) minLineLength = 100 maxLineGap = 10 lines = cv2.HoughLinesP( edges,1,np.pi/180,100,minLineLength,maxLineGap ) for line in lines: for x1,y1,x2,y2 in line: cv2.line( img,( x1,y1 ),( x2,y2 ),( 0,255,0 ),2 ) cv2.imwrite( 'E:/image/myhoughlinesp.jpg',img ) cv2.imshow(

Why the function cv2.HoughLinesP() has different effects?

前提是你 提交于 2021-02-10 11:11:10
问题 I learn in this link. This is the original picture: My test code: import cv2 import numpy as np img = cv2.imread( 'E:/image/sudoku.png' ) gray = cv2.cvtColor( img,cv2.COLOR_BGR2GRAY ) edges = cv2.Canny( gray,50,150,apertureSize = 3 ) minLineLength = 100 maxLineGap = 10 lines = cv2.HoughLinesP( edges,1,np.pi/180,100,minLineLength,maxLineGap ) for line in lines: for x1,y1,x2,y2 in line: cv2.line( img,( x1,y1 ),( x2,y2 ),( 0,255,0 ),2 ) cv2.imwrite( 'E:/image/myhoughlinesp.jpg',img ) cv2.imshow(