I really need a help on image processing

Discussion in 'Programming' started by the_red, Mar 14, 2011.

  1. #1
    Hi all, I was having a tutorial for image processing. The problem is I'm so stuck with the questions. Well, maybe it is so easy peasy for some of you. I'm such a newbie on this field.

    the tutorial question:
    an example:
    sensorData[0] represents cell [0,0];
    then
    sensorData[0] = 50;//red

    1)if sensorData[0] is for cell[0,0], then what is the corresponding sensorData array index for the following:
    a) cell[12,25]
    b)cell[25,25]
    c)cell[5,5]

    2) whats the general equaltion for mapping array index for sensorData array with cell[..,..] array

    pls guys..pls..I'm so stuck..
     
    the_red, Mar 14, 2011 IP
  2. woogley

    woogley Peon

    Messages:
    103
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    i think what you need is a multi-level array for your data, it would be easier to map it..

    example:

    sensorData = array();

    sensorData[0] = array();
    sensorData[0][0] = 50;
    sensorData[0][1] = 100;
    sensorData[0][2] = 150;

    sensorData[1] = array();
    sensorData[1][0] = 200;
    sensorData[1][1] = 250;
    sensorData[1][2] = 300;

    sensorData[2] = array();
    sensorData[2][0] = 350;
    sensorData[2][1] = 400;
    sensorData[2][2] = 450;

    // retrieving data
    red = sensorData[0][0];


    im not sure on how you want it to work, but thats what i understand based on you questions..

    note: if your using php, just put a $ before the variable name
     
    woogley, Mar 15, 2011 IP
  3. the_red

    the_red Peon

    Messages:
    132
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    hi..tq so much for your answer..But I'm still confuse with ---2) whats the general equaltion for mapping array index for sensorData array with?

    could you give me some links that will help me on this matter?
     
    the_red, Mar 15, 2011 IP
  4. ACME Squares

    ACME Squares Peon

    Messages:
    98
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You're mapping a 1D array to 2D image representation correct?
    I'd consider re-factoring that to use nested loops, because images are just naturally 2D.

    n = width * x + y;
    Where n is the linear position, and x,y are your cells.
     
    ACME Squares, Mar 16, 2011 IP
    the_red likes this.
  5. the_red

    the_red Peon

    Messages:
    132
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #5
    tq so so much!
     
    the_red, Mar 16, 2011 IP
  6. the_red

    the_red Peon

    Messages:
    132
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #6
    guys..it's linear mapping not 2D..could any help me in this linear mapping..I'm stuck..pls..anyone..
     
    the_red, Mar 20, 2011 IP
  7. ACME Squares

    ACME Squares Peon

    Messages:
    98
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I'm still a bit confused what you're trying to achieve.
     
    Last edited: Mar 21, 2011
    ACME Squares, Mar 21, 2011 IP
  8. Dobbin

    Dobbin Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #8
    Hi, im a liittle confused with your sample code, if you want more info, you can see this c# image processing app, i used it several times this month, it is helpful.
     
    Dobbin, Apr 16, 2013 IP