-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOpenCVRnS2-Spyder.py
More file actions
31 lines (27 loc) · 875 Bytes
/
Copy pathOpenCVRnS2-Spyder.py
File metadata and controls
31 lines (27 loc) · 875 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 25 22:19:15 2019
@author: asus
"""
import cv2
def main():
imgpath="D:\\CODES\\OpenCV3\\DataSets\\4.1.01.tiff"
img1=cv2.imread(imgpath, 1)
img2=cv2.imread(imgpath, 0)
img3=cv2.imread(imgpath, -1)
cv2.namedWindow('Pic1', cv2.WINDOW_AUTOSIZE)
cv2.namedWindow('Pic0', cv2.WINDOW_AUTOSIZE)
cv2.namedWindow('Pic-1', cv2.WINDOW_AUTOSIZE)
cv2.imshow('Pic1', img1)
cv2.imshow('Pic0', img2)
cv2.imshow('Pic-1', img3)
outpath="D:\\CODES\\OpenCV3\\OUTPUT\\4.1.01.1.jpg"
cv2.imwrite(outpath, img1)
outpath="D:\\CODES\\OpenCV3\\OUTPUT\\4.1.01.0.jpg"
cv2.imwrite(outpath, img2)
outpath="D:\\CODES\\OpenCV3\\OUTPUT\\4.1.01.-1.jpg"
cv2.imwrite(outpath, img3)
cv2.waitKey(0)
cv2.destroyAllWindows()
if __name__ == "__main__":
main()