Beispiel #1
0
void videowall_apply( VJFrame *frameA, VJFrame *frameB, int a,int b, int c, int d )
{
	unsigned int i;
	const unsigned int width = frameA->width;
	const unsigned int height = frameA->height;
	uint8_t *dstY = frameA->data[0];
	uint8_t *dstU = frameA->data[1];
	uint8_t *dstV = frameA->data[2];

	if(d==0)
	{
		offset_table_x[a] = b;
		offset_table_y[a] = c;
	}

	for( i = 0; i < 3; i ++ )
	{
		take_photo( frameA->data[i], photo_list[(frame_counter%num_photos)]->data[i], width, height , frame_counter % num_photos);
	}
	frame_counter++;

	for( i = 0; i < 3; i ++ )
	{
		take_photo( frameB->data[i], photo_list[(frame_counter%num_photos)]->data[i], width, height , frame_counter % num_photos);
	}

	for ( i = 0; i < num_photos; i ++ )
	{
		put_photo( dstY, photo_list[i]->data[0],width,height,i);
		put_photo( dstU, photo_list[i]->data[1],width,height,i);
		put_photo( dstV, photo_list[i]->data[2],width,height,i);
	}
	frame_counter++;

}
Beispiel #2
0
static void
refresh_button_clicked(GtkWidget *button, gpointer data)
{

	take_photo(config->image_file);
	sleep(1);
	update_image();
}
void raspberrypi_photoupload_run(void)
{
	IOTHUB_CLIENT_LL_HANDLE iotHubClientHandle;
	time_t now;
	struct tm *local;
	char* photoFileName;
	const unsigned char* photoContent;
	long contentLength;

	if (platform_init() != 0)
	{
		printf("Failed to initialize the platform.\r\n");
	}
	else
	{
		(void)printf("Starting the IoTHub client sample upload to blob...\r\n");

		if ((iotHubClientHandle = IoTHubClient_LL_CreateFromConnectionString(connectionString, HTTP_Protocol)) == NULL)
		{
			(void)printf("ERROR: iotHubClientHandle is NULL!\r\n");
		}
		else
		{
			printf("Connected to IoT Hub\r\n");
			while (true) {
				photoContent = take_photo(&contentLength);
				if (photoContent != NULL) {
					now = time(NULL);
					local = localtime(&now);

					photoFileName = (char*)malloc(strlen(deviceId) + 32);
					sprintf(photoFileName, "%s_%04d_%02d_%02d_%02d_%02d_%02d_Pro.jpg", deviceId, local->tm_year+1900, local->tm_mon+1, local->tm_mday, local->tm_hour, local->tm_min, local->tm_sec);
					printf("Try to upload as %s size is %d\r\n", photoFileName, contentLength);
					if (IoTHubClient_LL_UploadToBlob(iotHubClientHandle, photoFileName, photoContent, contentLength) != IOTHUB_CLIENT_OK)
					{
						printf("Failed to upload picture\r\n");
					}
					else
					{
						printf("Uploaded %s %d bytes.\r\n", photoFileName, contentLength);
					}
					free((void*)photoFileName);
					free((void*)photoContent);
				}
				else {
					printf("Failed to take a picture\r\n");
				}
				sleep(duration);
			}
			IoTHubClient_LL_Destroy(iotHubClientHandle);
		}
		platform_deinit();
	}
}
Beispiel #4
0
void Buzzer::notice(uint8_t type)
{
    switch (type)
    {
     case BUZZER_TARGET_NOT_FOUND:
        target_not_found();
        break;
    
     case BUZZER_TAKE_PHOTO:
        take_photo();
        break;
    }
}
Beispiel #5
0
void *take_photo_thread (void *args){
    for(;;){
        if(ir_state /* || 1 */){
            char str[25];
            sprintf(str,"%d.jpg",(int) time((time_t*)NULL));
            //printf("%s\n",str);
            take_photo(str);
            sleep (1);
            //char command[100];
            //sprintf (command, "./upload.sh %s", str);
            //system (command);
            char command[120];
            sprintf(command,"curl --form \"fileupload=@%s\"  http://www.lisperli.org/upload/?upload=yes",str);
            system  (command);
        }
        sleep(1);
    }
}
Beispiel #6
0
//take photo thread
void *take_photo_thread (void *args){
    for(;;){
        if(ir_state){ //check sensor state

            //get system time
            char str[25];
            sprintf(str,"%d.jpg",(int) time((time_t*)NULL));

            //take photo
            take_photo(str);
            sleep (1);

            //upload photo
            char command[120];
            sprintf(command,"curl --form \"fileupload=@%s\"  http://www.lisperli.org/upload/?upload=yes",str);
            system(command);
        }
        sleep(1);
    }
}
Beispiel #7
0
void photoplay_apply( VJFrame *frame, int width, int height, int size, int delay, int mode )
{
	unsigned int i;
	uint8_t *dstY = frame->data[0];
	uint8_t *dstU = frame->data[1];
	uint8_t *dstV = frame->data[2];

	matrix_f matrix_placement = get_matrix_func(mode);

	if( (size*size) != num_photos || num_photos == 0 )
	{
		destroy_filmstrip();
		if(!prepare_filmstrip(size*size, width,height))
		{
			return;
		}
	}

	if(frame_counter < num_photos)
	{
		for( i = 0; i < 3 ; i ++ )
			memset( frame->data[i], (i==0?16:128), (width*height));
		frame_counter ++;
		return;
	}

	for( i = 0; i < 3; i ++ )
	{
		take_photo( frame->data[i], photo_list[(frame_counter%num_photos)]->data[i], width, height , frame_counter % num_photos);
	}

	for ( i = 0; i < num_photos; i ++ )
	{
		matrix_t m = matrix_placement(i, size,width,height );
		put_photo( dstY, photo_list[i]->data[0],width,height,i, m);
		put_photo( dstU, photo_list[i]->data[1],width,height,i, m);
		put_photo( dstV, photo_list[i]->data[2],width,height,i, m);
	}

	frame_counter ++;
}
Beispiel #8
0
void *count_down_thread ()
{
	gchar  buf[1024];
	int countdown = settings->update_interval;

	for (;;)
	{

		sleep(1);

		if(timmer_running == TRUE)
		{
			gdk_threads_enter ();

			if(countdown == 1)
			{
				take_photo(config->image_file);
				sleep(1);
				update_image();

				countdown = settings->update_interval;

			} else
				countdown--;

			g_ascii_dtostr(buf, sizeof (buf), countdown);
			gtk_label_set_label(GTK_LABEL(lblUpdate), buf );

			gdk_threads_leave ();


		} else {
			countdown = settings->update_interval;
		}

	}

	return NULL;

}
Beispiel #9
0
void photoplay_apply( VJFrame *frame, int size, int delay, int mode )
{
	unsigned int i;

	const unsigned int width = frame->width;
	const unsigned int height = frame->height;
	uint8_t *dstY = frame->data[0];
	uint8_t *dstU = frame->data[1];
	uint8_t *dstV = frame->data[2];

	if( (size*size) != num_photos || num_photos == 0)
	{
		destroy_filmstrip();
		if(!prepare_filmstrip(size*size, width,height))
		{
			return;
		}
		frame_delay = 0;

		for( i = 0; i < num_photos; i ++ )
			rt[i] = i;

		if( mode == 0)
			fx_shuffle_int_array( rt, num_photos );
	}

	if(last_mode != mode)
	{
		for( i = 0; i < num_photos; i ++ )
			rt[i] = i;

		if( mode == 0)
			fx_shuffle_int_array( rt, num_photos );

	}

	last_mode = mode;

	if( frame_delay )
		frame_delay --;

	if( frame_delay == 0)
	{	
		for( i = 0; i < 3; i ++ )
		{
			take_photo( frame->data[i], photo_list[(frame_counter%num_photos)]->data[i], width, height , frame_counter % num_photos);
		}
		frame_delay = delay;
	}


	matrix_f matrix_placement;
	if( mode == 0 ) {
		matrix_placement = get_matrix_func(0); // !important in random mode
	}
	else {
		matrix_placement = get_matrix_func(mode-1);
	}

	for( i = 0; i < num_photos; i ++ ) 
	{
		matrix_t m = matrix_placement( rt[i], size,width,height );
		put_photo( dstY, photo_list[i]->data[0],width,height,i,m);
		put_photo( dstU, photo_list[i]->data[1],width,height,i,m);
		put_photo( dstV, photo_list[i]->data[2],width,height,i,m);
	}

	if(frame_delay == delay)
		frame_counter ++;
}