So the question is y python , i got bored with java and have been doing java
programming for years ,my friend sugggested to learn python thats it.
python is interesting ...
Here comes playing with open cv ,using which u can actually play with images ,
videos and via ur web cam.
So here s the code to use open cv to load img and video.
before that u need to install
python 3.7
open cv
numpy
before that check the python installation is working fine .
go to installation folder in windows AppData\Local\Programs\Python\Python37
open command prompt
cmd>python
this should give u the version like this
Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:57:15) [MSC v.1915 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
u can refer this for open cv and python tutorials -https://opencv.org/about.html
if u want to try out with different language say java u can find the tutorials too.
import cv2
import numpy as np
cap =cv2.VideoCapture(0) -- 0 is for video camera 1
while True:
ret, frame = cap.read()
grey = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.imshow('grey', grey)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
programming for years ,my friend sugggested to learn python thats it.
python is interesting ...
Here comes playing with open cv ,using which u can actually play with images ,
videos and via ur web cam.
So here s the code to use open cv to load img and video.
before that u need to install
python 3.7
open cv
numpy
before that check the python installation is working fine .
go to installation folder in windows AppData\Local\Programs\Python\Python37
open command prompt
cmd>python
this should give u the version like this
Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:57:15) [MSC v.1915 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
then try to install 'pip ' which is required to install all dependencies.
once pip is installed -
u can find pip inside this location.
AppData\Local\Programs\Python\Python37\Scripts
open command prompt
cmd>pip install numpy
this should install numpy.
similar fashion install required dependencies.
Then open up python editor ,in this case im using pyton IDLE
just type - import cv2 >>
then import numpy >>
if u dont get errors u can start programming ,otherwise
try to resolve the errors and then proceed.
if u want to try out with different language say java u can find the tutorials too.
import cv2
import numpy as np
cap =cv2.VideoCapture(0) -- 0 is for video camera 1
while True:
ret, frame = cap.read()
grey = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.imshow('grey', grey)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
Comments
Post a Comment