image processing

This is a discussion on image processing within the C Programming forums, part of the General Programming Boards category; What's this: Code: While Current_x < than Max_x; array[x]<--array[x-255] // meant to invert colour , by changing pixel value EndWhile; ...

  1. #31
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    What's this:
    Code:
    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);
    It looks like you are moving pixels around, rather than inverting the colour of the pixels.

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

  2. #32
    Registered User
    Join Date
    Sep 2007
    Posts
    104
    Quote Originally Posted by matsp View Post
    What's this:
    Code:
    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);
    It looks like you are moving pixels around, rather than inverting the colour of the pixels.

    --
    Mats
    Well I'm not sure , that's what I thought , but maybe I should break it up into 3 colours ( the pixels i mean ) , and then do this for all 3 :
    Code:
    array[colour] = 255-array[colour];

  3. #33
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by ICool View Post
    Well I'm not sure , that's what I thought , but maybe I should break it up into 3 colours ( the pixels i mean ) , and then do this for all 3 :
    Code:
    array[colour] = 255-array[colour];
    Somthing like that, yes. Although I'd expect that you need to do something along the lines of:
    Code:
    pixel = array[y][x];
    pixel.red = 255-pixel.red;
    ...
    Of course, the actual process of splitting the colour will involve some shifting and masking with and, rather than accessing a struct.

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

  4. #34
    Registered User
    Join Date
    Sep 2007
    Posts
    104
    Hmm , so you mean it is too difficult to split image into 3 colours ?

  5. #35
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by ICool View Post
    Hmm , so you mean it is too difficult to split image into 3 colours ?
    More like "not necessary" - but that's just my thoughts.

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

  6. #36
    Registered User
    Join Date
    Sep 2007
    Posts
    104
    Do you know any other way to do it then ?

  7. #37
    Registered User
    Join Date
    Aug 2007
    Posts
    270
    red is ((image_data[row][column]>>16)&0xff)
    blue is ((image_data[row][column]>>8)&0xff)
    green is ((image_data[row][column])&0xff)

  8. #38
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Right, so you will need to split each pixel into red, green, blue and then manipulate[1], but you don't need to make an array of each of the three base colours (at least not if all you want to do is invert the colour).

    [1] Although I did post a single operation that should be safe to perform on a whole pixel at a time[at least as long as there is no alpha value in the upper 8 bits]

    --
    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. #39
    Registered User
    Join Date
    Sep 2007
    Posts
    104
    I still dont understant how to use that

  10. #40
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by ICool View Post
    I still dont understant how to use that
    What don't you understand, and what have you done to understand it?

    --
    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. #41
    Registered User
    Join Date
    Sep 2007
    Posts
    104
    When I posted that I didn't understand I didn't see your post . When you say single operation you men this :
    pixel = array[y][x];
    pixel.red = 255-pixel.red;
    ...

  12. #42
    Registered User
    Join Date
    Aug 2007
    Posts
    270
    hey ICool, check ur private messages

  13. #43
    Registered User
    Join Date
    Sep 2007
    Posts
    104
    I'm not sure how to do that taurus , I think there is a function that he gives us that does it though , I haven't yet come to that part

  14. #44
    Dr Dipshi++ mike_g's Avatar
    Join Date
    Oct 2006
    Location
    On me hyperplane
    Posts
    1,218
    red is ((image_data[row][column]>>16)&0xff)
    blue is ((image_data[row][column]>>8)&0xff)
    green is ((image_data[row][column])&0xff)
    You seem to have mixed up blue and green. Colour elements tend to go RGB.

  15. #45
    Registered User
    Join Date
    Aug 2007
    Posts
    270
    Hi MATSP, got a question:
    for this:


    // 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.
    void ep100_lib_get_data(int data[EP100_LIB_MAX_X][EP100_LIB_MAX_Y]);


    i just wanna c if i understand it. data is the name of the array and the things in the [][] are the size. now to set the array (data) to the image file pixels, i would do this?:
    ep100_lib_get_data(data)
    ??
    or wat?

Page 3 of 6 FirstFirst 123456 LastLast
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, 05:17 AM
  2. Simple Image Processing
    By ejohns85 in forum C++ Programming
    Replies: 4
    Last Post: 03-19-2009, 01: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

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