Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

input frame #1

Open
SabraHashemi opened this issue Sep 11, 2023 · 3 comments
Open

input frame #1

SabraHashemi opened this issue Sep 11, 2023 · 3 comments

Comments

@SabraHashemi
Copy link

your code can not work with a 1920x1080 frame (it will crashed)
how can i improve the code to run on any videos?

@hadign20
Copy link
Owner

Hi
I tried with a larger video (3840x2160). It is slow but didn't crash.
You can set the DEBUG values to 0. Also, try increasing the block size and window size to see if it speeds up. In general, it's better to scale down the input videos to avoid slow processing. You can set the scale variable to true for this.

@SabraHashemi
Copy link
Author

but i have got below error when i want to run on Size : 1920X1080 but if ran it on woman.mp4 video it works
error text :
OpenCV(3.4.1) Error: Assertion failed (cn <= 4) in scalarToRawData, file /home/sabra-pc/Projects/Moving-Objects/DCFG/opencv_install/opencv-3.4.1/modules/core/src/array.cpp, line 3232
Aborted (core dumped)

this error happened in KLT function:

void DCFG::KLT(cv::Mat& imgGray) {
#if DFCG_DEBUG
	cv::RNG rng(12345);
	colorFrame.copyTo(testImg);
#endif

	if (!points[0].empty())
	{
		calcOpticalFlowPyrLK(prevGray, imgGray, points[0], points[1], status, err, winSize, 3, termcrit, 0, 0.001);
		size_t i;
		for (i = count = 0; i < points[1].size(); i++)
		{
			if (!status[i])
				continue;
			nMatch[count++] = i;
#if DFCG_DEBUG
			cv::Scalar color = cv::Scalar(rng.uniform(0, 255), rng.uniform(0, 255), rng.uniform(0, 255));
			circle(testImg, points[0][i], 3, color, -1, 8);
			circle(testImg, points[1][i], 3, color, -1, 8);
			cv::arrowedLine(testImg, points[0][i], points[1][i], color, 1);
#endif
		}
	}

#if DFCG_DEBUG
	imshow("LK Demo", testImg);
#endif

@SabraHashemi
Copy link
Author

also I have set the Debug Flag to 0 but still I have got this error :
./DCFG ~/Datasets/f.mp4
Processing f ...0
Segmentation fault (core dumped)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants