Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions sample_template/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ int Application::getFrame(const std::string &fileName, Mat& src)
return 0;
}

int Application::processFrame(const Mat& src, Mat& dst)
int Application::processFrame(const Mat& src, Mat& dst, int t)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@E1eMental1 , может быть можно добавить этот функционал без изменения интерфейса функции?

{
processor.processFrame(src, dst);
processor.processFrame(src, dst, t);

if (dst.empty())
{
Expand Down Expand Up @@ -60,15 +60,15 @@ int Application::drawButtons(Mat &display)
}

int Application::showFrame(const std::string &caption,
const Mat& src, Mat& dst)
const Mat& src, Mat& dst, int t)
{
if (guiState.state == OffFilter)
{
src.copyTo(dst);
}
else if (guiState.state == OnFilter)
{
processFrame(src, dst);
processFrame(src, dst, t);
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions sample_template/application.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ class Application
};
int parseArguments(int argc, const char **argv, Parameters &params);
int getFrame(const std::string &fileName, cv::Mat& src);
int processFrame(const cv::Mat& src, cv::Mat& dst);
int processFrame(const cv::Mat& src, cv::Mat& dst, int t);
int showFrame(const std::string &caption,
const cv::Mat& src, cv::Mat& dst);
const cv::Mat& src, cv::Mat& dst, int t);
friend void onButtonsOnOffClick(int eventId, int x, int y,
int flags, void *userData);
Application()
Expand Down
4 changes: 3 additions & 1 deletion sample_template/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ int main(int argc, const char **argv)
const std::string caption = "OpenCV Sample";
char key = 0;
Mat dst(src.rows, src.cols, src.type());
long long time = 0;
while (key != 27) // Esc
{
key = app.showFrame(caption, src, dst);
key = app.showFrame(caption, src, dst, time);
time += rand() % 21 - 10;
}

return OK;
Expand Down
5 changes: 3 additions & 2 deletions sample_template/processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

#include <opencv2/imgproc/imgproc.hpp>


using namespace cv;

void Processing::processFrame(const cv::Mat& src, cv::Mat& dst)
void Processing::processFrame(const cv::Mat& src, cv::Mat& dst, int t)
{
src.copyTo(dst);

cv::Rect region(src.rows/4, src.cols/4, src.rows/2, src.cols/2);
cv::Rect region(src.rows/4 + t / 5, src.cols/4 + t / 5, src.rows/2, src.cols/2);
Mat roi = dst(region);

const int kSize = 11;
Expand Down
2 changes: 1 addition & 1 deletion sample_template/processing.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
class Processing
{
public:
void processFrame(const cv::Mat& src, cv::Mat& dst);
void processFrame(const cv::Mat& src, cv::Mat& dst, int t);
};