예제 #1
0
void CameraSettings::setup(MMAL_COMPONENT_T *camera_)
{
	camera = camera_;
	set_saturation(saturation);
	set_sharpness(sharpness);
	set_contrast(contrast);
	set_brightness(brightness);
	//set_ISO(ISO); TODO Not working for some reason
	set_video_stabilisation(videoStabilisation);
	set_exposure_compensation(exposureCompensation);
	set_exposure_mode(exposureMode);
	set_metering_mode(exposureMeterMode);
	set_awb_mode(awbMode);
	set_imageFX(imageEffect);
	set_colourFX(&colourEffects);
	//set_thumbnail_parameters(camera, &params->thumbnailConfig);  TODO Not working for some reason
	set_rotation(rotation);
	set_flips(hflip, vflip);
}
예제 #2
0
int main(int argc,char *argv[])
{
	void *handle;
	option_t opt;
	void* csi_attr;
	int restart = 0;
	
	RegisterSigint();
	
	memset(&opt, 0, sizeof(option_t));
	opt.ev = 6;
	opt.sharpness = 1;
	strcpy(opt.outpath, "./");
	if (0 > parse_command(argc, argv, &opt))
		return -1;
		
	dc_pipe_init();
	
//	opt.raw = 1;
start:
	g_bQuit = 0;
	restart = 0;
	gp_IPC_VStream_Open(IPC_COLOR_YUYV, 0, 0, ON2_JPG);

	csi_attr = gp_IPC_VDev_Open(NULL);
	
	gp_IPC_VDev_Set_Exposure(csi_attr, opt.ev);
	set_sharpness(csi_attr, opt.sharpness);
	set_awb(csi_attr, opt.white_balance);
	set_color(csi_attr, opt.color);
	set_iso(csi_attr,opt.iso);
	
	gp_IPC_Enable_Display(1, 0, IPC_SCALE_BILINEAR, (opt.width == 1920) ? 0:1);
	
	gp_IPC_Enable_TimeStamp(opt.time_stamp);
	
	dc_pipemsg_send(CMD_READY_KEY, 0, NULL);
	
	while(1)
	{
		unsigned int msgId;
		void* msgPara;
		unsigned int mode;
		
		if (g_bQuit)
			break;
		
		if(dc_pipemsg_receive(&msgId, &msgPara) > 0)
		{
			printf("msgId=%d\n", msgId);
			if (msgPara)
			{
				mode = *(unsigned int*)msgPara;
				printf("mode = %d\n", mode);
			}
			switch(msgId)
			{
				case CMD_DO_CAPTURE:
					if(opt.raw)
					{
						gp_IPC_VDev_Close(csi_attr);
						gp_IPC_VStream_Close();
						gp_IPC_VStream_Open(IPC_COLOR_RAW, 0, 0, ON2_JPG);
						csi_attr = gp_IPC_VDev_Open(NULL);
						snap_shot(opt.width, opt.height, opt.quality, opt.outpath, opt.sequence, 1);
						restart = 1;
						g_bQuit = 1;
						dc_response_cmd(msgId);
					}
					else
						snap_shot(opt.width, opt.height, opt.quality, opt.outpath, opt.sequence, 0);
				break;
				case CMD_SET_DC_RESOLUTION:
					get_resolution(mode, &opt.width, &opt.height);
					gp_IPC_Enable_Display(0,0,0,0);
					gp_IPC_Enable_Display(1, 2, IPC_SCALE_BILINEAR, (opt.width == 1920) ? 0:1);
				break;
				case CMD_SET_QUALITY:
					opt.quality = get_quality(mode);
				break;
				case CMD_SET_EXPOSURE:
					gp_IPC_VDev_Set_Exposure(csi_attr, mode);
				break;
				case CMD_SET_SHARPNESS:
					set_sharpness(csi_attr, mode);
				break;
				case CMD_SET_AWB:
					set_awb(csi_attr, mode);	
				break;
				case CMD_SET_COLOR:
					set_color(csi_attr, mode);
				break;
				case CMD_SET_ISO:
					set_iso(csi_attr, mode);
				break;
				case CMD_SET_DC_DATE_STAMP:
					opt.time_stamp = mode;
					gp_IPC_Enable_TimeStamp(opt.time_stamp);
				break;
				case CMD_SET_SEQUENCE:
					opt.sequence = mode ? 3:0;
				break;
				case CMD_SET_ZOOM:
					mode = mode ? mode + 10: 0;
					gp_IPC_Set_Zoom(mode);
				break;
				case CMD_SET_EXIT:
					g_bQuit = 1;
				break;
			}
			if (!g_bQuit)
				dc_response_cmd(msgId);
		}
	}
	printf("++++++++++dc exit++++++++++\n");
	gp_IPC_VDev_Close(csi_attr);
	gp_IPC_VStream_Close();
	
	if(restart)
		goto start;

	dc_response_cmd(CMD_SET_EXIT);
}