OpenCV

Trying to segment characters using opencv - Contour problem

瘦欲@ 提交于 2020-12-15 05:26:36
问题 My code is detecting another box when there is no letter! # Create sort_contours() function to grab the contour of each digit from left to right def sort_contours(cnts,reverse = False): i = 0 boundingBoxes = [cv2.boundingRect(c) for c in cnts] (cnts, boundingBoxes) = zip(*sorted(zip(cnts, boundingBoxes), key=lambda b: b[1][i], reverse=reverse)) return cnts cont, _ = cv2.findContours(thre_mor, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) # creat a copy version "test_roi" of plat_image to draw

How to construct boost spsc_queue with runtime size parameter to exchange cv::Mat objects between two processes using shared memory?

醉酒当歌 提交于 2020-12-15 05:21:27
问题 Trying to implement a produced consumer scenario where one process feeds cv::Mat objects into a queue buffer. And the consumer consumes them. cv::Mat has a settable allocator that can be implemented for custom memory management, but I had no success in making it work. Popping from the que on consumer side led to segfaults. The closest I've got is this implementation whwre cv::Mat is serialized and deserialized. Another downside of this implementation is buffer size is defined during

How to delete the other object from figure by using opencv?

旧城冷巷雨未停 提交于 2020-12-15 05:18:07
问题 I tried to detect the yellow lines in the following picture but the logo(yellow color) will be marked as well. My question is that how to mask the logo? I use the standard code of the Hough Transform. My code is as follows: import cv2 import numpy as np img = cv2.imread('Road3.jpg') hsv = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) low_yellow=np.array([18, 94, 140]) up_yellow=np.array([48, 255, 255]) mask=cv2.inRange(hsv, low_yellow, up_yellow) edges = cv2.Canny(mask,75,150) lines = cv2.HoughLinesP

Object dimension measurement

血红的双手。 提交于 2020-12-15 04:54:12
问题 The following image is of a coin (for reference) and a pill. I need to measure the pill's dimensions. The objects are back-illuminated. I followed pyimagesearch.com tutorial for object height and width measurement. The coin has a diameter of 24.97 mm, and the actual dimensions of the pill are 9.43 mm x 19.33 mm. I am getting results with some error ranging from 0.5 mm to 2 mm. As mentioned on the website this is because of distortion and it is to be corrected. Can someone help me in

OpenCV - Blob/ Defect/ Anomaly Detection - Continued - Draw Contours

谁说胖子不能爱 提交于 2020-12-15 03:43:40
问题 OpenCV - Blob/ Defect/ Anomaly Detection If you need the image it's in the original link above. My current code is as follows, import cv2 import numpy as np import imutils # Read in the image in YCrCb, also show default img = cv2.imread('/home/pi/Downloads/divot1.jpeg', cv2.IMREAD_COLOR) imgS = cv2.resize(img, (768, 1024)) aimg = cv2.imread('/home/pi/Downloads/divot1.jpeg', cv2.COLOR_BGR2YCrCb) blur = cv2.blur(aimg,(6,6)) rblur = cv2.resize(blur, (384, 512)) #Statistics based approach mean =

Output of projectPoints() function

烂漫一生 提交于 2020-12-15 03:43:35
问题 i used projectPoints() function of OpenCV to do projection from world coordinates to pixel coordinates, the output image points are vector point2f, how can I extract the x,y coordinates from imagePoints? seconde question, some of the imagePoints are negative like below: I just project 2 points and these are the results [[[-37.95361728 316.5438248 ]] [[204.89090594 316.5144533 ]]] if I show these coordinates without the negative sign on the image it is correct first why i get a negative sign

Windows环境中编译opencv3.0同时加入OPENCV_contrib库及解决遇到相关问题[contrib 必须要3.1以上的opencv才支持了]

最后都变了- 提交于 2020-12-14 10:33:25
Windows环境中编译opencv3.0同时加入OPENCV_contrib库及解决遇到相关问题[contrib 必须要3.1以上的opencv才支持了] 参考文章: (1)Windows环境中编译opencv3.0同时加入OPENCV_contrib库及解决遇到相关问题[contrib 必须要3.1以上的opencv才支持了] (2)https://www.cnblogs.com/Geo-fortune/p/4822997.html 备忘一下。 来源: oschina 链接: https://my.oschina.net/u/4406565/blog/4795043

SIFT & SURF : Set OPENCV_ENABLE_NONFREE CMake ==> Solution OpenCV 3 & OpenCV 4 [closed]

五迷三道 提交于 2020-12-14 06:24:12
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed last month . Improve this question I try to use the SIFT and SURF function with some of the versions of OpenCV 3 and openCV 4 (after having installed opencv-contrib-python) with: pip install opencv-contrib-python i try version 3.4.3 and 3.4.9 and 4.1.0, but have same probleme: sift = cv2.xfeatures2d.SIFT_create(

How to locate pixel coordinates of a rectangle using Opencv?

走远了吗. 提交于 2020-12-13 11:27:45
问题 I'm making this Question because when I was editing my answer in the original post it was deleted. The original question was: I'm trying to get the pixel coordinates of the green rectangle on the image below. I suppose it's possible using OpenCV. (i blurred all private details) 回答1: I had to make sure that the rectangle was totally green by using the Chrome color picker. As the color is in hex format #00FF00, which is equivalent to RGB notation RGB(0, 255, 0). But in OpenCV the color is

Running OpenMP with different version of g++ in Mac

丶灬走出姿态 提交于 2020-12-13 11:23:28
问题 I recently installed OpenMP on my macOS high Sierra using brew. I can easily run code that has OpenMP directives using g++-9 (similar to what was suggested in the answer here: Using OpenMP with C++11 on Mac OS ) . However, I need to add OpenMP functionality to a project that uses OpenCV, and I can only compile that with regular g++ ( g++ —version shows it’s 4.2.1) . I do not intend to use any OpenCV built-in algorithms that may use OpenMP, simply want to use them separately in the same