DevIL Manual (1265192), страница 4

Файл №1265192 DevIL Manual (Задания) 4 страницаDevIL Manual (1265192) страница 42021-08-18СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 4)

“Alienified” imageBlurringILU has two blurring functions – iluBlurAverage and iluBlurGaussian. Blurring can beused for a simple motion blur effect or something as sophisticated as concealing theidentity of a person in an image. Both of these functions use a convolution filter andmultiple iterations to blur an image. Gaussian blurs look more natural than averagingblurs, because the center pixel in the convolution filter “weighs” more. For an in-depthdescription of convolution filters, see the excellent “Elementary Digital Filtering” articleat http://www.gamedev.net/reference/programming/features/edf/.iluBlurAverage and iluBlurGaussian are functionally equivalent.

Both functions accepta single parameter. Call the desired function with the number of iterations of blurringDeveloper’s Image Library Manual 17you wish to be performed on the image. Increase the number of iterations to increase theblurriness of an image.Figure 4-3. Average blurredwith 10 iterations appliedFigure 4-4. Gaussian blurredwith 10 iterations appliedContrastThe American Heritage Dictionary describes contrast as “The use of opposing elements,such as colors, forms, or lines, in proximity to produce an intensified effect in a work ofart.” ILU can apply more colour contrast to your image by brightening the lights anddarkening the darks via iluContrast. This effect can make a dull image livelier and“stand out” more.iluContrast accepts a single parameter describing the desired amount of contrast tomodify the image by. A value of 1.0 does not affect the image. Values above 1.0 to 1.7increase the amount of contrast in the image, with 1.7 increasing the contrast the most.Values from 0.0 to 1.0 decrease the amount of contrast in the image.

Values outside ofthe 0.0 to 1.7 range will give undefined results. -0.5 to 0.0 will actually create a negativeof the image and increase the contrast.Figure 4-5. Contrast of 1.6Figure 4-6. Contrast of 0.2Figure 4-7. Contrast of -.5Equali zationSometimes it may be useful to equalize an image – that is, bring the extreme colourvalues to a median point. iluEqualize darkens the bright colours and lightens the darkcolours, reducing the contrast in an image or “equalizing” it. Figure 4-8 shows the resultsof applying iluEqualize to the OpenIL image.18 Developer’s Image Library ManualFigure 4-8.

Equalized imageGamma CorrectioniluGammaCorrect applies gamma correction to an image using an exponential curve.The single parameter iluGammaCorrect accepts is the gamma correction factor youwish to use. A gamma correction factor of 1.0 leaves the image unmodified. Values inthe range 0.0 - 1.0 darken the image. 0.0 leaves a totally black image. Anything above1.0 brightens the image, but values too large may saturate the image.Figure 4-9. Result of gammacorrection of 0.5Figure 4-10.

Result of gammacorrection of 1.9NegativityiluNegative is a very basic function that inverts every pixel’s colour in an image. Forexample, pure white becomes pure black, and vice-versa. The resulting colour of a pixelcan be determined by this formula: new_colour = ~old_colour (where the tilde is thenegation of the set of bits).

iluNegative does not accept any parameters and is reversibleby calling it again.Figure 4-11. iluNegative exampleNoiseDevIL can add “random” noise to any image to make it appear noisy. The function,iluNoisify, simply uses the standard libc rand function after initializing it with a seed tosrand.

If your program depends on a different seed to rand, reset it after callingDeveloper’s Image Library Manual 19iluNoisify. The seed DevIL uses is the standard time(NULL) call. Of course, the noiseadded to the image is not totally random, since no such thing exists, but there should beno repeating, except in extremely large images.iluNoisify accepts a single parameter – the tolerance to use.

This parameter is a clamped(float) value that should be in the range 0.0f - 1.0f. Lower values indicate a lowertolerance, while higher values indicate the opposite. The tolerance indicates just howmuch of a mono intensity that iluNoisify is allowed to apply to each pixel. A “random”mono intensity is applied to each pixel so that you will not end up with totally newcolours, just the same colours with a different luminance value.

Colours change by bothnegative and positive values, so some pixels may be darker, some may be lighter, andothers will remain the same.Figure 4-12. Result of iluNoisify with a 0.50 tolerancePixelizationiluPixelize creates pixelized images by averaging the colour values of blocks of pixels.The single parameter passed to iluPixelize determines the size of these square blocks.The result is a pixelized image.Call iluPixelize with values greater than 1 to pixelize the image. The larger the values,the larger the pixel blocks will be.

A value of 1 will leave the image unchanged. Valuesless than 1 generate an error.Figure 4-13. Pixelization of 10 pixels acrossSharpeningSharpening sharply defines the outlines in an image. iluSharpen performs thissharpening effect on an image. iluSharpen accepts two parameters: the sharpeningfactor and the number of iterations to perform the sharpening effect.20 Developer’s Image Library ManualThe sharpening factor must be in the range of 0.0 - 2.5. A value of 1.0 for the sharpeningfactor will have no effect on the image. Values in the range 1.0 - 2.5 will sharpen theimage, with 2.5 having the most pronounced sharpening effect. Values from 0.0 to 1.0 doa type of reverse sharpening, blurring the image.

