ओपनसीवी का फुल फॉर्म ओपन सोर्स कंप्यूटर विज़न है, इस लाइब्रेरी का उपयोग करके हम इमेज, वीडियो पर अलग-अलग ऑपरेशन कर सकते हैं।
OpenCV के अनुप्रयोग क्षेत्र
- चेहरे की पहचान प्रणाली
- मोशन ट्रैकिंग
- कृत्रिम तंत्रिका नेटवर्क
- डीप न्यूरल नेटवर्क
- वीडियो स्ट्रीमिंग वगैरह.
विंडोज़ पर इंस्टाल करने के लिए हम इस कमांड लाइन का उपयोग कर सकते हैं
पाइप ओपनसीवी-पायथन स्थापित करें
लिनक्स के लिए -
sudo apt-get install python-opencv
अपना कार्य पूरा करने के लिए हमें कुछ चरणों का पालन करना होगा -
Step 1: We import OpenCv library named cv2. Step 2: Take a video as input data. Step 3: First we break the video into a number of frames and store all these frames in a list. Step 4: When we are getting all the frames then we shall apply iteration method. Step 5: Here we apply iteration for reversing the list. Step 6: Use the reverse() method for reversing the order of the frames in the list.
उदाहरण कोड
import cv2
# Grab the current frame.
my_check , vid = cap.read()
# use counter variable for
# Counting frames
counter = 0
check = True
frame_list = []
while(check == True):
cv2.imwrite("frame%d.jpg" %counter , vid)
check , vid = cap.read()
frame_list.append(vid)
# increment the counter by 1
counter += 1
frame_list.pop()
# looping in the List of frames.
for frame in frame_list:
# show the frame.
cv2.imshow("Frame" , frame)
if cv2.waitKey(25) and 0xFF == ord("q"):
break
cap.release()
# close any open windows
cv2.destroyAllWindows()
frame_list.reverse()
for frame in frame_list:
cv2.imshow("Frame" , frame)
if cv2.waitKey(25) and 0xFF == ord("q"):
break
cap.release()
cv2.destroyAllWindows() आउटपुट
