Skip to content

Commit

Permalink
Compression Added
Browse files Browse the repository at this point in the history
  • Loading branch information
JEGADESH312 authored Jan 27, 2022
1 parent 61d182e commit 188b062
Showing 1 changed file with 8 additions and 24 deletions.
32 changes: 8 additions & 24 deletions video_Streaming.py
Original file line number Diff line number Diff line change
@@ -1,38 +1,22 @@
import cv2

class Video(object):
def __init__(self):
self.video=cv2.VideoCapture(0)
self.count=0
def __del__(self):
self.video.release()
def get_frame(self):
ret,frame=self.video.read()
ret,jpg=cv2.imencode('.jpg',frame)
ret,frame=self.video.read()
ret,jpg=cv2.imencode('.jpg',frame,Compress(50))
self.count +=1

return jpg.tobytes()





def Compress(value):
return [int(cv2.IMWRITE_JPEG_QUALITY), value]




# import fractions
# import cv2

# video=cv2.VideoCapture(0)

# faceDetect=cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
# print(faceDetect)
# while True:
# ret,frame=video.read()
# print(ret)
# positions=faceDetect.detectMultiScale(frame,1.3,5)
# for x,y,w,h in positions:
# cv2.rectangle(frame,(x,y),(x+w,y+h),(255,0,255),2)
# cv2.imshow('Frame',frame)
# k=cv2.waitKey(1)
# if k==ord('q'):
# break
# video.release()
# cv2.destroyAllWindows()

0 comments on commit 188b062

Please sign in to comment.