"assertion failed (m.dims>=2) in Mat" Raspberry Pi OpenCV - c++

I downloaded a project which allows to get frames from Pi camera module with OpenCV. When I try to run the downloaded code, It works without a problem. I just want to apply simple trheshold operation on frames but I got the error shown below.
I check the frames' type and channel. image.channels() returns 1 and image.type() returns 0. I can't see any reason for the threshold operation error.
What is the problem here?
The error:
The Code:
#include "cap.h"
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;
using namespace std;
int main() {
namedWindow("Video");
// Create capture object, similar to VideoCapture
// PiCapture(width, height, color_flag);
// color_flag = true => color images are captured,
// color_flag = false => greyscale images are captured
PiCapture cap(320, 240, false);
Mat image,binary;
double time = 0;
unsigned int frames = 0;
cout << "Press 'q' to quit" << endl;
while(char(waitKey(1)) != 'q') {
double t0 = getTickCount();
image = cap.grab();
std::cout<<image.channels()<< endl;//check for channel
cout<<image.type()<< endl;//check for type
threshold(image,binary,150,255,THRESH_BINARY);//threshold operation
frames++;
if(!image.empty()) imshow("Hello", image);
else cout << "Frame dropped" << endl;
time += (getTickCount() - t0) / getTickFrequency();
cout << frames / time << " fps" << endl;
}
return 0;
}

Assertion m.ndims >= 2 is to check that the matrix in question is a valid two dimensional image. While you have a conditional to show the image only if it's not empty. But the assertion must be failing before the program reaches that conditional. So you shouldn't be seeing any image window pop up.

Related

Take screenshot of webcam feed on Keypress using OpenCV and C++

I'm currently getting the webcam feed of my laptop using VideoCapture cap(0) function and then display it in a Mat frame. What I want to do next is whenever I press a key 'c' for example, it takes the screenshot of the frame and save it into a folder as a JPEG image. However I have no idea on how to do so. Help is much needed, thank you.
I have spent several days searching the internet for the right solution with simple keyboard input. Ther was allways some leg / delay while using cv::waitKey.
The solution i have found is with adding Sleep(5) just after the capturing the frame from webcam.
The below example is a combination of different forum threads.
It works without any leg / delay. Windows OS.
Press "q" to capture and save the frame.
There is a webcam feed always present. You can change the sequence to show the captured frame / image.
PS "tipka" - means "key" on the keyboard.
Regards, Andrej
#include <opencv2/opencv.hpp>
#include <iostream>
#include <stdio.h>
#include <windows.h> // For Sleep
using namespace cv;
using namespace std;
int ct = 0;
char tipka;
char filename[100]; // For filename
int c = 1; // For filename
int main(int, char**)
{
Mat frame;
//--- INITIALIZE VIDEOCAPTURE
VideoCapture cap;
// open the default camera using default API
cap.open(0);
// OR advance usage: select any API backend
int deviceID = 0; // 0 = open default camera
int apiID = cv::CAP_ANY; // 0 = autodetect default API
// open selected camera using selected API
cap.open(deviceID + apiID);
// check if we succeeded
if (!cap.isOpened()) {
cerr << "ERROR! Unable to open camera\n";
return -1;
}
//--- GRAB AND WRITE LOOP
cout << "Start grabbing" << endl
<< "Press a to terminate" << endl;
for (;;)
{
// wait for a new frame from camera and store it into 'frame'
cap.read(frame);
if (frame.empty()) {
cerr << "ERROR! blank frame grabbed\n";
break;
}
Sleep(5); // Sleep is mandatory - for no leg!
// show live and wait for a key with timeout long enough to show images
imshow("CAMERA 1", frame); // Window name
tipka = cv::waitKey(30);
if (tipka == 'q') {
sprintf_s(filename, "C:/Images/Frame_%d.jpg", c); // select your folder - filename is "Frame_n"
cv::waitKey(10);
imshow("CAMERA 1", frame);
imwrite(filename, frame);
cout << "Frame_" << c << endl;
c++;
}
if (tipka == 'a') {
cout << "Terminating..." << endl;
Sleep(2000);
break;
}
}
// the camera will be deinitialized automatically in VideoCapture destructor
return 0;
}

PvAPI OpenCV built-in code: FPS mismatch and how to use multiple cameras?

