Skip to content

Commit

Permalink
opencv programs
Browse files Browse the repository at this point in the history
  • Loading branch information
rakeshlinux committed Feb 3, 2021
1 parent a571c89 commit 52734e1
Show file tree
Hide file tree
Showing 14 changed files with 71 additions and 2 deletions.
2 changes: 1 addition & 1 deletion PracticalFileQuestion/Q16.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def line_count():
for line in file.readlines():
if line[0]=='P' or line[0]=='S':
count+=1
print(line)
#print(line)
file.close()
print('Total lines :',count)

Expand Down
Binary file modified PracticalFileQuestion/binary.dat
Binary file not shown.
3 changes: 3 additions & 0 deletions PracticalFileQuestion/list_reverse.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
list1 =['rakesh','is','a','good','boy']
list2= list1[-1:0:-1]
print(list2)
5 changes: 5 additions & 0 deletions PracticalFileQuestion/reverse_text.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
file = open('C:/python/PracticalFileQuestion/diary.txt', 'r')
data = file.read().split()
for x in data[-1:0:-1]:
print(x[-1::-1], end=' ')
file.close()
1 change: 1 addition & 0 deletions PracticalFileQuestion/student.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
2,anmol,11
3,subodh,10
4,ravi,10
6,govind,20
6 changes: 5 additions & 1 deletion PracticalFileQuestion/tempCodeRunnerFile.py
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
temp = list1[i]
file = open('C:/python/PracticalFileQuestion/diary.txt', 'r')
data = file.read().split()
for x in data[-1:0:-1]:
print(x[-1::-1], end=' ')
file.close()
11 changes: 11 additions & 0 deletions Projects/md5_generator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import hashlib
import base64

text = 'This is me and this is my forst attempt in md5'
md_result = hashlib.md5(text.encode())
base64_result = base64.b64encode(text.encode())
sha384_result = hashlib.sha384(text.encode())

print(md_result.hexdigest())
print(base64_result.hex())
print(sha384_result.hexdigest())
9 changes: 9 additions & 0 deletions opencv_project/capture_camera.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import cv2
capture = cv2.VideoCapture(1)

while True:
ret, frame = capture.read(1)
cv2.imshow('image',frame)
if cv2.waitKey(1) & 0xFF==ord('q'):
break
capture.release()
10 changes: 10 additions & 0 deletions opencv_project/draw_shapes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import cv2
image = cv2.imread('walter.jpg',1)
cv2.line(image,(0,0),(400,400),(255,0,0),5)
cv2.rectangle(image,(100,200),(400,400),(0,255,0),10)
cv2.circle(image,(200,200),100,(0,0,255),-8)
font = cv2.FONT_HERSHEY_COMPLEX
cv2.putText(image,'Hello rakesh',(150,250),font,2,(255,255,0),cv2.LINE_8)
cv2.imshow('image',image)
cv2.waitKey(0)
cv2.destroyAllWindows()
4 changes: 4 additions & 0 deletions opencv_project/manipulating_pixel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import cv2

image =cv2.imread('walter.jpg',1)
print(image)
15 changes: 15 additions & 0 deletions opencv_project/mouse_event.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import cv2

def draw_circle(event,x,y,flag,param):
if event ==cv2.EVENT_LBUTTONDBLCLK :
cv2.circle(image,(x,y),100,(255,0,0),-1)

image = cv2.imread('walter.jpg',1)
cv2.namedWindow('image')
cv2.setMouseCallback('image',draw_circle)

while True:
cv2.imshow('image',image)
if cv2.waitKey(20) & 0xFF==27:
break
cv2.destroyAllWindows()
7 changes: 7 additions & 0 deletions opencv_project/read_image.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import cv2

image = cv2.imread('walter.jpg',1)
cv2.imshow('windows',image)
cv2.waitKey(3000)
cv2.imwrite('walter-1.png',image)
cv2.destroyAllWindows()
Binary file added walter-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes

0 comments on commit 52734e1

Please sign in to comment.