clc; clear; a= imread('cameraman.tif'); a=double(a); [m,n]=size(a); for i=1:3*m for j=1:3*n x=abs(i-floor(i/1.5)); x1=abs(x-floor(x/1.5)); y=abs(j-floor(j/1.5)); y1=abs(y-floor(y/1.5)); b(i,j) = a(x1,y1); end end a=uint8(a); b=uint8(b); figure;imshow(a) figure;imshow(b) El programa si corre pero al mostrar los resultados sale incorrecto
You can get that here drive.google.com/file/d/1GAGjgnEGaN4Dwn4yCgSE84JwD-ZdTOsH/view?usp=sharing I have used a slightly different algorithm for zooming and used a basic average for interpolation
@@pratikian I can convert to 1024 to 256. I have to use 256x256 image on MATLAB (not choose on desktop) and i want to convert from 256*256 to 1024*1024, matlab codes are below. Up to the figure;imshow(b), codes works but after the figure;imshow(b), program gives error: Attempted to access b(1,257); index out of bounds because size(b)=[256,256]. Error in soru2 (line 23) c(i,j)=b(x,y); matlab codes; a = imread(.....) [m,n]=size(a); for i=1:m/4 for j=1:n/4 p = i*4; q = j*4; b(i,j)=a(p,q); end end figure;imshow(a) figure;imshow(b) [m,n]=size(b) for i=1:m*4 for j=1:n*4 x = i-floor(i/4); y = j-floor(j/4); c(i,j)=b(x,y); end end figure;imshow(c)
@@denizbaran5804 this logic that you have applied is wrong for i=1:m*4 for j=1:n*4 x = i-floor(i/4); y = j-floor(j/4); c(i,j)=b(x,y); the logic of p=i - floor(i/2) only works to double the no of pixels if you want to increase by 4 times you have to use this logic twice as shown for i=1:m*4 for j=1:n*4 x = i-floor(i/2); x1 = x - floor(x/2); y = j-floor(j/2); y1 = y - floor(y/2); c(i,j)= a(x1,y1); end end hope this helps