Skip to content

plotlens : segmentation fault. #21

@prelard812

Description

@prelard812

Hi,

This is my first active participation to a git project ( 3d scanner is really cool) . I started to compile your project, two days ago and things are going well now. All my modules talk together, and now I'm trying to get my first camera calibration... but I got into problems with plotlens... I got a segmentation fault...

Problem: the problem rises into the last loop to plot the grid image...
pixb seems to be update to the first pixel of each row... so calculated index from this equation :
int idx = 3(r*w+c);* will produce an overflow... I think you need to just calculate the offset of the current column with 3*C see corrected code below. What do you think of this... Maybe I don<t understand your code... but I'm pretty sure of this correction.

Prelard812.

`// generate grid image distorted with lens (simulated image of grid)
if( gen_grid )
{

    int w = grid_img.cols;
    int h = grid_img.rows;
    for(int r=0; r<h; r++)
    {
         uchar* pixb = grid_img.ptr<unsigned char>(r);
         for(int c=0; c<w; c++)
         {
            //int idx = 3*(r*w+c);
            **int idx = 3*(c);**
            unsigned char v = 255;
            pixb[idx+0] = v;
            pixb[idx+1] = v;
            pixb[idx+2] = v;
         }
    }

}`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions