标签: camera

获取/ dev/video0的硬件信息

我在Linux中有两个USB摄像头,所以我在/dev/目录(video0video1)中有两个条目.

我想获得关于这两个基于videoX的相机的硬件信息(即供应商ID,产品ID,设备名称),并根据其硬件信息选择合适的相机.

有没有办法在cpp中获取有关videoX的硬件信息?

c++ linux usb camera

2
推荐指数
1
解决办法
2305
查看次数

'在Android上使用Phonegap捕获图像时出错'

我需要使用Phonegap应用程序捕获图像.在iOS上一切正常但在Android上(通过Phonegap Build)它会在"Error capture image"时抛出错误.

我在config.xml中添加了以下行,但这并没有改变任何内容:

<feature name="Camera">
    <param name="android-package" value="org.apache.cordova.camera.CameraLauncher" />
</feature>
<feature name="http://api.phonegap.com/1.0/device" />
<feature name="http://api.phonegap.com/1.0/camera" />
<feature name="http://api.phonegap.com/1.0/file" />
<feature name="http://api.phonegap.com/1.0/media" />
<feature name="http://api.phonegap.com/1.0/network" />
Run Code Online (Sandbox Code Playgroud)

我的API调用看起来像这样:

    $(document).on('click', '#cameraPreview', function() {
        pictureSource = navigator.camera.PictureSourceType;
        destinationType = navigator.camera.DestinationType;

        navigator.camera.getPicture(onGetPictureSuccess, onGetPictureFail, {
          quality: 40,
          sourceType: Camera.PictureSourceType.CAMERA,
          destinationType: Camera.DestinationType.FILE_URI,
          allowEdit: true,
            encodingType: Camera.EncodingType.JPG,
          targetWidth: 1000,
          targetHeight: 1000,
          saveToPhotoAlbum: true,
          correctOrientation: 1
        });
    });
Run Code Online (Sandbox Code Playgroud)

我使用Phonegap 3.7和Phonegap Build.

camera android cordova

2
推荐指数
1
解决办法
2962
查看次数

在Xamarin.Forms中访问相机

我需要使用Xamarin Forms PCL访问相机.我找不到任何可行的样本.

我尝试安装XLab并使用其示例代码,但它有例外.例如,使用XLabs示例我使用以下内容:

/// <summary>
/// Takes the picture.
/// </summary>
/// <returns>Take Picture Task.</returns>
internal async Task<MediaFile> TakePicture()
{
    Setup();

    ImageSource = null;

    return await _mediaPicker.TakePhotoAsync(new CameraMediaStorageOptions { DefaultCamera = CameraDevice.Front, MaxPixelDimension = 400 }).ContinueWith(t =>
    {
        if (t.IsFaulted)
        {
            Status = t.Exception.InnerException.ToString();
        }
        else if (t.IsCanceled)
        {
            Status = "Canceled";
        }
        else
        {
            var mediaFile = t.Result;

            ImageSource = ImageSource.FromStream(() => mediaFile.Source);

            return mediaFile;
        }

        return null;
    }, _scheduler);
}

/// <summary>
/// Setups this …
Run Code Online (Sandbox Code Playgroud)

c# camera xamarin.forms xlabs

2
推荐指数
1
解决办法
4762
查看次数

将相机拍摄的图像保存到内部存储器中

我刚开始使用Android编程,正在创建一个android应用程序,在该应用程序中,允许用户键入信息,使用ImageView实现拍照并保存信息。我已经到了可以显示拍摄到ImageView中的图像的地步。但是,我无法将拍摄的图像保存到手机的内部存储器中。这意味着,每当我尝试保存信息时,包括ImageView(来自相机的图像),只有图像会消失。我在http://www.androidhive.info/2013/09/android-working-with-camera-api/上遵循了此指南,但是由于我的手机没有SD卡存储,因此无法使用。

我在这里已经阅读了很多问题,但是它们并不能解决问题。

因此,如果有人可以给我详细的程序编辑方法,使我可以将图像保存到内部存储中或从中读取图像,那就太好了!谢谢。

/**
 * returning image / video
 */
