本文整理汇总了C++中CameraParameters类的典型用法代码示例。如果您正苦于以下问题:C++ CameraParameters类的具体用法?C++ CameraParameters怎么用?C++ CameraParameters使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CameraParameters类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lock
status_t CameraHardwareStub::setParameters(const CameraParameters& params)
{
Mutex::Autolock lock(mLock);
// XXX verify params
if (strcmp(params.getPreviewFormat(),
CameraParameters::PIXEL_FORMAT_YUV420SP) != 0) {
LOGE("Only yuv420sp preview is supported");
return -1;
}
if (strcmp(params.getPictureFormat(),
CameraParameters::PIXEL_FORMAT_JPEG) != 0) {
LOGE("Only jpeg still pictures are supported");
return -1;
}
int w, h;
params.getPictureSize(&w, &h);
if (w != kCannedJpegWidth && h != kCannedJpegHeight) {
LOGE("Still picture size must be size of canned JPEG (%dx%d)",
kCannedJpegWidth, kCannedJpegHeight);
return -1;
}
mParameters = params;
initHeapLocked();
return NO_ERROR;
}
示例2: getCameraParam
static bool getCameraParam(const CameraParameters& parameters,
const char* parameterKey,
float* outValue) {
const char* value = parameters.get(parameterKey);
if (value) {
*outValue = parameters.getFloat(parameterKey);
return true;
}
return false;
}
示例3: autoTimer
/** Return the camera parameters. */
char *HAL_camera_device_get_parameters(struct camera_device *dev)
{
ExynosCameraAutoTimer autoTimer(__func__);
ALOGV("DEBUG(%s):", __func__);
String8 str;
CameraParameters parms = obj(dev)->getParameters();
str = parms.flatten();
return strdup(str.string());
}
开发者ID:Exynos-CyanogenMod,项目名称:android_hardware_samsung_slsi_exynos5420,代码行数:11,代码来源:ExynosCameraHWInterface.cpp
示例4: lock
status_t CameraHardware::setParameters(const CameraParameters& params)
{
Mutex::Autolock lock(mLock);
int width = 0;
int height = 0;
int framerate = 0;
params.getPreviewSize(&width,&height);
LOGD("Set Parameter...!! ");
LOGD("PreviewFormat %s", params.getPreviewFormat());
if ( params.getPreviewFormat() != NULL ) {
if (strcmp(params.getPreviewFormat(), (const char *) CameraParameters::PIXEL_FORMAT_YUV422SP) != 0) {
LOGE("Only yuv422sp preview is supported");
return -EINVAL;
}
}
LOGD("PictureFormat %s", params.getPictureFormat());
if ( params.getPictureFormat() != NULL ) {
if (strcmp(params.getPictureFormat(), (const char *) CameraParameters::PIXEL_FORMAT_JPEG) != 0) {
LOGE("Only jpeg still pictures are supported");
return -EINVAL;
}
}
/* validate preview size */
params.getPreviewSize(&width, &height);
LOGD("preview width:%d,height:%d",width,height);
if ( validateSize(width, height, supportedPreviewRes, ARRAY_SIZE(supportedPreviewRes)) == false ) {
LOGE("Preview size not supported");
return -EINVAL;
}
/* validate picture size */
params.getPictureSize(&width, &height);
LOGD("picture width:%d,height:%d",width,height);
if (validateSize(width, height, supportedPictureRes, ARRAY_SIZE(supportedPictureRes)) == false ) {
LOGE("Picture size not supported");
return -EINVAL;
}
framerate = params.getPreviewFrameRate();
LOGD("FRAMERATE %d", framerate);
mParameters = params;
mParameters.getPictureSize(&width, &height);
LOGD("Picture Size by CamHAL %d x %d", width, height);
mParameters.getPreviewSize(&width, &height);
LOGD("Preview Resolution by CamHAL %d x %d", width, height);
return NO_ERROR;
}
示例5: round
CameraParameters
JordanCameraWrapper::getParameters() const
{
CameraParameters ret = mMotoInterface->getParameters();
if (mCameraType == CAM_SOC) {
/* the original zoom ratio string is '100,200,300,400,500,600',
but 500 and 600 are broken for the SOC camera, so limiting
it here */
ret.set(CameraParameters::KEY_MAX_ZOOM, "3");
ret.set(CameraParameters::KEY_ZOOM_RATIOS, "100,200,300,400");
}
/* Motorola uses mot-exposure-offset instead of exposure-compensation
for whatever reason -> adapt the values.
The limits used here are taken from the lib, we surely also
could parse it, but it's likely not worth the hassle */
float exposure = ret.getFloat("mot-exposure-offset");
int exposureParam = (int) round(exposure * 3);
ret.set(CameraParameters::KEY_EXPOSURE_COMPENSATION, exposureParam);
ret.set(CameraParameters::KEY_MAX_EXPOSURE_COMPENSATION, "9");
ret.set(CameraParameters::KEY_MIN_EXPOSURE_COMPENSATION, "-9");
ret.set(CameraParameters::KEY_EXPOSURE_COMPENSATION_STEP, "0.3333333333333");
ret.set("cam-mode", mVideoMode ? "1" : "0");
return ret;
}
示例6:
StereoFrame::StereoFrame(
const size_t id,
const CameraPose& cameraPose, const CameraParameters& calibrationLeft,
const double stereo_baseline, const CameraParameters& calibrationRight,
const ImageFeatures& imageFeaturesLeft, const ImageFeatures& imageFeaturesRight,
bool bFixed
)
: frameLeft_(Camera(cameraPose, calibrationLeft), imageFeaturesLeft)
, frameRight_(Camera(ComputeRightCameraPose(cameraPose, stereo_baseline), calibrationRight), imageFeaturesRight)
, rectified_camera_parameters_({stereo_baseline, calibrationLeft.focalLengths(), calibrationLeft.principalPoint()})
, bFixed_( bFixed ), id_( id )
{}
示例7: getSupportedVideoSizes
/*
* Query the camera to retrieve the supported video frame sizes
* and also to see whether CameraParameters::setVideoSize()
* is supported or not.
* @param params CameraParameters to retrieve the information
* @@param isSetVideoSizeSupported retunrs whether method
* CameraParameters::setVideoSize() is supported or not.
* @param sizes returns the vector of Size objects for the
* supported video frame sizes advertised by the camera.
*/
static void getSupportedVideoSizes(
const CameraParameters& params,
bool *isSetVideoSizeSupported,
Vector<Size>& sizes) {
*isSetVideoSizeSupported = true;
params.getSupportedVideoSizes(sizes);
if (sizes.size() == 0) {
ALOGD("Camera does not support setVideoSize()");
params.getSupportedPreviewSizes(sizes);
*isSetVideoSizeSupported = false;
}
}
示例8: LOGD
double CameraHandler::getProperty(int propIdx)
{
LOGD("CameraHandler::getProperty(%d)", propIdx);
switch (propIdx)
{
case ANDROID_CAMERA_PROPERTY_FRAMEWIDTH:
{
int w,h;
params.getPreviewSize(&w, &h);
return w;
}
case ANDROID_CAMERA_PROPERTY_FRAMEHEIGHT:
{
int w,h;
params.getPreviewSize(&w, &h);
return h;
}
case ANDROID_CAMERA_PROPERTY_SUPPORTED_PREVIEW_SIZES_STRING:
{
cameraPropertySupportedPreviewSizesString = params.get(CameraParameters::KEY_SUPPORTED_PREVIEW_SIZES);
union {const char* str;double res;} u;
memset(&u.res, 0, sizeof(u.res));
u.str = cameraPropertySupportedPreviewSizesString.c_str();
return u.res;
}
case ANDROID_CAMERA_PROPERTY_PREVIEW_FORMAT_STRING:
{
const char* fmt = params.get(CameraParameters::KEY_PREVIEW_FORMAT);
if (fmt == CameraParameters::PIXEL_FORMAT_YUV422SP)
fmt = "yuv422sp";
else if (fmt == CameraParameters::PIXEL_FORMAT_YUV420SP)
fmt = "yuv420sp";
else if (fmt == CameraParameters::PIXEL_FORMAT_YUV422I)
fmt = "yuv422i";
else if (fmt == CameraParameters::PIXEL_FORMAT_RGB565)
fmt = "rgb565";
else if (fmt == CameraParameters::PIXEL_FORMAT_JPEG)
fmt = "jpeg";
cameraPropertyPreviewFormatString = fmt;
union {const char* str;double res;} u;
memset(&u.res, 0, sizeof(u.res));
u.str = cameraPropertyPreviewFormatString.c_str();
return u.res;
}
};
return -1;
}
示例9: LOG_ERROR
/**
* Set a camera parameter
*/
int CaptureCommand::capture_setParameter(Value& name, Value& value) {
LOG_ERROR((name.isNull()), "name not specified");
LOG_ERROR((value.isNull()), "value not specified");
LOG_ERROR((mCamera.get() == NULL), "camera not initialized");
CameraParameters params = mCamera->getParameters();
params.set(name.asCString(), value.asCString());
status_t err = mCamera->setParameters(params.flatten());
if (err != ::OK) {
ALOGW("Error %d: Failed to set '%s' to '%s'", err,
name.asCString(), value.asCString());
}
return 0;
}
示例10: checkFrameRate
/*
* Check the requested frame rate has been successfully configured or not.
* If the target frameRate is -1, check on the current frame rate value
* setting is performed.
*
* @param params CameraParameters to retrieve the information
* @param the target video frame rate to check against
* @return OK if no error.
*/
status_t CameraSource::checkFrameRate(
const CameraParameters& params,
int32_t frameRate) {
ALOGV("checkFrameRate");
int32_t frameRateActual = params.getPreviewFrameRate();
if (frameRateActual < 0) {
ALOGE("Failed to retrieve preview frame rate (%d)", frameRateActual);
return UNKNOWN_ERROR;
}
// Check the actual video frame rate against the target/requested
// video frame rate.
#ifndef HTC_3D_SUPPORT // HTC uses invalid frame rates intentionally on the 3D camera
if (frameRate != -1 && (frameRateActual - frameRate) != 0) {
ALOGE("Failed to set preview frame rate to %d fps. The actual "
"frame rate is %d", frameRate, frameRateActual);
return UNKNOWN_ERROR;
}
#endif
// Good now.
mVideoFrameRate = frameRateActual;
return OK;
}
示例11: cvTackBarEvents
void cvTackBarEvents(int pos,void*)
{
if (iThresParam1<3) iThresParam1=3;
if (iThresParam1%2!=1) iThresParam1++;
if (ThresParam2<1) ThresParam2=1;
ThresParam1=iThresParam1;
ThresParam2=iThresParam2;
MDetector.setThresholdParams(ThresParam1,ThresParam2);
//recompute
MDetector.detect(TheInputImage,TheMarkers,TheCameraParameters);
TheInputImage.copyTo(TheInputImageCopy);
for (unsigned int i=0;i<TheMarkers.size();i++) TheMarkers[i].draw(TheInputImageCopy,Scalar(0,0,255),1);
//print other rectangles that contains no valid markers
/*for (unsigned int i=0;i<MDetector.getCandidates().size();i++) {
aruco::Marker m( MDetector.getCandidates()[i],999);
m.draw(TheInputImageCopy,cv::Scalar(255,0,0));
}*/
//draw a 3d cube in each marker if there is 3d info
if (TheCameraParameters.isValid())
for (unsigned int i=0;i<TheMarkers.size();i++)
CvDrawingUtils::draw3dCube(TheInputImageCopy,TheMarkers[i],TheCameraParameters);
cv::imshow("in",TheInputImageCopy);
cv::imshow("thres",MDetector.getThresholdedImage());
}
示例12:
void
GonkCameraHardware::PullParameters(CameraParameters& aParams)
{
if (!NS_WARN_IF(mClosing)) {
const String8 s = mCamera->getParameters();
aParams.unflatten(s);
}
}
示例13: CommitColorFX
bool ProtoCameraSettings::CommitColorFX()
{
MMAL_PARAMETER_COLOURFX_T colfx = { { MMAL_PARAMETER_COLOUR_EFFECT, sizeof(colfx) },
m_parameters.color_effects().enable(),
m_parameters.color_effects().u(),
m_parameters.color_effects().v() };
return !mmal_status_to_int( mmal_port_parameter_set( m_component->m_mmal_component.GetControlPort(), &colfx.hdr ) );
}
示例14: main
int main(int argc, char** argv) {
try {
if (readArguments(argc, argv) == false)
return 0;
// read board configuration
TheBoardConfig.readFromFile(TheBoardConfigFile);
// Open video input source
if (TheInputVideo == "") // read from camera
TheVideoCapturer.open(0);
else
TheVideoCapturer.open(TheInputVideo);
if (!TheVideoCapturer.isOpened()) {
cerr << "Could not open video" << endl;
return -1;
}
// read first image
TheVideoCapturer >> TheInputImage;
// read camera paramters if passed
TheCameraParams.readFromXMLFile(TheIntrinsicFile);
TheCameraParams.resize(TheInputImage.size());
TheBoardDetector.getMarkerDetector().setThresholdParams(25, 7);
glutInit(&argc, argv);
glutInitWindowPosition(0, 0);
glutInitWindowSize(TheInputImage.size().width, TheInputImage.size().height);
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
glutCreateWindow("ArUco");
glutDisplayFunc(vDrawScene);
glutIdleFunc(vIdle);
glutReshapeFunc(vResize);
glutMouseFunc(vMouse);
glClearColor(0.0, 0.0, 0.0, 1.0);
glClearDepth(1.0);
// these two are necesary for the mask effect
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0.5);
TheGlWindowSize = TheInputImage.size();
vResize(TheGlWindowSize.width, TheGlWindowSize.height);
glutMainLoop();
} catch (std::exception& ex)
{
cout << "Exception :" << ex.what() << endl;
}
}
示例15: CommitROI
bool ProtoCameraSettings::CommitROI()
{
bool ret = false;
MMAL_PARAMETER_INPUT_CROP_T crop = { { MMAL_PARAMETER_INPUT_CROP, sizeof(MMAL_PARAMETER_INPUT_CROP_T) } };
crop.rect.x = (65536 * m_parameters.region_of_interest().left() );
crop.rect.y = (65536 * m_parameters.region_of_interest().top() );
crop.rect.width = (65536 * m_parameters.region_of_interest().width() );
crop.rect.height = (65536 * m_parameters.region_of_interest().height() );
ret = !mmal_port_parameter_set( m_component->m_mmal_component.GetControlPort(),&crop.hdr);
return ret;
}