Using open cv it can be done easily. first you have to install opencv into your system.
open terminal or command prompt and write bellow command without double quotes : pip install opencv
After writing this command opencv will be installed into your system.
import numpyimport cv2img = "imagename.png" # write here your image name with extension
imgread = cv2.imread(img, 0) #
imgtxt = numpy.savetxt("outputfile.txt", imgread)
Using opencv we are reading the image ------- cv2.imread(imagelocation , mode).
Here numpy which is a library of python is used to save image in text
mode -----------numpy.savetxt("outputfilelocation,image_read_by_imread).
No comments:
Post a Comment