bugGNU Octave - Bugs: bug #50122, image package: normxcorr2...


bug #50122: image package: normxcorr2 sometimes returns inf values

Submitted by:  Hartmut <hardy>
Submitted on:  Sun Jan 22 19:28:24 2017  
Category: Octave Forge PackageSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: FixedAssigned to: None
Originator Name: Open/Closed: Closed
Release: 4.2.0Operating System: Any

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

Please log in, so followups can be emailed to you.


(Jump to the original submission Jump to the original submission)

Wed Apr 12 12:36:34 2017, comment #7:

Pushed after removing trailing whitespace


Thank you guys

Carnë Draug <carandraug>
Project Member
Thu Jan 26 04:47:21 2017, comment #6:

See also bug #50151

Avinoam Kalma <avinoam>
Project Member
Tue Jan 24 21:40:53 2017, comment #5:

I have tested this patch:
It solves the original issue of this bug report and it adds (passing) tests for the bug.

I would be happy to see this one applied to the image repository.

Note that normxcorr2 still has a problem of Matlab compatibility in
the margins. It is not related to this bug, so I will open a new bug report for this.

Changing status to "Patch Reviewed" (By Mike and by me).

Avinoam Kalma <avinoam>
Project Member
Mon Jan 23 19:05:09 2017, comment #4:

Here is a new version (V2) of my PATCH, that includes Mike's hints from comment #3.

(file #39543)

Hartmut <hardy>
Mon Jan 23 18:10:05 2017, comment #3:

Hartmut - you could combine your change into one line, may be slightly more efficient since it will be assigning the zeros all at the same time:

You could also change the test to assert that c is exactly what you expect it to be, something like

or at least test that c(3) is exactly zero. Just my two cents, makes it clear exactly what this test was added for.

Other than that, patch and test look good to me.

Mike Miller <mtmiller>
Project Administrator
Mon Jan 23 17:29:18 2017, comment #2:

(adding people to cc who care about the image package)

Hartmut <hardy>
Sun Jan 22 19:43:14 2017, comment #1:

Here is a PATCH to fix this behavior, including a new test for it.

(file #39533)

Hartmut <hardy>
Sun Jan 22 19:28:24 2017, original submission:

This bug was mentioned on the Octave help list:


The behavior is still present with Octave 4.2.0 and image-2.6.1.

The reason for this behavior is that the current Octave version of normxcorr2.m does not properly treat the special case of a constant value in the image part.

Here is what Matlab does:

A solution to this is to add the following line to the code to the end of normxcorr2.m:

I will prepare a patch for this soon.

Hartmut <hardy>


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

Attach File(s):

Attached Files
file #39533:  normxcorr2_no_infs.patch added by hardy (990B - text/x-diff)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by avinoam (Posted a comment)
  • -unavailable- added by mtmiller (Posted a comment)
  • -unavailable- added by hardy (adding people to cc who care about the image package)
  • -unavailable- added by hardy (adding people to cc who care about the image package)
  • -unavailable- added by hardy (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 8 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed Apr 12 12:36:34 2017carandraugStatusPatch Reviewed=>Fixed
    Tue Jan 24 21:40:53 2017avinoamStatusPatch Submitted=>Patch Reviewed
    Mon Jan 23 19:05:09 2017hardyAttached File-=>Added normxcorr2_no_infs_V2.patch, #39543
    Mon Jan 23 18:10:04 2017mtmillerStatusNone=>Patch Submitted
    Mon Jan 23 17:29:18 2017hardyCarbon-Copy-=>Added avinoam
      Carbon-Copy-=>Added carandraug
    Sun Jan 22 19:43:14 2017hardyAttached File-=>Added normxcorr2_no_infs.patch, #39533

    Back to the top

    Powered by Savane 3.1-cleanup1