Tag: 相机

UIImagePickerController错误:快照未呈现的视图会导致iOS 7中的空快照

我得到这个错误只在iOS 7和应用程序崩溃。 在iOS 6中,我从来没有得到任何错误,只是一旦打开相机的内存警告。 Snapshotting a view that has not been rendered results in an empty snapshot. Ensure your view has been rendered at least once before snapshotting or snapshot after screen updates. 这是我正在做的。 imagePicker = [[UIImagePickerController alloc] init]; [imagePicker setDelegate:self]; [imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera]; [imagePicker setAllowsEditing:YES]; [self presentModalViewController:imagePicker animated:YES]; 我曾试图推迟presentModalViewController,但我仍然得到相同的消息。 几秒钟后(7-10),应用程序崩溃。 这个错误只在iOS 7中出现。 任何人都有线索? 先谢谢你。

在OpenCV / Python中设置摄像机参数

我使用Thorlabs(DC1545M)的USB摄像头使用OpenCV(2.4)和Python(2.7.3)。 我正在做一些videostream的图像分析,我希望能够改变我的videostream的一些相机参数。 令人困惑的是,我能够改变一些相机的属性,但不是所有的,而我不确定我做错了什么。 这里是代码,使用Python中的cv2绑定,我可以确认它运行: import cv2 #capture from camera at location 0 cap = cv2.VideoCapture(0) #set the width and height, and UNSUCCESSFULLY set the exposure time cap.set(3,1280) cap.set(4,1024) cap.set(15, 0.1) while True: ret, img = cap.read() cv2.imshow("input", img) #cv2.imshow("thresholded", imgray*thresh2) key = cv2.waitKey(10) if key == 27: break cv2.destroyAllWindows() cv2.VideoCapture(0).release() 作为参考, cap.set()命令中的第一个参数引用下面列出的相机属性的枚举: 0. CV_CAP_PROP_POS_MSEC Current […]

Android中的相机方向问题

我正在构build一个使用相机拍照的应用程序。 这是我的源代码来做到这一点: File file = new File(Environment.getExternalStorageDirectory(), imageFileName); imageFilePath = file.getPath(); Intent intent = new Intent("android.media.action.IMAGE_CAPTURE"); //Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file)); startActivityForResult(intent, ACTIVITY_NATIVE_CAMERA_AQUIRE); 在onActivityResult()方法上,我使用BitmapFactory.decodeStream()来拾取图像。 当我在Nexus上运行我的应用程序时,它运行良好。 但是当我在三星Galaxy S或HTC Inspire 4G上运行时,图像的方向是不正确的。 用肖像模式拍摄,真实图像(保存在SD卡上)总是旋转90度。 拍摄后图像预览——— SD卡上的真实图像 捕捉景观模式,一切都很好。 拍摄后图像预览——— SD卡上的真实图像

Android的startCamera给我空意图和…它是否会摧毁我的全局variables?

我有下一个问题: 当我尝试启动相机时,我可以拍摄照片,甚至将其保存在我的SD卡上,但是当我要获取在设备上显示的path时,我会遇到错误。 我的全局variables是2(我用1但2更好,以确保这是一个奇怪的错误): private File photofile; private Uri mMakePhotoUri; 这是我的启动相机function: @SuppressLint("SimpleDateFormat") public void farefoto(int num){ // For naming the picture SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmmss"); String n = sdf.format(new Date()); String fotoname = "Immagine-"+ n +".jpg"; //Going through files and folders File photostorage = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES); File photostorage2 = new File(photostorage, "Immagini"); System.out.println(photostorage+"\n"+photostorage2); photostorage2.mkdirs(); // My […]

didFinishPickingMediaWithInfo返回零照片

我正在努力捕获在4.0中使用返回的图像 – (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { [[picker parentViewController] dismissModalViewControllerAnimated:YES]; // MediaType can be kUTTypeImage or kUTTypeMovie. If it's a movie then you // can get the URL to the actual file itself. This example only looks for images. // NSString* mediaType = [info objectForKey:UIImagePickerControllerMediaType]; // NSString* videoUrl = [info objectForKey:UIImagePickerControllerMediaURL]; // Try getting the […]

以编程方式在Android上使用相机拍照

我已经创build了一个button的应用程序,并为该button写onClickListener。 我已经尝试了几个示例代码示例,并没有一个工作。 他们都提出Android相机的应用程序,不要拍照。 我想要一些代码,我可以把我的onClickListener,所以当我按下屏幕上的button,一张照片将被采取。 在Android活动中按下button时,如何让相机拍照?

如何捕捉图像并将其与原生Android Camera一起存储

我有一个问题捕捉图像,并从本机相机应用程序存储它。 这里是我的一些代码的示例。 _path = Environment.getExternalStorageDirectory() + "make_machine_example.jpg"; File file = new File( _path ); Uri outputFileUri = Uri.fromFile( file ); Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE ); intent.putExtra( MediaStore.EXTRA_OUTPUT, outputFileUri ); startActivityForResult( intent, 0 ); 照片拍完后,我回到我原来的活动,当我通过Android DDMS文件浏览器导航到我的SD卡的图片不存在。 任何人都知道为什么这不被保存?

如何在Android上的Camera上使用SurfaceView绘制覆盖图?

我有一个简单的程序,将Camera的预览画成SurfaceView 。 我想要做的是使用onPreviewFrame方法,每当一个新的框架被绘制到SurfaceView时被调用,以执行应该调用onDraw方法的invalidate方法。 实际上,正在调用onDraw方法,但没有任何打印(我猜摄像机预览覆盖了我正在绘制的文本)。 这是我有的SurfaceView子类的简化版本: public class Superficie extends SurfaceView implements SurfaceHolder.Callback { SurfaceHolder mHolder; public Camera camera; Superficie(Context context) { super(context); mHolder = getHolder(); mHolder.addCallback(this); mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); } public void surfaceCreated(final SurfaceHolder holder) { camera = Camera.open(); try { camera.setPreviewDisplay(holder); camera.setPreviewCallback(new PreviewCallback() { public void onPreviewFrame(byte[] data, Camera arg1) { invalidar(); } }); } catch […]

Android相机意图:如何获得全尺寸的照片?

我正在使用意图启动相机: Intent cameraIntent = new Intent( android.provider.MediaStore.ACTION_IMAGE_CAPTURE); getParent().startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST); 并使用: Bitmap thumbnail = (Bitmap) data.getExtras().get("data"); photoImage.setImageBitmap(thumbnail); photoImage.setVisibility(View.VISIBLE); 但它只是一个缩略图,我怎么得到完整的位图? 我知道我可以使用我自己的活动,并使用: Camera.PictureCallback() 但无论如何,使用意图呢? 谢谢! 编辑: 我也试过: public void onActivityResult(int requestCode, int resultCode, Intent data) { Uri uri = data.getData(); imageView.setImageURI(uri); } 它适用于从图库中select的照片,但对于照相机意图,data.getData()返回null。

如何在android模拟器中使用networking摄像头捕捉实时图像?

据我所知,Android模拟器没有相机。 要拍摄实时图像,我们必须使用networking摄像头。 我已经看到这个网站上的代码使用android模拟器中的networking摄像头来捕捉图像,但我不知道如何使用这个代码。