computer-vision

Select a static ROI on webcam video on python openCV

让人想犯罪 __ 提交于 2021-02-08 08:21:27
问题 I need to selec a ROI (region of interest), or work area, on a live video from my webcam and take a snapshot of ONLY this work area or ROI, but I can't found how to do this. In this page https://www.learnopencv.com/how-to-select-a-bounding-box-roi-in-opencv-cpp-python/ have a code for draw a ROI but only with images, not a live video. import cv2 cam = cv2.VideoCapture(0) cam.set(cv2.CAP_PROP_FRAME_WIDTH, 1280) cam.set(cv2.CAP_PROP_FRAME_HEIGHT, 720) cv2.namedWindow("test") img_counter = 0

Select a static ROI on webcam video on python openCV

萝らか妹 提交于 2021-02-08 08:21:21
问题 I need to selec a ROI (region of interest), or work area, on a live video from my webcam and take a snapshot of ONLY this work area or ROI, but I can't found how to do this. In this page https://www.learnopencv.com/how-to-select-a-bounding-box-roi-in-opencv-cpp-python/ have a code for draw a ROI but only with images, not a live video. import cv2 cam = cv2.VideoCapture(0) cam.set(cv2.CAP_PROP_FRAME_WIDTH, 1280) cam.set(cv2.CAP_PROP_FRAME_HEIGHT, 720) cv2.namedWindow("test") img_counter = 0

What does disabling `CV_CAP_PROP_CONVERT_RGB` do?

放肆的年华 提交于 2021-02-08 07:28:37
问题 I'm attempting to get raw camera output with opencv. If I read an image normally I get a 640x480x3 image: >>> import cv2 >>> cap = cv2.VideoCapture(2) >>> _, im = cap.read() >>> im.shape (480, 640, 3) If I disable cv2.CAP_PROP_CONVERT_RGB then I get a strangely sized array, the end of which is always zeros: >>> cap.set(cv2.CAP_PROP_CONVERT_RGB, False) True >>> _, im = cap.read() >>> im.shape (1, 614400) >>> cv2.imshow('im', im.reshape((960, 640))); cv2.waitKey(0) The resulting 'image' is:

What does disabling `CV_CAP_PROP_CONVERT_RGB` do?

依然范特西╮ 提交于 2021-02-08 07:28:36
问题 I'm attempting to get raw camera output with opencv. If I read an image normally I get a 640x480x3 image: >>> import cv2 >>> cap = cv2.VideoCapture(2) >>> _, im = cap.read() >>> im.shape (480, 640, 3) If I disable cv2.CAP_PROP_CONVERT_RGB then I get a strangely sized array, the end of which is always zeros: >>> cap.set(cv2.CAP_PROP_CONVERT_RGB, False) True >>> _, im = cap.read() >>> im.shape (1, 614400) >>> cv2.imshow('im', im.reshape((960, 640))); cv2.waitKey(0) The resulting 'image' is:

What does the coordinate output of yolo algorithm represent?

戏子无情 提交于 2021-02-08 05:16:57
问题 My question is similar to this topic. I was watching this lecture on bounding box prediction by Andrew Ng when I started thinking about output of yolo algorithm. Let's consider this example, We use 19x19 grids and only one receptive field with 2 classes, so our output will be => 19x19x1x5. The last dimension(array of size 5) represents the following: 1) The class (0 or 1) 2) X-coordinate 3) Y-coordinate 4) height of the bounding box 5) Width of the bounding box I don't understand whether X,Y

How to remove watermark from text document using openCV python?

荒凉一梦 提交于 2021-02-07 21:14:30
问题 I am new to OpenCV, I need help removing the watermark from this image, I tried using inpaint but I want a more automated way of feature mapping and inpainting, pls help me with it. 回答1: If all your images are like this and have a watermark as shown in the question having a light gray watermark then a simple thresholding operation will work. import cv2 img = cv2.imread('watermark.jpg') _, thresh = cv2.threshold(img, 150, 255, cv2.THRESH_BINARY) cv2.imshow('Result', thresh) cv2.waitKey(0) cv2

How to remove watermark from text document using openCV python?

女生的网名这么多〃 提交于 2021-02-07 21:06:41
问题 I am new to OpenCV, I need help removing the watermark from this image, I tried using inpaint but I want a more automated way of feature mapping and inpainting, pls help me with it. 回答1: If all your images are like this and have a watermark as shown in the question having a light gray watermark then a simple thresholding operation will work. import cv2 img = cv2.imread('watermark.jpg') _, thresh = cv2.threshold(img, 150, 255, cv2.THRESH_BINARY) cv2.imshow('Result', thresh) cv2.waitKey(0) cv2

How to remove watermark from text document using openCV python?

两盒软妹~` 提交于 2021-02-07 21:05:23
问题 I am new to OpenCV, I need help removing the watermark from this image, I tried using inpaint but I want a more automated way of feature mapping and inpainting, pls help me with it. 回答1: If all your images are like this and have a watermark as shown in the question having a light gray watermark then a simple thresholding operation will work. import cv2 img = cv2.imread('watermark.jpg') _, thresh = cv2.threshold(img, 150, 255, cv2.THRESH_BINARY) cv2.imshow('Result', thresh) cv2.waitKey(0) cv2

OpenCV: Fitting a single circle to an image (in Python)

China☆狼群 提交于 2021-02-07 19:46:25
问题 I have an image like this: I need to fit an ellipse to the dark area (note: must be an ellipse, not a circle). What is the best way to do this in OpenCV? My first step so far has been to apply an adaptive (Otsu) threshold to it, which results in: But I'm not sure where to go from there. I'm writing the app in Python, but it's more the algorithm design I'm looking for. EDIT based on response/comment: OK, so I have already tried the morphology. Based on the OpenCV documentation, I did a 3

OpenCV: Error when using function cvGoodFeaturesToTrack

眉间皱痕 提交于 2021-02-07 13:59:30
问题 When I call the function cvGoodFeaturesToTrack to find Harris corners I get this error: OpenCV Error: Assertion failed (src.type() == CV_8UC1 || src.type() == CV_32FC1) in cornerEigenValsVecs, file /build/buildd/opencv-2.1.0/src/cv/cvcorner.cpp,line 254 terminate called after throwing an instance of 'cv::Exception' what(): /build/buildd/opencv-2.1.0/src/cv/cvcorner.cpp:254: error: (-215) src.type() == CV_8UC1 || src.type() == CV_32FC1 in function cornerEigenValsVecs Aborted It compiles