CMPT 401 CreateImage


CMPT 401 – Assignment 1 (Due Oct 11th 23:59)
Instructions
 You are going to submit Assignment1.cpp, Solution1.png and Solution2.png.
 Fill out the functions CreateImageFromTextFile() and DiamondFilter() in
Assignment1.cpp.
 Use to create Solution1.png
 Use to create Solution2.png
Question 1
The pixel values of a 299-by-299 RGBA image is stored in pixels.txt in a row-major, interleaved order. Write a function CreateImageFromTextFile() to create a PNG image using these values. Save the output image as Solution1.png.
Question 2
Write a function DiamondFilter() to apply the “diamond filter” (shown below) on a grayscale version of dog.jpg. Padded the image border using cv::BORDER_DEFAULT. Save the output image as Soution2.png.
Note: remember to normalize the output pixel values with the total kernel weight.
Note: if you are using two for-loops to calculate the output pixel values one-by-one, some of the values will not be integers. In such case, apply rounding before you write the values into the output byte array.
  CreateImageFromTextFile()
 DiamondFilter()
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值