63 m_sFilePathBaseLeft =
"";
64 m_sFilePathBaseRight =
"";
65 m_sFirstFilePathLeft =
"";
66 m_sFirstFilePathRight =
"";
68 m_sFirstFilePathLeft += pFirstFilePathLeft;
71 if (pFirstFilePathBaseRight)
73 m_sFirstFilePathRight += pFirstFilePathBaseRight;
88 m_sFileExtention =
"";
108 return m_bOK ? m_pLeftImage->
width : -1;
113 return m_bOK ? m_pLeftImage->
height : -1;
130 const char *pFirstFilePathLeft = m_sFirstFilePathLeft.c_str();
131 bool bLookForFigures =
false;
133 const int nLengthMinusOne = int(m_sFirstFilePathLeft.length()) - 1;
134 for (
int i = nLengthMinusOne; i >= 0; i--)
136 if (pFirstFilePathLeft[i] ==
'.')
138 bLookForFigures =
true;
139 m_sFileExtention =
"";
140 m_sFileExtention += m_sFirstFilePathLeft.substr(i + 1, 3);
142 else if (bLookForFigures)
144 if (pFirstFilePathLeft[i] <
'0' || pFirstFilePathLeft[i] >
'9')
146 m_sFilePathBaseLeft =
"";
147 m_sFilePathBaseLeft += pFirstFilePathLeft;
148 m_sFilePathBaseLeft[i + 1] =
'\0';
149 n = atoi(pFirstFilePathLeft + i + 1);
158 if (!m_pLeftImage->
LoadFromFile(m_sFirstFilePathLeft.c_str()))
163 const char *pFirstFilePathRight = m_sFirstFilePathRight.c_str();
164 bool bLookForFigures =
false;
166 const int nLengthMinusOne = int(m_sFirstFilePathRight.length()) - 1;
167 for (
int i = nLengthMinusOne; i >= 0; i--)
169 if (pFirstFilePathRight[i] ==
'.')
170 bLookForFigures =
true;
171 else if (bLookForFigures)
173 if (pFirstFilePathRight[i] <
'0' || pFirstFilePathRight[i] >
'9')
175 m_sFilePathBaseRight =
"";
176 m_sFilePathBaseRight += pFirstFilePathRight;
177 m_sFilePathBaseRight[i + 1] =
'\0';
178 if (n != atoi(pFirstFilePathRight + i + 1))
187 if (!m_pRightImage->
LoadFromFile(m_sFirstFilePathRight.c_str()))
190 if (m_nFiguresLeft != m_nFiguresRight || m_pLeftImage->
width != m_pRightImage->
width || m_pLeftImage->
height != m_pRightImage->
height)
211 sprintf(szTemp,
"%%s%%.%ii.%s", m_nFiguresLeft, m_sFileExtention.c_str());
212 sprintf(szTemp2, szTemp, m_sFilePathBaseLeft.c_str(), n);
219 printf(
"error: read image is not compatible in CBitmapSequenceCapture::CaptureImage\n");
227 sprintf(szTemp2, szTemp, m_sFilePathBaseRight.c_str(), n);
233 printf(
"error: read image is not compatible in CBitmapSequenceCapture::CaptureImage (right image)\n");
bool CopyImage(const CByteImage *pInputImage, CByteImage *pOutputImage, const MyRegion *pROI=0, bool bUseSameSize=false)
Copies one CByteImage to another.
ImageType
Enum specifying the supported image types.
CByteImage::ImageType GetType()
bool LoadFromFile(const char *pFileName)
Loads an image from a file.
ImageType type
The type of the image.
int width
The width of the image in pixels.
int height
The height of the image in pixels.
bool CaptureImage(CByteImage **ppImages)
CBitmapSequenceCapture(const char *pFilePathBase, const char *pSecondFilePathBase=NULL)
~CBitmapSequenceCapture()
bool IsCompatible(const CByteImage *pImage) const
Checks whether two images are compatible or not.
void Rewind()
Set the image counter to the first image.
Data structure for the representation of 8-bit grayscale images and 24-bit RGB (or HSV) color images ...