opencv-python

OpenCV: using Canny and Shi-Tomasi to detect round corners of a playing card

喜夏-厌秋 提交于 2021-01-27 11:38:06
问题 I want to do some planar rectification, to convert from left to right: I have the code to do the correction, but I need the 4 corner coords. I'm using the following code to find them: import cv2 image = cv2.imread('input.png') gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) canny = cv2.Canny(gray, 120, 255, 1) corners = cv2.goodFeaturesToTrack(canny,4,0.5,50) for corner in corners: x,y = corner.ravel() cv2.circle(image,(x,y),5,(36,255,12),-1) cv2.imshow("result", image) cv2.waitKey() It reads

Extract boxes from sudoku in opencv [duplicate]

旧城冷巷雨未停 提交于 2021-01-24 12:03:10
问题 This question already has answers here : How to get the cells of a sudoku grid with OpenCV? (3 answers) Closed 8 days ago . i have converted sudoku image into sudoku grid using opencv now i want to extract each box from image what is best way to do this? as per my knowledge i am trying to find intersection points of lines to find corner of each box class SudokuSolverPlay: def __init__(self, image): def __preProcess(self, img): """return grayscale image""" def __maskSudoku(self, img): ""

Extract boxes from sudoku in opencv [duplicate]

江枫思渺然 提交于 2021-01-24 12:01:32
问题 This question already has answers here : How to get the cells of a sudoku grid with OpenCV? (3 answers) Closed 8 days ago . i have converted sudoku image into sudoku grid using opencv now i want to extract each box from image what is best way to do this? as per my knowledge i am trying to find intersection points of lines to find corner of each box class SudokuSolverPlay: def __init__(self, image): def __preProcess(self, img): """return grayscale image""" def __maskSudoku(self, img): ""

openCV imshow fails randomly

限于喜欢 提交于 2020-08-20 05:38:09
问题 When I want to display an image, the cv2.imshow() fails randomly. import cv2 frame = cv2.imread('desk.jpg', cv2.IMREAD_COLOR) cv2.imshow('test', frame) cv2.waitKey(0) cv2.destroyAllWindows() Sometimes, I got the first and sometimes the second: I'm sure that the data is correctly loaded because when I print the frame matrix, everything is ok. I also tried to convert picture to other format but the result is always the same, random. >>> cv2.__version__ '4.3.0' # opencv-contrib-python is

No latest (4.3.0.) openCV library in opencv-python via PIP

泪湿孤枕 提交于 2020-08-10 22:10:06
问题 Im using PyCharm to connect libraries but suppose is similar to using pip install opencv-python Pycharm shows version 4.2.0.34 for opencv-python library when actual is 4.3.0 going to https://pypi.org/project/opencv-python/ i see only i see 4.2.0 version only. Going to https://github.com/skvark/opencv-python I can see it was updated two month ago when 4.3 is out and even I can see some note of 4.3. But Python shows version 4.2.0.34 and features of version 4.3.0 are not working. Am I doing