Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plotlens : segmentation fault. #21

Open
prelard812 opened this issue Apr 15, 2020 · 0 comments
Open

plotlens : segmentation fault. #21

prelard812 opened this issue Apr 15, 2020 · 0 comments

Comments

@prelard812
Copy link

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;
         }
    }

}`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant