Rght

This is a discussion on Rght within the C++ Programming forums, part of the General Programming Boards category; I am trying to do a Randimized Generalized Hough Transform. A document detailing this is available at http://www.cse.cuhk.edu.hk/~pffung/p...ce/CPR1996.pdf The problem ...

  1. #1
    Registered User
    Join Date
    Jan 2003
    Posts
    37

    Rght

    I am trying to do a Randimized Generalized Hough Transform. A document detailing this is available at
    http://www.cse.cuhk.edu.hk/~pffung/p...ce/CPR1996.pdf

    The problem I am having is in the first two steps of the algroithm

    1) Horizontal-gradient = Convolve(Image, Hor-Mask)
    2) Vertical-gradient = Convolve(Image, Ver-Mask)

    Hor-Mask = -1 -2 -3 -2 -1
    0 0 0 0 0
    1 2 3 2 1

    After executing step 1. The image doesn't change much. Jusct a black line around the edge.

    I know the code below is not great but I was just testing it. I would be greatful of any input.



    int Matrix[3][5] = {-1,-2,-3,-2,-1,
    0,0,0,0,0,
    1,2,3,2,1};
    int row;
    int col;
    int value;

    for (row = 2; row < Image1->Height - 1; row++)
    for (col = 1; col < Image1->Width - 2; col++)
    {
    value = Image1->Canvas->Pixels[col - 2][row - 1] * Matrix[0][0];
    value =+ Image1->Canvas->Pixels[col - 1][row - 1] * Matrix[0][1];
    value =+ Image1->Canvas->Pixels[col][row - 1] * Matrix[0][2];
    value =+ Image1->Canvas->Pixels[col + 1][row - 1] * Matrix[0][3];
    value =+ Image1->Canvas->Pixels[col + 2][row - 1] * Matrix[0][4];

    value =+ Image1->Canvas->Pixels[col - 2][row + 1] * Matrix[2][0];
    value =+ Image1->Canvas->Pixels[col - 1][row + 1] * Matrix[2][1];
    value =+ Image1->Canvas->Pixels[col][row + 1] * Matrix[2][2];
    value =+ Image1->Canvas->Pixels[col + 1][row + 1] * Matrix[2][3];
    value =+ Image1->Canvas->Pixels[col + 2][row + 1] * Matrix[2][4];

    Image2->Canvas->Pixels[col][row] = value;
    }

  2. #2
    Senior Member joshdick's Avatar
    Join Date
    Nov 2002
    Location
    Phildelphia, PA
    Posts
    1,146
    Truthfully, I don't understand a darn thing about what it is you're saying, but something caught my eye in your code.
    Code:
    value =+ Image1...
    I think you want to add the right hand side to value and store the whole shebang in value. If so, you want to use +=. The way your code is being interpreted by the computer is the + is a unary operator only operating on Image1. That might be your problem or I might be dead wrong. It's worth letting you know that, though. Good Luck.
    FAQ

    "The computer programmer is a creator of universes for which he alone is responsible. Universes of virtually unlimited complexity can be created in the form of computer programs." -- Joseph Weizenbaum.

    "If you cannot grok the overall structure of a program while taking a shower, you are not ready to code it." -- Richard Pattis.

  3. #3
    Registered User
    Join Date
    Jan 2003
    Posts
    37
    Thanks.
    That was one of my mistakes.


    I'm sure there are many more.

  4. #4
    Senior Member joshdick's Avatar
    Join Date
    Nov 2002
    Location
    Phildelphia, PA
    Posts
    1,146
    My suggestion to you is to repost your revised code using code tags this time and ask a specific question. Hopefully then, someone more qualified than me could help you.
    FAQ

    "The computer programmer is a creator of universes for which he alone is responsible. Universes of virtually unlimited complexity can be created in the form of computer programs." -- Joseph Weizenbaum.

    "If you cannot grok the overall structure of a program while taking a shower, you are not ready to code it." -- Richard Pattis.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Rght
    By spidereen in forum C++ Programming
    Replies: 4
    Last Post: 01-20-2003, 12:11 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21