FAsT-Match icon indicating copy to clipboard operation
FAsT-Match copied to clipboard

issues after removing parallel_for

Open aopaw opened this issue 3 years ago • 1 comments

Hello, I am working on visual servo research. In order to locate an approximate position of the object, I am looking for approach related to template tracking and found your code. A few errors came during debug session possibably because of the compiler of visual studio 2013 I am using. One part is here ``` if (WITHIN(cv::Point2f(affine_corners.at(0, 0), affine_corners.at(0, 1)), top_left, bottom_right) && WITHIN(cv::Point2f(affine_corners.at(1, 0), affine_corners.at(1, 1)), top_left, bottom_right) && WITHIN(cv::Point2f(affine_corners.at(2, 0), affine_corners.at(2, 1)), top_left, bottom_right) && WITHIN(cv::Point2f(affine_corners.at(3, 0), affine_corners.at(3, 1)), top_left, bottom_right)) {

			affines[i] = affine;
			insiders[i] = true;


One other is about matrix boundary
		if (!photometric_invariance) {
			for (int j = 0; j < no_of_points; j++) {
				int target_x = int(a11 * xs_ptr_cent[j] + a12 * ys_ptr_cent[j] + tmp_1),
					target_y = int(a21 * xs_ptr_cent[j] + a22 * ys_ptr_cent[j] + tmp_2);

				int rj, cj;
				if (target_y - 1 <=0)
					rj = 0;
				else if (target_y > padded.size().height)
					rj = padded.size().height-1;
				else
					rj = target_y-1;

				if (target_x - 1 <= 0)
					cj = 0;
				else if (target_x > padded.size().width)
					cj = padded.size().width-1;
				else
					cj = target_x-1;


				score += abs(vals_i1[j] - padded.at<float>(rj,cj));
I also replace tbb::parallel_for with standard for simply because failure in using TBB which had also been compiled successfully. After such modifications, the program compiled but does not give me result within a long time. 

So, I open this post to tell my question and also want to ask whether the program running takes very long time if the tbb::parallel_for was entirely removed. 

Thanks in advance.

aopaw avatar Jun 29 '21 13:06 aopaw

It's in essence a parallel for when it was running on a small notebook without GPU. Yes, it'd run slower, however, that was like 7 years ago, so:

  • It might be negligible if you own fast computer, not sure if it'd work on single board computers
  • Use a GPU or sth

subokita avatar Jun 29 '21 13:06 subokita