matlab - Changing image aspect ratio of interpolated RGB image. Square to rectangular -
I have some code that takes eye-eye images of a fish and converts it into a rectangular image in every RGB channels . I am having trouble with the fact that the output image is square instead of rectangular. (This means that the picture has been horizontally compressed.) I have tried to successfully convert the output matrix into a more suitable format. Apart from this, I have also found that the code to work for input image should be a class like 500x500. Any idea how to solve this issue? This code is:
This code is inspired by light focus, "From the polar / rectangular variations of images" the Exchange file on the mailbox.
Edit code now works.
function imP = FISHCOLOR2 (IMR) rMin = 0.1; RMax = 1; [MR, NR, DR] = size (IMR); % Size of rectangular image xRc = (Shree + 1) / 2; % Co-coordinate with the center of the image yRc = (NR + 1) / 2; Sx = (Mr. -1) / 2; % Scale factor sy = (NR-1) / 2; Low_dream = minutes (size (IMR, 1), size (IMR, 2)); IMR = IMRSEX (IMR, [low_dem low_dim]); M = size (infant mortality, 1); N = size (infant mortality, 2); Dr. = (Rmx - RMIN) / (M-1); Dth = 2 * pi / N; R = rMin: Dr. rMin + (M1) * Dr; Th = (0: DTH: (N-1) * DTH); [R, th] = meshgrid (R, th); . X = r * because (th); . Y = R * sin (th); XR = x * sx + xRc; YR = y * sy + yRc; K = 1: Dr.% color IPP (:,,: k) = interposition 2 (imr (:,:, k), xr, yr); Add% K channel end imP = imresize (IMP, [size (IMP, 1), size (IMP, 2) / 3]); IMP = Amerotate (IMP, 270); Resolve & lt; - Image link
& lt; - Image link
Part One A class To remove the need for input image, you should convert the input image to square one with it -
%% // reduce the size to reduce the square to reduce the input image _dim = min (size (IMR, 1), size (IMR, 2)); IMR = IMRSEX (IMR, [low_dem low_dim]); On some points I would like to resize this image, however here would like to create a square image here. It was a quick and dirty view and distracts the image for a non-square image, which you do not want the image to be "squirish" in many of those non-squarish images, between the boundaries of the image There will be black ranges in If you can extract an image processing algorithm or just using manual photoshipping, then it would be ideal. Even if the image is not square, then imresize can be considered as a safe option. Part B Now, at the end of your code, after processing the fisheye image, after main processing, it seemed that the image was 90 Depending on the degree clockwise or counter clockwise if the objects in the fisheye image intestine or externally respectively. %% // rotate the image imP = imrotate (IMP, -90)); %% // when internally estimated IMP = imrotate (IMP, -90); Note that in the flattened image, the input squared should be equal to half the size of the image, which is the radius of the image <%> // Externally projected < P> As the number of rows in the final output image - should be (IMP, 2) / 2 because you are fisheye image processing, I think the flat image width must be 2 * PI the height of that time. Therefore, I tried to do it - imP = imresize (IMP, [size (IMP, 2) / 2 pi * size (IMP, 2)]); But the results were very explained. Therefore, the next logical experimental value looks like the height of PI , i.e. - imP = imresize (IMP, [size (IMP, 2) / 2 pie * Size (IMP, 2) / 2]); In this case the results look good.
Comments
Post a Comment