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

Radon transformation - individual projections interpolation error #3848

Open
4 tasks done
Dugnom opened this issue Dec 12, 2024 · 0 comments
Open
4 tasks done

Radon transformation - individual projections interpolation error #3848

Dugnom opened this issue Dec 12, 2024 · 0 comments

Comments

@Dugnom
Copy link

Dugnom commented Dec 12, 2024

System information (version)
  • OpenCV => 4.10
Detailed description

The sum of values over each column (projection) has to be equal to the sum of values in the whole original image by definition!
The simple 4 by 4 example proofs it is not.
Given the 4x4 matrix with all zeros, except one entry at (1,1) equal to 1.
grafik

Rotating this matrix in 15° increments, we get the following sums for each projection:

  • 0° / 90° : 1
  • 15° / 75° : 0.9915
  • 30° / 60° / 120° / 150° : 0.9492
  • 45° / 135° : 0.9278
  • 105° / 165°: 0.9922
    The 15 ° rotation is not cherry picked, but a random example.
    grafik

This is undocumented and unexpected information loss which is hard to predict or compensate for.
This fluctuation could mess with image recognition and shape descriptors (one quick example would be 10.1016/j.cviu.2005.06.005 , which squares each value) and probably other tasks for which sinograms are used.

My guess is, that this is due to some issue in the interpolation when rotating the matrix. Bilinear interpolation should not lose this information to my understanding, so this is still unexpected..

This issue was found together with the issues described in #3846 but is independent of it.

Steps to reproduce
   cv::Mat mat = cv::Mat::zeros(4, 4, CV_64F);
   double RotationStepAngleTest = 15.0;
   double StartAngleTest = 0.0;
   double EndAngleTest = 180.0;

// Set specific entries to 1
   mat.at<double>(1, 1) = 1; // Row 1, Column 2
   mat.at<double>(2, 0) = 0; // Row 2, Column 2
   mat.at<double>(3, 3) = 0;

   cv::Mat MatCropFalse = mat.clone();
   cv::Mat MatCropTrue = mat.clone();

   cv::Mat SinogramCropFalse;
   cv::Mat SinogramCropTrue;

   cv::ximgproc::RadonTransform(MatCropFalse, SinogramCropFalse, RotationStepAngleTest, StartAngleTest, EndAngleTest, false, false);
   cv::ximgproc::RadonTransform(MatCropTrue, SinogramCropTrue, RotationStepAngleTest, StartAngleTest, EndAngleTest, true, false);
Issue submission checklist
  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues,
    forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files: videos, images, onnx, etc
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

1 participant