标签: image-rotation

如何旋转容器中的背景图像?

我想旋转放置在Chrome中滚动条按钮的图像.现在我有一个包含以下内容的CSS:

::-webkit-scrollbar-button:vertical:decrement
{
    background-image:url(images/arrowup.png) ;
    -webkit-transform:rotate(120deg);
    -moz-transform:rotate(120deg);
    background-repeat:no-repeat;
    background-position:center;
    background-color:#ECEEEF;
    border-color:#999;
}
Run Code Online (Sandbox Code Playgroud)

我想旋转图像而不旋转其内容.

css background-image image-rotation

145
推荐指数
5
解决办法
33万
查看次数

Android:如何在中心点上旋转位图

我一直在寻找解决这个问题的一天,但没有任何帮助,甚至这里的答案.文档也没有解释任何内容.

我只是想在另一个物体的方向上进行旋转.问题是位图不是围绕固定点旋转,而是围绕位图(0,0)旋转.

这是我遇到麻烦的代码:

  Matrix mtx = new Matrix();
  mtx.reset();
  mtx.preTranslate(-centerX, -centerY);
  mtx.setRotate((float)direction, -centerX, -centerY);
  mtx.postTranslate(pivotX, pivotY);
  Bitmap rotatedBMP = Bitmap.createBitmap(bitmap, 0, 0, spriteWidth, spriteHeight, mtx, true);
  this.bitmap = rotatedBMP;
Run Code Online (Sandbox Code Playgroud)

奇怪的是,如何更改pre/ postTranslate()和float参数中的值并不重要setRotation().有人可以帮助并推动我朝着正确的方向前进吗?:)

android center bitmap matrix image-rotation

83
推荐指数
5
解决办法
13万
查看次数

如何使R的'光栅'包区分GeoTIFF中的正旋转矩阵和负旋转矩阵?

看来R中的光栅包不区分GeoTIFF的正旋转和负旋转.我感觉这是因为R忽略了旋转矩阵中的负号.我不够精通,无法深入挖掘raster源代码进行验证,但我确实创建了一个可重现的示例来演示问题:

阅读R徽标并另存为GeoTIFF.

library(raster)
b <- brick(system.file("external/rlogo.grd", package="raster"))
proj4string(b) <- crs("+init=epsg:32616")

writeRaster(b, "R.tif")
Run Code Online (Sandbox Code Playgroud)

使用Python向tiff添加旋转

import sys
from osgeo import gdal
from osgeo import osr
import numpy as np
from math import *

def array2TIFF(inputArray,gdalData,datatype,angle,noData,outputTIFF):
#    this script takes a numpy array and saves it to a geotiff
#    given a gdal.Dataset object describing the spatial atributes of the data set
#    the array datatype (as a gdal object) and the name of the output raster, and rotation …
Run Code Online (Sandbox Code Playgroud)

r raster image-rotation geotiff r-raster

51
推荐指数
1
解决办法
854
查看次数

动力学js拖动,放下,调整大小和旋转图像

我试图结合拖放调整大小图像触摸旋转图像,我的表现很奇怪http://jsfiddle.net/littlechad/Kuaxn/

我的代码如下:

