void BMDSmartViewClient::printStateToSerial()	{
	for(uint8_t monId=0; monId<=1; monId++)	{
		Serial.print(F("Monitor "));
		Serial.println(monId==0?F("A:"):F("B:"));
		
		Serial.print(F("Brightness: "));
		Serial.println(getBrightness(monId));

		Serial.print(F("Contrast: "));
		Serial.println(getContrast(monId));

		Serial.print(F("Saturation: "));
		Serial.println(getSaturation(monId));

		Serial.print(F("Identify: "));
		Serial.println(getIdentify(monId));

		Serial.print(F("Border: "));
		Serial.println(getBorder(monId));

		Serial.print(F("WidescreenSD: "));
		Serial.println(getWidescreenSD(monId));

		Serial.print(F("ScopeMode: "));
		Serial.println(getScopeMode(monId));

		Serial.print(F("AudioChannel: "));
		Serial.println(getAudioChannel(monId));
		
		Serial.println();
	}
}
コード例 #2
0
string ofxRPiCameraVideoGrabber::currentStateToString()
{
    stringstream info;
    info << "sharpness " << getSharpness() << endl;
    info << "contrast " << getContrast() << endl;
    info << "brightness " << getBrightness() << endl;
    info << "saturation " << getSaturation() << endl;

    info << "ISO " << getISO() << endl;
    info << "AutoISO " << getAutoISO() << endl;

    info << "DRE " << getDRE() << endl;
    info << "cropRectangle " << getCropRectangle() << endl;
    info << "zoomLevelNormalized " << getZoomLevelNormalized() << endl;
    info << "mirror " << getMirror() << endl;
    info << "rotation " << getRotation() << endl;
    info << "imageFilter " << getImageFilter() << endl;
    info << "exposurePreset " << getExposurePreset() << endl;
    info << "evCompensation " << getEvCompensation() << endl;
    info << "autoShutter " << getAutoShutter() << endl;
    info << "shutterSpeed " << getShutterSpeed() << endl;
    info << "meteringType " << getMeteringType() << endl;
    info << "SoftwareSaturationEnabled " << isSoftwareSaturationEnabled() << endl;
    info << "SoftwareSharpeningEnabled " << isSoftwareSharpeningEnabled() << endl;

    //OMXCameraSettings
    info << omxCameraSettings.toString() << endl;
    return info.str();
}
コード例 #3
0
ファイル: kis_color_selector.cpp プロジェクト: IGLOU-EU/krita
void KisColorSelector::mousePressEvent(QMouseEvent* event)
{
    m_clickPos       = mapCoord(event->posF(), m_renderArea);
    m_mouseMoved     = false;
    m_pressedButtons = event->buttons();
    m_clickedRing    = getSaturationIndex(m_clickPos);
    
    qint8 clickedLightPiece = getLightIndex(event->posF());
    
    if (clickedLightPiece >= 0) {
        setLight(getLight(event->posF()), m_relativeLight);
        m_selectedLightPiece = clickedLightPiece;
        setSelectedColor(m_selectedColor, !(m_pressedButtons & Qt::RightButton), true);
        m_mouseMoved   = true;
    }
    else if (m_clickedRing >= 0) {
        if (getNumPieces() > 1) {
            for(int i=0; i<getNumRings(); ++i)
                m_colorRings[i].setTemporaries(m_selectedColor);
        }
        else {
            Radian angle = std::atan2(m_clickPos.x(), m_clickPos.y()) - RAD_90;
            m_selectedColor.setH(angle.scaled(0.0f, 1.0f));
            m_selectedColor.setS(getSaturation(m_clickedRing));
            m_selectedColor.setX(getLight(m_light, m_selectedColor.getH(), m_relativeLight));
            setSelectedColor(m_selectedColor, !(m_pressedButtons & Qt::RightButton), true);
            m_selectedRing = m_clickedRing;
            m_mouseMoved   = true;
            update();
        }
    }
}
コード例 #4
0
ファイル: VideoInput.cpp プロジェクト: dtbinh/dviz
float VideoInput::setSaturation(float saturation)
{
	//HERE;
	if ( saturation > 1 )
		saturation = 1;
	else
	if ( saturation < 0 )
		saturation = 0;
	m_saturation = saturation;
	return getSaturation();
}
コード例 #5
0
ファイル: kis_color_selector.cpp プロジェクト: IGLOU-EU/krita
void KisColorSelector::mouseReleaseEvent(QMouseEvent* /*event*/)
{
    if (!m_mouseMoved && m_clickedRing >= 0) {
        Radian angle = std::atan2(m_clickPos.x(), m_clickPos.y()) - RAD_90;
        
        m_selectedRing  = m_clickedRing;
        m_selectedPiece = getHueIndex(angle, m_colorRings[m_clickedRing].getShift());
        
        if (getNumPieces() > 1)
            m_selectedColor.setH(getHue(m_selectedPiece, m_colorRings[m_clickedRing].getShift()));
        else
            m_selectedColor.setH(angle.scaled(0.0f, 1.0f));
        
        m_selectedColor.setS(getSaturation(m_selectedRing));
        m_selectedColor.setX(getLight(m_light, m_selectedColor.getH(), m_relativeLight));
        
        setSelectedColor(m_selectedColor, !(m_pressedButtons & Qt::RightButton));
    }
    else if (m_mouseMoved)
        setSelectedColor(m_selectedColor, m_selectedColorIsFgColor);
    
    m_clickedRing = -1;
    update();
}
コード例 #6
0
ファイル: videolib.c プロジェクト: fniephaus/squeak
BOOLEAN setupDevice(Device device) {
   BOOLEAN change;
   fprintf(stdout, "- Seting up device %p\n", device);


   /* check (again) for a valid device */
   if (!(device->vcapability.type & VID_TYPE_CAPTURE)) {
      fprintf(stdout, "    * The device can't capture video\n");
      return FALSE;
   }

   if (device->vcapability.channels == 0) {
      fprintf(stdout, "    * The device hasn't inputs\n");
      return FALSE;
   }


   /* ---------------------------------------------------------------------- */
   /* let's try to change the capture width & height */
   change = FALSE;
   if (EINTR_RETRY(xioctl(device->fd, VIDIOCGWIN, &device->vwindow)) < 0) {
      perror("VIDIOCGWIN1");
      return FALSE;
   }

   if (device->desiredWidth && (device->vwindow.width != device->desiredWidth)) {
     fprintf(stdout, "    - Changing the width from %d to %d\n", device->vwindow.width, device->desiredWidth);

     device->vwindow.width = device->desiredWidth;
     change = TRUE;
   }
   if (device->desiredHeight && (device->vwindow.height != device->desiredHeight)) {
     fprintf(stdout, "    - Changing the height from %d to %d\n", device->vwindow.height, device->desiredHeight);

     device->vwindow.height = device->desiredHeight;
     change = TRUE;
   }

   if (change) {
      if (EINTR_RETRY(xioctl(device->fd, VIDIOCSWIN, &device->vwindow)) < 0) {
         perror("VIDIOCGWIN2");
         return FALSE;
      }

      if (EINTR_RETRY(xioctl(device->fd, VIDIOCGWIN, &device->vwindow)) < 0) {
         perror("VIDIOCGWIN3");
         return FALSE;
      }
      if (device->desiredWidth != device->vwindow.width) {
         fprintf(stdout,
                 "    * The device can't change the capture width (now=%d)\n",
                 device->vwindow.width);
         return FALSE;
      }
      if (device->desiredHeight != device->vwindow.height) {
         fprintf(stdout,
                 "    * The device can't change the capture height (now=%d)\n",
                 device->vwindow.height);
         return FALSE;
      }

   }

   fprintf(stdout,
           "    - Extent=%d@%d\n",
           device->vwindow.width,
           device->vwindow.height);

   if (EINTR_RETRY(xioctl(device->fd, VIDIOCGPICT, &device->vpicture)) < 0) {
      perror("VIDIOCGPICT");
      return FALSE;
   }

   fprintf(stdout,
           "    - Brightness=%d, Contrast=%d, Saturation=%d, Hue=%d\n",
           getBrightness(device),
           getContrast(device),
           getSaturation(device),
           getHue(device));
   /* ---------------------------------------------------------------------- */


   /* ---------------------------------------------------------------------- */
   if (!setupPalette(device)) {
      return FALSE;
   }
   /* ---------------------------------------------------------------------- */


   device->imageSize = (int) device->vwindow.width * device->vwindow.height * (paletteBytesPerPixel(device->vpicture.palette));
   device->buffer24  = (char*) malloc(device->vwindow.width * device->vwindow.height * 3);

   if (device->forceRead) {
      fprintf(stdout, "    - Capturing using (forced) read()\n");
      if (!switchToRead(device)) {
         return FALSE;
      }
   }
   else {
      setupMMap(device);

      if (device->usingMMap) {
         fprintf(stdout, "    - Capturing using mmap()\n");
         if (!startCaptureInBuffers(device)) {
            fprintf(stdout, "    * Falling back to read()\n");
            if (!switchToRead(device)) {
               return FALSE;
            }
         }
      }
      else {
         fprintf(stdout, "    - Capturing using read()\n");
         if (!switchToRead(device)) {
            return FALSE;
         }
      }
   }

   return TRUE;
}
コード例 #7
0
int GStreamerPlayer::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 13)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 13;
    } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
        if (_id < 13)
            *reinterpret_cast<int*>(_a[0]) = -1;
        _id -= 13;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< int*>(_v) = getBrightness(); break;
        case 1: *reinterpret_cast< int*>(_v) = getContrast(); break;
        case 2: *reinterpret_cast< int*>(_v) = getHue(); break;
        case 3: *reinterpret_cast< int*>(_v) = getSaturation(); break;
        case 4: *reinterpret_cast< bool*>(_v) = getPlaying(); break;
        case 5: *reinterpret_cast< bool*>(_v) = getPaused(); break;
        case 6: *reinterpret_cast< bool*>(_v) = getStopped(); break;
        default: break;
        }
        _id -= 7;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setBrightness(*reinterpret_cast< int*>(_v)); break;
        case 1: setContrast(*reinterpret_cast< int*>(_v)); break;
        case 2: setHue(*reinterpret_cast< int*>(_v)); break;
        case 3: setSaturation(*reinterpret_cast< int*>(_v)); break;
        case 4: setPlaying(*reinterpret_cast< bool*>(_v)); break;
        case 5: setPaused(*reinterpret_cast< bool*>(_v)); break;
        case 6: setStopped(*reinterpret_cast< bool*>(_v)); break;
        default: break;
        }
        _id -= 7;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 7;
    } else if (_c == QMetaObject::RegisterPropertyMetaType) {
        if (_id < 7)
            *reinterpret_cast<int*>(_a[0]) = -1;
        _id -= 7;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
コード例 #8
0
bool parseHueLightInfo(HueLightInfo currentInfo, aJsonObject *parsedRoot, HueLightInfo *newInfo) {
  *newInfo = currentInfo;
  aJsonObject* onState = aJson.getObjectItem(parsedRoot, "on");
  if (onState) {
    newInfo->on = onState->valuebool;
  }

  // pull brightness
  aJsonObject* briState = aJson.getObjectItem(parsedRoot, "bri");
  if (briState) {
    newInfo->brightness = briState->valueint;
  }

  // pull effect
  aJsonObject* effectState = aJson.getObjectItem(parsedRoot, "effect");
  if (effectState) {
    const char *effect = effectState->valuestring;
    if (!strcmp(effect, "colorloop")) {
      newInfo->effect = EFFECT_COLORLOOP;
    } else {
      newInfo->effect = EFFECT_NONE;
    }
  }
  // pull alert
  aJsonObject* alertState = aJson.getObjectItem(parsedRoot, "alert");
  if (alertState) {
    const char *alert = alertState->valuestring;
    if (!strcmp(alert, "select")) {
      newInfo->alert = ALERT_SELECT;
    } else if (!strcmp(alert, "lselect")) {
      newInfo->alert = ALERT_LSELECT;
    } else {
      newInfo->alert = ALERT_NONE;
    }
  }

  aJsonObject* hueState = aJson.getObjectItem(parsedRoot, "hue");
  aJsonObject* satState = aJson.getObjectItem(parsedRoot, "sat");
  aJsonObject* ctState = aJson.getObjectItem(parsedRoot, "ct");
  aJsonObject* xyState = aJson.getObjectItem(parsedRoot, "xy");
  if (xyState) {
    aJsonObject* elem0 = aJson.getArrayItem(xyState, 0);
    aJsonObject* elem1 = aJson.getArrayItem(xyState, 1);
    if (!elem0 || !elem1) {
      sendError(5, "/api/api/lights/?/state", "xy color coordinates incomplete");
      return false;
    }
    HsbColor hsb = getXYtoRGB(elem0->valuefloat, elem1->valuefloat, newInfo->brightness);
    newInfo->hue = getHue(hsb);
    newInfo->saturation = getSaturation(hsb);
  } else if (ctState) {
    int mirek = ctState->valueint;
    if (mirek > 500 || mirek < 153) {
      sendError(7, "/api/api/lights/?/state", "Invalid vaule for color temperature");
      return false;
    }

    HsbColor hsb = getMirektoRGB(mirek);
    newInfo->hue = getHue(hsb);
    newInfo->saturation = getSaturation(hsb);
  } else if (hueState || satState) {
    if (hueState) newInfo->hue = hueState->valueint;
    if (satState) newInfo->saturation = satState->valueint;
  }
  return true;
}
コード例 #9
0
	//[20091123 exif Ratnesh
	void CameraHal::CreateExif(unsigned char* pInThumbnailData,int Inthumbsize,unsigned char* pOutExifBuf,int& OutExifSize,int flag)
	{
		int w =0, h = 0;

		int orientationValue = getOrientation();
		HAL_PRINT("CreateExif orientationValue = %d \n", orientationValue);				
		
		ExifCreator* mExifCreator = new ExifCreator();
		unsigned int ExifSize = 0;
		ExifInfoStructure ExifInfo;
		char ver_date[5] = {NULL,};
		unsigned short tempISO = 0;
		struct v4l2_exif exifobj;
		
		// To read values from driver
		if(mCameraIndex==MAIN_CAMERA)
		{
			getExifInfoFromDriver(&exifobj);
		}
   
		memset(&ExifInfo, NULL, sizeof(ExifInfoStructure));

		strcpy( (char *)&ExifInfo.maker, "SAMSUNG");
		strcpy( (char *)&ExifInfo.model, "GT-I9003");

		mParameters.getPreviewSize(&w, &h);

		mParameters.getPictureSize((int*)&ExifInfo.imageWidth , (int*)&ExifInfo.imageHeight);
		mParameters.getPictureSize((int*)&ExifInfo.pixelXDimension, (int*)&ExifInfo.pixelYDimension);

		struct tm *t = NULL;
		time_t nTime;
		time(&nTime);
		t = localtime(&nTime);

		if(t != NULL)
		{
			sprintf((char *)&ExifInfo.dateTimeOriginal, "%4d:%02d:%02d %02d:%02d:%02d", t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec);
			sprintf((char *)&ExifInfo.dateTimeDigitized, "%4d:%02d:%02d %02d:%02d:%02d", t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec);						
			sprintf((char *)&ExifInfo.dateTime, "%4d:%02d:%02d %02d:%02d:%02d", t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec); 					
		}

		if(mCameraIndex==MAIN_CAMERA)
		{
			int cam_ver = GetCamera_version();

			ExifInfo.Camversion[0] = (cam_ver & 0xFF);
			ExifInfo.Camversion[1] = ((cam_ver >> 8) & 0xFF);
			ExifInfo.Camversion[2] = ((cam_ver >> 16) & 0xFF);
			ExifInfo.Camversion[3] = ((cam_ver >> 24) & 0xFF);
			HAL_PRINT("CreateExif GetCamera_version =[%x][%x][%x][%x]\n", ExifInfo.Camversion[2],ExifInfo.Camversion[3],ExifInfo.Camversion[0],ExifInfo.Camversion[1]);	

			sprintf((char *)&ExifInfo.software, "fw %02d.%02d prm %02d.%02d", ExifInfo.Camversion[2],ExifInfo.Camversion[3],ExifInfo.Camversion[0],ExifInfo.Camversion[1]); 	
			if(mThumbnailWidth > 0 && mThumbnailHeight > 0)
			{
				ExifInfo.hasThumbnail = true;
				ExifInfo.thumbStream			= pInThumbnailData;
				ExifInfo.thumbSize				= Inthumbsize;
				ExifInfo.thumbImageWidth		= mThumbnailWidth;
				ExifInfo.thumbImageHeight		= mThumbnailHeight;
			}
			else
			{
				ExifInfo.hasThumbnail = false;
			}

			ExifInfo.exposureProgram            = 3;
			ExifInfo.exposureMode               = 0;
			ExifInfo.contrast                   = convertToExifLMH(getContrast(), 2);
			ExifInfo.fNumber.numerator          = 26;
			ExifInfo.fNumber.denominator        = 10;
			ExifInfo.aperture.numerator         = 26;
			ExifInfo.aperture.denominator       = 10;
			ExifInfo.maxAperture.numerator      = 26;
			ExifInfo.maxAperture.denominator    = 10;
			ExifInfo.focalLength.numerator      = 3430;
			ExifInfo.focalLength.denominator    = 1000;
			//[ 2010 05 01 exif
			ExifInfo.shutterSpeed.numerator 	= exifobj.TV_Value;
			ExifInfo.shutterSpeed.denominator   = 100;
			ExifInfo.exposureTime.numerator     = 1;
			ExifInfo.exposureTime.denominator   = (unsigned int)pow(2.0, ((double)exifobj.TV_Value/100.0));
			//]
			ExifInfo.brightness.numerator       = 5;
			ExifInfo.brightness.denominator     = 9;
			ExifInfo.iso                        = 1;
			ExifInfo.flash                     	= 0;	// default value

			// Flash
			// bit 0    -whether the flash fired
			// bit 1,2 -status of returned light
			// bit 3,4 - indicating the camera's flash mode
			// bit 5    -presence of a flash function
			// bit 6    - red-eye mode

			// refer to flash_mode[] at CameraHal.cpp
			// off = 1
			// on = 2
			// auto = 3


			// Todo : Need to implement how HAL can recognize existance of flash
			//		if( ! isFlashExist )	// pseudo code
			//			ExifInfo.flash = 32;		// bit 5 - No flash function.
			//		else
			{
				LOGD("createExif - flashmode = %d flash result = %d", mPreviousFlashMode, ExifInfo.flash);

				// bit 0
				ExifInfo.flash = ExifInfo.flash | exifobj.flash;
				// bit 3,4
				if(mPreviousFlashMode == 3)	// Flashmode auto
					ExifInfo.flash = ExifInfo.flash |24;
				// bit 6
				// Todo : Need to implement about red-eye			
				//			if(mPreviousFlashMode == ??)	// Flashmode red-eye
				//				ExifInfo.flash = ExifInfo.flash | 64;						
			}

			HAL_PRINT("Main Orientation = %d\n",orientationValue);
			switch(orientationValue)
			{            		
				case 0:
					ExifInfo.orientation                = 1 ;
					break;
				case 90:
					ExifInfo.orientation                = 6 ;
					break;
				case 180:
					ExifInfo.orientation                = 3 ;
					break;
				case 270:
					ExifInfo.orientation                = 8 ;
					break;
				default:
					ExifInfo.orientation                = 1 ;
					break;
			}
			//[ 2010 05 01 exif
			double calIsoValue = 0;
			calIsoValue = pow(2.0,((double)exifobj.SV_Value/100.0))*3.125;
			//]
			if(calIsoValue < 8.909)
			{
				tempISO = 0;
			}
			else if(calIsoValue >=8.909 && calIsoValue < 11.22)
			{
				tempISO = 10;
			}
			else if(calIsoValue >=11.22 && calIsoValue < 14.14)
			{
				tempISO = 12;
			}
			else if(calIsoValue >=14.14 && calIsoValue < 17.82)
			{
				tempISO = 16;
			}
			else if(calIsoValue >=17.82 && calIsoValue < 22.45)
			{
				tempISO = 20;
			}
			else if(calIsoValue >=22.45 && calIsoValue < 28.28)
			{
				tempISO = 25;
			}
			else if(calIsoValue >=28.28 && calIsoValue < 35.64)
			{
				tempISO = 32;
			}
			else if(calIsoValue >=35.64 && calIsoValue < 44.90)
			{
				tempISO = 40;
			}
			else if(calIsoValue >=44.90 && calIsoValue < 56.57)
			{
				tempISO = 50;
			}
			else if(calIsoValue >=56.57 && calIsoValue < 71.27)
			{
				tempISO = 64;
			}
			else if(calIsoValue >=71.27 && calIsoValue < 89.09)
			{
				tempISO = 80;
			}
			else if(calIsoValue >=89.09 && calIsoValue < 112.2)
			{
				tempISO = 100;
			}
			else if(calIsoValue >=112.2 && calIsoValue < 141.4)
			{
				tempISO = 125;
			}
			else if(calIsoValue >=141.4 && calIsoValue < 178.2)
			{
				tempISO = 160;
			}
			else if(calIsoValue >=178.2 && calIsoValue < 224.5)
			{
				tempISO = 200;
			}
			else if(calIsoValue >=224.5 && calIsoValue < 282.8)
			{
				tempISO = 250;
			}
			else if(calIsoValue >=282.8 && calIsoValue < 356.4)
			{
				tempISO = 320;
			}
			else if(calIsoValue >=356.4 && calIsoValue < 449.0)
			{
				tempISO = 400;
			}
			else if(calIsoValue >=449.0 && calIsoValue < 565.7)
			{
				tempISO = 500;
			}
			else if(calIsoValue >=565.7 && calIsoValue < 712.7)
			{
				tempISO = 640;
			}
			else if(calIsoValue >=712.7 && calIsoValue < 890.9)
			{
				tempISO = 800;
			}
			else if(calIsoValue >=890.9 && calIsoValue < 1122)
			{
				tempISO = 1000;
			}
			else if(calIsoValue >=1122 && calIsoValue < 1414)
			{
				tempISO = 1250;
			}
			else if(calIsoValue >=1414 && calIsoValue < 1782)
			{
				tempISO = 160;
			}
			else if(calIsoValue >=1782 && calIsoValue < 2245)
			{
				tempISO = 2000;
			}
			else if(calIsoValue >=2245 && calIsoValue < 2828)
			{
				tempISO = 2500;
			}
			else if(calIsoValue >=2828 && calIsoValue < 3564)
			{
				tempISO = 3200;
			}
			else if(calIsoValue >=3564 && calIsoValue < 4490)
			{
				tempISO = 4000;
			}
			else if(calIsoValue >=4490 && calIsoValue < 5657)
			{
				tempISO = 5000;
			}
			else if(calIsoValue >=5657 && calIsoValue < 7127)
			{
				tempISO = 6400;
			}
			else
			{
				tempISO = 8000;
			}

			if(mPreviousSceneMode <= 1)
			{
				ExifInfo.meteringMode               = mPreviousMetering;
				if(mPreviousWB <= 1)
				{
					ExifInfo.whiteBalance               = 0;
				}
				else
				{
					ExifInfo.whiteBalance               = 1;
				}
				ExifInfo.saturation                 = convertToExifLMH(getSaturation(), 2);
				ExifInfo.sharpness                  = convertToExifLMH(getSharpness(), 2);
				switch(mPreviousISO)
				{
					case 2:
						ExifInfo.isoSpeedRating             = 50;
						break;
					case 3:
						ExifInfo.isoSpeedRating             = 100;
						break;
					case 4:
						ExifInfo.isoSpeedRating             = 200;
						break;
					case 5:
						ExifInfo.isoSpeedRating             = 400;
						break;
					case 6:
						ExifInfo.isoSpeedRating             = 800;
						break;
					default:
						ExifInfo.isoSpeedRating             = tempISO;
						break;
				}                

				switch(getBrightness())
				{
					case 0:
						ExifInfo.exposureBias.numerator = -20;
						break;
					case 1:
						ExifInfo.exposureBias.numerator = -15;
						break;
					case 2:
						ExifInfo.exposureBias.numerator = -10;
						break;
					case 3:
						ExifInfo.exposureBias.numerator =  -5;
						break;
					case 4:
						ExifInfo.exposureBias.numerator =   0;
						break;
					case 5:
						ExifInfo.exposureBias.numerator =   5;
						break;
					case 6:
						ExifInfo.exposureBias.numerator =  10;
						break;
					case 7:
						ExifInfo.exposureBias.numerator =  15;
						break;
					case 8:
						ExifInfo.exposureBias.numerator =  20;
						break;
					default:
						ExifInfo.exposureBias.numerator = 0;
						break;
				}
				ExifInfo.exposureBias.denominator       = 10;
				ExifInfo.sceneCaptureType               = 0;
			}
			else
			{
				switch(mPreviousSceneMode)
				{
					case 3://sunset
						ExifInfo.meteringMode               = 2;
						ExifInfo.whiteBalance               = 1;
						ExifInfo.saturation                 = 0;
						ExifInfo.sharpness                  = 0;
						ExifInfo.isoSpeedRating             = tempISO;
						ExifInfo.exposureBias.numerator     = 0;
						ExifInfo.exposureBias.denominator   = 10;
						ExifInfo.sceneCaptureType           = 4;
						break;
					case 4://dawn
						ExifInfo.meteringMode               = 2;
						ExifInfo.whiteBalance               = 1;
						ExifInfo.saturation                 = 0;
						ExifInfo.sharpness                  = 0;
						ExifInfo.isoSpeedRating             = tempISO;
						ExifInfo.exposureBias.numerator     = 0;
						ExifInfo.exposureBias.denominator   = 10;
						ExifInfo.sceneCaptureType           = 4;
						break;
					case 5://candlelight
						ExifInfo.meteringMode               = 2;
						ExifInfo.whiteBalance               = 1;
						ExifInfo.saturation                 = 0;
						ExifInfo.sharpness                  = 0;
						ExifInfo.isoSpeedRating             = tempISO;
						ExifInfo.exposureBias.numerator     = 0;
						ExifInfo.exposureBias.denominator   = 10;
						ExifInfo.sceneCaptureType           = 4;
						break;
					case 6://beach & snow
						ExifInfo.meteringMode               = 2;
						ExifInfo.whiteBalance               = 0;
						ExifInfo.saturation                 = 2;
						ExifInfo.sharpness                  = 0;
						ExifInfo.isoSpeedRating             = 50;
						ExifInfo.exposureBias.numerator     = 10;
						ExifInfo.exposureBias.denominator   = 10;
						ExifInfo.sceneCaptureType           = 1;
						break;
					case 7://againstlight
						ExifInfo.whiteBalance               = 0;
						ExifInfo.saturation                 = 0;
						ExifInfo.sharpness                  = 0;
						ExifInfo.isoSpeedRating             = tempISO;
						if(mPreviousFlashMode <= 1)
						{
							ExifInfo.meteringMode               = 3;
						}
						else
						{
							ExifInfo.meteringMode               = 2;
						}
						ExifInfo.exposureBias.numerator 	= 0;
						ExifInfo.exposureBias.denominator   = 10;
						ExifInfo.sceneCaptureType           = 4;
						break;
					case 8://text
						ExifInfo.meteringMode               = 2;
						ExifInfo.whiteBalance               = 0;
						ExifInfo.saturation                 = 0;
						ExifInfo.sharpness                  = 2;
						ExifInfo.isoSpeedRating             = tempISO;
						ExifInfo.exposureBias.numerator     = 0;
						ExifInfo.exposureBias.denominator   = 10;
						ExifInfo.sceneCaptureType           = 4;
						break;
					case 9://night
						ExifInfo.meteringMode               = 2;
						ExifInfo.whiteBalance               = 0;
						ExifInfo.saturation                 = 0;
						ExifInfo.sharpness                  = 0;
						ExifInfo.isoSpeedRating             = tempISO;
						ExifInfo.exposureBias.numerator     = 0;
						ExifInfo.exposureBias.denominator   = 10;
						ExifInfo.sceneCaptureType           = 3;
						break;	
					case 10://landscape
						ExifInfo.meteringMode               = 5;
						ExifInfo.whiteBalance               = 0;
						ExifInfo.saturation                 = 2;
						ExifInfo.sharpness                  = 2;
						ExifInfo.isoSpeedRating             = tempISO;
						ExifInfo.exposureBias.numerator     = 0;
						ExifInfo.exposureBias.denominator   = 10;
						ExifInfo.sceneCaptureType           = 1;
						break;
					case 11://fireworks
						ExifInfo.meteringMode               = 2;
						ExifInfo.whiteBalance               = 0;
						ExifInfo.saturation                 = 0;
						ExifInfo.sharpness                  = 0;
						ExifInfo.isoSpeedRating             = 50;
						ExifInfo.exposureBias.numerator     = 0;
						ExifInfo.exposureBias.denominator   = 10;
						ExifInfo.sceneCaptureType           = 4;
						break;
					case 12://portrait
						ExifInfo.meteringMode               = 2;
						ExifInfo.whiteBalance               = 0;
						ExifInfo.saturation                 = 0;
						ExifInfo.sharpness                  = 1;
						ExifInfo.isoSpeedRating             = tempISO;
						ExifInfo.exposureBias.numerator     = 0;
						ExifInfo.exposureBias.denominator   = 10;
						ExifInfo.sceneCaptureType           = 2;
						break;
					case 13://fallcolor
						ExifInfo.meteringMode               = 2;
						ExifInfo.whiteBalance               = 0;
						ExifInfo.saturation                 = 2;
						ExifInfo.sharpness                  = 0;
						ExifInfo.isoSpeedRating             = tempISO;
						ExifInfo.exposureBias.numerator     = 0;
						ExifInfo.exposureBias.denominator   = 10;
						ExifInfo.sceneCaptureType           = 4;
						break;
					case 14://indoors
						ExifInfo.meteringMode               = 2;
						ExifInfo.whiteBalance               = 0;
						ExifInfo.saturation                 = 2;
						ExifInfo.sharpness                  = 0;
						ExifInfo.isoSpeedRating             = 200;
						ExifInfo.exposureBias.numerator     = 0;
						ExifInfo.exposureBias.denominator   = 10;
						ExifInfo.sceneCaptureType           = 4;
						break;
					case 15://sports
						ExifInfo.meteringMode               = 2;
						ExifInfo.whiteBalance               = 0;
						ExifInfo.saturation                 = 0;
						ExifInfo.sharpness                  = 0;
						ExifInfo.isoSpeedRating             = tempISO;
						ExifInfo.exposureBias.numerator     = 0;
						ExifInfo.exposureBias.denominator   = 10;
						ExifInfo.sceneCaptureType           = 4;
						break;
				}
			}
		}
コード例 #10
0
ファイル: LEDs.cpp プロジェクト: saikoLED/TeensyLED
void HSIColor::getHSI(float *HSI) {
  HSI[0] = getHue();
  HSI[1] = getSaturation();
  HSI[2] = getIntensity();
}
コード例 #11
0
	//[20091123 exif Ratnesh
	void CameraHal::CreateExif(unsigned char* pInThumbnailData, int Inthumbsize,
		unsigned char* pOutExifBuf, int& OutExifSize, int flag)
	{
		//                                0   90  180 270 360
		const int MAIN_ORIENTATION[]  = { 1,  6,  3,  8,  1};
		const int FRONT_ORIENTATION[] = { 3,  6,  1,  8,  3};
			
		ExifCreator* mExifCreator = new ExifCreator();
		unsigned int ExifSize = 0;
		ExifInfoStructure ExifInfo;
		char ver_date[5] = {NULL,};
		unsigned short tempISO = 0;
		struct v4l2_exif exifobj;
		
		int orientationValue = getOrientation();
		LOGV("CreateExif orientationValue = %d \n", orientationValue);	

		memset(&ExifInfo, NULL, sizeof(ExifInfoStructure));

		strcpy( (char *)&ExifInfo.maker, "SAMSUNG");
		
		mParameters.getPictureSize((int*)&ExifInfo.imageWidth , (int*)&ExifInfo.imageHeight);
		mParameters.getPictureSize((int*)&ExifInfo.pixelXDimension, (int*)&ExifInfo.pixelYDimension);

		struct tm *t = NULL;
		time_t nTime;
		time(&nTime);
		t = localtime(&nTime);

		if(t != NULL)
		{
			sprintf((char *)&ExifInfo.dateTimeOriginal, "%4d:%02d:%02d %02d:%02d:%02d", t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec);
			sprintf((char *)&ExifInfo.dateTimeDigitized, "%4d:%02d:%02d %02d:%02d:%02d", t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec);						
			sprintf((char *)&ExifInfo.dateTime, "%4d:%02d:%02d %02d:%02d:%02d", t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec); 					
		}
				
		if(mCameraIndex==MAIN_CAMERA)
		{
			if(orientationValue<=360)
				ExifInfo.orientation = MAIN_ORIENTATION[orientationValue/90];
			else
				ExifInfo.orientation = 0;
			
			getExifInfoFromDriver(&exifobj);
			strcpy( (char *)&ExifInfo.model, "GT-I8320 M4MO");
			int cam_ver = GetCamera_version();
			ExifInfo.Camversion[0] = (cam_ver & 0xFF);
			ExifInfo.Camversion[1] = ((cam_ver >> 8) & 0xFF);
			//HAL_PRINT("CreateExif GetCamera_version =[%x][%x][%x][%x]\n", ExifInfo.Camversion[2],ExifInfo.Camversion[3],ExifInfo.Camversion[0],ExifInfo.Camversion[1]);	
			sprintf((char *)&ExifInfo.software, "%02X%02X", ExifInfo.Camversion[1], ExifInfo.Camversion[0]); 	
// TODO: get thumbnail offset of m4mo jpeg data
			// if(mThumbnailWidth > 0 && mThumbnailHeight > 0)
			// {
				// ExifInfo.hasThumbnail = true;
				// ExifInfo.thumbStream			= pInThumbnailData;
				// ExifInfo.thumbSize				= Inthumbsize;
				// ExifInfo.thumbImageWidth		= mThumbnailWidth;
				// ExifInfo.thumbImageHeight		= mThumbnailHeight;
			// }
			// else
			{
				ExifInfo.hasThumbnail = false;
			}

			ExifInfo.exposureProgram            = 3;
			ExifInfo.exposureMode               = 0;
			ExifInfo.contrast                   = convertToExifLMH(getContrast(), 2);
			ExifInfo.fNumber.numerator          = 26;
			ExifInfo.fNumber.denominator        = 10;
			ExifInfo.aperture.numerator         = 26;
			ExifInfo.aperture.denominator       = 10;
			ExifInfo.maxAperture.numerator      = 26;
			ExifInfo.maxAperture.denominator    = 10;
			ExifInfo.focalLength.numerator      = 4610;
			ExifInfo.focalLength.denominator    = 1000;
			//[ 2010 05 01 exif
			ExifInfo.shutterSpeed.numerator 	= exifobj.shutter_speed_numerator;
			ExifInfo.shutterSpeed.denominator   = exifobj.shutter_speed_denominator;
			ExifInfo.exposureTime.numerator     = exifobj.exposure_time_numerator;
			ExifInfo.exposureTime.denominator   = exifobj.exposure_time_denominator;
			//]
			ExifInfo.brightness.numerator       = exifobj.brigtness_numerator;
			ExifInfo.brightness.denominator     = exifobj.brightness_denominator;
			ExifInfo.iso                        = 1;
			ExifInfo.isoSpeedRating             = roundIso(exifobj.iso);
			// Flash
			// bit 0    -whether the flash fired
			// bit 1,2 -status of returned light
			// bit 3,4 - indicating the camera's flash mode
			// bit 5    -presence of a flash function
			// bit 6    - red-eye mode

			// refer to flash_mode[] at CameraHal.cpp
			// off = 1
			// on = 2
			// auto = 3
			ExifInfo.flash  					= exifobj.flash 
												| (mPreviousFlashMode == 3)?(3<<4):0;	// default value
			
			ExifInfo.whiteBalance               = (mPreviousWB <= 1)?0:1;
			ExifInfo.meteringMode               = mPreviousMetering;
			ExifInfo.saturation                 = convertToExifLMH(getSaturation(), 2);
			ExifInfo.sharpness                  = convertToExifLMH(getSharpness(), 2);  
			ExifInfo.exposureBias.numerator 	= (getBrightness()-4)*5;
			ExifInfo.exposureBias.denominator   = 10;
			ExifInfo.sceneCaptureType           = mPreviousSceneMode;
		
			// ExifInfo.meteringMode               = 2;
			// ExifInfo.whiteBalance               = 1;
			// ExifInfo.saturation                 = 0;
			// ExifInfo.sharpness                  = 0;
			// ExifInfo.isoSpeedRating             = tempISO;
			// ExifInfo.exposureBias.numerator     = 0;
			// ExifInfo.exposureBias.denominator   = 10;
			// ExifInfo.sceneCaptureType           = 4;
		}
		
		else // VGA Camera
		{	
			if(orientationValue<=360)
コード例 #12
0
ファイル: ccolor.C プロジェクト: anilkunwar/OOF2
void CHSVColor::print(std::ostream &os) const {
  os << "CHSVColor(" << getHue() << ", " << getSaturation() 
     << ", " << getValue() << ")";
}