![]() ![]() Let's go through the above code line by line. Then your image should be saved in the specified location. Please note that you have to replace "D:/My OpenCV Website/fly-agaric.jpg" in the code with a valid location to an image in your computer. ![]() WaitKey(0) // Wait for any keystroke in the windowĭestroyWindow(windowName) //destroy the created windowĬopy and paste above code snippet into your IDE and run it. Imshow(windowName, image) // Show our image inside the created window. NamedWindow(windowName) // Create a window String windowName = "The Saved Image" //Name of the window bool isSuccess = imwrite("D:/MyImage.png", image) //write the image to a file as PNGĬout << "Failed to save the image" << endl Ĭout << "Image is succusfully saved to a file" << endl Change brightness/contrast of the imageīool isSuccess = imwrite("D:/MyImage.jpg", image) //write the image to a file as JPEG Mat image = imread("D:/My OpenCV Website/fly-agaric.jpg") Ĭout << "Could not open or find the image" << endl ġ. Uncomment the following line if you are compiling this code in Visual Studio ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
January 2023
Categories |