├── Python └── Opencv │ ├── basic_to_read_image.py │ ├── color_detection.py │ ├── face_detection.py │ ├── images │ └── nature.jpg │ └── open_camera.py ├── R language └── R basics.R └── README.md /Python/Opencv/basic_to_read_image.py: -------------------------------------------------------------------------------- 1 | import cv2 2 | 3 | img = cv2.imread('files/nature.jpg',1) 4 | img = cv2.resize(img,(700,700)) 5 | img = cv2.rotate(img, cv2.ROTATE_90_CLOCKWISE) 6 | 7 | 8 | cv2.imshow('Image', img) 9 | 10 | cv2.waitKey(0) 11 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /Python/Opencv/color_detection.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import cv2 3 | 4 | cap = cv2.VideoCapture(0) 5 | 6 | while True: 7 | ret, frame = cap.read() 8 | width = int(cap.get(3)) 9 | height = int(cap.get(4)) 10 | 11 | hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV) 12 | 13 | cv2.imshow('frame', hsv) 14 | 15 | if cv2.waitKey(1) == ord('q'): 16 | break 17 | 18 | cap.release() 19 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /Python/Opencv/face_detection.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import cv2 3 | 4 | cap = cv2.VideoCapture(0) 5 | face_cascade = cv2.CascadeClassifier(cv2.data.haarcascades + 'haarcascade_frontalface_default.xml') 6 | 7 | 8 | while True: 9 | ret, frame = cap.read() 10 | 11 | gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) 12 | faces = face_cascade.detectMultiScale(gray, 1.3, 5) 13 | for (x, y, w, h) in faces: 14 | cv2.rectangle(frame, (x, y), (x + w, y + h), (255, 0, 0), 5) 15 | roi_gray = gray[y:y+w, x:x+w] 16 | roi_color = frame[y:y+h, x:x+w] 17 | 18 | 19 | cv2.imshow('frame', frame) 20 | 21 | if cv2.waitKey(1) == ord('q'): 22 | break 23 | 24 | cap.release() 25 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /Python/Opencv/images/nature.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BarathkumarJK/programming-languages/44290e8264ba33017943533e33cc2d42e5d6bc72/Python/Opencv/images/nature.jpg -------------------------------------------------------------------------------- /Python/Opencv/open_camera.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import cv2 3 | 4 | cap = cv2.VideoCapture(0) 5 | 6 | while True: 7 | ret, frame = cap.read() 8 | 9 | cv2.imshow('frame',frame) 10 | 11 | if cv2.waitKey(1) == ord('q'): 12 | break 13 | 14 | cap.release() 15 | cv2.destroyAllWindows() 16 | -------------------------------------------------------------------------------- /R language/R basics.R: -------------------------------------------------------------------------------- 1 | print("Barathkumar") 2 | 3 | a=10 4 | print(a) #simple assignment 5 | a 6 | 7 | b<-100 #leftward assignment 8 | b 9 | 10 | 800->c #rightward assignment 11 | c 12 | 13 | 14 | #Arithmetic calculatons 15 | a<-100 16 | b=555 17 | a+b #Addition 18 | a-b #subraction 19 | a*b #multiplicaiton 20 | b/a #Division 21 | b%/%a #Quotient 22 | 23 | a=100 24 | b=30 25 | c=10 26 | ls() #listing the variable 27 | 28 | rm(b) #removing the variable 29 | ls() 30 | 31 | #Vectors or Data type 32 | vnum<- c(22.5,5,222) #numeric 33 | typeof(vnum) 34 | 35 | vint<- c(2L,3L,8L) #integer 36 | typeof(vint) 37 | 38 | vch<- c('a',"good", "TRUE",'23.4') #character 39 | typeof(vch) 40 | 41 | vcom<- c(3+2i, 4+5i) #complex 42 | typeof(vcom) 43 | 44 | vlog<-TRUE #logical 45 | typeof(vlog) 46 | is.logical(vlog) 47 | 48 | 49 | num<- c(55,66,88.8) 50 | is.numeric(num) # To find the data is numeric 51 | 52 | #Typecasting 53 | OTP<- c("505512","600612","702541") 54 | OTP<- as.numeric(OTP) 55 | OTP 56 | 57 | 58 | #Accessing the vector 59 | strname<-c("Ashwin","Babu","Bharathraj","Chandesh","Deepak","Gowtham","Jana","Karthick") 60 | strname[1] 61 | strname[2:5] 62 | 63 | #Appending the vector 64 | month<- c("January","Feburary","May","June") 65 | full_month<- c("March","April") 66 | total<-c(month,full_month) 67 | total 68 | 69 | #1.Removing a single vector 70 | month<- c("January","Feburary","May","June") 71 | full_month<- c("March","April") 72 | total<-c(month[c(1,2,3)],full_month) 73 | total 74 | 75 | #2.Removing a single vector 76 | month<- c("January","Feburary","May","June") 77 | full_month<- c("March","April") 78 | total<-c(month[-3],full_month) 79 | total 80 | length(total) 81 | 82 | #Vector Arithmetic 83 | number1 <- 1:10 84 | number2 <- 11:20 85 | number1*2 86 | number1*number2 87 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Programming-languages 2 | --------------------------------------------------------------------------------