MARMEX_VB test application program. This application works on "mbed NXP LPC1768" only. This application expects to have the MARMEX_VB module on a "MAPLE mini type-B (MARM03-BASE)" baseboard (slot2) with MARMEX_OB module (on slot1)

Dependencies:   MARMEX_VB NokiaLCD mbed

This is the library test program.
The program can test features of the library (refer to MARMEX-VB's API document) and can save captured data into BMP file.

Warning!

This test program can run on "mbed NXP LPC1768" only.

/media/uploads/nxpfan/dsc_0506_-1-.jpg
Picture : sample of test program operation
The modules of MARMEX-VB and MARMEX-OB are set on the "MAPLE mini type-B (MARM03-BASE)" baseboard.
The image data from camera is mirrored and alpha graphics added by software.

Committer:
nxpfan
Date:
Fri Jun 06 03:37:02 2014 +0000
Revision:
0:343c01965543
Child:
1:dbe2dc31542d
version 0.1

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nxpfan 0:343c01965543 1 /** Test program for MARMEX_VB Camera control library
nxpfan 0:343c01965543 2 *
nxpfan 0:343c01965543 3 * @version 0.1
nxpfan 0:343c01965543 4 * @date 10-Jun-2014
nxpfan 0:343c01965543 5 *
nxpfan 0:343c01965543 6 * Released under the Apache License, Version 2.0 : http://mbed.org/handbook/Apache-Licence
nxpfan 0:343c01965543 7 *
nxpfan 0:343c01965543 8 * Test program for MARMEX_VB Camera control library
nxpfan 0:343c01965543 9 *
nxpfan 0:343c01965543 10 * ** This program runs on mbed_NXP_LPC1768 only **
nxpfan 0:343c01965543 11 */
nxpfan 0:343c01965543 12
nxpfan 0:343c01965543 13
nxpfan 0:343c01965543 14 #include "mbed.h"
nxpfan 0:343c01965543 15 #include "MARMEX_OB_oled.h"
nxpfan 0:343c01965543 16 #include "MARMEX_VB.h"
nxpfan 0:343c01965543 17 #include "bmp_handler.h"
nxpfan 0:343c01965543 18
nxpfan 0:343c01965543 19 MARMEX_OB_oled oled1( p5, p7, p20, p16, p15 );
nxpfan 0:343c01965543 20 // mosi, sclk, cs, rst, power_control -- maple-mini-type-b-board-slot1
nxpfan 0:343c01965543 21
nxpfan 0:343c01965543 22 MARMEX_VB camera( p5, p6, p7, p22, p26, p28, p27 );
nxpfan 0:343c01965543 23 // mosi, miso, sclk, cs, reset, sda, scl -- maple-mini-type-b-board-slot2
nxpfan 0:343c01965543 24
nxpfan 0:343c01965543 25 BusOut led( LED4, LED3, LED2, LED1 );
nxpfan 0:343c01965543 26 Timer timer;
nxpfan 0:343c01965543 27
nxpfan 0:343c01965543 28 void test_camera( void );
nxpfan 0:343c01965543 29 void test_camera_resolution_change( void );
nxpfan 0:343c01965543 30
nxpfan 0:343c01965543 31 void copy_image_from_camera_to_oled( void );
nxpfan 0:343c01965543 32 void copy_image_from_camera_to_oled_interlaced( void );
nxpfan 0:343c01965543 33 void line_mirroring( short *buf );
nxpfan 0:343c01965543 34 void save_still_image( char *file_name );
nxpfan 0:343c01965543 35 void oled_test_screen( void );
nxpfan 0:343c01965543 36 void capture_to_bmp( void );
nxpfan 0:343c01965543 37
nxpfan 0:343c01965543 38 //#define SAVE_EACH_SIZES_OF_STILL_IMAGE
nxpfan 0:343c01965543 39
nxpfan 0:343c01965543 40 alpha_param ap;
nxpfan 0:343c01965543 41
nxpfan 0:343c01965543 42
nxpfan 0:343c01965543 43 int main()
nxpfan 0:343c01965543 44 {
nxpfan 0:343c01965543 45 printf( "\r\n\r\nMARY-CAMERA test program\r\n\r\n" );
nxpfan 0:343c01965543 46
nxpfan 0:343c01965543 47 read_alpha_BMP( "alpha.bmp", &ap );
nxpfan 0:343c01965543 48
nxpfan 0:343c01965543 49
nxpfan 0:343c01965543 50 led = 0x3;
nxpfan 0:343c01965543 51
nxpfan 0:343c01965543 52 oled1.cls();
nxpfan 0:343c01965543 53 oled_test_screen();
nxpfan 0:343c01965543 54
nxpfan 0:343c01965543 55 #ifdef SAVE_EACH_SIZES_OF_STILL_IMAGE
nxpfan 0:343c01965543 56 led = 0x1;
nxpfan 0:343c01965543 57 camera.resolution( MARMEX_VB::QCIF );
nxpfan 0:343c01965543 58 save_still_image( "i_qcif.bmp" );
nxpfan 0:343c01965543 59
nxpfan 0:343c01965543 60 led = 0x2;
nxpfan 0:343c01965543 61 camera.resolution( MARMEX_VB::QQVGA );
nxpfan 0:343c01965543 62 save_still_image( "i_qqvga.bmp" );
nxpfan 0:343c01965543 63
nxpfan 0:343c01965543 64 led = 0x4;
nxpfan 0:343c01965543 65 camera.resolution( MARMEX_VB::QVGA );
nxpfan 0:343c01965543 66 save_still_image( "i_qvga.bmp" );
nxpfan 0:343c01965543 67
nxpfan 0:343c01965543 68 led = 0x8;
nxpfan 0:343c01965543 69 camera.resolution( MARMEX_VB::VGA );
nxpfan 0:343c01965543 70 save_still_image( "i_vga.bmp" );
nxpfan 0:343c01965543 71
nxpfan 0:343c01965543 72 camera.resolution( MARMEX_VB::QCIF );
nxpfan 0:343c01965543 73 #endif
nxpfan 0:343c01965543 74
nxpfan 0:343c01965543 75 printf( " camera operation started\r\n" );
nxpfan 0:343c01965543 76 printf( " hit key [c] for saving data into BMP (for blue-mbed only)\r\n" );
nxpfan 0:343c01965543 77 printf( " hit key [o] to change data reading order\r\n" );
nxpfan 0:343c01965543 78 printf( " hit key [i] to toggle interlace mode\r\n" );
nxpfan 0:343c01965543 79 printf( " hit key [1], [2], [3] or [4] to change resolution QCIF, QQVGA, QVGA, VGA\r\n" );
nxpfan 0:343c01965543 80
nxpfan 0:343c01965543 81 timer.start(); // timer for measureing frame rate
nxpfan 0:343c01965543 82 test_camera(); // this function doesn't return
nxpfan 0:343c01965543 83 }
nxpfan 0:343c01965543 84
nxpfan 0:343c01965543 85 #if defined( TARGET_MBED_LPC1768 ) || defined( TARGET_LPC11U24_401 )
nxpfan 0:343c01965543 86 Serial pc(USBTX, USBRX); // tx, rx
nxpfan 0:343c01965543 87 #endif
nxpfan 0:343c01965543 88
nxpfan 0:343c01965543 89
nxpfan 0:343c01965543 90 void test_camera( void )
nxpfan 0:343c01965543 91 {
nxpfan 0:343c01965543 92 int interlace = 0;
nxpfan 0:343c01965543 93 int frame_count = 0;
nxpfan 0:343c01965543 94
nxpfan 0:343c01965543 95 while ( 1 ) {
nxpfan 0:343c01965543 96 if ( pc.readable() ) {
nxpfan 0:343c01965543 97 switch ( pc.getc() ) {
nxpfan 0:343c01965543 98 case 'c' :
nxpfan 0:343c01965543 99 capture_to_bmp();
nxpfan 0:343c01965543 100 printf( " [c] : capture started\r\n" );
nxpfan 0:343c01965543 101 break;
nxpfan 0:343c01965543 102 case 'o' :
nxpfan 0:343c01965543 103 printf( " [o] read order change : %s\r\n", camera.read_order_change() ? "ENABLED" : "DISABLED" );
nxpfan 0:343c01965543 104 break;
nxpfan 0:343c01965543 105 case 'i' :
nxpfan 0:343c01965543 106 interlace = !interlace;
nxpfan 0:343c01965543 107 printf( " [i] : interlace setting : %s\r\n", interlace ? "ENABLED" : "DISABLED" );
nxpfan 0:343c01965543 108 /* FALL THROUGH */
nxpfan 0:343c01965543 109 case 'f' :
nxpfan 0:343c01965543 110 if ( frame_count ) {
nxpfan 0:343c01965543 111 timer.stop();
nxpfan 0:343c01965543 112 float t = timer.read();
nxpfan 0:343c01965543 113 printf( " [f] : %s rate : %5.3f\r\n", interlace ? "field" : "frame", (float)frame_count / t );
nxpfan 0:343c01965543 114 frame_count = 0;
nxpfan 0:343c01965543 115 timer.reset();
nxpfan 0:343c01965543 116 timer.start();
nxpfan 0:343c01965543 117 } else {
nxpfan 0:343c01965543 118 printf( " [f] : no frame drawn yet. try again later\r\n" );
nxpfan 0:343c01965543 119 }
nxpfan 0:343c01965543 120 break;
nxpfan 0:343c01965543 121 case '1' :
nxpfan 0:343c01965543 122 printf( " [1] resolution change : QCIF\r\n" );
nxpfan 0:343c01965543 123 camera.init( MARMEX_VB::QCIF );
nxpfan 0:343c01965543 124 break;
nxpfan 0:343c01965543 125 case '2' :
nxpfan 0:343c01965543 126 printf( " [2] resolution change : QQVGA\r\n" );
nxpfan 0:343c01965543 127 camera.init( MARMEX_VB::QQVGA );
nxpfan 0:343c01965543 128 break;
nxpfan 0:343c01965543 129 case '3' :
nxpfan 0:343c01965543 130 printf( " [3] resolution change : QVGA\r\n" );
nxpfan 0:343c01965543 131 camera.init( MARMEX_VB::QVGA );
nxpfan 0:343c01965543 132 break;
nxpfan 0:343c01965543 133 case '4' :
nxpfan 0:343c01965543 134 printf( " [4] resolution change : VGA\r\n" );
nxpfan 0:343c01965543 135 camera.init( MARMEX_VB::VGA );
nxpfan 0:343c01965543 136 break;
nxpfan 0:343c01965543 137 }
nxpfan 0:343c01965543 138 }
nxpfan 0:343c01965543 139
nxpfan 0:343c01965543 140 led = 0x1;
nxpfan 0:343c01965543 141
nxpfan 0:343c01965543 142 if ( interlace )
nxpfan 0:343c01965543 143 copy_image_from_camera_to_oled_interlaced();
nxpfan 0:343c01965543 144 else
nxpfan 0:343c01965543 145 copy_image_from_camera_to_oled();
nxpfan 0:343c01965543 146
nxpfan 0:343c01965543 147
nxpfan 0:343c01965543 148 // camera.colorbar( ((count++ >> 2) & 0x1) ? MARMEX_VB::ON : MARMEX_VB::OFF );
nxpfan 0:343c01965543 149
nxpfan 0:343c01965543 150 led = 0x2;
nxpfan 0:343c01965543 151
nxpfan 0:343c01965543 152 frame_count++;
nxpfan 0:343c01965543 153 }
nxpfan 0:343c01965543 154 }
nxpfan 0:343c01965543 155
nxpfan 0:343c01965543 156
nxpfan 0:343c01965543 157 void test_camera_resolution_change( void )
nxpfan 0:343c01965543 158 {
nxpfan 0:343c01965543 159 int count = (3 << 3);
nxpfan 0:343c01965543 160 int setting;
nxpfan 0:343c01965543 161
nxpfan 0:343c01965543 162 while ( 1 ) {
nxpfan 0:343c01965543 163
nxpfan 0:343c01965543 164 if ( !(count & 0x7) ) {
nxpfan 0:343c01965543 165 setting = (count >> 3) & 0x3;
nxpfan 0:343c01965543 166 camera.init( (MARMEX_VB::CameraResolution)(setting + 1) );
nxpfan 0:343c01965543 167 led = 0x1 << setting;
nxpfan 0:343c01965543 168 }
nxpfan 0:343c01965543 169
nxpfan 0:343c01965543 170 count++;
nxpfan 0:343c01965543 171
nxpfan 0:343c01965543 172 copy_image_from_camera_to_oled();
nxpfan 0:343c01965543 173 }
nxpfan 0:343c01965543 174 }
nxpfan 0:343c01965543 175
nxpfan 0:343c01965543 176
nxpfan 0:343c01965543 177 void alpha( int line_num, short *bf, int offset_x, int offset_y, alpha_param *app )
nxpfan 0:343c01965543 178 {
nxpfan 0:343c01965543 179 short r, g, b;
nxpfan 0:343c01965543 180 int y_pos;
nxpfan 0:343c01965543 181
nxpfan 0:343c01965543 182 if ( (line_num < offset_y) || (offset_y + app->v) <= line_num || (app->buffer == NULL) )
nxpfan 0:343c01965543 183 return;
nxpfan 0:343c01965543 184
nxpfan 0:343c01965543 185 bf += offset_x;
nxpfan 0:343c01965543 186 y_pos = ((app->v - (line_num - offset_y + 1)) * (app->h * app->byte_per_pixel));
nxpfan 0:343c01965543 187
nxpfan 0:343c01965543 188 for ( int i = 0; i < 60; i++ ) {
nxpfan 0:343c01965543 189 r = ((*bf >> 1) & 0x0F) + (*(app->buffer + i * 3 + 0 + y_pos ) >> 4);
nxpfan 0:343c01965543 190 g = ((*bf >> 6) & 0x1F) + (*(app->buffer + i * 3 + 1 + y_pos ) >> 3);
nxpfan 0:343c01965543 191 b = ((*bf >> 12) & 0x0F) + (*(app->buffer + i * 3 + 2 + y_pos ) >> 4);
nxpfan 0:343c01965543 192
nxpfan 0:343c01965543 193 *bf++ = (b << 11) | (g << 5) | (r << 0);
nxpfan 0:343c01965543 194 }
nxpfan 0:343c01965543 195 }
nxpfan 0:343c01965543 196
nxpfan 0:343c01965543 197
nxpfan 0:343c01965543 198 void copy_image_from_camera_to_oled( void )
nxpfan 0:343c01965543 199 {
nxpfan 0:343c01965543 200 short buf[ MARMEX_OB_oled::WIDTH ];
nxpfan 0:343c01965543 201 static int count = 0;
nxpfan 0:343c01965543 202
nxpfan 0:343c01965543 203 camera.open_transfer();
nxpfan 0:343c01965543 204
nxpfan 0:343c01965543 205 for ( int line = 0; line < MARMEX_OB_oled::HEIGHT; line++ ) {
nxpfan 0:343c01965543 206 camera.read_a_line( buf, line + (camera.get_vertical_size() - (int)MARMEX_OB_oled::HEIGHT) / 2, (camera.get_horizontal_size() - (int)MARMEX_OB_oled::WIDTH ) / 2, MARMEX_OB_oled::WIDTH );
nxpfan 0:343c01965543 207 line_mirroring( buf );
nxpfan 0:343c01965543 208 alpha( line, buf, ((count >> 4) & 1) ? 60 : 8, ((count >> 4) & 1) ^ ((count >> 3) & 1) ? ((int)MARMEX_OB_oled::HEIGHT - (ap.v + 4)) : 4, &ap );
nxpfan 0:343c01965543 209 oled1.blit565( 0, line, MARMEX_OB_oled::WIDTH, 1, buf );
nxpfan 0:343c01965543 210 }
nxpfan 0:343c01965543 211
nxpfan 0:343c01965543 212 count++;
nxpfan 0:343c01965543 213 camera.close_transfer();
nxpfan 0:343c01965543 214 }
nxpfan 0:343c01965543 215
nxpfan 0:343c01965543 216
nxpfan 0:343c01965543 217 void copy_image_from_camera_to_oled_interlaced( void )
nxpfan 0:343c01965543 218 {
nxpfan 0:343c01965543 219 short buf[ MARMEX_OB_oled::WIDTH ];
nxpfan 0:343c01965543 220 static int count = 0;
nxpfan 0:343c01965543 221
nxpfan 0:343c01965543 222 camera.open_transfer();
nxpfan 0:343c01965543 223
nxpfan 0:343c01965543 224 for ( int line = (count++) & 1; line < MARMEX_OB_oled::HEIGHT; line += 2 ) {
nxpfan 0:343c01965543 225 camera.read_a_line( buf, line + (camera.get_vertical_size() - (int)MARMEX_OB_oled::HEIGHT) / 2, (camera.get_horizontal_size() - (int)MARMEX_OB_oled::WIDTH ) / 2, MARMEX_OB_oled::WIDTH );
nxpfan 0:343c01965543 226 line_mirroring( buf );
nxpfan 0:343c01965543 227 alpha( line, buf, ((count >> 4) & 1) ? 60 : 8, ((count >> 4) & 1) ^ ((count >> 3) & 1) ? ((int)MARMEX_OB_oled::HEIGHT - (ap.v + 4)) : 4, &ap );
nxpfan 0:343c01965543 228 oled1.blit565( 0, line, MARMEX_OB_oled::WIDTH, 1, buf );
nxpfan 0:343c01965543 229 }
nxpfan 0:343c01965543 230
nxpfan 0:343c01965543 231 camera.close_transfer();
nxpfan 0:343c01965543 232 }
nxpfan 0:343c01965543 233
nxpfan 0:343c01965543 234
nxpfan 0:343c01965543 235
nxpfan 0:343c01965543 236 void line_mirroring( short *buf )
nxpfan 0:343c01965543 237 {
nxpfan 0:343c01965543 238 short tmp;
nxpfan 0:343c01965543 239
nxpfan 0:343c01965543 240 for ( int i = 0; i < (MARMEX_OB_oled::WIDTH / 2); i++ ) {
nxpfan 0:343c01965543 241 tmp = buf[ i ];
nxpfan 0:343c01965543 242 buf[ i ] = buf[ (MARMEX_OB_oled::WIDTH - 1) - i ];
nxpfan 0:343c01965543 243 buf[ (MARMEX_OB_oled::WIDTH - 1) - i ] = tmp;
nxpfan 0:343c01965543 244 }
nxpfan 0:343c01965543 245 }
nxpfan 0:343c01965543 246
nxpfan 0:343c01965543 247
nxpfan 0:343c01965543 248 void oled_test_screen( void )
nxpfan 0:343c01965543 249 {
nxpfan 0:343c01965543 250 oled1.background( 0x000000 );
nxpfan 0:343c01965543 251 oled1.cls();
nxpfan 0:343c01965543 252
nxpfan 0:343c01965543 253 int colorbar_width = MARMEX_OB_oled::WIDTH / 8;
nxpfan 0:343c01965543 254
nxpfan 0:343c01965543 255 for ( int i = 0; i < 8; i++ )
nxpfan 0:343c01965543 256 oled1.fill( colorbar_width * i, 0, colorbar_width, MARMEX_OB_oled::HEIGHT, ((i & 0x4) ? 0xFF0000 : 0x000000) | ((i & 0x2) ? 0x00FF00 : 0x000000) | ((i & 0x1) ? 0x0000FF : 0x000000) );
nxpfan 0:343c01965543 257
nxpfan 0:343c01965543 258 oled1.fill( 50, 50, 64, 64, 0xCCCCCC );;
nxpfan 0:343c01965543 259
nxpfan 0:343c01965543 260 oled1.locate( 0, 2 );
nxpfan 0:343c01965543 261 oled1.printf( "MaryCemara test" );
nxpfan 0:343c01965543 262 oled1.locate( 0, 3 );
nxpfan 0:343c01965543 263 oled1.printf( "%s", (MARMEX_VB::NO_ERROR == camera.ready()) ? "Camera is ready" : "No Camera found" );
nxpfan 0:343c01965543 264 oled1.locate( 0, 4 );
nxpfan 0:343c01965543 265 oled1.printf( "%s", "saving into BMP" );
nxpfan 0:343c01965543 266 oled1.locate( 0, 5 );
nxpfan 0:343c01965543 267 oled1.printf( "%d", camera.get_horizontal_size() );
nxpfan 0:343c01965543 268 oled1.locate( 0, 6 );
nxpfan 0:343c01965543 269 oled1.printf( "%d", camera.get_vertical_size() );
nxpfan 0:343c01965543 270
nxpfan 0:343c01965543 271
nxpfan 0:343c01965543 272 for (int i = 0; i < MARMEX_OB_oled::WIDTH; i++ )
nxpfan 0:343c01965543 273 oled1.pixel( i, 80 + sin( (float)i / 5.0 ) * 10, 0x000000 );
nxpfan 0:343c01965543 274 }
nxpfan 0:343c01965543 275
nxpfan 0:343c01965543 276
nxpfan 0:343c01965543 277 #include "bmp_handler.h"
nxpfan 0:343c01965543 278
nxpfan 0:343c01965543 279 void save_still_image( char *file_name )
nxpfan 0:343c01965543 280 {
nxpfan 0:343c01965543 281 short buf[ camera.get_horizontal_size() ];
nxpfan 0:343c01965543 282
nxpfan 0:343c01965543 283 if ( open_BMP( file_name, camera.get_horizontal_size(), camera.get_vertical_size() ) )
nxpfan 0:343c01965543 284 return;
nxpfan 0:343c01965543 285
nxpfan 0:343c01965543 286 camera.open_transfer();
nxpfan 0:343c01965543 287
nxpfan 0:343c01965543 288 for ( int line = (camera.get_vertical_size() - 1); 0 <= line; line-- ) {
nxpfan 0:343c01965543 289 camera.read_a_line( buf, line, 0, camera.get_horizontal_size() );
nxpfan 0:343c01965543 290 write_BMP( buf, camera.get_horizontal_size() );
nxpfan 0:343c01965543 291 }
nxpfan 0:343c01965543 292 camera.close_transfer();
nxpfan 0:343c01965543 293
nxpfan 0:343c01965543 294 close_BMP();
nxpfan 0:343c01965543 295 }
nxpfan 0:343c01965543 296
nxpfan 0:343c01965543 297 void capture_to_bmp( void )
nxpfan 0:343c01965543 298 {
nxpfan 0:343c01965543 299 short buf[ camera.get_horizontal_size() ];
nxpfan 0:343c01965543 300 camera.open_transfer();
nxpfan 0:343c01965543 301
nxpfan 0:343c01965543 302 if ( open_BMP( "RGB.bmp", camera.get_horizontal_size(), camera.get_vertical_size() ) )
nxpfan 0:343c01965543 303 return;
nxpfan 0:343c01965543 304
nxpfan 0:343c01965543 305 for ( int line = (camera.get_vertical_size() - 1); 0 <= line; line-- ) {
nxpfan 0:343c01965543 306 camera.read_a_line( buf, line, 0, camera.get_horizontal_size() );
nxpfan 0:343c01965543 307 // write_BMP( buf, camera.get_horizontal_size(), 0x7 );
nxpfan 0:343c01965543 308 write_BMP( buf, camera.get_horizontal_size() );
nxpfan 0:343c01965543 309 }
nxpfan 0:343c01965543 310
nxpfan 0:343c01965543 311 close_BMP();
nxpfan 0:343c01965543 312
nxpfan 0:343c01965543 313 #if 0
nxpfan 0:343c01965543 314
nxpfan 0:343c01965543 315 if ( open_BMP( "R.bmp", camera.get_horizontal_size(), camera.get_vertical_size() ) )
nxpfan 0:343c01965543 316 return;
nxpfan 0:343c01965543 317
nxpfan 0:343c01965543 318 for ( int line = (camera.get_vertical_size() - 1); 0 <= line; line-- ) {
nxpfan 0:343c01965543 319 camera.read_a_line( buf, line, 0, camera.get_horizontal_size() );
nxpfan 0:343c01965543 320 write_BMP( buf, camera.get_horizontal_size(), 0x4 );
nxpfan 0:343c01965543 321 }
nxpfan 0:343c01965543 322
nxpfan 0:343c01965543 323 close_BMP();
nxpfan 0:343c01965543 324
nxpfan 0:343c01965543 325
nxpfan 0:343c01965543 326 if ( open_BMP( "G.bmp", camera.get_horizontal_size(), camera.get_vertical_size() ) )
nxpfan 0:343c01965543 327 return;
nxpfan 0:343c01965543 328
nxpfan 0:343c01965543 329 for ( int line = (camera.get_vertical_size() - 1); 0 <= line; line-- ) {
nxpfan 0:343c01965543 330 camera.read_a_line( buf, line, 0, camera.get_horizontal_size() );
nxpfan 0:343c01965543 331 write_BMP( buf, camera.get_horizontal_size(), 0x2 );
nxpfan 0:343c01965543 332 }
nxpfan 0:343c01965543 333
nxpfan 0:343c01965543 334 close_BMP();
nxpfan 0:343c01965543 335
nxpfan 0:343c01965543 336
nxpfan 0:343c01965543 337 if ( open_BMP( "B.bmp", camera.get_horizontal_size(), camera.get_vertical_size() ) )
nxpfan 0:343c01965543 338 return;
nxpfan 0:343c01965543 339
nxpfan 0:343c01965543 340 for ( int line = (camera.get_vertical_size() - 1); 0 <= line; line-- ) {
nxpfan 0:343c01965543 341 camera.read_a_line( buf, line, 0, camera.get_horizontal_size() );
nxpfan 0:343c01965543 342 write_BMP( buf, camera.get_horizontal_size(), 0x1 );
nxpfan 0:343c01965543 343 }
nxpfan 0:343c01965543 344
nxpfan 0:343c01965543 345 close_BMP();
nxpfan 0:343c01965543 346
nxpfan 0:343c01965543 347 #endif
nxpfan 0:343c01965543 348 camera.close_transfer();
nxpfan 0:343c01965543 349 }