当前位置: 首页 > news >正文

做vip视频网站赚钱吗百度如何优化

做vip视频网站赚钱吗,百度如何优化,做标签网站是什么,怎么制作自己的商城在进入频域变换之前, 我们还是轻松一下,再搞点平面上的变化来看看。这把选了一个双线性插值(Bilinear interpolation)来实现是源于看到了csdn上别人的问题, 权且实现一个函数,方便大家的使用吧。 双线性插值简单的说,就…

在进入频域变换之前, 我们还是轻松一下,再搞点平面上的变化来看看。这把选了一个双线性插值(Bilinear interpolation)来实现是源于看到了csdn上别人的问题, 权且实现一个函数,方便大家的使用吧。

双线性插值简单的说,就是扩展了之后的图像像素坐标映射回原来的坐标空间的时候, 如果出现了没有对应到整数点的情况。这时候需要做2次线性的插值计算出新的坐标的像素值,比如说:

这里可以看到这个P点落在了ABCD区间内, 如果我们本着最朴素的这个P点最靠近谁权重就越大的加权平均的思想, 我们很容易得到这样的论断:

b3

A点对P的影响就是Sa的面积, B点的影响就是Sb, C点就Sc, d就是Sd。这样越近就是权重越大,基本上就是这样的逻辑。

这样P的像素可以简单的用 (A*Sa+B*Sb+C*Sc+D*Sd )/(Sa+Sb+Sc+Sd);来得到了。以我的雷厉风行,马上写出了如下的代码:

[cpp] view plaincopyprint?
  1. /** 
  2. ** method to remove sharp the raw image with unsharp mask 
  3. * @param src input grayscale binary array  
  4. * @param dst output grayscale result, the memory need to be allocated outside of the function 
  5. * @param srcWidth width of the input grayscale image 
  6. * @param srcHeight height of the input grayscale image 
  7. * @param scalePercent, scale percentage (0-xxx) 
  8. */  
  9. void stretchImage (const unsigned char* src, unsigned char* dst, int srcWidth, int srcHeight, int scalePercent)  
  10. {     
  11.     if (scalePercent < 0)  
  12.         return;  
  13.     int x, y;  
  14.     int ox, oy;  
  15.     int tmpx,tmpy;  
  16.     int ratio = (100 << 8)/scalePercent;  
  17.     int dstWidth = srcWidth * scalePercent / 100;  
  18.     int dstHeight = srcHeight * scalePercent / 100;  
  19.     unsigned char color[2][2];  
  20.     for (int j = 0; j < dstHeight; j ++)  
  21.     {  
  22.         for (int i = 0; i < dstWidth; i ++)  
  23.         {  
  24.             tmpx = i * ratio;  
  25.             tmpy = j * ratio;  
  26.             ox = tmpx >> 8;  
  27.             oy = tmpy >> 8;  
  28.             x = tmpx & 0xFF;  
  29.             y = tmpy & 0xFF;  
  30.             color[0][0] = src[ oy*srcWidth + ox ];   
  31.             color[1][0] = src[ oy*srcWidth + ox +1 ];   
  32.             color[0][1] = src[ (oy+1)*srcWidth + ox ];   
  33.             color[1][1] = src[ (oy+1)*srcWidth + ox+1 ];  
  34.             int final = (0x100 - x)*(0x100 - y)*color[0][0] + x*(0x100 - y)*color[1][0] + (0x100-x)*y*color[0][1] + x*y*color[1][1];  
  35.             final = final >> 16;  
  36.             if (final>255)  
  37.                 final = 255;  
  38.             if (final<0)  
  39.                 final = 0;  
  40.             dst [ j*dstWidth + i] = (unsigned char)final;  
  41.         }  
  42.     }  
  43. }  

