octave-bug-tracker
[Top][All Lists]

## [Octave-bug-tracker] [bug #54874] [octave forge] (image) hough transform

 From: Avinoam Kalma Subject: [Octave-bug-tracker] [bug #54874] [octave forge] (image) hough transform size is not compatible with Matlab Date: Mon, 22 Oct 2018 00:12:07 -0400 (EDT) User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36

```URL:
<https://savannah.gnu.org/bugs/?54874>

Summary: [octave forge] (image) hough transform size is not
compatible with Matlab
Project: GNU Octave
Submitted by: avinoam
Submitted on: Mon 22 Oct 2018 04:12:06 AM UTC
Category: Octave Forge Package
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Matlab Compatibility
Status: None
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: other
Operating System: Any

_______________________________________________________

Details:

Matlab:

>> size(hough (zeros(10)))

ans =

27   180

>> size(hough (zeros(20)))

ans =

55   180

Octave:

>> size(hough (zeros(10)))

ans =

29   180

>> size(hough (zeros(20)))

ans =

57   180

According to Matlab documentation
(https://www.mathworks.com/help/images/ref/hough.html)
The Hough transform matrix, H, is nrho-by-ntheta where:

nrho = 2*(ceil(D/RhoResolution)) + 1, and
D = sqrt((numRowsInBW - 1)^2 + (numColsInBW - 1)^2).

While hough_line.cc set the size as:

Matrix size (1, 2);
size (0) = r; size (1) = c;
const double diag_length = sqrt (size.sumsq ()(0));
const int nr_bins = 2 * (int)ceil (diag_length) - 1;

Which should be changes to

const double diag_length = sqrt ((c-1)*(c-1)+(r-1)*(r-1));
const int nr_bins = 2 * (int)ceil (diag_length) + 1;

This change makes hough tests compatible with matlab

_______________________________________________________

<https://savannah.gnu.org/bugs/?54874>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

```