Uploaded by ahmed abd elhamed

New Text Document (2)

advertisement
shape
import cv2
img1 = cv2.imread('watch.JPG')
print("shape :",img1.shape)
print("size:",img1.size)
print("type:",img1.dtype)
cv2.imshow("img",img1)
cv2.waitKey(0)
cv2.destroyAllWindows()---------------
-----------------------------------------------------
---------------------------------------------------
resizing
import cv2
img1 = cv2.imread('watch.JPG')
resized=cv2.resize(img1,(100,100))
cv2.imshow('image', resized)
cv2.waitKey(0)
cv2.destroyAllWindows()
------------------------------------------------------------------------------------------------------------------------------------------------------
keboard import cv2
img1 = cv2.imread('watch.JPG')
cv2.imshow("image",img1)
k=cv2.waitKey(0)
if k=='27':
cv2.destroyAllWindows()
elif k==ord('s') :
cv2.imwrite('watch.png',img1)
cv2.destroyAllWindows()
---------------------------------------------------------------------------------------------------------------------------
drawing
import cv2
img1 = cv2.imread('watch.JPG')
output =img1.copy()
cv2.rectangle(output,(500,500),(300,200),(0,0,255),3)
cv2.imshow("output",output)
cv2.waitKey(0)
cv2.destroyAllWindows(
------------------------------------------------------------------------------------------------------------------------------------------------------------
crop
import cv2
img1 = cv2.imread('watch.JPG')
output =img1.copy()
cv2.rectangle(output,(500,500),(300,200),(0,0,255),3)
cv2.imshow("output",output)
cv2.waitKey(0)
cv2.destroyAllWindows()
-----------------------------------------------------------------------------------------------------
reading import cv2
img1 = cv2.imread('watch.JPG',0)
cv2.imshow('image',img1)
cv2.waitKey(0)
cv2.destroyAllWindows()
-----------------------------------------------
Download
Random flashcards
Radioactivity

30 Cards

Nomads

17 Cards

Marketing

46 Cards

Create flashcards