AnsweredAssumed Answered

Image Pixel Manipulation

Question asked by incubus888 on Nov 27, 2009
Latest reply on Nov 27, 2009 by incubus888

Hi guys!

     I've captured a 720x486 image, which has the UYVY or CbYCrY format, using a Micron MT9V135 CMOS sensor. Found below are the settings of the DMA and PPI registers that I used for image capture.

 

#define DATALEN                      0x0000

#define POL_C                          0x0000
#define POL_S                          0x0000

#define CFG                              0x0000 //FOR ITU 656
#define ITU656_Input_Mode        0x0000 //ITU-656 Active Field Only
#define STOP_MODE                0x0000

#define DataPacking1                0x0000 //Data packing is disabled to isolate the Y, Cb and Cr elements of the image pixel (unsure)

 

*pDMA0_CONFIG = STOP_MODE | DMA2D | WDSIZE_16 | DI_EN | WNR;

 

*pPPI_CONTROL = FLD_SEL | POL_S | POL_C | DATALEN | DataPacking1 | CFG | ITU656_Input_Mode;

 

     Having captured the image, I then transposed and reshaped it into a (row*col)x1 image. By doing so, I supposedly could possibly obtain the mean or average of the image by adding each of the image pixel values and dividing the sum by the total number of pixels. These steps are similar to what the MATLAB does when getting the mean of an image. However, when I actually tried to get the mean of the image, the BF537 board could not seem to calculate it. Found below are the codes that would obtain the mean.

 

double actmean, sumstore, sum;

int x;

sumstore=0;
for(x=0;x<349920;x++){sum=reshaped[x]+sumstore;          //normalization of images
    sumstore=sum;                                                                       
    }                                                                                 //acquiring mean      
actmean=sumstore/349920;              
ssync();
printf("%e",actmean); 

 

     The variable actmean is the variable that would contain the mean value. When I tried to print its value, the processor could not print it; thus, leaving me with the conclusion that the value was not calculated. Now, my questions are: (1) Is there anything I should now when working with raw pixel data? (2) Does unpacking the data bytes (packing disabled) guarantee that each of the Y, Cb and Cr element is isolated? Please guys, if you have any information as to how one should handle image pixel manipulation, then could you please help me? Any help will be greatly appreciated.

 

Regards,

     Allan

Outcomes