Data Analysis

Go to Problems

OpenCV

OpenCV is an open-source programming library/package that has been created especially for allowing programmers to work with the world of Computer Vision. The OpenCV package was primarily developed by Intel Corporation.  OpenCV stands for Open-Source Computer Vision (Library). Firstly import cv2. It is a cross-platform library using which we can develop real-time computer vision applications. The main focus, but not limited to, is on image processing, video capture, and analysis including features like face detection and object detection.

 

To begin with, for loading an image into our system RAM (Random Access Memory), we can use the imread() method provided by OpenCV, as shown below.

import cv2
image =cv2.imread("location_of_image")
cv2.imshow('InterviewBit Computer Vision', image)
cv2.waitkey(“1”) # This displays the image indefinitely till you cut the window or press any key


You can read the image with the cv2.imread( ) function and the functioncv2. The  imshow() function is used to display the current image on the screen (in google colab this will be cv2_imshow imported from google.colab.patches).

 

cv2.VideoCapture(0)  function captures video from the computer’s camera. The parameter 0 here is for accessing the camera connected to your computer.

 

ret, frame = capture.read() 

 

is used in order to see the images we captured in the video. Because videos consist of frames here we will read the captured image and then return that image.

(B, G, R) = image[h,w] # here we are extracting the RGB values of a pixel at h,w for height and width.
resized_image = cv2.resize(image, (1000, 200)) 

using this function we can resize the dimensions of an image here as we are resizing here to new dimensions.

We can also rotate an image after generating a 2dmatrix. getRotationMatrix2D() function returns a 2*3 matrix and warpAffline() calculates new x, y coordinates of the image and transforms it. You can try out these functions, along with multiple others, and see how it affects the image.




Serious about Learning Data Science and Machine Learning ?

Learn this and a lot more with Scaler's Data Science industry vetted curriculum.
Vector analysis (numpy)
Problem Score Companies Time Status
find the one 30
2:22
choose the output 30
4:00
python broadcasting 30
4:37
How not to retrieve? 30
4:50
Fill Infinite 30
2:19
Duplicates detection 50
29:27
Row-wise unique 50
28:34
Data handling (pandas)
Problem Score Companies Time Status
For 'series' 30
4:38
drop axis 30
1:46
Rename axis 30
1:58
iloc vs loc part I 30
1:39
As a Series 50
21:51
Max registrations they asked? 50
45:12
Basic computer vision (opencv)
Problem Score Companies Time Status
Which library it is? 30
0:48
Image dimensions 30
1:33
Dimension with components 30
1:07
Color interpretation 30
1:54
Image cropping 30
2:00
Data visualization (matplotlib)
Problem Score Companies Time Status
2d graphics 30
0:39
Suitable plot type 30
1:20
Subplot Coordinates 30
3:50
Vertically Stacked Bar Graph 30
3:22
Load RGB 30
2:15
Web scraping basics
Problem Score Companies Time Status
What does the code do? 30
2:35
Retrieval protocol 30
1:36
2-way communication 30
0:54
Search engine process 30
1:28
What does the code print? 30
1:17
Eda
Problem Score Companies Time Status
PCA's secondary objective 30
1:31
Five number theory 30
1:28