旋转 bmp 并将其正面朝上显示
我有一个应用程序可以拍摄图片并将图片显示在 Imageview 上。问题是,我只能在横向模式下拍摄照片,以便将 bmp 正面朝上显示 - 如果在纵向模式下拍摄照片,有没有办法可以将其旋转到正面朝上/
谢谢!
这是我用来将图像放置在 img 视图中的代码 -
private void processCameraImage(Intent intent) {
setContentView(R.layout.detectlayout);
((Button) findViewById(R.id.detect_face)).setOnClickListener(btnClick);
ImageView imageView = (ImageView) findViewById(R.id.image_view);
cameraBitmap = (Bitmap) intent.getExtras().get("data");
imageView.setImageBitmap(cameraBitmap);
有一个检测面部按钮,可以检测是否存在面部。
I have an app that snaps a picture and displays the picture on an Imageview. The problem is, I can only snap a pic in landscape mode in order for the bmp to be displayed right side up - Is there a way I can rotate it to right side up if the pic is taken in portrait mode/
Thanks!
Here is the code I use to place the image in the img view -
private void processCameraImage(Intent intent) {
setContentView(R.layout.detectlayout);
((Button) findViewById(R.id.detect_face)).setOnClickListener(btnClick);
ImageView imageView = (ImageView) findViewById(R.id.image_view);
cameraBitmap = (Bitmap) intent.getExtras().get("data");
imageView.setImageBitmap(cameraBitmap);
There is a detect faces button that will detect if there are faces present.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是旋转 bmp 的方法:
This is how you would rotate a bmp:
这是我在活动中使用 onActivityResult() 的代码。返回的意图是选择 image/* 类型的图像。对我来说效果很好!
Here is the code I used onActivityResult() in my activity. The intent returned was for picking an image of the type image/*. Works well for me!