Skip to content

Commit c49e156

Browse files
committed
Update radon_transform.cpp
1 parent 80f1ca2 commit c49e156

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

modules/ximgproc/src/radon_transform.cpp

+9-10
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@ namespace cv {namespace ximgproc {
1717
CV_Assert(src.channels() == 1);
1818
CV_Assert((end_angle - start_angle) * theta > 0);
1919

20-
Mat _srcMat = src.getMat();
20+
int _col_num = cvRound((end_angle - start_angle) / theta);
21+
int _row_num, _out_mat_type;
22+
Point _center;
23+
Mat _srcMat, _masked_src;
2124

22-
int _row_num, _col_num, _out_mat_type;
23-
_col_num = cvRound((end_angle - start_angle) / theta);
24-
transpose(_srcMat, _srcMat);
25-
Mat _masked_src;
26-
cv::Point _center;
25+
transpose(src, _srcMat);
2726

2827
if (_srcMat.type() == CV_32FC1 || _srcMat.type() == CV_64FC1) {
2928
_out_mat_type = CV_64FC1;
@@ -59,7 +58,10 @@ namespace cv {namespace ximgproc {
5958

6059
double _t;
6160
Mat _rotated_src;
62-
Mat _radon(_row_num, _col_num, _out_mat_type);
61+
62+
// Initialize dst with appropriate size and type
63+
dst.create(_row_num, _col_num, _out_mat_type);
64+
Mat _radon = dst.getMat(); // Get reference to the output matrix
6365

6466
for (int _col = 0; _col < _col_num; _col++) {
6567
// rotate the source by _t
@@ -74,8 +76,5 @@ namespace cv {namespace ximgproc {
7476
if (norm) {
7577
normalize(_radon, _radon, 0, 255, NORM_MINMAX, CV_8UC1);
7678
}
77-
78-
_radon.copyTo(dst);
79-
return;
8079
}
8180
} }

0 commit comments

Comments
 (0)