当前位置:首页 » 安卓系统 » android拍照旋转

android拍照旋转

发布时间: 2022-04-30 02:34:41

❶ 现在 做了个 android 视频录制的程序 ,后置摄像头总是旋转90度,如何用代码实现正常。

MediaRecorder 中一个方法setCamera();所以可以先设置好摄像头的参数,然后再设置到MediaRecorder 中(但是录制前需要解锁)。
部分关键的代码如果下:
//初始化相机信息
Camera mCamera = Camera.open();
Camera.Parameters params = mCamera.getParameters();
mCamera.setDisplayOrientation(90);//旋转了90度,最好先判断下JDK的版本号,再决定旋转不
mCamera.setParameters(params);
mCamera.stopPreview();
mCamera.unlock();//解锁
videoMediaRecorder.setCamera(mCamera);

❷ android 用 SurfaceView 预览 拍照,竖屏时,显示的图像旋转了90度,怎么处理

设置activity不让它重力感应

❸ android怎么实现图片旋转

可以使用RotateAnimation动画实现,设定无限循环即可

代码如下

java">{

ImageViewiv;
@Override
protectedvoidonCreate(BundlesavedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_two);
iv=(ImageView)findViewById(R.id.image);
RotateAnimationanimation=newRotateAnimation(0,360);
animation.setDuration(100000);//设定转一圈的时间
animation.setRepeatCount(Animation.INFINITE);//设定无限循环
animation.setRepeatMode(Animation.RESTART);
iv.startAnimation(animation);
}
}


也可以自定义view继承于imageview,启动一个线程,在while循环里设置view的旋转角度


{

privatefloatmCurDegree=0;//当前旋转角度
publicRotateView(Contextcontext,AttributeSetattrs){
super(context,attrs);
newThread(this).start();
}

@Override
protectedvoidonLayout(booleanchanged,intleft,inttop,intright,
intbottom){
super.onLayout(changed,left,top,right,bottom);
//设定旋转中心
setPivotX(getMeasuredWidth()/2);
setPivotY(getMeasuredHeight()/2);
}

@Override
publicvoidrun(){
while(true){
setRotation(mCurDegree);
mCurDegree+=5;
postInvalidate();
SystemClock.sleep(16);
}
}
}

在布局文件里使用RotateView代替imageview即可

❹ Android的图片旋转后会被重绘吗

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
[picker :YES];
NSString* mediaType=[info objectForKey:];
if([mediaType isEqualToString:(NSString*)kUTTypeImage])//@"public.image"
{
UIImage* image=[info objectForKey:];
UIImageOrientation imageOrientation=image.imageOrientation;
if(imageOrientation!=UIImageOrientationUp)
{
// 原始图片可以根据照相时的角度来显示,但UIImage无法判定,于是出现获取的图片会向左转90度的现象。
// 以下为调整图片角度的部分
UIGraphicsBeginImageContext(image.size);
[image drawInRect:CGRectMake(0, 0, image.size.width, image.size.height)];
iPortraitImageView.image = ();
UIGraphicsEndImageContext();
// 调整图片角度完毕
}
}
}

❺ 为很么在Android程序中调用前置摄像头获得的预览图像旋转了一百八十度注:在系统相机中是正常的

你把这个软件放在其他手机上照相试下,如果还是那样,那就是你下载的软件有问题。

❻ android怎么实现一张图片旋转几秒后后自动换到另一张图片

图片旋转使用动画,设置动画时间,旋转完成后,设置另一张图片

RotateAnimation 动画,
RotateAnimation (float fromDegrees, float toDegrees, int
pivotXType, float pivotXValue, int pivotYType, float pivotYValue)
参数说明:

float fromDegrees:旋转的开始角度。
float toDegrees:旋转的结束角度。
int
pivotXType:X轴的伸缩模式,可以取值为ABSOLUTE、RELATIVE_TO_SELF、RELATIVE_TO_PARENT。
float
pivotXValue:X坐标的伸缩值。
int
pivotYType:Y轴的伸缩模式,可以取值为ABSOLUTE、RELATIVE_TO_SELF、RELATIVE_TO_PARENT。
float
pivotYValue:Y坐标的伸缩值。

❼ android 怎么让图片实现朝Z轴的方向旋转RotateAnimation是x y方向的,我想要包含z方向的

RotateAnimation是不可以绕Z轴旋转的,如果LZ想要实现Z轴旋转效果,可以看下matrix这个类(实际还是opengl),可以给LZ例举下:
rotateX(float degree) 绕着x轴旋转degree个度数
rotateY(float degree) 绕着y轴旋转degree个度数
rotateZ(float degree) 绕着z轴旋转degree个度数

❽ Android如何判断手机摄像头是否倒置或旋转角度

摄像头没有装倒这一说,说明你们开发的程序还是有瑕疵的,都是程序设定的,就好比你拿着手机拍照,不管你怎么旋转手机,图像始终是朝下的,给你个提示:重力感应。

❾ android 怎么得到手机拍照照片的旋转角度

具体思路:
1、首先在调用拍照方法时,保存拍照后的相片原图,得到原图路径,(PhotoBitmapUtils是我自己写的一个工具类)

String fileName = "";
/**
* 启动相机拍照
*/
private void addBitmapShoots() {
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
// 设置图片要保存的 根路径+文件名
fileName = PhotoBitmapUtils.getPhotoFileName(getContext());
File file = new File(fileName);
if (!file.exists()) {
try {
file.createNewFile();

热点内容
三位数乘两位数速算法 发布:2025-05-12 13:05:48 浏览:389
暴风影音缓存在哪里 发布:2025-05-12 12:42:03 浏览:535
access数据库exe 发布:2025-05-12 12:39:04 浏览:623
五开的配置是什么 发布:2025-05-12 12:36:37 浏览:359
加密ovpn 发布:2025-05-12 12:01:55 浏览:45
python练手项目 发布:2025-05-12 11:14:07 浏览:123
压缩听算音频 发布:2025-05-12 10:58:12 浏览:801
数据库系统报告 发布:2025-05-12 10:43:17 浏览:603
日产高配有哪些配置 发布:2025-05-12 10:32:16 浏览:475
大众朗逸哪个配置值得入手 发布:2025-05-12 10:31:20 浏览:505