Skip to content

Commit a5eea33

Browse files
committed
update: getFrames関数の更新
1 parent ae836e6 commit a5eea33

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

usb_camera/CameraCapture.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,17 @@ bool CameraCapture::getFrame(cv::Mat& outFrame)
6565
return true;
6666
}
6767

68-
bool CameraCapture::getFrames(cv::Mat* frames, int numFrames, double seconds)
68+
bool CameraCapture::getFrames(cv::Mat* frames, int numFrames, int intervals)
6969
{
70-
if(frames == nullptr || numFrames <= 0 || seconds <= 0) return false;
71-
int intervalMs = static_cast<int>((seconds * 1000) / numFrames);
70+
if(frames == nullptr || numFrames <= 0 || intervals <= 0) return false;
7271
bool allSuccess = true;
7372
for(int i = 0; i < numFrames; ++i) {
7473
if(!getFrame(frames[i])) {
7574
std::cerr << "フレーム " << i << " の取得に失敗しました。" << std::endl;
7675
allSuccess = false;
7776
}
7877
if(i < numFrames - 1) {
79-
std::this_thread::sleep_for(std::chrono::milliseconds(intervalMs));
78+
std::this_thread::sleep_for(std::chrono::milliseconds(intervals));
8079
}
8180
}
8281
return allSuccess;

usb_camera/CameraCapture.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class CameraCapture {
2828
bool openCamera();
2929
void setCapProps(double width, double height);
3030
bool getFrame(cv::Mat& outFrame);
31-
bool getFrames(cv::Mat* frames, int numFrames, double seconds);
31+
bool getFrames(cv::Mat* frames, int numFrames, int intervals);
3232
bool saveFrame(const cv::Mat& frame, std::string filepath, std::string filename);
3333
};
3434

0 commit comments

Comments
 (0)