[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #66698] [octave forge] (image) imgradient may
From: |
Liang Tang |
Subject: |
[Octave-bug-tracker] [bug #66698] [octave forge] (image) imgradient may output high values |
Date: |
Wed, 22 Jan 2025 12:55:32 -0500 (EST) |
URL:
<https://savannah.gnu.org/bugs/?66698>
Summary: [octave forge] (image) imgradient may output high
values
Group: GNU Octave
Submitter: lt1234
Submitted: Wed 22 Jan 2025 05:55:28 PM UTC
Category: Octave Package
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Matlab Compatibility
Status: None
Assigned to: None
Originator Name: lt1234
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: 9.2.0
Operating System: Microsoft Windows
Fixed Release: None
Planned Release: None
_______________________________________________________
Follow-up Comments:
-------------------------------------------------------
Date: Wed 22 Jan 2025 05:55:28 PM UTC By: Liang Tang <lt1234>
Hi, I observed a difference between Octave and Matlab in imgradient. Thanks.
Octave Image imgradient.m may produce high gradient values at the image outer
perimeter. The attachment mat file contain the image associated with the
numbers listed below. Other images can be used to demonstrate my observation
if the image does not have a uniform black background.
grad=imgradient(bw);grad(1:10,1:10)
667.5148 630.0286 630.0286 626.0288 626.0288 630.0286 630.0286
627.0072 627.0072 628.0000
632.0000 8.0000 8.0000 8.0000 8.0000 8.0000 8.0000
3.1623 5.8310 4.0000
632.0000 8.0000 8.0000 8.0000 8.0000 8.0000 8.0000
1.4142 7.6158 4.0000
632.0000 8.0000 8.0000 8.0000 8.0000 8.0000 8.0000
0 8.0000 0
632.0000 8.0000 8.0000 8.0000 8.0000 8.0000 8.0000
1.4142 7.6158 4.0000
632.0000 8.0000 8.0000 8.0000 8.0000 8.0000 8.0000
4.4721 7.2111 8.0000
632.0000 8.0000 8.0000 8.0000 8.0000 8.0000 8.0000
8.2462 6.0000 8.0000
631.0198 10.7703 8.2462 9.4868 9.4868 8.2462 10.7703
11.6619 6.3246 7.0711
629.0199 13.9284 8.9443 10.7703 10.7703 8.9443 13.9284
10.2956 2.0000 2.0000
628.0000 13.0384 8.2462 9.0554 9.0554 8.2462 13.0384
6.3246 7.2111 7.6158
Matlab solution:
8.0000 8.0000 8.0000 8.0000 8.0000 8.0000 8.0000
4.0000 4.0000 0
8.0000 8.0000 8.0000 8.0000 8.0000 8.0000 8.0000
3.1623 5.8310 4.0000
8.0000 8.0000 8.0000 8.0000 8.0000 8.0000 8.0000
1.4142 7.6158 4.0000
8.0000 8.0000 8.0000 8.0000 8.0000 8.0000 8.0000
0 8.0000 0
8.0000 8.0000 8.0000 8.0000 8.0000 8.0000 8.0000
1.4142 7.6158 4.0000
8.0000 8.0000 8.0000 8.0000 8.0000 8.0000 8.0000
4.4721 7.2111 8.0000
8.0000 8.0000 8.0000 8.0000 8.0000 8.0000 8.0000
8.2462 6.0000 8.0000
11.4018 10.7703 8.2462 9.4868 9.4868 8.2462 10.7703
11.6619 6.3246 7.0711
13.0384 13.9284 8.9443 10.7703 10.7703 8.9443 13.9284
10.2956 2.0000 2.0000
12.0000 13.0384 8.2462 9.0554 9.0554 8.2462 13.0384
6.3246 7.2111 7.6158
The rest is FYI only.
imgradientxy is called from imgradient to calculate the gradient.
imgradientxy name is common in Octave/Matlab.
Octave Image imgradientxy uses conv2 to apply filters.
Matlab Image imgradientxy uses imfilter to apply filters.
imfilter has padding options to control what the calculation of gradient at
the image outer perimeter is based on.
I assume that conv2 uses zero pad.
The example below shows where I see the differences may be from.
% Octave Image package default
[gradX] = conv2 (double(bw), fspecial('sobel')', 'same');
gradX(1:10,1:10)
% imfilter can produce the same as conv2
[gradX] = imfilter (double(bw), fspecial('sobel')', 'conv');
gradX(1:10,1:10)
% But in Matlab imgradientxy, the padding is controlled.
[gradX] = imfilter (double(bw), fspecial('sobel')', 'replicate',
'corr');gradX(1:10,1:10) % matlab default
[gradX] = imfilter (double(bw), fspecial('sobel')', 'replicate',
'conv');gradX(1:10,1:10) % conv is not an issue. The padding is.
_______________________________________________________
File Attachments:
-------------------------------------------------------
Name: bw.zip Size: 147KiB
<https://file.savannah.gnu.org/file/bw.zip?file_id=56802>
AGPL NOTICE
These attachments are served by Savane. You can download the corresponding
source code of Savane at
https://savannah.gnu.org/source/savane-31c1c407b236753eb42459c749b2de08c0e97606.tar.gz
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?66698>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc
Description: PGP signature
- [Octave-bug-tracker] [bug #66698] [octave forge] (image) imgradient may output high values,
Liang Tang <=
- [Octave-bug-tracker] [bug #66698] [octave forge] (image) imgradient may output high values, Pantxo Diribarne, 2025/01/23
- [Octave-bug-tracker] [bug #66698] [octave forge] (image) imgradient may output high values, Pantxo Diribarne, 2025/01/23
- [Octave-bug-tracker] [bug #66698] [SPAM] [octave forge] (image) imgradient may output high values, Ineiev, 2025/01/23
- [Octave-bug-tracker] [bug #66698] [SPAM] [octave forge] (image) imgradient may output high values, John W. Eaton, 2025/01/23
- [Octave-bug-tracker] [bug #66698] [SPAM] [octave forge] (image) imgradient may output high values, Ineiev, 2025/01/23
- [Octave-bug-tracker] [bug #66698] [SPAM] [octave forge] (image) imgradient may output high values, John W. Eaton, 2025/01/23
- [Octave-bug-tracker] [bug #66698] [SPAM] [octave forge] (image) imgradient may output high values, Ineiev, 2025/01/23