×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor
    Join Date
    Oct 2004
    Posts
    52

    how can i get RGB pixel data into an array?

    Hi,
    I am trying to take the RGB data from each pixel of an image and store it in an array.

    This is what I am trying at the moment:
    Code:
    TRgb *rgb;
    for(TInt i=0; i<w; i++) {
         for(TInt j=0; j<h; j++) {
               iBackgroundImage->GetPixel(*rgb, TPoint(i, j));
               imageBuffer[i*j] = rgb;
         }
    }
    But I am getting the error "binary '=' : no operator found which takes a right-hand operand of type 'TRgb *' (or there is no acceptable conversion)".

    And when I comment out that line I am getting an "unresolved external symbol" error.

    Does anyone know what I am doing wrong?

    Thanks,
    Miranda

  2. #2
    Regular Contributor
    Join Date
    Oct 2004
    Posts
    52
    Update:

    it's fixed now! The code I ended up with was:
    Code:
    void CimagePixelsContainer::grabPixels() {
    
    	TRgb rgb;
    	for(TInt i=y; i<y+h; i++) {
    		for(TInt j=x; j<x+w; j++) {
    			iBackgroundImage->GetPixel(rgb, TPoint(i, j));
    			rgbData.Append(rgb);
    		}
    	}
    }
    where rgbData is declared as: RArray<TRgb>;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •