رفتن به مطلب

zoom و shrink تصویر


ارسال های توصیه شده

سلام

دنبال سورس برنامه به زبان matlab میگردم که بتونه روی تصاویر یه سری عملیات انجام بده از قبیل :

1- zoom و shrink

2- متقارن نبودن مرتبه zoom و shrink

3- اعمال تابع نمایی و ریشه ی n ام روی تصویر حاصل

اگه اینا نبود یه کد ساده هم از تغییرات تصویر بزارین من کارم راه میفته

آخه برنامه ای که نوشتم یه جاهایی ایرادات داره ...

:ws25:

لینک به دیدگاه
  • 3 هفته بعد...

فکرکنم خودم باهاس اینجا بهتون اموزش بدم با این اندک دانسته هام .... :icon_pf (34):

اینم یه کد فوق العاده ساده ....

 

x=imread ('1.jpg');

whos x

figure (1)

imshow(x);

x_g=rgb2gray(x);

figure (2)

imshow(x(:,:,2),[]);

figure (3)

imshow(x_g);

% part 2

y=x_g';imshow(y,[]);

figure (4)

imshow(x_g(1:end/2,1:end/2));

% part 3

figure (5)

imshow(fliplr(x_g));

% part 4

figure (6)

imshow(x_g);

coord=ginput(2);

c1=round(coord(1,1));r1=round(coord(1,2));

c2=round(coord(2,1));r2=round(coord(2,2));

% part 5

figure (7)

imshow(x_g(r1:r2,c1:c2));

لینک به دیدگاه
سلام

دنبال سورس برنامه به زبان matlab میگردم که بتونه روی تصاویر یه سری عملیات انجام بده از قبیل :

1- zoom و shrink

2- متقارن نبودن مرتبه zoom و shrink

3- اعمال تابع نمایی و ریشه ی n ام روی تصویر حاصل

اگه اینا نبود یه کد ساده هم از تغییرات تصویر بزارین من کارم راه میفته

آخه برنامه ای که نوشتم یه جاهایی ایرادات داره ...

:ws25:

:icon_redface:

سلام آبجی.......... :icon_gol:

خوب و دلشاد باشی........

رفتم از دوستهام پرسیدم.........

جواب دادن حتماً میگم........

شرمنده از اینکه خودم بلد نیستم تا بخوام توضیح بدم........

لینک به دیدگاه

آبجی یه چیزهایی پیدا شد..........

حالا باید خوذم بگردم ببینم چه خبره........

 

*******************

imresize - Resize image

 

Syntax

 

B = imresize(A, scale)

B = imresize(A, [numrows numcols])

[Y newmap] = imresize(X, map, scale)

[...] = imresize(..., method)

[...] = imresize(..., parameter, value, ...)

 

Description

 

B = imresize(A, scale) returns image B that is scale times the size of A. The input image A can be a grayscale, RGB, or binary image. If scale is between 0 and 1.0, B is smaller than A. If scale is greater than 1.0, B is larger than A.

B = imresize(A, [numrows numcols]) returns image B that has the number of rows and columns specified by [numrows numcols]. Either numrows or numcols may be NaN, in which case imresize computes the number of rows or columns automatically to preserve the image aspect ratio.

[Y newmap] = imresize(X, map, scale) resizes the indexed image X. scale can either be a numeric scale factor or a vector that specifies the size of the output image ([numrows numcols]). By default, imresize returns a new, optimized colormap (newmap) with the resized image. To return a colormap that is the same as the original colormap, use the 'Colormap' parameter (see below).

[...] = imresize(..., method) resizes the indexed image. method can be (1) a text string that specifies a general interpolation method, (2) a text string that specifies an interpolation kernel, or (3) a two-element cell array that specifies an interpolation kernel.

(1) Text String Specifying Interpolation Method

Method NameDescription 'nearest'

Nearest-neighbor interpolation; the output pixel is assigned the value of the pixel that the point falls within. No other pixels are considered.

