Rotating image in matlab without cropping

I am trying to rotate a square image in Matlab in various angles without cropping the central object and having black regions to increase my dataset for object recognition purposes. Here is the original image: Rotating image in matlab without cropping

With my current attempt,

function imF = my_im_rotate(img, angle) s = ceil(size(img)/2); imP = padarray(img, s(1:2), 'replicate', 'both'); imR = imrotate(imP, angle, 'bilinear', 'crop'); S = ceil(size(imR)/2); imF = imR(S(1)-s(1):S(1)+s(1)-1, S(2)-s(2):S(2)+s(2)-1, :); %// Final form end

My result is: Rotating image in matlab without cropping

A part of it is getting cropped. How do I prevent it?

Category:image Views:0 Time:2018-07-29

Related post

  • using slider to rotate image in Matlab 2011-07-01

    I have a GUI (using GUIDE) in Matlab, this is how it looks: I want to rotate the image using slider and to show the change in real time. I use axes to display the image. how can I do this? EDIT: I'm building OCR application. this is how the plate loo

  • Why rotate Image in OpenCV without rotation code? 2011-06-10

    I am taking photo using AVCaptureStillImageOutput, AVCaptureSession, AVCaptureVideoPreviewLayer and display it in UIImageView. Its work properly. But, After display image in UIImage. I am detecting faces using OpenCV from that displayed image. It det

  • How do I shear an image in MATLAB without using built-in functions? 2010-05-12

    I want a method to shear an image without using the built-in functions (methods) of MATLAB. How can I do this? --------------Solutions------------- I'm assuming that "without using the built-in functions" means "not using the Image Processing Toolbox

  • How to handle large images in matlab without running out of memory? 2011-02-27

    I am creating mosaic of two images based on the region matches between them using sift descriptors. The problem is when the created mosaic's size gets too large matlab runs out of memory. Is there some way of stitching the images without actually loa

  • after rotating image on matlab..then results go on bad:( 2012-04-03

    I am intersted with determining branchpoints of retinal images and then registering these images. First of all I am using a algorithm for extracting of vessels from image then skeletization and finding branchpoints. At first operation all things were

  • How to rotate images in matlab automatically to get it aligned to the horizontal axis irrespective of its position? 2015-03-10

    This question already has an answer here: Extract rotated object from a white background 1 answer Suppose this is the image I have: How do I get this image exactly aligned to the horizontal axis if i do not know the tilt angle? how to rotate this con

  • how to crop some portion of scaled, rotated image-view 2011-05-17

    I am unable to crop he image from image view, which is scaled and rotated before cropping. used existing cropping methods.but its applicable only for image-view which is fixed.Hope code will helpful. --------------Solutions------------- Finally succe

  • Resize image and display without saving it 2013-03-10

    I've built an image gallery and saved the image "as is" without cropping it. I want to resize the image on the fly while it's loaded in the controller, so when I load the controller in the browser it displays the image re-sized to whatever I want. I'

  • How To Rotate Image By Nearest Neighbor Interpolation Using Matlab 2009-11-28

    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

  • flip and rotate a color image in MATLAB 2010-10-24

    How do I flip a color image (RGB) in MATLAB? The fliplr does not seem to work without losing the color contents, as it only deals with 2D. As well, the imrotate may not rotate color images. --------------Solutions------------- The function FLIPDIM wi

  • How do I rotate image then move to the top left 0,0 without cutting off the image 2011-03-04

    How do I rotate image then move to the top left 0,0 without cutting off the image. Please read the comments inside the code. I got stuck at STEP 3 I think using trigonometry should be able to solve this problem. thanks private Bitmap RotateImage(Bitm

  • Crop an image in Matlab 2011-04-03

    I want to crop an image from a specific row onwards. Please help me how can I do this. I am a beginner in Matlab. --------------Solutions------------- See this: http://www.mathworks.com/help/techdoc/creating_plots/f9-47085.html There is a graph edito

  • crop image from center without GD library and generate a thumbnail 2011-08-01

    Possible Duplicate: Crop Image From Center PHP I need to crop an image from the center with size of 200 * 130 using PHP. Any help will be hugely be appreciated. --------------Solutions------------- There is no way to crop an image using PHP without a

  • How to measure the rotation of a image in MATLAB? 2011-09-19

    I have two images. One is the original, and the another is rotated. Now, I need to discover the angle that the image was rotated. Until now, I thought about discovering the centroids of each color (as every image I will use has squares with colors in

  • Rotate image without shrinking on Android 2012-04-02

    I need to create a compass on an app i am working on. So i tried to create a new view called CompassView which basically extends imageview, shows a bitmap that has east west north south pointed on it, uses sensors to find the degrees the phone is poi

  • Cropping a rotated image in opencv 2014-03-25

    Ok so I am having problems cropping my rotated image in opencv. First off does it matter what order the points are in the array fed into minAreaRect? If not then I don't know what is wrong with my code but as soon as I crop the rotated image the crop

  • How do I save an image in Matlab with axes but without plotting? 2014-01-09

    I have an image I that I want to save with axes on it. imwrite(I,jet,'image.jpg'); will save the image. I = image; RI = imref2d(size(I)); RI.XWorldLimits = [xmin xmax]; RI.YWorldLimits = [ymin ymax]; figure(1); imshow(I,RI,jet); xlabel('x'); ylabel('

  • Color Comparison of two images using matlab 2010-04-30

    Is it possible to compare the color of two images using Matlab if the two images are of different sizes?The problem that am facing is that, i want to detect the presence of a colored patch in an image? --------------Solutions------------- You could j

  • I would like to rotate images on the web using aspx 2012-03-29

    I am writing an application ( .NET 4.0 using web forms). What I like to do is to give the ability for users to see images they have stored in a directory and be able to perform changes to their pictures ( zoom, rotate, crop, etc). I can do the zoom,

  • Resize image in Python without losing EXIF data 2008-12-30

    I need to resize jpg images with Python without losing the original image's EXIF data (metadata about date taken, camera model etc.). All google searches about python and images point to the PIL library which I'm currently using, but doesn't seem to

  • Rotating images, AJAX-like, in Ruby on Rails 2009-01-25

    I'm working on a site where I'd like to cycle images, similar to a slideshow, while the user is on the page. I've searched around and haven't been able to find a lead. Has anyone done this with Rails and the Javascript frameworks it supports? -------

  • How can I save an altered image in MATLAB? 2009-02-22

    I want to read an image into MATLAB, draw a rectangle on it, and then save the image. Also, I'm just learning MATLAB--please be gentle. It seems like it should be simple, but I can't seem to do it. im = imread('image.tif'); imshow(im); rectangle('Pos

  • Rotate image clockwise or anticlockwise inside a div using javascript 2009-06-09

    HI, Is there a way by which I can rotate an image inside a div clockwise or anticlockwise. I have a main fixed width div[overflow set to hidden] with images loaded from database. There is a scroll bar for showing the images inside the div. When image

  • image resize but without any compromise in DPI? 2010-03-14

    I want to resize a image with DPI 300 or greater.. I want it's DPI to remain intact... I have used GD library function to resize image cropped but it brings down DPI to 90! please give a solution as my requirement involves no downsizing of DPI ------

  • Import a binary image from matlab to a "C" program 2010-06-23

    I have a binary image in Matlab, and I need the binary array(0 and 1) in a C program, How can I import it? I can save the binary image in Matlab as ".mat" but I don't know how to read the mat file in C. Also I thought maybe I can save the binary imag

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.176 (s). 11 q(s)