Practice
Resources
Contests
Online IDE
New
Free Mock
Events New Scaler
Practice
Improve your coding skills with our resources
Contests
Compete in popular contests with top coders
logo
Events
Attend free live masterclass hosted by top tech professionals
New
Scaler
Explore Offerings by SCALER

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
1:58
choose the output 30
3:41
python broadcasting 30
3:57
How not to retrieve? 30
4:25
Fill Infinite 30
1:13
Duplicates detection 50
34:23
Row-wise unique 50
33:29
Data handling (pandas)
Problem Score Companies Time Status
For 'series' 30
3:41
drop axis 30
1:12
Rename axis 30
1:31
iloc vs loc part I 30
1:10
As a Series 50
21:40
Max registrations they asked? 50
46:53
Basic computer vision (opencv)
Problem Score Companies Time Status
Which library it is? 30
0:46
Image dimensions 30
1:16
Dimension with components 30
0:51
Color interpretation 30
1:30
Image cropping 30
1:27
Data visualization (matplotlib)
Problem Score Companies Time Status
2d graphics 30
0:35
Suitable plot type 30
1:14
Subplot Coordinates 30
3:12
Vertically Stacked Bar Graph 30
2:07
Load RGB 30
1:14
Web scraping basics
Problem Score Companies Time Status
What does the code do? 30
2:27
Retrieval protocol 30
1:11
2-way communication 30
0:47
Search engine process 30
1:20
What does the code print? 30
1:06
Eda
Problem Score Companies Time Status
PCA's secondary objective 30
1:09
Five number theory 30
1:02
Free Mock Assessment
Fill up the details for personalised experience.
All fields are mandatory
Current Employer *
Enter company name *
Graduation Year *
Select an option *
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
Phone Number *
OTP will be sent to this number for verification
+1 *
+1
Change Number
Phone Number *
OTP will be sent to this number for verification
+1 *
+1
Change Number
Graduation Year *
Graduation Year *
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
*Enter the expected year of graduation if you're student
Current Employer *
Company Name *
Please verify your phone number
Edit
Resend OTP
By clicking on Start Test, I agree to be contacted by Scaler in the future.
Already have an account? Log in
Free Mock Assessment
Instructions from Interviewbit
Start Test