Thread: image processing

  1. #16
    Registered User
    Join Date
    Aug 2007
    Posts
    270
    hey to invert an image, do i have to invert red, green and blue parts of it? or can i just says 255 - image_data for example?

  2. #17
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by taurus View Post
    hey to invert an image, do i have to invert red, green and blue parts of it? or can i just says 255 - image_data for example?
    0xFFFFFF-RGB should work if the RGB colours are in the low 24 bits. Since the highest value for a byte is 0xFF, there's no problem with overflow seeping from one colour to another.

    --
    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. #18
    Registered User
    Join Date
    Aug 2007
    Posts
    270
    well in my assignment there is some mention about separating it into red green and blue

    Code:
    red is (image_data[row][column]>>16)&0xff)
    blue is ((image_data[row][column]>>8)&0xff)
    green is ((image_data[row][column])&0xff)
    so would i then take it i have to invert each of those, ie say
    Code:
    red = (image_data[row][column]>>16)&0xff)
    so 255 - red? or wat

    thanks

  4. #19
    Dr Dipshi++ mike_g's Avatar
    Join Date
    Oct 2006
    Location
    On me hyperplane
    Posts
    1,218
    so 255 - red? or wat
    Yes. And then you have to shift the red element back to its position in the integer. along with the other colour elements.

  5. #20
    Registered User
    Join Date
    Aug 2007
    Posts
    270
    would u mind explaing how that is done?

  6. #21
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by taurus View Post
    would u mind explaing how that is done?
    How do you think it's done?

    --
    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. #22
    Registered User
    Join Date
    Aug 2007
    Posts
    270
    thats what i dont know

  8. #23
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by taurus View Post
    thats what i dont know
    Yes, and you should know by now that we are perfectly happy to HELP you get it right, but not to write the code for you without you trying.

    --
    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.

  9. #24
    Registered User
    Join Date
    Aug 2007
    Posts
    270
    well i got this function:
    // This routine will set the image pixel data from the supplied matrix
    // from top left to bottom right. You must ensure that enough space is
    // available.
    void ep100_lib_set_data(int data[EP100_LIB_MAX_X][EP100_LIB_MAX_Y])

    but not sure after i have inverted the three colors how it applies?

  10. #25
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Don't ask almost the same question in two different threads.

    And again, TRY TO do something yourself.

    --
    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.

  11. #26
    Registered User
    Join Date
    Sep 2007
    Posts
    104
    Hey my thread got hijacked

  12. #27
    Registered User
    Join Date
    Sep 2007
    Posts
    104
    Hmm taurus seems to get more help than me , Where Im stuck is interpreting in pseudocode how I would use memmove() to scroll an image . I see no other way than using simple english description on what would happen . Our lecturer didn't go over any more advanced c functions and how they would be interpreted in pseudocode.

  13. #28
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by ICool View Post
    Hmm taurus seems to get more help than me , Where Im stuck is interpreting in pseudocode how I would use memmove() to scroll an image .
    And what have YOU got to show for your efforts? Show us what you're doing, and we'll do our best to help. I try to treat everyone the same (obviously based on their abilities - someone who knows what they are doing will (hopefully) get a different answer than a beginner).

    --
    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.

  14. #29
    Registered User
    Join Date
    Sep 2007
    Posts
    104
    I have this so far
    Code:
    Algorith Image_Operations;
    
    // The following algorithm shall do a number of operations on the source 
    //  image file.
    
    INTEGER data[program_LIB_MAX_X][EP100_LIB_MAX_Y] ;
    
    // This routine will put the image pixel data into the supplied matrix
    // from top left to bottom right. You must ensure that enough space is
    // available.
    
    PROCEDURE program_lib_get_data(intdata[program_LIB_MAX_X]
    [EP100_LIB_MAX_Y]) ;
    
    FUNCTION program_lib_get_data(data); // Get the image data from the user, by calling a function 
    
    PROCEDURE Image_Invert(float data);
    Array new[1024][1024]
    INTEGER Max_y<--y
    INTEGER Max_x<--x
    INTEGER Current_y 
    INTEGER Current_x
    While Current_x < than Max_x;
    array[x]<--array[x-255] 
    // meant to invert colour , by changing pixel   value 
    EndWhile;
    While Current_y less than Max_y;
    Array[y]<--array[y-255]; 
    EndWhile;
    new <-- Invert(array x y);
    
    FUNCTION main()
    // We must check that image is not bigger than 1024x1024
    Output " Please enter size of image { width x height}";
    
    INTEGER X,Y;
    
    Input x,y;
    
    If X>1024 OR Y>1024;
    
    Then Output “ Image too large , try another image “;

  15. #30
    Registered User
    Join Date
    Sep 2007
    Posts
    104
    It has indentation , but it got lost when I copy / pasted

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