Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1 ) HW _ resize 1 D ( float * IN , float * OUT , int INlen, int OUTlen, int kernel _ type, double
HWresizeD float IN float OUTint INlen, int OUTlen, int kerneltype, double param Function HWresizeD scales the list of numbers stored in IN into a newlist OUT. IN has INlen elements of datatype float. OUT has OUTlen elements. If OUTLEN INLEN, then magnification must be performed. Else, minification takes place. In either case, the user specifies the filter through argument kerneltype,which can be set to to refer to nearest neighbor, linear interpolation, and cubic convolution, respectively. Incubic convolution, the free variable a is passed through param. V alues and for kerneltype are reserved for windowed sinc functions. The corresponding windowfunctions that should be used are: Hann, Hamming, and Lanczos windows. Note that parameter N for the Hann and Hamming windows as used in the equations in the book are passed through param.That is param will store the width of the window. Inthe case of the Lanczos window, param is used to store the number of sinc lobes allowed to pass. For instance, the Lanczosx windowwill be specified with param the Lanczosx windowwith param etc. Test HWresizeD for magnification for a D impulse function. Initialize an array of numbers with everywhere, and at the center location Then magnify this list by a scale factor of using all the above kernels. The output list of elements should match with the samples of the respective reconstruction kernels. Submit aplot of the output for each kernel. Remember to pad the input to avoid problems at the borders where the convolution kernel falls off the edge of the image. Use pixel replication for padding. Test HWresizeD for minification for a D sine wav e function having values lying between and Initialize an array of numbers with a sine wav e having cycles per scanline or cycles per pixel Then minify this list by a scale factor of using all the above kernels. The output list will have elements. Submit aplot of the output for each kernel. Remember to pad the input to avoid problems at the borders where the convolution kernel falls off the edge of the image. Use pixel replication for padding. Also, note that unlikethe magnification case, minification will cause the kernel to be stretched wider and reduced in amplitude in proportion to the scale factor. HWresizeD ImagePtr I int newh int newwint kerneltype, int param, ImagePtr I Function HWresizeD scales an image stored in Iand stores it in I The dimensions of the output image is newh height; or rows by neww width; or columns This function implements scaling separably by first resampling each image scanline with calls to HWresizeDputting the result into an intermediate buffer. Then, HWresizeD is invokedoneach column to yield the output image. Run this function on small images, such as eyepgm and textpgm to demonstrate magnification. Magnify by several scale factors, including and Over what scale factors are the various kernels acceptable?Describe the artifacts that appear, including their location and structure. Note that you will want to convert the unsigned char elements in Itofloat for use in HWresizeDand then convert back to unsigned char for storage in file I Run HWresizeD on large images with a lot of high frequencies edges such as star.pgm to demonstrate minification. Compare the results between the point sampling nearest neighbor and a higher quality filter when minifying star.pgm or ramp.pgm Whydoes point sampling work well for the ramp.pgm image and not for star.pgm
HWresizeD float IN float OUTint INlen, int OUTlen, int kerneltype, double param Function HWresizeD scales the list of numbers stored in IN into a newlist OUT. IN has INlen elements of datatype float. OUT has OUTlen elements. If OUTLEN INLEN, then magnification must be performed. Else, minification takes place. In either case, the user specifies the filter through argument kerneltype,which can be set to to refer to nearest neighbor, linear interpolation, and cubic convolution, respectively. Incubic convolution, the free variable a is passed through param. V alues and for kerneltype are reserved for windowed sinc functions. The corresponding windowfunctions that should be used are: Hann, Hamming, and Lanczos windows. Note that parameter N for the Hann and Hamming windows as used in the equations in the book are passed through param.That is param will store the width of the window. Inthe case of the Lanczos window, param is used to store the number of sinc lobes allowed to pass. For instance, the Lanczosx windowwill be specified with param the Lanczosx windowwith param etc. Test HWresizeD for magnification for a D impulse function. Initialize an array of numbers with everywhere, and at the center location Then magnify this list by a scale factor of using all the above kernels. The output list of elements should match with the samples of the respective reconstruction kernels. Submit aplot of the output for each kernel. Remember to pad the input to avoid problems at the borders where the convolution kernel falls off the edge of the image. Use pixel replication for padding. Test HWresizeD for minification for a D sine wav e function having values lying between and Initialize an array of numbers with a sine wav e having cycles per scanline or cycles per pixel Then minify this list by a scale factor of using all the above kernels. The output list will have elements. Submit aplot of the output for each kernel. Remember to pad the input to avoid problems at the borders where the convolution kernel falls off the edge of the image. Use pixel replication for padding. Also, note that unlikethe magnification case, minification will cause the kernel to be stretched wider and reduced in amplitude in proportion to the scale factor. HWresizeD ImagePtr I int newh int newwint kerneltype, int param, ImagePtr I Function HWresizeD scales an image stored in Iand stores it in I The dimensions of the output image is newh height; or rows by neww width; or columns This function implements scaling separably by first resampling each image scanline with calls to HWresizeDputting the result into an intermediate buffer. Then, HWresizeD is invokedoneach column to yield the output image. Run this function on small images, such as eyepgm and textpgm to demonstrate magnification. Magnify by several scale factors, including and Over what scale factors are the various kernels acceptable?Describe the artifacts that appear, including their location and structure. Note that you will want to convert the unsigned char elements in Itofloat for use in HWresizeDand then convert back to unsigned char for storage in file I Run HWresizeD on large images with a lot of high frequencies edges such as star.pgm to demonstrate minification. Compare the results between the point sampling nearest neighbor and a higher quality filter when minifying star.pgm or ramp.pgm Whydoes point sampling work well for the ramp.pgm image and not for star.pgm
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started