GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — [LeetCode] 661. Image Smoother · Issue #661 · grandyang/leetcode Open Description
Given a 2D integer matrix M representing the gray scale of an image, you need to design a smoother to make the gray scale of each cell becomes the average gray scale (rounding down) of all the 8 surrounding cells and itself. If a cell has less than 8 surrounding cells, then use as many as you can. Example 1:
Note:
这道题让我们给一个图片进行平滑处理,博主其实还是有一些图像处理的背景的,一般来说都是用算子来跟图片进行卷积,但是由于这道题只是个Easy的题目,我们直接用土办法就能解了,就直接对于每一个点统计其周围点的个数,然后累加像素值,做个除法就行了,注意边界情况的处理,参见代码如下:
ActivityMetadataMetadataAssigneesLabelsNo labels TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |