
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 33676 Articles for Programming

1K+ Views
In OpenCV, a trackbar can be created using cv2.reateTrackbar() function. To access the value of the selected trackbar position, we use cv2.getTrackbarPos() function. Using these two functions, we create a window that contains the trackbars for R, G, B colors and a color window to display the selected color. By changing the position of trackbars RGB colors change between 0 and 255. See the below syntaxes for both functions. Syntax cv2.createTrackbar(trackbar_name, window_name, default_value, max_value, callback_func) cv2.getTrackbarPos(trackbar_name, window_name) Parameters trackbar_name − It's the trackbar name. This name is used to access the trackbar position value. window_name − It is ... Read More

25K+ Views
An RGB (colored) image has three channels, Red, Blue and Green. A colored image in OpenCV has a shape in [H, W, C] format, where H, W, and C are image height, width and number of channels. All three channels have a value range between 0 and 255. The HSV image also has three channels, the Hue, Saturation and Value channels. In OpenCV, the values of the Hue channel range from 0 to 179, whereas the Saturation and Value channels range from 0 to 255. In OpenCV, to convert an RGB image to HSV image, we use the cv2.cvtColor() function. ... Read More

21K+ Views
To create a black image, we could use the np.zeros() method. It creates a numpy n-dimensional array of given size with all elements as 0. As all elements are zero, when we display it using cv2.imshow() or plt.imshow() functions, it displays a balck image. To create a white image, we could use the np.ones() method. It creates a numpy n-dimensional array of given size with all elements as 1. We multiply this array by 255 to create a white image. Now all elements are 255, so when we display it using cv2.imshow() or plt.imshow() functions it gives a white image. ... Read More

5K+ Views
Images in OpenCV are represented as numpy.ndarray. OpenCV provides two functions − cv2.hconcat() and cv2.vconcat() to join images. The function cv2.hconcat() joins images horizontally and the function cv2.vconcat() joins images vertically. These functions join two or more images. These functions accept a list of images of the same size to join them. The height, width and number of channels of all images must be the same to join them Syntax cv2.hconcat(img_list) cv2.vconcat(img_list) Where img_list is a list of images [img1, img2, …]. To join the images horizontally or vertically, one could follow the steps given below − ... Read More

12K+ Views
OpenCV provides the function cv2.resize() to resize an image. Resizing in OpenCV is referred to as scaling. We can resize an image by specifying the image size or scaling factor. The aspect ratio is preserved when we specify the scaling factor. There are different interpolation methods used in cv2.resize() function − cv2.INTER_AREA − Used for shrinking an image. cv2.INTER_CUBIC − It’s slow, used for zooming. cv2.INTER_LINEAR − Used for zooming. It is default for all resizing purposes. Steps You can use the following steps to resize an image − Import the required libraries. In all the following Python ... Read More

2K+ Views
In this tutorial we will discuss how to write a GO program to extract the last two digits of a given year. This program takes any year as input and prints its last two digits. You need to extract the last two digits from a given year, by using the modulus operation. Modulus Operation The % operator is the modulus operator, which returns the remainder rather than the quotient after division. This is useful for finding numbers that are multiples of the same number. As the name suggests where there is an execution to be operated required to deal with ... Read More

7K+ Views
In this article, we will learn about the “with” statement in python and its uses. The with statement in Python replaces a try-catch block with a simple shorthand. More significantly, it ensures that resources are closed immediately after processing. Reading or writing to a file is a common use of the with statement. A context manager is a function or class that supports the with statement. A context manager enables you to open and close resources right when you want to. The open() function, for example, is a context manager. When you use the with statement to call the ... Read More

11K+ Views
It can be difficult for beginners to grasp the concept of Python modules and libraries. You can tell from the zoom-out content that each of them is a collection of codes. But there is a significant difference between them. In this article, we will show you the major difference between python modules and libraries. Python Modules and Libraries Real-world programs are complicated. Even simple software contains thousands of lines of code. Because of this, writing code in continuous flow is difficult for programmers and developers to grasp. Developers utilize modular programming to facilitate learning and make it logically separated. It ... Read More

5K+ Views
In this article, we will explain what are the compound datatypes and data structures in python. Variables have so far only stored one value. What if we wish to save many related values? We could simply create distinct variables for each. But what if we don't know how many values will be present? What if we wish to use these values within a loop? Compound data structures are data types that can store a large number of values. In Python, there are various types of compound data structures. We will mostly concentrate on Lists. In the end, we will ... Read More

23K+ Views
To access the serial port in Python, use the pyserial module, which Python Serial Port Extension for Win32, OSX, Linux, BSD, Jython, IronPython. Let us see the features - Access to the port settings through Python properties. Support for different byte sizes, stop bits, parity and flow control with RTS/CTS and/or Xon/Xoff. Working with or without receive timeout. The files in this package are 100% pure Python. The port is set up for binary transmission. No NULL byte stripping, CR-LF translation etc. To install pyserial, use pip pip install pyserial At first import the required libraries. import ... Read More