beginner on image procesing

hi
i have posted this message in the c beginners secito, but maybe this the right place for it. the question is the next: how can i load an image into a variable in c? i suppose this variable must be an array, which dimensions depend on the type of image. i do not know either this can be done by using a standard c library. if this is not the case, any suggestion about how to start working?

thanks

cacaramba

Comments

  • : hi
    : i have posted this message in the c beginners secito, but maybe this the right place for it. the question is the next: how can i load an image into a variable in c? i suppose this variable must be an array, which dimensions depend on the type of image. i do not know either this can be done by using a standard c library. if this is not the case, any suggestion about how to start working?
    :
    : thanks
    :
    : cacaramba
    :
    Well, you can use memory also to do this instead of an array. But this also depends on you use DOS or Win32. Anyway, here's a link for some C graphs library that may help you out:
    http://www.programmersheaven.com/app/search/search.aspx?SearchMode=1&SearchTxt=c+library+graphics

    If you want to develop your own graph lib, you need to know some formats, this is a link to a File Format Encyclopedia:
    http://www.programmersheaven.com/search/Download.asp?FileID=923

    An array in this case does not need to be multidimensional, just a twodimensional array. But this is only if you need a constant size image, such as 100x100.
    [code]
    int image[100][100]
    [/code]
    But, remember that you can also store image in memory.

    Or, you could just load the file directly onto the screen.

    Hope this lil info helps you out.
    ****************
    Any questions? Just ask!

    :-) [b][blue]GAASHIUS[/blue][/b] :-)


  • : : hi
    : : i have posted this message in the c beginners secito, but maybe this the right place for it. the question is the next: how can i load an image into a variable in c? i suppose this variable must be an array, which dimensions depend on the type of image. i do not know either this can be done by using a standard c library. if this is not the case, any suggestion about how to start working?
    : :
    : : thanks
    : :
    : : cacaramba
    : :
    : Well, you can use memory also to do this instead of an array. But this also depends on you use DOS or Win32. Anyway, here's a link for some C graphs library that may help you out:
    : http://www.programmersheaven.com/app/search/search.aspx?SearchMode=1&SearchTxt=c+library+graphics
    :
    : If you want to develop your own graph lib, you need to know some formats, this is a link to a File Format Encyclopedia:
    : http://www.programmersheaven.com/search/Download.asp?FileID=923
    :
    : An array in this case does not need to be multidimensional, just a twodimensional array. But this is only if you need a constant size image, such as 100x100.
    : [code]
    : int image[100][100]
    : [/code]
    : But, remember that you can also store image in memory.
    :
    : Or, you could just load the file directly onto the screen.
    :
    : Hope this lil info helps you out.
    : ****************
    : Any questions? Just ask!
    :
    : :-) [b][blue]GAASHIUS[/blue][/b] :-)
    :
    :
    :
    i also want to know how this is done. in your example, how do you assign a 100x100 bmp file for example named "trial.bmp" to the 2 dimensional array variable image. im very confused in this part. tnx!
  • [b][red]This message was edited by MT2002 at 2006-2-3 18:32:15[/red][/b][hr]
    : : : hi
    : : : i have posted this message in the c beginners secito, but maybe this the right place for it. the question is the next: how can i load an image into a variable in c? i suppose this variable must be an array, which dimensions depend on the type of image. i do not know either this can be done by using a standard c library. if this is not the case, any suggestion about how to start working?
    : : :
    : : : thanks
    : : :
    : : : cacaramba
    : : :
    : : Well, you can use memory also to do this instead of an array. But this also depends on you use DOS or Win32. Anyway, here's a link for some C graphs library that may help you out:
    : : http://www.programmersheaven.com/app/search/search.aspx?SearchMode=1&SearchTxt=c+library+graphics
    : :
    : : If you want to develop your own graph lib, you need to know some formats, this is a link to a File Format Encyclopedia:
    : : http://www.programmersheaven.com/search/Download.asp?FileID=923
    : :
    : : An array in this case does not need to be multidimensional, just a twodimensional array. But this is only if you need a constant size image, such as 100x100.
    : : [code]
    : : int image[100][100]
    : : [/code]
    : : But, remember that you can also store image in memory.
    : :
    : : Or, you could just load the file directly onto the screen.
    : :
    : : Hope this lil info helps you out.
    : : ****************
    : : Any questions? Just ask!
    : :
    : : :-) [b][blue]GAASHIUS[/blue][/b] :-)
    : :
    : :
    : :
    : i also want to know how this is done. in your example, how do you assign a 100x100 bmp file for example named "trial.bmp" to the 2 dimensional array variable image. im very confused in this part. tnx!
    :
    [blue]
    Just loop it. Example..[/blue][code]
    const int iWidth = 100, [green]//image width/height[/green]
    iHeight = 100;

    char* image; [green]// your loaded image[/green]

    int pixels[iHeight][iWidth]; [green]// destination (assuming 24 bpp image)[/green]


    [green]// copy the image[/green]
    for ( int y = 0; y< iHeight; y++)
    for ( int x=0; x<iWidth; x++)
    pixels [y][x] = image [x+y*iWidth];[/code]
    [blue]
    The formula [b]x+y*iWidth[/b] can be used to retrieve an element
    (in this case, pixel) at an x/y location in linear memory.

    This will [b]only[/b] work if "image" and "pixels" are
    the same bit depth. If they are not, you will need to
    convert it.

    Hope this helps!
    ~mt2002[/blue]


  • : [b][red]This message was edited by MT2002 at 2006-2-3 18:32:15[/red][/b][hr]
    : : : : hi
    : : : : i have posted this message in the c beginners secito, but maybe this the right place for it. the question is the next: how can i load an image into a variable in c? i suppose this variable must be an array, which dimensions depend on the type of image. i do not know either this can be done by using a standard c library. if this is not the case, any suggestion about how to start working?
    : : : :
    : : : : thanks
    : : : :
    : : : : cacaramba
    : : : :
    : : : Well, you can use memory also to do this instead of an array. But this also depends on you use DOS or Win32. Anyway, here's a link for some C graphs library that may help you out:
    : : : http://www.programmersheaven.com/app/search/search.aspx?SearchMode=1&SearchTxt=c+library+graphics
    : : :
    : : : If you want to develop your own graph lib, you need to know some formats, this is a link to a File Format Encyclopedia:
    : : : http://www.programmersheaven.com/search/Download.asp?FileID=923
    : : :
    : : : An array in this case does not need to be multidimensional, just a twodimensional array. But this is only if you need a constant size image, such as 100x100.
    : : : [code]
    : : : int image[100][100]
    : : : [/code]
    : : : But, remember that you can also store image in memory.
    : : :
    : : : Or, you could just load the file directly onto the screen.
    : : :
    : : : Hope this lil info helps you out.
    : : : ****************
    : : : Any questions? Just ask!
    : : :
    : : : :-) [b][blue]GAASHIUS[/blue][/b] :-)
    : : :
    : : :
    : : :
    : : i also want to know how this is done. in your example, how do you assign a 100x100 bmp file for example named "trial.bmp" to the 2 dimensional array variable image. im very confused in this part. tnx!
    : :
    : [blue]
    : Just loop it. Example..[/blue][code]
    : const int iWidth = 100, [green]//image width/height[/green]
    : iHeight = 100;
    :
    : char* image; [green]// your loaded image[/green]
    :
    : int pixels[iHeight][iWidth]; [green]// destination (assuming 24 bpp image)[/green]
    :
    :
    : [green]// copy the image[/green]
    : for ( int y = 0; y< iHeight; y++)
    : for ( int x=0; x
    #include

    [green]/* definition of both bitmaps height and width */[/green]
    #define BITMAPX 352
    #define BITMAPY 292

    [green]/* structure to contain data for one pixel */[/green]
    typedef struct {
    float r,g,b; [green]/* color data varies for each color from 0-255 */[/green]
    }RGB; [green]/* they are floats just for convinience */[/green]

    [green]/* two 352x292x24 bit bitmaps containing about to be compared images */[/green]
    RGB bitmap1[BITMAPX][BITMAPY],bitmap2[BITMAPX][BITMAPY];


    [green]/* variables to hold number of pixels, current pixel and match so far */
    /* and match for current pixel */[/green]
    float pixels=BITMAPX*BITMAPY,current_pixel=0;
    float match=0,currentmatch=0;


    main()
    {

    [green]/* now we start looping through all pixels in our bitmaps comparing */
    /* according pixels to each other */[/green]
    int posx, posy, currentpixel;
    for(posx=0;posx<BITMAPX;posx++){
    for(posy=0;posy<BITMAPY;posy++){
    currentpixel++;

    [green]/* this is where actual comparison takes place */
    /* given that all three basic colors are on different axis */
    /* match between them can be calculated using */
    /* vector length equation */[/green]
    currentmatch=sqrt(pow(bitmap1[posx][posy].r-bitmap2[posx][posy].r,2)+pow(bitmap1[posx][posy].g-bitmap2[posx][posy].g,2)+pow(bitmap1[posx][posy].b-bitmap2[posx][posy].b,2));

    match=((match*currentpixel)+currentmatch)/(currentpixel);
    }
    }

    match=100-match/2.56;

    printf("%f",match);
    }
    [/code]

    but i cant seem to load the image properly to the two dimensional arrays that I declared. how can I for example load an image named "try.bmp" to bitmap1 and "try1.bmp" to bitmap2. thanks!
  • : : [b][red]This message was edited by MT2002 at 2006-2-3 18:32:15[/red][/b][hr]
    : : : : : hi
    : : : : : i have posted this message in the c beginners secito, but maybe this the right place for it. the question is the next: how can i load an image into a variable in c? i suppose this variable must be an array, which dimensions depend on the type of image. i do not know either this can be done by using a standard c library. if this is not the case, any suggestion about how to start working?
    : : : : :
    : : : : : thanks
    : : : : :
    : : : : : cacaramba
    : : : : :
    : : : : Well, you can use memory also to do this instead of an array. But this also depends on you use DOS or Win32. Anyway, here's a link for some C graphs library that may help you out:
    : : : : http://www.programmersheaven.com/app/search/search.aspx?SearchMode=1&SearchTxt=c+library+graphics
    : : : :
    : : : : If you want to develop your own graph lib, you need to know some formats, this is a link to a File Format Encyclopedia:
    : : : : http://www.programmersheaven.com/search/Download.asp?FileID=923
    : : : :
    : : : : An array in this case does not need to be multidimensional, just a twodimensional array. But this is only if you need a constant size image, such as 100x100.
    : : : : [code]
    : : : : int image[100][100]
    : : : : [/code]
    : : : : But, remember that you can also store image in memory.
    : : : :
    : : : : Or, you could just load the file directly onto the screen.
    : : : :
    : : : : Hope this lil info helps you out.
    : : : : ****************
    : : : : Any questions? Just ask!
    : : : :
    : : : : :-) [b][blue]GAASHIUS[/blue][/b] :-)
    : : : :
    : : : :
    : : : :
    : : : i also want to know how this is done. in your example, how do you assign a 100x100 bmp file for example named "trial.bmp" to the 2 dimensional array variable image. im very confused in this part. tnx!
    : : :
    : : [blue]
    : : Just loop it. Example..[/blue][code]
    : : const int iWidth = 100, [green]//image width/height[/green]
    : : iHeight = 100;
    : :
    : : char* image; [green]// your loaded image[/green]
    : :
    : : int pixels[iHeight][iWidth]; [green]// destination (assuming 24 bpp image)[/green]
    : :
    : :
    : : [green]// copy the image[/green]
    : : for ( int y = 0; y< iHeight; y++)
    : : for ( int x=0; x
    : #include
    :
    : [green]/* definition of both bitmaps height and width */[/green]
    : #define BITMAPX 352
    : #define BITMAPY 292
    :
    : [green]/* structure to contain data for one pixel */[/green]
    : typedef struct {
    : float r,g,b; [green]/* color data varies for each color from 0-255 */[/green]
    : }RGB; [green]/* they are floats just for convinience */[/green]
    :
    : [green]/* two 352x292x24 bit bitmaps containing about to be compared images */[/green]
    : RGB bitmap1[BITMAPX][BITMAPY],bitmap2[BITMAPX][BITMAPY];
    :
    :
    : [green]/* variables to hold number of pixels, current pixel and match so far */
    : /* and match for current pixel */[/green]
    : float pixels=BITMAPX*BITMAPY,current_pixel=0;
    : float match=0,currentmatch=0;
    :
    :
    : main()
    : {
    :
    : [green]/* now we start looping through all pixels in our bitmaps comparing */
    : /* according pixels to each other */[/green]
    : int posx, posy, currentpixel;
    : for(posx=0;posx<BITMAPX;posx++){
    : for(posy=0;posy<BITMAPY;posy++){
    : currentpixel++;
    :
    : [green]/* this is where actual comparison takes place */
    : /* given that all three basic colors are on different axis */
    : /* match between them can be calculated using */
    : /* vector length equation */[/green]
    : currentmatch=sqrt(pow(bitmap1[posx][posy].r-bitmap2[posx][posy].r,2)+pow(bitmap1[posx][posy].g-bitmap2[posx][posy].g,2)+pow(bitmap1[posx][posy].b-bitmap2[posx][posy].b,2));
    :
    : match=((match*currentpixel)+currentmatch)/(currentpixel);
    : }
    : }
    :
    : match=100-match/2.56;
    :
    : printf("%f",match);
    : }
    : [/code]
    :
    : but i cant seem to load the image properly to the two dimensional arrays that I declared. how can I for example load an image named "try.bmp" to bitmap1 and "try1.bmp" to bitmap2. thanks!
    :
    [blue]
    Do you have a bitmap loader? If so, load the bitmap to heap
    memory, and copy it to the array (as I posted).

    If you dont have a loader, making one is easy. The Win32 API
    makes it even easier. Im assuming you dont have a loader
    (according to your code). If so, check out
    http://www.gamedev.net/reference/articles/article1966.asp

    Hope this helps!
    ~mt2002[/blue]
  • : : : [b][red]This message was edited by MT2002 at 2006-2-3 18:32:15[/red][/b][hr]
    : : : : : : hi
    : : : : : : i have posted this message in the c beginners secito, but maybe this the right place for it. the question is the next: how can i load an image into a variable in c? i suppose this variable must be an array, which dimensions depend on the type of image. i do not know either this can be done by using a standard c library. if this is not the case, any suggestion about how to start working?
    : : : : : :
    : : : : : : thanks
    : : : : : :
    : : : : : : cacaramba
    : : : : : :
    : : : : : Well, you can use memory also to do this instead of an array. But this also depends on you use DOS or Win32. Anyway, here's a link for some C graphs library that may help you out:
    : : : : : http://www.programmersheaven.com/app/search/search.aspx?SearchMode=1&SearchTxt=c+library+graphics
    : : : : :
    : : : : : If you want to develop your own graph lib, you need to know some formats, this is a link to a File Format Encyclopedia:
    : : : : : http://www.programmersheaven.com/search/Download.asp?FileID=923
    : : : : :
    : : : : : An array in this case does not need to be multidimensional, just a twodimensional array. But this is only if you need a constant size image, such as 100x100.
    : : : : : [code]
    : : : : : int image[100][100]
    : : : : : [/code]
    : : : : : But, remember that you can also store image in memory.
    : : : : :
    : : : : : Or, you could just load the file directly onto the screen.
    : : : : :
    : : : : : Hope this lil info helps you out.
    : : : : : ****************
    : : : : : Any questions? Just ask!
    : : : : :
    : : : : : :-) [b][blue]GAASHIUS[/blue][/b] :-)
    : : : : :
    : : : : :
    : : : : :
    : : : : i also want to know how this is done. in your example, how do you assign a 100x100 bmp file for example named "trial.bmp" to the 2 dimensional array variable image. im very confused in this part. tnx!
    : : : :
    : : : [blue]
    : : : Just loop it. Example..[/blue][code]
    : : : const int iWidth = 100, [green]//image width/height[/green]
    : : : iHeight = 100;
    : : :
    : : : char* image; [green]// your loaded image[/green]
    : : :
    : : : int pixels[iHeight][iWidth]; [green]// destination (assuming 24 bpp image)[/green]
    : : :
    : : :
    : : : [green]// copy the image[/green]
    : : : for ( int y = 0; y< iHeight; y++)
    : : : for ( int x=0; x
    : : #include
    : :
    : : [green]/* definition of both bitmaps height and width */[/green]
    : : #define BITMAPX 352
    : : #define BITMAPY 292
    : :
    : : [green]/* structure to contain data for one pixel */[/green]
    : : typedef struct {
    : : float r,g,b; [green]/* color data varies for each color from 0-255 */[/green]
    : : }RGB; [green]/* they are floats just for convinience */[/green]
    : :
    : : [green]/* two 352x292x24 bit bitmaps containing about to be compared images */[/green]
    : : RGB bitmap1[BITMAPX][BITMAPY],bitmap2[BITMAPX][BITMAPY];
    : :
    : :
    : : [green]/* variables to hold number of pixels, current pixel and match so far */
    : : /* and match for current pixel */[/green]
    : : float pixels=BITMAPX*BITMAPY,current_pixel=0;
    : : float match=0,currentmatch=0;
    : :
    : :
    : : main()
    : : {
    : :
    : : [green]/* now we start looping through all pixels in our bitmaps comparing */
    : : /* according pixels to each other */[/green]
    : : int posx, posy, currentpixel;
    : : for(posx=0;posx<BITMAPX;posx++){
    : : for(posy=0;posy<BITMAPY;posy++){
    : : currentpixel++;
    : :
    : : [green]/* this is where actual comparison takes place */
    : : /* given that all three basic colors are on different axis */
    : : /* match between them can be calculated using */
    : : /* vector length equation */[/green]
    : : currentmatch=sqrt(pow(bitmap1[posx][posy].r-bitmap2[posx][posy].r,2)+pow(bitmap1[posx][posy].g-bitmap2[posx][posy].g,2)+pow(bitmap1[posx][posy].b-bitmap2[posx][posy].b,2));
    : :
    : : match=((match*currentpixel)+currentmatch)/(currentpixel);
    : : }
    : : }
    : :
    : : match=100-match/2.56;
    : :
    : : printf("%f",match);
    : : }
    : : [/code]
    : :
    : : but i cant seem to load the image properly to the two dimensional arrays that I declared. how can I for example load an image named "try.bmp" to bitmap1 and "try1.bmp" to bitmap2. thanks!
    : :
    : [blue]
    : Do you have a bitmap loader? If so, load the bitmap to heap
    : memory, and copy it to the array (as I posted).
    :
    : If you dont have a loader, making one is easy. The Win32 API
    : makes it even easier. Im assuming you dont have a loader
    : (according to your code). If so, check out
    : http://www.gamedev.net/reference/articles/article1966.asp
    :
    : Hope this helps!
    : ~mt2002[/blue]
    :

    btw is there any conflict if i'm going to use this program on a linux platform because im using bmp images. would you recommend using a different image format then?
  • : : : : [b][red]This message was edited by MT2002 at 2006-2-3 18:32:15[/red][/b][hr]
    : : : : : : : hi
    : : : : : : : i have posted this message in the c beginners secito, but maybe this the right place for it. the question is the next: how can i load an image into a variable in c? i suppose this variable must be an array, which dimensions depend on the type of image. i do not know either this can be done by using a standard c library. if this is not the case, any suggestion about how to start working?
    : : : : : : :
    : : : : : : : thanks
    : : : : : : :
    : : : : : : : cacaramba
    : : : : : : :
    : : : : : : Well, you can use memory also to do this instead of an array. But this also depends on you use DOS or Win32. Anyway, here's a link for some C graphs library that may help you out:
    : : : : : : http://www.programmersheaven.com/app/search/search.aspx?SearchMode=1&SearchTxt=c+library+graphics
    : : : : : :
    : : : : : : If you want to develop your own graph lib, you need to know some formats, this is a link to a File Format Encyclopedia:
    : : : : : : http://www.programmersheaven.com/search/Download.asp?FileID=923
    : : : : : :
    : : : : : : An array in this case does not need to be multidimensional, just a twodimensional array. But this is only if you need a constant size image, such as 100x100.
    : : : : : : [code]
    : : : : : : int image[100][100]
    : : : : : : [/code]
    : : : : : : But, remember that you can also store image in memory.
    : : : : : :
    : : : : : : Or, you could just load the file directly onto the screen.
    : : : : : :
    : : : : : : Hope this lil info helps you out.
    : : : : : : ****************
    : : : : : : Any questions? Just ask!
    : : : : : :
    : : : : : : :-) [b][blue]GAASHIUS[/blue][/b] :-)
    : : : : : :
    : : : : : :
    : : : : : :
    : : : : : i also want to know how this is done. in your example, how do you assign a 100x100 bmp file for example named "trial.bmp" to the 2 dimensional array variable image. im very confused in this part. tnx!
    : : : : :
    : : : : [blue]
    : : : : Just loop it. Example..[/blue][code]
    : : : : const int iWidth = 100, [green]//image width/height[/green]
    : : : : iHeight = 100;
    : : : :
    : : : : char* image; [green]// your loaded image[/green]
    : : : :
    : : : : int pixels[iHeight][iWidth]; [green]// destination (assuming 24 bpp image)[/green]
    : : : :
    : : : :
    : : : : [green]// copy the image[/green]
    : : : : for ( int y = 0; y< iHeight; y++)
    : : : : for ( int x=0; x
    : : : #include
    : : :
    : : : [green]/* definition of both bitmaps height and width */[/green]
    : : : #define BITMAPX 352
    : : : #define BITMAPY 292
    : : :
    : : : [green]/* structure to contain data for one pixel */[/green]
    : : : typedef struct {
    : : : float r,g,b; [green]/* color data varies for each color from 0-255 */[/green]
    : : : }RGB; [green]/* they are floats just for convinience */[/green]
    : : :
    : : : [green]/* two 352x292x24 bit bitmaps containing about to be compared images */[/green]
    : : : RGB bitmap1[BITMAPX][BITMAPY],bitmap2[BITMAPX][BITMAPY];
    : : :
    : : :
    : : : [green]/* variables to hold number of pixels, current pixel and match so far */
    : : : /* and match for current pixel */[/green]
    : : : float pixels=BITMAPX*BITMAPY,current_pixel=0;
    : : : float match=0,currentmatch=0;
    : : :
    : : :
    : : : main()
    : : : {
    : : :
    : : : [green]/* now we start looping through all pixels in our bitmaps comparing */
    : : : /* according pixels to each other */[/green]
    : : : int posx, posy, currentpixel;
    : : : for(posx=0;posx<BITMAPX;posx++){
    : : : for(posy=0;posy<BITMAPY;posy++){
    : : : currentpixel++;
    : : :
    : : : [green]/* this is where actual comparison takes place */
    : : : /* given that all three basic colors are on different axis */
    : : : /* match between them can be calculated using */
    : : : /* vector length equation */[/green]
    : : : currentmatch=sqrt(pow(bitmap1[posx][posy].r-bitmap2[posx][posy].r,2)+pow(bitmap1[posx][posy].g-bitmap2[posx][posy].g,2)+pow(bitmap1[posx][posy].b-bitmap2[posx][posy].b,2));
    : : :
    : : : match=((match*currentpixel)+currentmatch)/(currentpixel);
    : : : }
    : : : }
    : : :
    : : : match=100-match/2.56;
    : : :
    : : : printf("%f",match);
    : : : }
    : : : [/code]
    : : :
    : : : but i cant seem to load the image properly to the two dimensional arrays that I declared. how can I for example load an image named "try.bmp" to bitmap1 and "try1.bmp" to bitmap2. thanks!
    : : :
    : : [blue]
    : : Do you have a bitmap loader? If so, load the bitmap to heap
    : : memory, and copy it to the array (as I posted).
    : :
    : : If you dont have a loader, making one is easy. The Win32 API
    : : makes it even easier. Im assuming you dont have a loader
    : : (according to your code). If so, check out
    : : http://www.gamedev.net/reference/articles/article1966.asp
    : :
    : : Hope this helps!
    : : ~mt2002[/blue]
    : :
    :
    : btw is there any conflict if i'm going to use this program on a linux platform because im using bmp images. would you recommend using a different image format then?
    :
    [blue]
    I dont know, but it shouldnt cause any conflict..As long as you
    write your loader from scratch (ie; dont use Win32) it should
    still be okay.[/blue]
  • [code]
    : const int iWidth = 100, [green]//image width/height[/green]
    : iHeight = 100;
    :
    : char* image; [green]// your loaded image[/green]
    :
    : int pixels[iHeight][iWidth]; [green]// destination (assuming 24 bpp image)[/green]
    :
    :
    : [green]// copy the image[/green]
    : for ( int y = 0; y< iHeight; y++)
    : for ( int x=0; x<iWidth; x++)
    : pixels [y][x] = image [x+y*iWidth];[/code]
    : [blue]
    : The formula [b]x+y*iWidth[/b] can be used to retrieve an element
    : (in this case, pixel) at an x/y location in linear memory.
    :
    : This will [b]only[/b] work if "image" and "pixels" are
    : the same bit depth. If they are not, you will need to
    : convert it.
    :
    : Hope this helps!
    : ~mt2002[/blue]
    :
    :
    Won't it be possible to do something like this:

    [code]
    const int iWidth = 100, [green]//image width/height[/green]
    iHeight = 100;

    char* image; [green]// your loaded image[/green]

    char pixels[iHeight][iWidth];

    pixel = image;
    [/code]
    Another way would be to copy the whole array. Then you get chars instead if ints, but does that matter?

    Happy coding wishes
    the one and only
    [b]Niklas Ulvinge[/b] [white]aka [b]IDK[/b][/white]

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories