红色仅RGB 24位c

时间:2014-06-25 16:38:58

标签: c++ image pixel mbed

我正在使用OV7670相机,mbed和激光使用以下代码

void CameraSnap(){
    led4 = 1;

            // Kick things off by capturing an image
    camera.CaptureNext();
    while(camera.CaptureDone() == false);     

    camera.ReadStart(); 

    t1 = t.read_ms();

    unsigned colorpixel;
    unsigned int byte1, byte2;
    int x;
    int y;

    int i = 0;


    for (int i=0; i < SIZEX; i++) {

        Maximo[i] = 0;
        PuntosMaximo[i] = 0;
}


    for(y = 0; y<SIZEY; y++)            
        for(x = 0; x<SIZEX; x++)      
        {  

 // Read in the first half of the image
        if(format == 'b')
            {
                camera.ReadOnebyte();
            }
        else
            if(format == 'y' || format == 'r')
                {
                    byte1 = camera.ReadOnebyte();
                    //pc.putc(byte1); 
                }    
                // Read in the Second half of the image

        byte2 = camera.ReadOnebyte();

        red = (byte1 & 0xF8)>>3; 
        green = (((byte1 << 8) | byte2) & 0x5E)>>5;
        blue = (byte2 & 0x1F);
        unsigned short data = (red+ green + blue) /3;
             pc.putc(data); 

         if ((red > Maximo[x] )&& (green < 10) && (blue < 10 )) {
            Maximo[x] = rojo;
            PuntosMaximo[x] = y;

         }

}  
camera.ReadStop();



t2 = t.read_ms();        

我希望程序存储来自RGB 24位图像的Maximo[i]的最大强度像素,但是在OV7670抓取器(https://mbed.org/users/edodm85/code/OV7670_Test_Code/file/d0d4760d32b2/main.cpp)中,它只显示黑白图像。

你可以给我一些建议吗?提前谢谢!

0 个答案:

没有答案