I have a small application that saves images using cv::imwrite
. The problem that I have is that I have been trying to find a way to store cropped images after matching them. I successfully extract the cropped image but it is overwritten in the same folder instead just added to the folder.
How can I save images without overwriting them?
See below the most important piece of the code:
stereo.h
public:
void cropMatches(int xa, int ya, int xb, int yb);
stereo.cpp
void StereoCal::cropMatches(int xa, int ya, int xb, int yb){
cv::Point ptA=cv::Point(xa, ya);
cv::Point ptB=cv::Point(xb, yb);
cv::Size sz;
sz.height=regionSize;
sz.width=regionSize;
cv::Mat regionA, regionB;
cv::getRectSubPix(currentImages.getA().get8Bitmap(),sz,ptA,regionA);
cv::getRectSubPix(currentImages.getB().get8Bitmap(),sz,ptB,regionB);
std::string path = "/home/path/to/folder/";
std::string outA = path+"cropA.tiff";
std::string outB = path+"cropB.tiff";
cv::imwrite(outA,regionA);
cv::imwrite(outB,regionB);
}
Please shed a little bit of light on how to solve this issue.