Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Divide by zero error in SEEDS Superpixels #2935

Closed
@scloke

Description

@scloke
  • OpenCV => 4.2
  • Operating System / Platform => Windows 64 Bit
  • Compiler =>Visual Studio 2019
Detailed description

For opencv_contrib/modules/ximgproc/src/seeds.cpp
lines 136-141

//compute initial label for sublevels: level <= seeds_top_level//this is an equally sized grid with size nr_h[level]*nr_w[level]int computeLabel(int level, int x, int y) {    return std::min(y / (height / nr_wh[2 * level + 1]), nr_wh[2 * level + 1] - 1) * nr_wh[2 * level]            + std::min((x / (width / nr_wh[2 * level])), nr_wh[2 * level] - 1);}

When processing a large number of images, a program crash can occur with a divide by zero error in the above function. This can be rectified by changing to the following:

//compute initial label for sublevels: level <= seeds_top_level//this is an equally sized grid with size nr_h[level]*nr_w[level]int computeLabel(int level, int x, int y) {    return std::min(y * nr_wh[2 * level + 1] / height), nr_wh[2 * level + 1] - 1) * nr_wh[2 * level]            + std::min((x * nr_wh[2 * level] / width)), nr_wh[2 * level] - 1);}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp