Learn Load, Display In Addition To Relieve An Image
Mat imread(const string& filename, intflags=1 )
| Parameters: |
|
|---|
bool imwrite(const string& filename, InputArray img, const vector<int>¶ms=vector<int>() )
| Parameters: |
|
|---|
void imshow(const string& winname, InputArray mat)
Parameters:
- winname – Name of the window.
- image – Image to live on shown.
Steps:
- Load icon using imread().
- Display icon using namedWindow() as well as imshow().
- Save the icon using imwrite().
- Wait for keyboard push press using waitKey().
Example:
--------------#include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include <iostream> using namespace cv; using namespace std; int main( ) { Mat image; // LOAD icon icon = imread("image1.jpg", CV_LOAD_IMAGE_COLOR); // Read the file "image.jpg". //This file "image.jpg" should live on inwards the projection folder. //Else furnish amount address : "D:/images/image.jpg" if(! image.data ) // Check for invalid input { cout << "Could non opened upwards or detect the image" << std::endl ; render -1; } //DISPLAY icon namedWindow( "window", CV_WINDOW_AUTOSIZE ); // Create a window for display. imshow( "window", icon ); // Show our icon within it. //SAVE icon imwrite("result.jpg",image);// it volition shop the icon inwards mention "result.jpg" waitKey(0); // Wait for a keystroke inwards the window render 0; } --------------Sources:
http://docs.opencv.org/doc/tutorials/introduction/display_image/display_image.html
Comments
Post a Comment