I have two Manta G125B cameras (B stands for black that means monochrome). These are GigE interface cameras, and I am using PvAPI C++ application programmer's interface to read camera data to my Windows OS laptop by using Microsoft Visual Studio Community 2015 IDE.
Recently I came across Steven Puttemans' github account and there he shared the code AVT_Manta_opencv_builtin.cpp in this link:
https://github.com/StevenPuttemans/opencv_tryout_code/blob/master/camera_interfacing/AVT_Manta_opencv_builtin.cpp
I downloaded OpenCV 3.0.0 source files from
Itseez github page and built all required files by using CMake (I selected use default native compilers and Visual Studio 14 2015 64 options after I clicked configure option as I am using a 64-bit CPU and MVS Community 2015). I selected WITH_PVAPI option after first configuration (actually it was already selected) and I noticed that PVAPI_INCLUDE_PATH and PVAPI_LIBRARY options are automatically recognized correctly as C:/Program Files/Allied Vision Technologies/GigESDK/inc-pc and C:/Program Files/Allied Vision Technologies/GigESDK/lib-pc/x64/PvAPI.lib, respectively. I clicked configure option again, and then clicked generate option (in the mean time, if I don't unselect BUILD_PERF_TESTS and BUILD_TESTS options which are already selected after configurations, when I open OpenCV.sln and build ALL_BUILD and INSTALL, Visual Studio shows three errors. I removed the ticks at BUILD_PERF_TEST and BUILD_TESTS options, and errors are gone).
After building OpenCV from scratch, I made a Visual Studio project and modified Steven Puttemans' code slightly to see real-time camera acquisition from one of my cameras while printing frame number and frame rate on console. Here is my code:
int main()
{
Mat frame, imgResized;
double f = 0.4; /* f is a scalar in [0-1] range that scales the raw image. Output image is displayed in the screen. */
DWORD timeStart, timeEnd; // these variables are used for computing fps and avg_fps.
double fps = 1.0; // frame per second
double sum_fps(0.);
double avg_fps(0.); // average fps
int frameCount = 0;
VideoCapture camera(0 + CV_CAP_PVAPI); /* open the default camera; VideoCapture is class, camera is object. */
if (!camera.isOpened())
{
cerr << "Cannot open the camera." << endl;
return EXIT_FAILURE;
}
double rows = camera.get(CV_CAP_PROP_FRAME_HEIGHT); /* Height of the frames in the video stream. */
double cols = camera.get(CV_CAP_PROP_FRAME_WIDTH); /* Width of the frames in the video stream. */
double exposure = camera.get(CV_CAP_PROP_EXPOSURE);
cout << "Exposure value of the camera at the beginning is " << exposure << endl;
double exposureTimeInSecond = 0.02; /* As exposureTimeInSecond variable decreases, fps should increase */
exposure = exposureTimeInSecond * 1000000; /* esposure time in us */
camera.set(CV_CAP_PROP_EXPOSURE, exposure);
double frameRate; /* built-in fps */
cout << "Frame size of the camera is " << cols << "x" << rows << "." << endl;
cout << "Exposure value of the camera is set to " << exposure << endl;
char* winname = "Manta Camera";
namedWindow(winname, WINDOW_AUTOSIZE);
cout << "Press ESC to terminate default camera." << endl;
while (true)
{
timeStart = GetTickCount();
camera >> frame;
frameCount++;
frameRate = camera.get(CV_CAP_PROP_FPS); /* Built-in frame rate in Hz. */
/* resize() built-in function is in imgproc main module, in Geometric Image Transformations module. I resize the image by f (where f is a scalar in [0-1] range) for display. */
resize(frame, imgResized, Size(), f, f, INTER_LINEAR); /* void cv::resize(InputArray src, OutputArray dst, Size dsize, double fx = 0, double fy = 0, int interpolation = INTER_LINEAR) */
imshow(winname, imgResized);
moveWindow(winname, 980, 50);
int key = waitKey(10);
if (key == VK_ESCAPE)
{
destroyWindow(winname);
break;
}
/* Calculating FPS in my own way. */
timeEnd = GetTickCount();
fps = 1000.0 / (double)(timeEnd - timeStart); /* 1s = 1000ms */
sum_fps += fps;
avg_fps = sum_fps / frameCount;
cout << "FPS = " << frameRate << ", frame #" << frameCount << ", my_fps = " << fps << ", avg_fps = "<< avg_fps << endl;
}
cout << "Compiled with OpenCV version " << CV_VERSION << endl; /* thanks to Shervin Emami */
system("pause");
return EXIT_SUCCESS;
}
and this is the screenshot of the output during real-time acquisition:
Can someone explain why built-in fps is 30.9? I am pretty sure that real fps in my screen is around 15-16 Hz because I computed time between two different frame numbers that I see in my console, and then computed the fps and the result is the same as avg_fps value in console. I also ran SampleViewer.exe file that is in C:\Program Files\Allied Vision Technologies\GigESDK\bin-pc\x64 directory and when I click on "Show camera's attributes" icon, I see StatFrameRate = 30.2 approximately.
My second question is, how can I open the second camera that is connected to network switch? And also, how can I trigger them at the same moment? I examined cap_pvapi.cpp file that is located in source files that I downloaded from Itseez github page, and as far as I understand, the camera's FrameStartTriggerMode is "Freerun." Other options are SyncIn1, SyncIn2, FixedRate and Software. My main camera is left camera and I call the second camera as right camera. What should be the corresponding FrameStartTriggerMode for my left and right cameras?
I am able to open both of the cameras:
stereo camera real-time acquisition with OpenCV PvAPI built-in option
#include <iostream>
#include "Windows.h" /* data type DWORD and function GetTickCount() are defined in Windows.h */
#include "opencv2/opencv.hpp"
#include <cassert>
#include <ppl.h> // Parallel patterns library, concurrency namespace. Young-Jin uses this, so do I. It's very important; if not used, when images are processed, fps drops dramatically.
#if !defined VK_ESCAPE /* VK stands for virtual key*/
#define VK_ESCAPE 0x1B /* ASCII code for ESC character is 27 */
#endif
using namespace std;
using namespace cv;
const unsigned long numberOfCameras = 2;
bool displayImages = true;
int main()
{
Mat frame[numberOfCameras], imgResized[numberOfCameras];
double f = 0.4; /* f is a scalar in [0-1] range that scales the raw image. Output image is displayed in the screen. */
DWORD timeStart, timeEnd; // these variables are used for computing fps and avg_fps.
double fps = 1.0; // frame per second
double sum_fps(0.);
double avg_fps(0.); // average fps
int frameCount = 0;
VideoCapture camera[numberOfCameras]; // (0 + CV_CAP_PVAPI); /* open the default camera; VideoCapture is class, camera is object. */
for (int i = 0; i < numberOfCameras; i++)
{
camera[i].open(i + CV_CAP_PVAPI);
if (!camera[i].isOpened())
{
cerr << "Cannot open camera " << i << "." << endl;
return EXIT_FAILURE;
}
}
double rows = camera[0].get(CV_CAP_PROP_FRAME_HEIGHT); /* Height of the frames in the video stream. */
double cols = camera[0].get(CV_CAP_PROP_FRAME_WIDTH); /* Width of the frames in the video stream. */
if (numberOfCameras == 2)
assert(rows == camera[1].get(CV_CAP_PROP_FRAME_HEIGHT) && cols == camera[0].get(CV_CAP_PROP_FRAME_WIDTH));
for (int i = 0; i<numberOfCameras; i++) // initializing monochrome images.
{
frame[i] = Mat(Size(cols, rows), CV_8UC1); /* Mat(Size size, int type) */
resize(frame[i], imgResized[i], Size(0, 0), f, f, INTER_LINEAR);
}
/* combo is a combined image consisting of left and right resized images. images are resized in order to be displayed at a smaller region on the screen. */
Mat combo(Size(imgResized[0].size().width * 2, imgResized[0].size().height), imgResized[0].type()); /* This is the merged image (i.e., side by side) for real-time display. */
Rect roi[numberOfCameras]; /* roi stands for region of interest. */
for (int i = 0; i < numberOfCameras; i++)
roi[i] = Rect(0, 0, imgResized[0].cols, imgResized[0].rows);
/* Setting locations of images coming from different cameras in the combo image. */
if (numberOfCameras > 1) /* I assume max camera number is 2. */
{
roi[1].x = imgResized[0].cols;
roi[1].y = 0;
}
double exposure, exposureTimeInSecond = 0.06; /* As exposureTimeInSecond variable decreases, fps should increase */
for (int i = 0; i < numberOfCameras; i++)
{
exposure = camera[i].get(CV_CAP_PROP_EXPOSURE);
cout << "Exposure value of the camera " << i << " at the beginning is " << exposure << endl;
exposure = exposureTimeInSecond * 1000000; /* esposure time in us */
camera[i].set(CV_CAP_PROP_EXPOSURE, exposure);
}
double frameRate[numberOfCameras]; /* built-in fps */
cout << "Frame size of the camera is " << cols << "x" << rows << "." << endl;
cout << "Exposure value of both cameras is set to " << exposure << endl;
char* winname = "real-time image acquisition";
if (displayImages)
namedWindow(winname, WINDOW_AUTOSIZE);
cout << "Press ESC to terminate real-time acquisition." << endl;
while (true)
{
timeStart = GetTickCount();
Concurrency::parallel_for((unsigned long)0, numberOfCameras, [&](unsigned long i)
{
camera[i] >> frame[i];
frameRate[i] = camera[i].get(CV_CAP_PROP_FPS); /* Built-in frame rate in Hz. */
resize(frame[i], imgResized[i], Size(), f, f, INTER_LINEAR); /* void cv::resize(InputArray src, OutputArray dst, Size dsize, double fx = 0, double fy = 0, int interpolation = INTER_LINEAR) */
imgResized[i].copyTo(combo(roi[i])); /* This is C++ API. */
});
frameCount++;
if (displayImages)
{
imshow(winname, combo);
moveWindow(winname, 780, 50);
}
int key = waitKey(10);
if (key == VK_ESCAPE)
{
destroyWindow(winname);
break;
}
/* Calculating FPS in my own way. */
timeEnd = GetTickCount();
fps = 1000.0 / (double)(timeEnd - timeStart); /* 1s = 1000ms */
sum_fps += fps;
avg_fps = sum_fps / frameCount;
for (int i = 0; i < numberOfCameras; i++)
cout << "FPScam" << i << "=" << frameRate[i] << " ";
cout << "frame#" << frameCount << " my_fps=" << fps << " avg_fps=" << avg_fps << endl;
}
cout << "Compiled with OpenCV version " << CV_VERSION << endl; /* thanks to Shervin Emami */
system("pause");
return EXIT_SUCCESS;
}
// double triggerMode = camera.get(CV_CAP_PROP_PVAPI_FRAMESTARTTRIGGERMODE);
////camera.set(CV_CAP_PROP_PVAPI_FRAMESTARTTRIGGERMODE, 4.0);
//
//if (triggerMode == 0.)
//cout << "Trigger mode is Freerun" << endl;
//else if (triggerMode == 1.0)
//cout << "Trigger mode is SyncIn1" << endl;
//else if (triggerMode == 2.0)
//cout << "Trigger mode is SyncIn2" << endl;
//else if (triggerMode == 3.0)
//cout << "Trigger mode is FixedRate" << endl;
//else if (triggerMode == 4.0)
//cout << "Trigger mode is Software" << endl;
//else
//cout << "There is no trigger mode!!!";
But fps is still not the value that I desire.. :(
I also noticed that there exists cap_pvapi.cpp (contributed by Justin G. Eskesen) file that is implicitly used by my code at this subdirectory:
C:\opencv\sources\modules\videoio\src
and when I examined it, I saw that both cameras are set to "Freerun" FrameStartTriggerMode. Original command in PvAPI is:
PvAttrEnumSet(Camera.Handle, "FrameStartTriggerMode", "Freerun");
In my opinion, when using stereo cameras, cameras should be set to "Software" FrameStartTriggerMode. I already have a code that is running in this configuration for my stereo camera setup, but after some time, my console and running application are getting frozen. I tested my code if there memory leak or not and I am quite sure that there is no memory leak.
Average fps is about 16 but sometimes fps becomes low such as 2Hz which is not good. Good side of this code is, it doesn't stop but still not reliable. I am still wondering if it's possible to transfer all images at a fps more than 25. Actually, in my other code that gets frozen after some time (the one that is triggered by "Software" option), if I don't display the images on screen, avg_fps gets close to 27Hz. But it stops and screen gets frozen due to an unknown failure.

how do I grab a still image from a cam using imwrite in opencv c++?

this code is suppose to display a webcam feed and when you press the s key save the image to a file in the path selected. It is not working. imwrite crashes the program with this error code.
Unspecified error (could not find a writer for the specified extension) in cv::imwrite_, file ........\opencv\modules\highgui\src\loadsave.cpp, line 275
here is my code it crashes at line 99 imwrite(buffer, imgh); if you can think of any way I can make it save this image I'd be very grateful.
#include <opencv/cv.h>
#include "opencv2/highgui/highgui.hpp"
#include <iostream>
#include <cstdlib>
#include <windows.h>
using namespace cv;
using namespace std;
double Brightness;
double Contrast;
double Saturation;
double Gain;
double Exposure;
char buffer[100];
int i = 0;
int c = 1;
int main(int argc, char* argv[])
{
VideoCapture cap(0); // open the video camera no. 0
if (!cap.isOpened()){
cout << "Cannot open the video cam" << endl;
return -1;
}
double dWidth = cap.get(CV_CAP_PROP_FRAME_WIDTH); //get the width of frames of the video
double dHeight = cap.get(CV_CAP_PROP_FRAME_HEIGHT); //get the height of frames of the video
cap.set(CV_CAP_PROP_AUTO_EXPOSURE,0.0 ); // turn off auto exposure
// Get fixed Cam Properties
Brightness = cap.get(CV_CAP_PROP_BRIGHTNESS);
Contrast = cap.get(CV_CAP_PROP_CONTRAST );
Saturation = cap.get(CV_CAP_PROP_SATURATION);
Gain = cap.get(CV_CAP_PROP_GAIN);
Exposure = cap.get(CV_CAP_PROP_AUTO_EXPOSURE );
// Display Them
cout<<"===================================="<<endl;
cout<<"Default Brightness -------> "<<Brightness<<endl;
cout<<"Default Contrast----------> "<<Contrast<<endl;
cout<<"Default Saturation--------> "<<Saturation<<endl;
cout<<"Default Gain--------------> "<<Gain<<endl;
cout<<"Default exp --------------> "<<Exposure<<endl;
cout<<"===================================="<<endl;
// console adjustment for testing
cout << "\nFrame size : " << dWidth << " x " << dHeight << endl;
int bright;
cout<< "\nbrightness level -100 - 100 " << endl;
cin>> bright;
cout <<"\nbrightness level: " <<bright <<endl;
namedWindow("Video"); //create a window called "MyVideo"
for(;;)
{
Mat frame;
cap >> frame;
int x = 200;
Sleep(x);
Mat imgH = frame + Scalar(0.0722*bright, 0.7152*bright, 0.7152*bright); // convert BGR to Luminance set to color space
char ch =waitKey(30);
sprintf(buffer, "C:\\pics\\image%d.jpg" ,c);
cvWaitKey(10);
//save image frmae
if (ch == 's'){
cvWaitKey(10);
cout<< "new frame in window " <<buffer<<endl;
imshow("Video", imgH );
imwrite(buffer, imgH); // <-- this is not working die in a hole!!!
c++ ;
}
// Camera Properties
if (ch == 'p'){
cap.set(CV_CAP_PROP_SETTINGS , 1 );
}
//Exit
if (ch == 27){
cout << "esc key is pressed by user" << endl;
return 0;
}
}
return 0;
}
It works fine. The issue was in the version of visual studio I was using. I switched to 2010 and linked the libraries dynamically and the code works.
how to install opencv and link libraries in visual studio 2010
https://www.youtube.com/watch?v=cgo0UitHfp8&list=PLvwB65U8V0HHCEyW2UTyOJym5FsdqfbHQ
thanks for looking at it.

The call imshow() in OpenCV is not creating any output

I am trying to read data from an industrial camera using the V4l linux driver and C++. I would like to display the result using the OpenCV. I read the buffer, create an Mat object, which actually contains values in range 0...255.
The problem seems to be the imshow() call. When commenting this line out, an actual window without an image is displayed. Once uncommented no window is diplayed and also no output in terminal after this line is shown. I am not able to find a solution on my own, all examples I found look the same as my code to me.
Here is the code:
#include <fcntl.h>
#include "opencv/cv.h"
#include "opencv/highgui.h"
#include <libv4l2.h>
#include <libv4l1.h>
#include <linux/videodev2.h>
#include <sys/ioctl.h>
#define BUFFERSIZE 357120 // 744 * 480
using namespace cv;
using namespace std;
int main(int argc, char **argv) {
int cameraHandle, i;
unsigned char pictureBuffer[BUFFERSIZE];
char cameraDevice[] = "/dev/video0";
struct v4l2_control V4L2_control;
/* open camera device */
if (( cameraHandle = v4l1_open(cameraDevice, O_RDONLY)) == -1 ){
printf("Unable to open the camera");
return -1;
}
// disable auto exposure
V4L2_control.id = V4L2_CID_EXPOSURE_AUTO;
V4L2_control.value = V4L2_EXPOSURE_SHUTTER_PRIORITY;
ioctl(cameraHandle, VIDIOC_S_CTRL, &V4L2_control);
// set exposure time
V4L2_control.id = V4L2_CID_EXPOSURE_ABSOLUTE;
V4L2_control.value = 2;
ioctl(cameraHandle, VIDIOC_S_CTRL, &V4L2_control);
// get 5 pictures to warm up the camera
for (i = 0; i <= 5; i++){
v4l1_read(cameraHandle, pictureBuffer, BUFFERSIZE);
}
// show pictures
Mat mat = Mat(744, 480, CV_8UC3, (void*)pictureBuffer);
cout << "M = " << endl << " " << mat << endl << endl; // display the image data
namedWindow("imagetest", CV_WINDOW_AUTOSIZE );
imshow("imagetest", mat);
waitKey(30);
cout << "test output" << endl;
//clenup
v4l1_close(cameraHandle);
destroyWindow("imagetest");
return 0;
}
EDIT:
Well, after running the code in terminal instead of ecipse I saw a segmentation fault Even commenting everything behind the
cout << "M = " << endl << " " << mat << endl << endl;
line gives me this error.
Solved. The problem lied in the wrong file format. CV_8UC1 or CV_8U instead of CV_8UC3 brought and an output. The difference between those formats is described here: In OpenCV, what's the difference between CV_8U and CV_8UC1?

opencv videocapture c++ not working 2 times

I tried the following code for capturing a video from my webcam:
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace cv;
using namespace std;
int main()
{
VideoCapture cap(0); // open the video camera no. 0
if (!cap.isOpened()) // if not success, exit program
{
cout << "Cannot open the video cam" << endl;
return -1;
}
double dWidth = cap.get(CV_CAP_PROP_FRAME_WIDTH); //get the width of frames of the video
double dHeight = cap.get(CV_CAP_PROP_FRAME_HEIGHT); //get the height of frames of the video
cout << "Frame size : " << dWidth << " x " << dHeight << endl;
namedWindow("MyVideo", CV_WINDOW_AUTOSIZE); //create a window called "MyVideo"
namedWindow("Changed", CV_WINDOW_AUTOSIZE);
while (1)
{
Mat frame;
bool bSuccess = cap.read(frame); // read a new frame from video
if (!bSuccess) //if not success, break loop
{
cout << "Cannot read a frame from video stream" << endl;
break;
}
Mat imgH = frame + Scalar(75, 75, 75);
imshow("MyVideo", frame); //show the frame in "MyVideo" window
imshow("Changed", imgH);
if (waitKey(30) == 27) //wait for 'esc' key press for 30ms. If 'esc' key is pressed, break loop
{
cout << "esc key is pressed by user" << endl;
break;
}
}
return 0;
}
Now here's my problem:
After debugging that program for the first time everything works as expected. But when debugging for a second time (after changing some lines in the code) it cannot read from the camera.
Does anyone have a hint for me how to solve that problem?
Thanks!
The code you posted seems to be working absolutely fine in my case, and the output is as intended.
However please make sure that your webcam is switched on before you run the program, this is important.
Since i have a YouCam client in my computer for the webcam, therefore it shows that i need to start youcam.
Since i dont have enough reputation to post an image, so please see the following link in order to view the output i got when webcam not already switched on.
http://i.imgur.com/h4bTZ7z.png
Hope this helps!!