computer-vision

Detect number of rows and columns in table image with OpenCV

天涯浪子 提交于 2021-02-18 17:12:40
问题 How can we get the number of rows and columns in an Image table via Opencv. Code for getting boxes in table which I am getting right contours, hierarchy = cv2.findContours(img_final_bin, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) def sort_contours(cnts, method="left-to-right"): # initialize the reverse flag and sort index reverse = False i = 0 # handle if we need to sort in reverse if method == "right-to-left" or method == "bottom-to-top": reverse = True # handle if we are sorting against the y

Detect number of rows and columns in table image with OpenCV

社会主义新天地 提交于 2021-02-18 17:07:13
问题 How can we get the number of rows and columns in an Image table via Opencv. Code for getting boxes in table which I am getting right contours, hierarchy = cv2.findContours(img_final_bin, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) def sort_contours(cnts, method="left-to-right"): # initialize the reverse flag and sort index reverse = False i = 0 # handle if we need to sort in reverse if method == "right-to-left" or method == "bottom-to-top": reverse = True # handle if we are sorting against the y

how to segment the connected area based on depth color in opencv

拜拜、爱过 提交于 2021-02-18 06:33:38
问题 I have a picture like , which i need to segment the picture into 8 blocks. I have tried this threshold method img_gray = cv2.imread(input_file,cv2.IMREAD_GRAYSCALE) ret,thresh = cv2.threshold(img_gray,254,255,cv2.THRESH_BINARY) = kernel = np.array(cv2.getStructuringElement(cv2.MORPH_RECT, (3, 3), (-1, -1))) img_open = cv2.morphologyEx(thresh, cv2.MORPH_OPEN, kernel) cv2.imshow('abc',img_open) ret1,thresh1 = cv2.threshold(img_open,254,255,cv2.THRESH_BINARY_INV) # contours, hierarchy = cv2

Efficiently converting color to transparency in python

余生颓废 提交于 2021-02-16 18:13:25
问题 GIMP has a convenient function that allows you to convert an arbitrary color to an alpha channel. Essentially all pixels become transparent relative to how far away from the chosen color they are. I want to replicate this functionality with opencv. I tried iterating through the image: for x in range(rows): for y in range(cols): mask_img[y, x][3] = cv2.norm(img[y, x] - (255, 255, 255, 255)) But this is prohibitively expensive, it takes about 10 times longer to do that iteration than it takes

Reducing misses on template matching (using transparent template)

时光怂恿深爱的人放手 提交于 2021-02-11 17:14:10
问题 I'm trying to determine the position of puzzle piece on a puzzle image. I have an image of a puzzle piece (transparent png) an image of a puzzleboard whith a white outline around the correct position Firstly i extract the contour on image 1. and use it to draw my final template. Then i match the final template to the puzzleboard and save some result images. Here are some examples of the results i'm getting https://imgur.com/a/ZYyw7tU On some of the images, there's clearly a lot of mismatches

Reducing misses on template matching (using transparent template)

扶醉桌前 提交于 2021-02-11 17:14:00
问题 I'm trying to determine the position of puzzle piece on a puzzle image. I have an image of a puzzle piece (transparent png) an image of a puzzleboard whith a white outline around the correct position Firstly i extract the contour on image 1. and use it to draw my final template. Then i match the final template to the puzzleboard and save some result images. Here are some examples of the results i'm getting https://imgur.com/a/ZYyw7tU On some of the images, there's clearly a lot of mismatches

Temporal filtering on depth image

前提是你 提交于 2021-02-11 15:08:36
问题 I'm reading the following paper and I'm trying to implement it, but it seems I'm not understanding fully the paper. https://vcg.informatik.uni-rostock.de/~malub/publications/2016_depthenhance/16_ARLS_depthenhancement.pdf I have calculated optical flow and some history of the depth images, and took the a linear average over the history samples as shown in the shader code. What I get is an image that has holes however the original one doesn't have any holes. Current filtered image Shader

TypeError: cannot unpack non-iterable numpy.float64 object

蹲街弑〆低调 提交于 2021-02-11 14:40:46
问题 The below piece of code uses openCV module to identify lanes on road. I use the python 3.6 for coding (I use atom IDE for development. This info is being provided because stackoverflow isn't letting me post the info without unnecessary lines of info. so please ignore the comments in bracket) The code runs fine with a given sample video. But when I run it for another video it throws the following error: (base) D:\Self-Driving course\finding-lanes>RayanFindingLanes.py C:\Users\Tarun\Anaconda3

How do you redistort a point?

谁说我不能喝 提交于 2021-02-11 12:42:46
问题 I have a distorted image on which I use Cv2.Undistort() which straightens it out. After this I find some points in the image. I need to get the location of those points in the distorted image. I have tried Cv2.ProjectPoints() but failed to get appropriate coordinates. They were outside the bounds of the image. This is how I went about doing this: List<float> arr = new List<float>(); foreach (var i in points) { arr.Add(i.X); arr.Add(i.Y); arr.Add(0); } Mat pointArr = new Mat(3, points.Count,

Is there a way to generate real time depthmap from single camera video in python/opencv?

蓝咒 提交于 2021-02-11 12:23:25
问题 I'm trying to convert single images into it's depthmap , but I can't find any useful tutorial or documentation. I'd like to use opencv, but if you know a way to get the depth map using for example tensorflow, I'd be glad to hear it. There are numerous tutorials for stereo vision but I want to make it cheaper because it's for a project to help blind people. I'm currently using esp32 cam to stream frame by frame and receiving the images on python using opencv. 回答1: Usually, we need a