how can i make a change in my image ?
Show older comments
hi guys . i have an image (257*161) .
im = f(x,y)
how can i change my image equation to im = f(x/8 , y/12 )
could you please help me ?
thanks
3 Comments
Geoff Hayes
on 1 Sep 2014
Hamed - in your function
im = f(x,y)
what are the inputs x and y? Are they (integer) pixel coordinates of your image, or something else? What is the purpose of your function f? Is the output, im, the image or ..? Please provide more details concerning the problem that you wish to be solved.
I downloaded your file matlab.mat , and using the MATLAB function image it created a lovely figure showing some torso cross-section, like from a CT scan.
What is the problem with the image? What exactly do you mean by "image equation"? What is the function f ? What are the variables x and y ? How should the image be different?
Do you wish to scale, resize or skew the image?
Answers (1)
Image Analyst
on 1 Sep 2014
Do you possibly mean imresize()?
[rows, columns, numberOfColorChannels] = size(im);
% Get new x-width and y-height using formulas x/8 , y/12
% Remember, arrays are (rows, columns) = (y, x) NOT (x,y)!!!!!!!!!!
newRows = round(rows/12); % New y height
newColumns = round(columns / 8); % New x width
% Resize image
resizedImage = imresize(im, [newRows, newColumns]);
5 Comments
Image Analyst
on 1 Sep 2014
Your "scale and translation normalization" sort of sounds like you want to paste the image in a different place. If you want to do that, see my image copy and paste demo, attached.
Image Analyst
on 1 Sep 2014
That just scales and shifts the image so that what once happened at x now happens at x/a + xbar, or at x/m in your equation.
Image Analyst
on 3 Sep 2014
hamed, see my attached demo where I compute the first 4 image moments, mean, standard deviation, skewness, and kurtosis.
Categories
Find more on Image Arithmetic in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!