image-rotation

How to crop a cross rectangle from an image using c#?

跟風遠走 提交于 2019-11-29 07:35:15
I want to get some specific parts of an image so I'm cropping the images. However, when I want to get a part that is not parallel to the image, I rotate the image and crop afterwards. I don't want to rotate the image and crop a parallel rectangle. What I want is, without rotating the image, to crop a rectangle with an angle from the image. Is there any way to do that? I think I couldnt express myself well enough. This is what I want to do: example picture . Assume the red thing is a rectangle :) I want to crop that thing out of image. After cropping it doesn't need to be angeled. So mj can lie

rotating an image 90 degrees in java [duplicate]

本小妞迷上赌 提交于 2019-11-28 21:38:45
This question already has an answer here: Java: Rotating Images 4 answers I have managed to rotate an image 180 degrees but wish to rotate it 90 degrees clockwise can someone edit my code so that it does this with explanation. Thanks. private void rotateClockwise() { if(currentImage != null){ int width = currentImage.getWidth(); int height = currentImage.getHeight(); OFImage newImage = new OFImage(width, height); for(int y = 0; y < height; y++) { for(int x = 0; x < width; x++) { newImage.setPixel( x, height-y-1, currentImage.getPixel(x, y)); } } currentImage = newImage; imagePanel.setImage

Android: How to rotate a moving animated sprite based on the coordinates of its destination

扶醉桌前 提交于 2019-11-28 19:56:01
My application fires up sprite instances around a Canvas which then move across the screen towards a x/y coordinate. I would like to be able to rotate the sprite around its center so that it faces its destination coordinates. I am using a sprite-sheet and have had issues with clipping. I have also found a lot of good examples but nothing seems to cover exactly what I'm looking for. This example is very close but for efficiency I am using an ImagePooler class and cannot reload an image on each draw/rotation. So if someone had an idea on how to rotate the preloaded image w/out cutting my sprite

How To Rotate Image By Nearest Neighbor Interpolation Using Matlab

空扰寡人 提交于 2019-11-28 09:12:42
My Plain Code without interpolation: im1 = imread('lena.jpg');imshow(im1); [m,n,p]=size(im1); thet = rand(1); m1=m*cos(thet)+n*sin(thet); n1=m*sin(thet)+n*cos(thet); for i=1:m for j=1:n t = uint16((i-m/2)*cos(thet)-(j-n/2)*sin(thet)+m1/2); s = uint16((i-m/2)*sin(thet)+(j-n/2)*cos(thet)+n1/2); if t~=0 && s~=0 im2(t,s,:)=im1(i,j,:); end end end figure; imshow(im2); This code creates black spot, the problem is how to do interpolation? Thank you all for any illumination. P.S. Not asking for build-in function: imrotate(im1,1/thet,'nearest'); To rotate the image without the black spots, you need to

Android - how to scale/move/rotate the imageviews on a imageview [closed]

孤街浪徒 提交于 2019-11-28 06:48:38
问题 I need to implement image editor project. basically, I need to add some icons,text over an input image then export to final image. Is there any good tutorial for this? 回答1: What you are searching is android-multitouch-controller. I have implemented in one of my application. It is working fine. It has following facility. Multi touch image scaling Multi touch image zooming single touch image panning There are 3 projects. In that "MTPhotoSortr" is one which I used. You need to check as per your

Rotating BufferedImage changes its colors

别等时光非礼了梦想. 提交于 2019-11-28 06:25:30
问题 I'm trying to code a class to seam carve images in x and y direction. The x direction is working, and to reduce the y direction I thought about simply rotating the image 90° and run the same code over the already rescaled image (in x direction only) and after that, rotate it back to its initial state. I found something with AffineTransform and tried it. It actually produced a rotated image, but messed up the colors and I don't know why. This is all the code: import java.awt.image

Rotate Opencv Matrix by 90, 180, 270 degrees [duplicate]

久未见 提交于 2019-11-28 06:15:06
This question already has an answer here: Rotate image by 90, 180 or 270 degrees 9 answers I'm capturing image from webcam and I need to rotate it by right angle. I found myself theese functions: getRotationMatrix2D - to create rotation matrix (whatever it is) transform - transform one matrix to another by rotation matrix But, I don't get anything but black area. This is my code: 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); /

How to crop a cross rectangle from an image using c#?

这一生的挚爱 提交于 2019-11-28 01:32:51
问题 I want to get some specific parts of an image so I'm cropping the images. However, when I want to get a part that is not parallel to the image, I rotate the image and crop afterwards. I don't want to rotate the image and crop a parallel rectangle. What I want is, without rotating the image, to crop a rectangle with an angle from the image. Is there any way to do that? I think I couldnt express myself well enough. This is what I want to do: example picture. Assume the red thing is a rectangle

Android: How to rotate a moving animated sprite based on the coordinates of its destination

点点圈 提交于 2019-11-27 20:35:52
问题 My application fires up sprite instances around a Canvas which then move across the screen towards a x/y coordinate. I would like to be able to rotate the sprite around its center so that it faces its destination coordinates. I am using a sprite-sheet and have had issues with clipping. I have also found a lot of good examples but nothing seems to cover exactly what I'm looking for. This example is very close but for efficiency I am using an ImagePooler class and cannot reload an image on each

How to rotate image in picture box

瘦欲@ 提交于 2019-11-27 16:15:53
I am making a winforms application. One of the features I hope to implement is a rotating gear on the home form. When the home form is loaded, you should hover over the picture of the gear, and it should rotate in place. But all I have so far is the RotateFlip and that just flips the picture. Is there a way to make the gear turn in place when the mouse is hovering over it? The code I have so far is: Bitmap bitmap1; public frmHome() { InitializeComponent(); try { bitmap1 = (Bitmap)Bitmap.FromFile(@"gear.jpg"); gear1.SizeMode = PictureBoxSizeMode.AutoSize; gear1.Image = bitmap1; } catch (System