I’m a newby interested in learning how to use opencv and python programming
I’m trying to learn how to capture the coordinates (x and y points) of the start and finish of a grid of vertical and horizontal lines drawing in a picture and then store those coordinates in a text file for use by another program. Outline of Logic;- import cv2 import numpy as np ) Read-in the picture to an image im = cv2.imread ('grid1.jpg') ( the picture can be a simple grid of black lines on a white background, so it may not be necessary to process it to clarify the lines) ) Scan the image find the lines ?? ) Identify, or calculate the coordinates where the vertical and horizontal lines start and finish ?? ) Write the coordinate of each, one at a time, into a list ?? ) Write that list to a text file np.savetxt('output_file', list)
Can someone show some python code that would do that ?
I’ve started to read about some of the standard opencv library methods, such as the information about SimpleBlobDetector and FeatureDetector¶ provided at
http://docs.opencv.org/modules/features2d/doc/common_interfaces_of_feature_detectors.html#simpleblobdetector
and about moments at
http://docs.opencv.org/doc/tutorials/imgproc/shapedescriptors/moments/moments.html
python-opencv, finding centroid of an image but that information is beyond me at the moment ( and some of it is for C++, not for someone learning Python ) My environment setting are;- I’m using;- Opencv 2.4 Windows 7 Visual Studio 2013 express for Windows Desktop Anaconda Python 2.7
Many Thanks for your help