bugGNU Octave - Bugs: bug #66107, [octave forge] (image) im2bw()...

 
 

bug #66107: [octave forge] (image) im2bw() function in image should use the result of graythresh() function when converting grayscal

Submitter:  Yu Hongbo <yuhongbo>
Submitted:  Mon 19 Aug 2024 03:31:28 AM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Invalid / Not an Octave Bug Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * other Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 25 Aug 2024 05:45:23 AM UTC, comment #1: 

Checking MATLAB documentation, when using
im2bw(input)

MATLAB is using a threshold of 0.5 (and not graythresh(input)),
so the result is correct.

Closing this bug report, thanks.

Avinoam Kalma <avinoam>
Group Member
Mon 19 Aug 2024 03:31:28 AM UTC, original submission:  

im2bw() function in image should use the result of graythresh() function when converting grayscale image to black&white image.

First, the "input" variant is a grayscale image.

>> input

input =

   0.1000   0.2000   0.3000
   0.2000   0.3000   0.4000
   0.3000   0.4000   0.5000

If calling im2bw() function only with 1 param, the result image is full black. This is not correct.

>> im2bw(input)


If calling im2bw() function with 2 params, the result image is black&white separately. This is correct.

>> im2bw(input, 0.2)


So, im2bw() function can convert grayscale image to black&white image, not full-black image.
But the correct behavior is, if calling im2bw() function only with 1 param, the threshold of black&white is the result of graythresh() function, which is an auto calculated value.

>> graythresh(input)

ans = 0.2490

So, only when converting grayscale images, the two lines of code below should be equivalent.

>> im2bw(input)
>> im2bw(input, graythresh(input))

Yu Hongbo <yuhongbo>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by avinoam (Posted a comment)
  • -email is unavailable- added by yuhongbo (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-08-25 avinoam StatusNone Invalid / Not an Octave Bug
        Open/ClosedOpen Closed
        ReleaseNone other
        Operating SystemNone Any

    Back to the top

    Powered by Savane 3.14-5139.
    Corresponding source code