Programming Articles - Page 1351 of 3366

What is Image Array? Explain with an example in C++

Ginni
Updated on 10-Mar-2021 07:49:32

860 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

How to save an Image in OpenCV using C++?

Ginni
Updated on 10-Mar-2021 08:10:01

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

How to load and show image in OpenCV using C++?

Ginni
Updated on 10-Mar-2021 07:45:51

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

How to install OpenCV for C++ in Windows?

Ginni
Updated on 10-Mar-2021 07:44:08

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

What is OpenCV?

Ginni
Updated on 10-Mar-2021 07:35:56

748 Views

OpenCV stands for open-source computer vision. It was generated to support a common infrastructure for computer vision operations and use system behaviour in financial products. It generally targets image processing, faces recognition, video capture, searching, and object disclosure.OpenCV is created to implement various operations including recognising and detecting faces, analysing human tasks in videos, identifying objects, recording camera movements, tracking moving objects, and combining images to create a high-resolution image for the accurate scene. Let's see the topic defining the term "Computer Vision."Computer VisionComputer vision is a flexible scientific area that manages to regenerate, preventing, and learn a 3D image from ... Read More

What do you mean by static memory allocation in C programming?

Bhanu Priya
Updated on 09-Mar-2021 08:33:58

3K+ Views

Memory can be allocated in the following two ways −Static Memory AllocationStatic variable defines in one block of allocated space, of a fixed size. Once it is allocated, it can never be freed.Memory is allocated for the declared variable in the program.The address can be obtained by using ‘&’ operator and can be assigned to a pointer.The memory is allocated during compile time.It uses stack for maintaining the static allocation of memory.In this allocation, once the memory is allocated, the memory size cannot change.It is less efficient.The final size of a variable is decided before running the program, it will ... Read More

How to extract only first sub-element from a list in R?

Nizamuddin Siddiqui
Updated on 06-Mar-2021 14:15:37

13K+ Views

To extract only first element from a list, we can use sapply function and access the first element with double square brackets. For example, if we have a list called LIST that contains 5 elements each containing 20 elements then the first sub-element can be extracted by using the command sapply(LIST,"[[",1).Example1Consider the below data frame − Live DemoList1

How to find the monthly average from different date data in R?

Nizamuddin Siddiqui
Updated on 06-Mar-2021 14:15:10

2K+ Views

To find the monthly average from different date data, we first need to extract the months and year from date column and then find the average using aggregate function. For example, if we have a data frame called df which has three columns say x, month, and year then the monthly average can be found by using the command −aggregate(x~Month+Year,df,mean)Example1Consider the below data frame − Live DemoDate1

How to change the code "Yes" to 1 in an R data frame column?

Nizamuddin Siddiqui
Updated on 06-Mar-2021 14:07:30

15K+ Views

To change the code “Yes” to 1, we can use ifelse function and set the Yes to 1 and others to 0. For example, if we have a data frame called df that contains a character column x which has Yes and No values then we can convert those values to 1 and 0 using the command ifelse(df$x=="Yes",1,0).Example1Consider the below data frame − Live DemoAgree

How to find the count of a particular character in a string vector in R?

Nizamuddin Siddiqui
Updated on 06-Mar-2021 14:02:00

179 Views

To find the count of a particular character in a string vector we can use nchar function along with gsub. For example, if we have a vector called x that contains string such India, Russia, Indonesia then we can find the number of times character i occurred then we can use the command nchar(gsub("[^i]","",x)) and the output will be 1 1 1 because first I’s in India and Indonesia will not be considered as they are in uppercase.Example1 Live Demox1

Advertisements