void Calibration::calibrationVisionColor(){
	namedWindow("input");
	namedWindow("values");

	createTrackbar("HMin", "values", &staticVisionColorHelper[0], 180, callbackHueMin, &staticVisionColorHelper[0]);
	createTrackbar("HMax", "values", &staticVisionColorHelper[3], 180, callbackHueMax, &staticVisionColorHelper[3]);

	createTrackbar("SMin", "values", &staticVisionColorHelper[1], 255, callbackSaturationMin, &staticVisionColorHelper[1]);
	createTrackbar("SMax", "values", &staticVisionColorHelper[4], 255, callbackSaturationMax, &staticVisionColorHelper[4]);

	createTrackbar("VMin", "values", &staticVisionColorHelper[2], 255, callbackValueMin, &staticVisionColorHelper[2]);
	createTrackbar("VMax", "values", &staticVisionColorHelper[5], 255, callbackValueMax, &staticVisionColorHelper[5]);

	while(true){
		if(!device){
			inputImage = imread(imagePath);
		}else{
			cam >> inputImage;
		}
		
		applyFilters();
		setMouseCallback("input", callbackMouseClickColor, 0);
	
		draw();
		imshow("input", inputImage);
		medianBlur(outputImage, outputImage, 3);
		imshow("output", outputImage);


		char key = waitKey(10); 
		if(key == 27){
			break;
		}else if(key == 32){
			for(int i = 0 ; i < 3 ; i++){
				staticVisionColor.min.rgb[i] = staticVisionColorHelper[i];
				staticVisionColor.max.rgb[i] = staticVisionColorHelper[i+3];
			}

			handleHSV(staticVisionColor.min);
			handleHSV(staticVisionColor.max);

			saveHSV();
			saveRGB();
			break;
		}
	}
}
Beispiel #2
0
int main (){
  //2592x1944 by default
  OMXCAM_STILL_SETTINGS settings;
  
  //Capture a raw RGB image
  OMXCAM_initStillSettings (&settings);
  settings.bufferCallback = bufferCallbackRGB;
  settings.camera.shutterSpeedAuto = OMXCAM_FALSE;
  //Shutter speed in milliseconds (1/8 by default: 125)
  settings.camera.shutterSpeed = (uint32_t)((1.0/8.0)*1000);
  settings.format = OMXCAM_FormatRGB888;
  
  if (saveRGB ("still.rgb", &settings)) return 1;
  
  //Capture a raw YUV420 image
  settings.bufferCallback = bufferCallbackYUV;
  settings.format = OMXCAM_FormatYUV420;
  
  if (saveYUV ("still.yuv", &settings)) return 1;
  
  printf ("ok\n");
  
  return 0;
}