cmucam3-hardware (#1) - Output file write error --- out of disk space ? (#209) - Message List

Output file write error --- out of disk space ?

Hello I'm a french user. I am working on a project called : CMUCAM WEB SERVER I want to use the CMUCAM3 as an IP camera. Before sending a jpeg image through internet I need to know its size in bytes for create the HTTP header. But I have a problem, after a certain number of images sent the camera stops. Herewith a piece of the program which highlights the problem. After 413 occurrences I have the following message: "Output file write error --- out of disk space ?" I do not understand because I save the image still under the same name "c:/cmucam.jpg"... Please can you help me ?


#include <stdio.h> #include <stdlib.h>

#include "cc3.h" #include "jpeglib.h"

static void capture_current_jpeg(FILE *f); static void init_jpeg(void); static void destroy_jpeg(void);

int main(void) {

int i,j; FILE *f;

cc3_uart_init (0,

CC3_UART_RATE_115200, CC3_UART_MODE_8N1, CC3_UART_BINMODE_TEXT);

cc3_camera_init ();

cc3_filesystem_init();

cc3_camera_set_resolution(CC3_CAMERA_RESOLUTION_LOW); cc3_pixbuf_frame_set_subsample (CC3_SUBSAMPLE_NEAREST, 2, 1); cc3_timer_wait_ms(1000);

// init pixbuf with width and height cc3_pixbuf_load();

// init jpeg init_jpeg();

cc3_led_set_state(1, true);

i = 0; while(true) {

printf("Image jpg num: %d\n",i); f = fopen("c:/cmucam.jpg", "w+"); if ( f!=NULL ) {

capture_current_jpeg(f); rewind(f); j=0; while ( !feof(f) ) {

fgetc (f); j++;

} printf("Image size: %d bytes\n",j); fclose(f);

} else {

printf("Error acess file !\n");

} i++;

}

destroy_jpeg(); return 0;

}

static struct jpeg_compress_struct cinfo; static struct jpeg_error_mgr jerr; //static cc3_pixel_t *row; uint8_t *row;

void init_jpeg(void) {

cinfo.err = jpeg_std_error(&jerr); jpeg_create_compress(&cinfo);

// parameters for jpeg image cinfo.image_width = cc3_g_pixbuf_frame.width; cinfo.image_height = cc3_g_pixbuf_frame.height; printf( "image width=%d image height=%d\n", cinfo.image_width, cinfo.image_height ); cinfo.input_components = 3;

// cinfo.in_color_space = JCS_YCbCr;

cinfo.in_color_space = JCS_RGB;

// set image quality, etc. jpeg_set_defaults(&cinfo); jpeg_set_quality(&cinfo, 100, true);

// allocate memory for 1 row row = cc3_malloc_rows(1); if(row==NULL) printf( "Out of memory!\n" );

}

void capture_current_jpeg(FILE *f) {

JSAMPROW row_pointer[1]; row_pointer[0] = row;

// output is file jpeg_stdio_dest(&cinfo, f);

// capture a frame to the FIFO cc3_pixbuf_load();

// read and compress jpeg_start_compress(&cinfo, TRUE); while (cinfo.next_scanline < cinfo.image_height) {

cc3_pixbuf_read_rows(row, 1); jpeg_write_scanlines(&cinfo, row_pointer, 1);

}

// finish jpeg_finish_compress(&cinfo);

}

void destroy_jpeg(void) {

jpeg_destroy_compress(&cinfo); free(row);

}

  • Message #533

    This certainly sounds like a bug.

    If you have time, could you please make a New Ticket for this problem? Then we won't forget about it. Thanks.