'bilinear'

Bilinear interpolation; the output pixel value is a weighted average of pixels in the nearest 2-by-2 neighborhood

'bicubic'

Bicubic interpolation (the default); the output pixel value is a weighted average of pixels in the nearest 4-by-4 neighborhood

(2) Text String Specifying Interpolation Kernel

Kernel NameDescription 'box'Box-shaped kernel 'triangle'Triangular kernel (equivalent to 'bilinear') 'cubic'Cubic kernel (equivalent to 'bicubic') 'lanczos2'Lanczos-2 kernel 'lanczos3'Lanczos-3 kernel (3) Two-element Cell Array Specifying Interpolation Kernel

FormDescription {f,w}f is a function handle for a custom interpolation kernel and w is the custom kernel's width.f(x) must be zero outside the interval -w/2

ParameterValue 'Antialiasing'A Boolean value that specifies whether to perform antialiasing when shrinking an image. The default value depends on the interpolation method. If the method is nearest-neighbor ('nearest'), the default is false; for all other interpolation methods, the default is true. 'Colormap'A text string that specifies whether imresize returns an optimized colormap or the original colormap (Indexed images only). If set to 'original', the output colormap (newmap) is the same as the input colormap (map). If set to 'optimized', imresize returns a new optimized colormap. The default value is 'optimized'. 'Dither'A Boolean value that specifies whether to perform color dithering (Indexed images only). The default value is true. 'Method'As described above 'OutputSize'A two-element vector, [numrows numcols], that specifies the size of the output image. If you specify NaN for one of the values, imresize computes the value of the dimension to preserve the aspect ratio of the original image. 'Scale'A scalar or two-element vector that specifies the resize scale factors. If you specify a scalar, imresize uses the value as the scale factor for each dimension. If you specify a vector, imresize uses the individual values as the scale factors for the row and column dimensions, respectively. Remarks

 

The function imresize changed in version 5.4 (R2007a). Previous versions of the Image Processing Toolbox used a somewhat different algorithm by default. If you need the same results produced by the previous implementation, use the function imresize_old.

For bicubic interpolation, the output image may have some values slightly outside the range of pixel values in the input image. This may also occur for user-specified interpolation kernels.

Class Support

 

The input image can be numeric or logical and it must be nonsparse. The output image is of the same class as the input image. An input image that is an indexed image can be uint8, uint16, or double.

Examples

 

Shrink by factor of two using the defaults of bicubic interpolation and antialiasing.

I = imread('rice.png');

J = imresize(I, 0.5);

figure, imshow(I), figure, imshow(J)Shrink by factor of two using nearest-neighbor interpolation. (This is the fastest method, but it has the lowest quality.)

J2 = imresize(I, 0.5, 'nearest');Resize an indexed image

[X, map] = imread('trees.tif');

[Y, newmap] = imresize(X, map, 0.5);

imshow(Y, newmap)Resize an RGB image to have 64 rows. The number of columns is computed automatically.

RGB = imread('peppers.png');

RGB2 = imresize(RGB, [64 NaN]);

لینک به دیدگاه

به گفتگو بپیوندید

هم اکنون می توانید مطلب خود را ارسال نمایید و بعداً ثبت نام کنید. اگر حساب کاربری دارید، برای ارسال با حساب کاربری خود اکنون وارد شوید .

مهمان
ارسال پاسخ به این موضوع ...

×   شما در حال چسباندن محتوایی با قالب بندی هستید.   حذف قالب بندی

  تنها استفاده از 75 اموجی مجاز می باشد.

×   لینک شما به صورت اتوماتیک جای گذاری شد.   نمایش به صورت لینک

×   محتوای قبلی شما بازگردانی شد.   پاک کردن محتوای ویرایشگر

×   شما مستقیما نمی توانید تصویر خود را قرار دهید. یا آن را اینجا بارگذاری کنید یا از یک URL قرار دهید.

×
×
  • اضافه کردن...