function update (activeAnchor) {
    var group       = activeAnchor.getParent();
    var topLeft     = group.get('.topLeft')[0];
    var topRight    = group.get('.topRight')[0];
    var bottomRight = group.get('.bottomRight')[0];
    var bottomLeft  = group.get('.bottomLeft')[0];
    var image       = group.get('.image')[0];
    var stage       = group.getStage();

    var anchorX     = activeAnchor.getX();
    var anchorY     = activeAnchor.getY();

    // update anchor positions
    switch (activeAnchor.getName()) {
        case 'topLeft':
            topRight.setY(anchorY);
            bottomLeft.setX(anchorX);
            break;
        case 'topRight':
            topLeft.setY(anchorY);
            bottomRight.setX(anchorX);
            break;
        case 'bottomRight':
            bottomLeft.setY(anchorY);
            topRight.setX(anchorX); 
            break;
        case 'bottomLeft':
            bottomRight.setY(anchorY);
            topLeft.setX(anchorX); 
            break;
    }

    image.setPosition(topLeft.getPosition());

    var height          = bottomLeft.attrs.y …
Run Code Online (Sandbox Code Playgroud)

html5 image-rotation image-resizing kineticjs

41
推荐指数
1
解决办法
4742
查看次数

iOS:保存为PNG表示数据后,图像旋转90度

我已经研究了足够的工作,但无法修复它.只要我将图像存储为UIImage,从相机拍照后,它就可以了,但只要我将此图像存储为PNG表示,它就会旋转90度.

以下是我的代码和我尝试过的所有事情:

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info 
{
    NSString *mediaType = [info valueForKey:UIImagePickerControllerMediaType];

    if([mediaType isEqualToString:(NSString*)kUTTypeImage]) 
    {
        AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
        delegate.originalPhoto  = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
        NSLog(@"Saving photo");
        [self saveImage];
        NSLog(@"Fixing orientation");
        delegate.fixOrientationPhoto  = [self fixOrientation:[UIImage imageWithContentsOfFile:[delegate filePath:imageName]]];      
        NSLog(@"Scaling photo");
        delegate.scaledAndRotatedPhoto  =  [self scaleAndRotateImage:[UIImage imageWithContentsOfFile:[delegate filePath:imageName]]];
    }
    [picker dismissModalViewControllerAnimated:YES];
    [picker release];
}


- (void)saveImage
{
    AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    NSData *imageData = UIImagePNGRepresentation(delegate.originalPhoto);
    [imageData writeToFile:[delegate filePath:imageName] atomically:YES];
}
Run Code Online (Sandbox Code Playgroud)

这里分别从这里这里取得fixOrientation和scaleAndRotateImage函数.当我在UIImage上应用它们时,它们工作正常并旋转图像,但如果我将图像保存为PNG表示并应用它们则不起作用.

请执行以上功能后请参考以下图片:

第一张照片是原始的,第二张是保存的,第三张和第四张是在保存的图像上应用fixorientation和scaleandrotate功能后

iphone image-rotation uiimage landscape-portrait ios5.1

38
推荐指数
4
解决办法
4万
查看次数

检测文本图像是否颠倒

我有几百张图像(扫描的文档),其中大多数是歪斜的。我想使用Python使它们偏斜。
这是我使用的代码:

import numpy as np
import cv2

from skimage.transform import radon


filename = 'path_to_filename'
# Load file, converting to grayscale
img = cv2.imread(filename)
I = cv2.cvtColor(img, COLOR_BGR2GRAY)
h, w = I.shape
# If the resolution is high, resize the image to reduce processing time.
if (w > 640):
    I = cv2.resize(I, (640, int((h / w) * 640)))
I = I - np.mean(I)  # Demean; make the brightness extend above and below zero
# Do the radon transform
sinogram = …
Run Code Online (Sandbox Code Playgroud)

python opencv image-rotation skew

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

将Opencv矩阵旋转90度,180度,270度

我正在从网络摄像头捕捉图像,我需要以直角旋转它.我发现自己的功能:

  1. getRotationMatrix2D - 创建旋转矩阵(无论它是什么)
  2. transform - 通过旋转矩阵将一个矩阵转换为另一个矩阵

但是,除了黑色区域,我什么也得不到.这是我的代码:

   if(rotate_button.click%4>0) {
       double angle = (rotate_button.click%4)*90;  //button increments its click by 1 per click
       Mat transform_m = getRotationMatrix2D(Point(cam_frame_width/2, cam_frame_height/2), angle, 1);  //Creating rotation matrix
       Mat current_frame;
       transform(cam_frame, current_frame, transform_m);  //Transforming captured image into a new one
       cam_frame = Mat((int)current_frame.cols,(int)current_frame.rows, cam_frame_type) = Scalar(0,128,0);  //resizing captured matrix, so I can copy the resized one on it
       current_frame.copyTo(cam_frame);  //Copy resized to original
   }
Run Code Online (Sandbox Code Playgroud)

输出只是黑屏.

c++ opencv matrix image-rotation

34
推荐指数
3
解决办法
8万
查看次数

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

旋转带动画的图像

图像的两种状态

是)我有的

我有一个箭头图像(如左图).当用户点击它时,它应该用动画旋转180度,看起来应该是正确的.

我做了什么

private void rotate(float degree, final int toggleV) {

        final RotateAnimation rotateAnim = new RotateAnimation(0.0f, degree,
                RotateAnimation.RELATIVE_TO_SELF, 0.5f,
                RotateAnimation.RELATIVE_TO_SELF, 0.5f);

        rotateAnim.setDuration(500);
        toggle.startAnimation(rotateAnim);
        rotateAnim.setAnimationListener(new Animation.AnimationListener() {

            @Override
            public void onAnimationStart(Animation animation) {

            }

            @Override
            public void onAnimationEnd(Animation animation) {


                if (toggleV == 1)
                    toggle.setImageResource(R.drawable.toggle_up);
                else
                    toggle.setImageResource(R.drawable.toggle_down);
            }

            @Override
            public void onAnimationRepeat(Animation animation) {

            }
        });
    }
Run Code Online (Sandbox Code Playgroud)

问题

我看到动画工作正常,但设置图像时有一点闪烁.可能是因为动画结束和设置图像时的时差.

如何删除此闪烁问题?你有更好的方法吗?

android image-rotation android-animation android-imageview

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

如何创建旋转轮控制?

我正在尝试在android中实现Rotatory wheel,就像下面显示的图像一样.我从这个链接中看到了教程.但我想实现如下图所示.轮子由各个图像组成.有没有人对这个实现有任何想法?任何帮助,将不胜感激.

在此输入图像描述

提前致谢.

阿卡什

animation android rotation image-rotation android-animation

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