Skip to content

Radon transformation - individual projections interpolation error #3848

Open
@Dugnom

Description

@Dugnom
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions