Advertisemen
Add following codes(codes that are highlighted) to the existing codes from our last tutorial.
flip(InputArray src, OutputArray dst, int flipCode)
- src – input array.
- dst – output array of the same size and type as src.
- flipCode – a flag to specify how to flip the array; 0 means flipping around the x-axis and positive value (for example, 1) means flipping around y-axis. Negative value (for example, -1) means flipping around both axes (see the discussion below for the formulas).
imwrite saves image in same folder as original with the name specified.
full codes will look like this :
#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
int main()
{
cv::Mat image; // 1
image = cv::imread("binary.jpg"); // 2
cv::namedWindow("Aarlangdi Original Image"); //3
cv::imshow("Aarlangdi Original Image", image); // 4
cv::Mat result;
cv::flip(image, result, 1);
cv::namedWindow("windowTwo");
cv::imshow("windowTwo", result);
// saving image
cv::imwrite("binaryModified.jpg", result);
cv::waitKey(0); //5
}
Advertisemen
Tidak ada komentar:
Posting Komentar