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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #51724] [octave forge] (image) imregionalmax m


From: Hartmut
Subject: [Octave-bug-tracker] [bug #51724] [octave forge] (image) imregionalmax misbehaves on float images
Date: Mon, 28 Aug 2017 17:35:48 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0

Follow-up Comment #5, bug #51724 (project octave):

Please do NOT use my patch from comment #4. It is horrendously slow.

Here is a small test case to test for the speed of imregionialmax.m on float
images:


im = peaks(300);
tic;
m = imregionalmax(im);
toc


Using this test script on imregionalmax with my last patch, gives me a run
time of 7.0 seconds on my PC. Does anyone understand why this is so VERY
slow?

Here is an alternative approach for dealing with float input images:


    if (isfloat(img))
      Dx = diff (img, 1, 1);
      Dy = diff (img, 1, 2);
      deltax = min (abs (Dx(:)));
      deltay = min (abs (Dy(:)));
      delta = min (deltax, deltay);
      recon = imreconstruct (img, img + delta, conn);
    else
      recon = imreconstruct (img, img + 1, conn);
    end


(This code would need to become a bit more beautiful, and be extended to
images of ndims <>2 before usage.)

With this code in imregionalmax.m I get a run time of 0.07s, this is 100 times
faster.

What do you think? Does this approach make sense for float input images? The
reasoning behind this is, that a regional maximum "only" needs to be higher
than its neighbors by the minimum distance change that happens in the whole
image. But his minimum distance change is here only computed in the
4-neighborhood (regardless of the conn setting in imregionalmax). Is there an
easy way to improve this and also calculate the minimum distance change in a
8-neighborhood?


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?51724>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]