Saturday 15 August 2015

Matlab figure keeps the history of the previous images -


I'm working on rotating the image manually. Every time I run my code with a different image, the previous images have been rotated, shown in the picture. I can not get it. Any help would be commendable code here:

Enter image details here [screenshot ]

  im1 = imread ('gradient.jpg'); [H, w, p] = size (im 1); Theta = p / 12; Hh = round (h * cos (+ theta) + wade * abs (sin (theta)); % Closest integer ww = round (w * cos (theta) + h * abs (sin (theta)) round;% closest integer R round = [cos (live) -n (theta); sin (theta) cos ); T = [w / 2; g / 2]; rt = [for (r) t; 0]; for z = 1: x for x = 1: y = 1 ww: hh% Using matrix multiplication i = zero (3,1); i = rt * [x-ww / 2; y-hh / 2; 1]; %% nearest neighbor i = round (i); if i (1) Gt; 0 & amp; amp; amp; (2) & gt; 0 & amp; amp; i (1) & lt; = w & amp; amp; amp; (2) & lt; = h im2 (y, x, Z) = im1 (i (2), i (1), z); end end end end x = 1: ww; y = 1: hh; [x, y] = meshgrid (x, w) ;) Generate X and Y arrays for the% 3-D plots. Orig_pos = [X (:) 'Y' (''; ''; people (1, numel (x)); elements in array or subcriptive array expression Number of orig_pos_2 = [X (:) '- (ww / 2); y (:)' - (hh / 2); people (1, numel (x)); New_pos = round (RT * orig_pos_2); % Check the nearest neighboring% to the neighbor that the new status comes from the map: valid_pos = new_pos (1, :) & gt; = 1 & amp; New_pos (1, :) & lt; = W & amp; New_pos (2, :) & gt; = 1 & amp; New_pos (2, :) & lt; = H; Orig'pos = orig_pos (:, legal_pos); New_pos = new_pos (:, valid_poz); Siz = size (IM1); Siz2 = size (im2); Expand the 2D index to include the third dimension IndiOver_poz = sub-ind (Sees 2, Orsipop (2 * ones (p, 1), :), parent_pose (w (p, 1), :), ( 1: P) '* ones (1, length (parent_position)); Ind_new_pos = sub2ind (siz, new_pos (2 * ones (p, 1)), new_pos (ones (p, 1), :), (1: p) '* ones (1, length (new_pos))); IM2 (Ind_orig_pos) = IM1 (IND_NU_pos); Imshow (IM2); There is a problem with the introduction of  im2 ,    

im2 has been created in the following section:
  If i (1) & gt; 0 & amp; Amp; I (2) & gt; 0 & amp; Amp; I (1) & lt; = W & amp; Amp; I (2) & lt; = H im2 (y, x, z) = im1 (i (2), i (1), z); End   

If this code is present before im2 and its width or height is greater than the image that you are generating a new image then only the top Attempting to start im2 by adding Do;

first

 for  z = 1: p for x = 1: ww y = 1: hh ...          

No comments:

Post a Comment