
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 26504 Articles for Server Side Programming

2K+ Views
Digital images are made of pixels. Using OpenCV, it is easy to read the value of pixels. However, if we want to get the pixel values, we have to handle a single channel separately.Here we are loading an image in the matrix named 'cimage', and then it converts the image using 'cvtColor(cimage, img, COLOR_BGR2GRAY); ' and store it in the matrix named 'img'.The following program read the pixel value of an image and shows the values in console window.Example#include #include #include using namespace std; using namespace cv; int main() { int x;//Declaring an integer variable to hold values of pixels// ... Read More

5K+ Views
Inverting a binary image means inverting the pixel values. From a visual perspective, when we invert a binary image, white pixels will be converted to black, and black pixels will be converted to white.The basic form of this function is −cvtColor(original_image, grayscale_image, COLOR_BGR2GRAY);The next line is converting the grayscale image into a binary image and storing the converted image into 'binary_image' matrix.threshold(grayscale_image, binary_image, 100, 255, THRESH_BINARY);Here 'grayscale_image' is the source matrix, 'binary_image' is the destination matrix. After that, there are two values 100 and 255. These two values represent the threshold range. In this line, the threshold range represents the ... Read More

3K+ Views
A binary image is just a digital image that represents two colors, black and white. From an image processing perspective, a binary image contains pixels with two possible values- zero and one. When the value of a pixel is 0, it represents a pure black color. When the value of the pixel is 1, it means pure white color.In a grayscale image, there are 256 different possible values for each. But in Binary Image, there are only two possible values. Binary images have different types of applications. For example, morphological transformation requires a binary image, object shape extraction from background ... Read More

2K+ Views
Color space is the model of representing colors. There are different ways of describing colors. For example, RGB, CYMK, HSV, Grayscale etc.Here, we used a new header named 'imgproc.hpp'. This 'imgproc.hpp' is the abbreviation of Image Processing. To convert color spaces, we need to use 'cvtColor()' function of OpenCV. This function is defined in 'imgproc' header file. That's why we have included 'imgproc.hpp'.Firstly, we declared two matrices and two windows. These are for loading and showing the images. Then we loaded our image named 'cat.jpg' into 'myImage' matrix. After that we used 'cvtColor(myImage, myImage_Converted, COLOR_RGB2GRAY)'. This line converts the RGB color space ... Read More

4K+ Views
There are three channels in an RGB image- red, green and blue. The color space where red, green and blue channels represent images is called RGB color space. In OpenCV, BGR sequence is used instead of RGB. This means the first channel is blue, the second channel is green, and the third channel is red. To split an RGB image into different channels, we need to define a matrix of 3 channels. We use 'Mat different_Channels[3]' to define a three-channel matrix.Next, we split the loaded image using OpenCV 'split()' function. The format of this function is 'split(Source Matrix, Destination Matrix)'. This function ... Read More

2K+ Views
In this topic, we will understand how to find out the number of channels of an image. After running the program, the number of the channel will be shown in the console window.To get the number of the channel, we have used a class of OpenCV named 'channels()'. When we pass the image matrix as an object of the class 'channels()', it gives the channel an integer value.The following program counts the number of the channels and show it in the console window.Example#include #include using namespace std; using namespace cv; int main(int argc, char** argv) { Mat image_load;//Declaring a ... Read More

850 Views
An array is a convenient method to store and retrieve the collection of data. In OpenCV, we can use this concept to load multiple images in an image array and show them using the array's index number.The following program loads multiple images in a matrix array and shows the array's images called by the index number.Example#include #include using namespace cv; using namespace std; int main(int argc, const char** argv) { Mat myImage_array[3];//declaring a matrix named myImage// namedWindow("PhotoFrame1");//declaring the window to show the image// namedWindow("PhotoFrame2");//declaring the window to show the image// namedWindow("PhotoFrame3");//declaring the window to show the ... Read More

5K+ Views
Here, we will understand how to save the OpenCV image to any location on your computer. OpenCV provides imwrite() function to save an image to a specified file. The file extension represents the image format. The actual format of the function is −imwrite("Destination/Name of the image with extension", Source Matrix)Here, "Destination" is where we want to save the image. In this program, we save the image as "Lakshmi.jpg". We can give any name to the image. The "Source Matrix" is the matrix where the image has been loaded. In this program, the image is loaded as "myImage" matrix.Example#include #include using namespace ... Read More

3K+ Views
In this topic, we will determine how to load and show images using OpenCV in C++. There are the following functions required for loading and showing an image in OpenCV. Mat: Mat is not a function. It is a data structure, a type of variable. Like int, char, string variable types in C++, Mat is a variable of OpenCV, which creates a matrix data structure to load images inside it. In this program, we wrote 'Mat myImage;'. That means we are declaring a matrix variable named 'myImage'. namedWindow(): It allocates some memory and creates a window to show the image. It works like a ... Read More

23K+ Views
There are three steps to install OpenCV, which are as follows −Downloading all required software and install them.Processing OpenCV for Visual Studio.Linking OpenCV with Visual Studio.Let us define these steps one by one.Step 1 - Downloading and Installing the required SoftwareWe will use OpenCV in Microsoft Visual Studio. So we must have to download Visual Studio and OpenCV.Visual StudioOpenCVCMakeLet us learn how to install this software first.Installing Visual StudioThe first step is to download the Visual Studio on your system from its official website or follow link https://visualstudio.microsoft.com/downloads/.Then click on the download button for downloading the Visual Studio. After installing ... Read More