Values outside of the 0.0 - 2.5 rangeproduce undefined results.The number of iterations to perform will usually be 1, but to achieve more sharpening,increase the number of iterations. This parameter is similar to the Iterations parameter ofthe two blurring functions. The time it takes to run this function is directly proportionalto the number of iterations desired.Figure 4-14. Sharpening of 1.5 with 5 iterationsDeveloper’s Image Library Manual 21Resizing ImagesBasic ScalingTo resize images, use the iluScale function:ILboolean iluScale(ILuint Width, ILuint Height, ILuint Depth);Listing 5.1.

Syntax of the iluScale functionThe three parameters are relatively explanatory. Any image can be resized to a newwidth, height and depth, provided that you have enough memory to hold the new image.The new dimensions do not have to be the same as the original in any way. Aspect ratiosof the image do not even have to be the same. The currently bound image is replacedentirely by the new scaled image.If you specify a dimension greater than the original dimension, the image enlarges in thatdirection. Alternately, if you specify a dimension smaller tha n the original dimension,the image shrinks in that direction.Figure 5.1. Original imageFigure 5.2.

Enlarged imageFigure 5.3. Shrunk imageAdvanced ScalingDevIL also allows you to specify which method you want to use to resize images. Asyou can see in figure 5.2, the enlarged image is very pixelized. In figure 5.3, the shrunkimage is also blocky.

This is because a nearest filter was applied to the image in figure5.1 to produce figures 5.2 and 5.3.DevIL allows you to use different filters to produce better scaling results:•••••••••Nearest filterLinear filterBilinear filterBox filterTriangle filterBell filterB Spline filterLanczos filterMitchell filter-ILU_NEARESTILU_LINEARILU_BILINEARILU_SCALE_BOXILU_SCALE_TRIANGLEILU_SCALE_BELLILU_SCALE_BSPLINEILU_SCALE_LANCZOS3ILU_SCALE_MITCHELL22 Developer’s Image Library ManualJust use the ILU_FILTER define as PName in iluImageParameter with the appropriatefilter define as Param.ILvoid iluImageParameter(ILenum PName, ILenum Param);Listing 5.1. Syntax of the iluImageParameter functionFilter ComparisonsThe first three filters (nearest, linear and bilinear) require an increasing amount of time toresize an image, with nearest being the quickest and bilinear being the slowest of thethree.

All the filters after bilinear are considered the “advanced” scaling functions andrequire much more time to complete, but they generally produce much nicer results.When minimizing an image, bilinear filtering should be sufficient, since it uses a fourpixel averaging scheme to create every destination pixel. Minimized images do notgenerally have to use higher sampling schemes to achieve a reasonable image.Enlarging an image, though, depends quite heavily on how good the sampling scheme is.DevIL provides several filtering functions to let you choose which one best fits yourneeds: speed versus image quality. Below is a comparison of the different types of filterswhen enlarging an image.Figure 5.4.

Original ‘Lena’ imageNearest filterLinear filterBilinear filterBox filterTriangle filterBell filterDeveloper’s Image Library Manual 23B spline filterFigure 5.5. Filter comparisonsLanczos filterMitchell filter24 Developer’s Image Library ManualSub-ImagesMipmapsMipmaps in DevIL are successive half-dimensioned power-of-2 images. The dimensionsdo not have to be powers of 2 if you generate them manually, but DevIL’s mipmapgeneration facilities assume power-of-2 images.Figure 4-1. All mipmap levels down to 1x1Mipmap CreationYou generate mipmaps for any image using iluBuildMipmaps . If the image already hasmipmaps, the previous mipmaps are erased, and new mipmaps are generated.

Характеристики

Тип файла
PDF-файл
Размер
458,87 Kb
Материал
Тип материала
Высшее учебное заведение

Список файлов учебной работы

Задания
DevIL
include
IL
devil_cpp_wrapper.hpp
il.h
ilu.h
ilu_region.h
ilut.h
ilut_config.h
lib
libIL.a
libIL.la
libILU.a
libILU.la
libILUT.a
libILUT.la
DevIL-master
DevIL
org.eclipse.cdt.make.core.ScannerConfigBuilder.launch
org.eclipse.cdt.make.core.makeBuilder.launch
.cvsignore
org.eclipse.wst.sse.core.prefs
org.eclipse.wst.validation.prefs
src-ILUT
include
Makefile.am
ilut_allegro.h
ilut_internal.h
ilut_opengl.h
ilut_states.h
msvc8
resources
IL Logo.ico
ILUT.rc
ILUT Unicode.rc
ILUT Unicode.vcproj
ILUT.dsp
ILUT.rc
ILUT.vcproj
ilut.def
resource.h
msvc9
resources
IL Logo.ico
ILUT.rc
main.cpp
makefile.
QuantumOperation
definitions.h
header.h
helpers.cpp
kernel.cu
main.cpp
makefile.
Свежие статьи
Популярно сейчас
Почему делать на заказ в разы дороже, чем купить готовую учебную работу на СтудИзбе? Наши учебные работы продаются каждый год, тогда как большинство заказов выполняются с нуля. Найдите подходящий учебный материал на СтудИзбе!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
6390
Авторов
на СтудИзбе
307
Средний доход
с одного платного файла
Обучение Подробнее