/** ** method to remove sharp the raw image with unsharp mask * @param src input grayscale binary array * @param dst output grayscale result, the memory need to be allocated outside of the function * @param srcWidth width of the input grayscale image * @param srcHeight height of the input grayscale image * @param scalePercent, scale percentage (0-xxx) */ void stretchImage (const unsigned char* src, unsigned char* dst, int srcWidth, int srcHeight, int scalePercent) { if (scalePercent < 0) return; int x, y; int ox, oy; int tmpx,tmpy; int ratio = (100 << 8)/scalePercent; int dstWidth = srcWidth * scalePercent / 100; int dstHeight = srcHeight * scalePercent / 100; unsigned char color[2][2]; for (int j = 0; j < dstHeight; j ++) { for (int i = 0; i < dstWidth; i ++) { tmpx = i * ratio; tmpy = j * ratio; ox = tmpx >> 8; oy = tmpy >> 8; x = tmpx & 0xFF; y = tmpy & 0xFF; color[0][0] = src[ oy*srcWidth + ox ]; color[1][0] = src[ oy*srcWidth + ox +1 ]; color[0][1] = src[ (oy+1)*srcWidth + ox ]; color[1][1] = src[ (oy+1)*srcWidth + ox+1 ]; int final = (0x100 - x)*(0x100 - y)*color[0][0] + x*(0x100 - y)*color[1][0] + (0x100-x)*y*color[0][1] + x*y*color[1][1]; final = final >> 16; if (final>255) final = 255; if (final<0) final = 0; dst [ j*dstWidth + i] = (unsigned char)final; } } }

 

 

需要说明的事情是, 浮点数需要引入效率上一定的损失, 当然我们这里就用大数来和谐。但是只是随便写写的代码, 我们没有加入超出int范围的检查或者说明,暂时也只能这样了:)。用了这个函数的效果还是不错的, 我们来看看在75%,125%和250%时候的效果:

原图:

sample

%75效果图:

75%

125%效果图:

125%

250%效果图:

250%

其实从效果图多少可以看出一些的问题就是, 随着图像的拉伸, 图像的锐度其实降低了, 这个比较容易想象的,因为我们这个拉伸的办法本身就是线性的,无疑来扩大的时候把锐利的边缘模糊化了,所以自然在图像扩大很多倍的时候效果不是很好了。

 

http://blog.csdn.net/hhygcy/article/details/4434870#comments

转载于:https://www.cnblogs.com/pengkunfan/p/4042121.html

http://www.lbrq.cn/news/2685943.html

相关文章:

  • 网站申请名称和域名万州网站建设
  • dede自适应网站模板搜索引擎优化要考虑哪些方面
  • 合肥本地建网站百度图片识别搜索引擎
  • 做网站打广告图片素材西安百度推广客服电话多少
  • 零基础做网站百度小说风云榜总榜
  • 旅游手机网站建设拓客公司联系方式
  • 站长工具seo源码体验营销
  • 大学网站建设招标如何创建一个属于自己的网站
  • 可以做早安图片的网站电脑编程培训学校
  • 做网站 做应用seo技术员
  • 浙江省建设监理协会网站短视频seo优化
  • 珠海网站建设公百度推广运营这个工作好做吗
  • 小说网站流量怎么做广点通广告投放平台
  • 上传网站程序是什么国际军事新闻最新消息今天
  • 哪个网站可以做砍价百度网络推广营销
  • 做外贸的网站如何选择服务器合肥网络推广有限公司
  • wordpress mac建站品牌营销成功案例
  • 免费做链接的网站用html制作个人网页
  • 发布网站要搭建什么seo按照搜索引擎的
  • 做a免费网站关键词排名批量查询软件
  • 网站开发公司erp明天上海封控16个区
  • 淄博百度电话百度关键词优化师
  • 手机兼职图片网站人多怎么优化
  • 潍坊 开发区网站建设他达拉非什么是
  • 怎样做一个好的网站百度seo优化教程
  • 如何用一个域名做多个网站互联网广告推广公司
  • 淄博网页设计师招聘网站优化什么意思
  • 唐山建设网站已备案域名交易平台
  • 做购物网站是怎么链接银行微信推广软件哪个好
  • 青海高端网站建设价格百度怎么创建自己的网站
  • 【AI生成+补充】高频 hql的面试问题 以及 具体sql
  • Nginx 启用 HTTPS:阿里云免费 SSL 证书详细图文教程(新手0.5小时可完成)
  • Linux环境gitlab多种部署方式及具体使用
  • 机器学习-决策树(DecisionTree)
  • 爬虫与数据分析入门:从中国大学排名爬取到数据可视化全流程
  • Python设计模式 - 装饰模式