private static File getOutputMediaFile(int type) {

    // External sdcard location
    File mediaStorageDir = new File(
            Environment
                    .getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES),
            IMAGE_DIRECTORY_NAME);

    // Create the storage directory if it does not exist
    if (!mediaStorageDir.exists()) {
        if (!mediaStorageDir.mkdirs()) {
            Log.d(IMAGE_DIRECTORY_NAME, "Oops! Failed create "
                    + IMAGE_DIRECTORY_NAME + " directory");
            return null;
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

这是我当前的代码:

private static final String IMAGE_DIRECTORY_NAME = "Hello Camera";
private Uri fileUri; // file url to store image/video
private …
Run Code Online (Sandbox Code Playgroud)

camera android image

2
推荐指数
1
解决办法
3万
查看次数

MediaCapture StartPreviewAsync失败

我正在尝试从UWP应用中的相机开始视频预览捕获,但是StartPreviewAsync引发异常

样例代码:

MediaCapture mc = new MediaCapture();
await mc.InitializeAsync();
await mc.StartPreviewAsync();
Run Code Online (Sandbox Code Playgroud)

c# media camera windows-runtime uwp

2
推荐指数
1
解决办法
1502
查看次数

这个Xamarin自定义渲染器教程中的CameraOptions类型是什么?

我很可能只是一个白痴,为此我提前道歉.无论如何,我正在尝试将相机功能添加到我的Xamarin.Forms(以iOS为中心)的应用程序中.

我在Xamarin的网站上找到了这个教程并且正在关注它(https://developer.xamarin.com/guides/xamarin-forms/custom-renderer/view/).

但是,我没有看到CameraOptions类型的定义 - 它为我抛出了一个错误,类似于"在此上下文中没有CameraOptions的定义".

我想我必须错过"使用"声明,但我想不出任何使用.

这是我开始感到困惑的代码的一部分:

public class CameraPreview : View
{
  public static readonly BindableProperty CameraProperty =
    BindableProperty.Create<CameraPreview, CameraOptions> (p => p.Camera, CameraOptions.Rear);

  public CameraOptions Camera {
    get { return (CameraOptions)GetValue (CameraProperty); }
    set { SetValue (CameraProperty, value); }
  }
}
Run Code Online (Sandbox Code Playgroud)

说真的.什么是CameraOptions类型?在整个教程中没有提到一次,它只是在代码中使用,所以我必须遗漏一些东西.

c# camera ios xamarin xamarin.forms

2
推荐指数
1
解决办法
518
查看次数

如何使用Qt在Android和桌面中使用相机

我想在桌面和Android上使用QWidgets/C++在我的Qt机器人项目上显示和获取Camera的框架.相机在只有QML的程序中工作,但我的实际项目需要在C++中使用QWidgets.

我尝试了各种方式:

  1. 带容器的QQuickView显示QML Camera不能用于Android
  2. 我试过这个:Qt QML Camera to C++ QImage on Android 但是我没有得到框架.
  3. 我也看到了这个:http://www.programering.com/a/MTN3IjMwATQ.html/ http://blog.csdn.net/kl222/article/details/23187693 但它不适用于Android

c++ qt camera android qml

2
推荐指数
1
解决办法
3851
查看次数

如何在swift中将摄像机视图扩展到全屏 - UIImagePickerController

我正在使用UIImagePickerController来拍摄带有照片的照片,并稍后在应用程序中使用该照片.

这是我启动相机的代码:

imagePicker = UIImagePickerController()
imagePicker.delegate = self
imagePicker.sourceType = .Camera
imagePicker.showsCameraControls = false
imagePicker.cameraOverlayView = customViewTakePhoto()

presentViewController(imagePicker, animated: true, completion: nil)
Run Code Online (Sandbox Code Playgroud)

一切正常,相机启动,我可以拍摄照片,但只有一件我无法弄清楚,那就是:

如何在拍摄照片之前在整个屏幕上进行相机查看?

以下是显示我需要的图像

这是我现在的观点(我强烈推荐这本书,顺便说一句):

在此输入图像描述

这就是我需要的(全屏摄像机视图):

在此输入图像描述

camera ios swift

2
推荐指数
2
解决办法
5368
查看次数

相机是颠倒的OpenGL

我的相机在OpenGL中颠倒了我的问题.如果我在没有将相机Z旋转设置为180度的情况下渲染我的对象,则对象会被颠倒渲染.也许它与glm有关?

这是我如何设置我的矩阵:

//Model Matrix:
mat4 modelMatrix;
modelMatrix = translate(modelMatrix, vec3(entity.getPosition().x, entity.getPosition().y, entity.getPosition().z));
modelMatrix = rotate(modelMatrix, (float) (entity.getRotation().x / 180 * PI), vec3(1, 0, 0));
modelMatrix = rotate(modelMatrix, (float) (entity.getRotation().y / 180 * PI), vec3(0, 1, 0));
modelMatrix = rotate(modelMatrix, (float) (entity.getRotation().z / 180 * PI), vec3(0, 0, 1));
modelMatrix = scale(modelMatrix, entity.getScale());
return modelMatrix;

//View Matrix:
mat4 viewMatrix;
viewMatrix = rotate(viewMatrix, (float)(camera.getRotation().x / 180 * PI), vec3(1, 0, 0));
viewMatrix = rotate(viewMatrix, (float)(camera.getRotation().y / 180 * PI), vec3(0, 1, 0)); …
Run Code Online (Sandbox Code Playgroud)

c++ opengl camera rotation

2
推荐指数
1
解决办法
1128
查看次数

从图库中选择图像或从相机中取出

我必须制作一个按钮,用于从图库中选择图像或从相机中取出.

 private void showFileChooser() {
    Intent takePicture = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    startActivityForResult(takePicture, 0);
    Intent pickPhoto = new Intent(Intent.ACTION_PICK,
            android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
    startActivityForResult(pickPhoto , 1);

}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent imageReturnedIntent) {
    super.onActivityResult(requestCode, resultCode, imageReturnedIntent);
    switch(requestCode) {
        case 0:
            if(resultCode == RESULT_OK){
                Uri selectedImage = imageReturnedIntent.getData();
                imageView.setImageURI(selectedImage);
            }

            break;
        case 1:
            if(resultCode == RESULT_OK){
                Uri selectedImage = imageReturnedIntent.getData();
                imageView.setImageURI(selectedImage);
            }
            break;
    }
}
Run Code Online (Sandbox Code Playgroud)

结果是工作.如果我从图库中选择,图像查看器将查看它,如果我选择从相机拍照,它也可以工作.问题是,在我的showFileChooser()方法中,我的所有意图都在同一时间运行,所以当我从图库中选择时,相机仍在运行.我选择相机,画廊也开放.我想我应该在switch case模式下实现我的代码,但我不明白该怎么做.请帮助解决我的初学者问题.

camera android gallery

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

camera ×10

android ×4

c# ×3

c++ ×3

ios ×2

xamarin.forms ×2

cordova ×1

gallery ×1

image ×1

linux ×1

media ×1

opengl ×1

qml ×1

qt ×1

rotation ×1

swift ×1

usb ×1

uwp ×1

windows-runtime ×1

xamarin ×1

xlabs ×1