Thread: image processing

  1. #61
    Registered User
    Join Date
    Aug 2007
    Posts
    270
    what do you mean by offset? how

  2. #62
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    If you consider it like a string rather than a picture, how would you move the first two letters to the back of a string? There are several ways to do it, and some are better than others, but simple will be good enough for now.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #63
    Registered User
    Join Date
    Aug 2007
    Posts
    270
    so i could use >> operator,
    say data = data >> 3

    ?

  4. #64
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by taurus View Post
    so i could use >> operator,
    say data = data >> 3

    ?
    That wasn't what I was after - in fact I'm quite confused as to how you came up with that.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #65
    Registered User
    Join Date
    Aug 2007
    Posts
    270
    oh i was just reading up on the >> operator.

    for the string thing i would get the first character them move to last character.

    for a 5 item array.......
    so array[0] moves to array[4]

    but am not sure on how to say move

  6. #66
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by taurus View Post
    oh i was just reading up on the >> operator.

    for the string thing i would get the first character them move to last character.

    for a 5 item array.......
    so array[0] moves to array[4]

    but am not sure on how to say move
    If it's an N array, and you want to move M characters, how would you do it then?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  7. #67
    Registered User
    Join Date
    Aug 2007
    Posts
    270
    M-N?

    i think
    Last edited by taurus; 10-14-2007 at 12:27 PM.

  8. #68
    Registered User
    Join Date
    Aug 2007
    Posts
    270
    help

  9. #69
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by taurus View Post
    M-N?

    i think
    What's that supposed to mean...

    Describe HOW you'd move the characters around. Once you've got that sorted, you have the scrolling sorted.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  10. #70
    Registered User
    Join Date
    Aug 2007
    Posts
    270
    well i think id take the last column in the array and move it to the first if i was to scroll right, but im still like confused on exactly how to do it, need a hint.

    how would i set it to another area

    cant i do something like using the >> operator?
    Last edited by taurus; 10-14-2007 at 12:42 PM.

  11. #71
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    The >> operator is essentially a divide by a power of 2, so for example x >> 3 is the same as x / (2 * 2 * 2), which turns out as x / 8. It doesn't do anything useful on strings (or any other arrays).

    [In C++ the >> operator, and the complementary << operator, are used as a way to input and output (respectively) data from/to the console, as alternatives to scanf and printf - but in standard C, that's not meaningful at all. ]

    --
    Mats
    Last edited by matsp; 10-14-2007 at 01:00 PM.
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  12. #72
    Registered User
    Join Date
    Aug 2007
    Posts
    270
    hmmm, i dont know then how i can do it.

    I need some help on this pls.
    how to i move the colums to the other end for horizontal scroll?
    Last edited by taurus; 10-14-2007 at 01:02 PM.

  13. #73
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by taurus View Post
    hmmm, i dont know then how i can do it.

    I need some help on this pls.
    how to i move the colums to the other end for horizontal scroll?
    Start by writing a piece of code to scroll a piece of text around, based on:
    str: char array with text in it.
    n = strlen(str);
    m = some number you've given.
    write a function
    scroll(str, n, m)
    that modifies by str "rotating" it M steps.

    If you can't do that, it's no point in trying to get that working on an image - it will just be much harder to figure out what's going on, because you won't be bale to immediately spot what's going wrong. Once you can do that, just change the scroll to take pixels (ints) instead of chars, or rows of pixels instead of chars for the vertical scroll, and you have your function ready to go.

    --
    Mats
    Last edited by matsp; 10-14-2007 at 02:20 PM. Reason: Fix minor thinko's.
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  14. #74
    Registered User
    Join Date
    Sep 2007
    Posts
    104
    IS something like this adequate for image scrolling procedure :
    Code:
    Image_horiscroller(INTEGER image_olddata[EP100_LIB_MAX_X][EP100_LIB_MAX_Y], INTEGER
    width, INTEGER height, INTEGER horiscroll)
    INTEGER * image_data[EP100_LIB_MAX_X][ EP100_LIB_MAX_Y]
    INTEGER i, j
    FOR (i <1
    TO i<= width) DO
    FOR (j <1
    TO j<=height) DO
    IF ((i + horiscroll)> width) THEN
    image_data * [i+horiscroll100]
    <image_
    olddata[i]
    ELSE IF ((i + horiscroll)<0 THEN
    image_data * [i+horiscroll+100] <image_
    olddata[i]
    ELSE
    image_data * [i+horiscroll] <image_
    olddata[i]
    ENDIF
    ENDIF
    ENDIF
    END_Image_horiscroller
    Image_vertiscroller(INTEGER image_olddata[EP100_LIB_MAX_X][EP100_LIB_MAX_Y], INTEGER
    width, INTEGER height, INTEGER vertiscroll)
    INTEGER image_data * [EP100_LIB_MAX_X][ EP100_LIB_MAX_Y]
    INTEGER i, j
    FOR (i <1
    TO i<= height) DO
    FOR (j <1
    TO j<=width) DO
    IF ((i + vertiscroll)> height) THEN
    image_data * [i+vertiscroll100]
    <image_
    olddata[i]
    ELSE IF ((i + vertiscroll)<0 THEN
    image_data * [i+vertiscroll+100] <image_
    olddata[i]
    ELSE
    image_data * [i+vertiscroll] <image_
    olddata[i]
    ENDIF
    ENDIF
    ENDIF
    END_Image_vertiscroller

  15. #75
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    There seems to be a constant 100 in there that I don't quite understand the meaning of.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem reading tiff image files?
    By compz in forum C++ Programming
    Replies: 9
    Last Post: 10-30-2009, 04:17 AM
  2. Simple Image Processing
    By ejohns85 in forum C++ Programming
    Replies: 4
    Last Post: 03-19-2009, 12:10 PM
  3. Replies: 4
    Last Post: 03-02-2003, 09:12 AM
  4. Memory Allocation in Intell Image processing liberary
    By nisar in forum Windows Programming
    Replies: 0
    Last Post: 01-12-2003, 07:29 AM
  5. Image rotation using intel image processing
    By sunis in forum Windows Programming
    Replies: 1
    Last Post: 11-18-2002, 02:40 AM