首页 文章 精选 留言 我的

精选列表

搜索[图像感知],共10000篇文章
优秀的个人博客,低调大师

使用jQuery Jcrop 图像裁剪无法更换图片的解决方案

​ 因为公司需求,之前的一个老项目需要完成一个显示屏定制的业务,用户自主上传图片然后在线裁剪的功能,我选择了jQuery Jcrop这个插件。 先看看怎么使用 使用方法 载入 CSS 文件 <link rel="stylesheet" href="jquery.Jcrop.css"> 载入 JavaScript 文件 <script src="jquery.js"></script> <script src="jquery.Jcrop.js"></script> 给 IMG 标签加上 ID <img id="element_id" src="pic.jpg"> 调用 Jcrop $('#element_id').Jcrop(); 就不展示具体代码了,最终实现的图需要是这样。 实际操作 重点来了,敲黑板 举个栗子:当你上传一张图片后裁剪,忽然这个时候你发现当前图片可能不适用,当你重新上传图片后,发现裁剪后的图片变了,但是上传的图片没变。如下图 这就很尴尬了,于是我就看上传后的图片地址 可以看下我的标注,其实你重新上传后,原图片地址已经改变了,但是jcorp操作的不是原始的img那个对象了,是jcorp生成的img对象。 这不是玩我么,于是一顿百度谷歌搜索看看有没有大佬遇到过,还是有发现的。 有人说使用jcorp的setImage方法设置图片地址,也有人说把定义的jcrop_api, boundx, boundy变成全局变量(变量名不是固定的, 你定义成什么就用什么)。boundx和boundy是用于记录选择的原始图片尺寸与在弹窗上展现尺寸的缩小/放大比例的,前面的jcrop_api变量用于获取到所有jcropd 的API。 也不知道是我操作失误,还是就是这个插件年久失修,我用了上面的所有解决方案都是不行。 于是乎我决定另辟蹊径,为何我不上传图片时直接操作jcrop的IMG对象呢?把上传后的图片地址赋值给Jcrop的图片地址。 var reader = new FileReader(); reader.onload = function (evt) { $('#uploadImg').attr("src", evt.target.result) $('#jcropImg').attr("src", evt.target.result) $('#preview').removeClass("hidden"); $('.preview-container').removeClass("hidden"); $(".jcrop-holder img").attr("src",$('#uploadImg').attr("src")) //这里就是直接操作的Jcrop previewNewImg() //裁剪方法 } reader.readAsDataURL(file.files[0]); ok,大功告成。 总结 偷了个懒,直接使用插件裁剪,但是Jcrop这个裁剪插件最后一次更新是14年,所以说可能遗留了很多问题,虽然是一个骚操作,但是实属无奈之举,有朋友有更好的解决方法请不要吝啬。

优秀的个人博客,低调大师

图像识别攻击还没完全解决,语音识别攻击又来了!

当前的语音识别技术发展良好,各大公司的语音识别率也到了非常高的水平。语音识别技术落地场景也很多,比如智能音箱,还有近期的谷歌 IO 大会上爆红的会打电话的 Google 助手等。本文章的重点是如何使用对抗性攻击来攻击语音识别系统。本文发表在 The Gradient 上,雷锋网将全文翻译如下。 假设你在房间的角落放一台低声嗡嗡作响的设备就能阻碍 NSA 窃听你的私人谈话。你会觉得这是从来自科幻小说吗?其实这项技术不久就会实现。 今年 1 月,伯克利人工智能研究人员 Nicholas Carlini 和 David Wagner 发明了一种针对语音识别 AI 的新型攻击方法。只需增加一些细微的噪音,这项攻击就可以欺骗语音识别系统使它产生任何攻击者想要的输出。论文已经发表在 https://arxiv.org/pdf/1801.01944

优秀的个人博客,低调大师

关于安卓图像显示比iOS差的原因(英文文档)

There are so many comparations between Android phone and iPhone. We cannot make the conclusion about which one is better, but we all knows that the image quality of Android phone is much worse than iPhone. No matter you are using Facebook, Twitter or even Instagram, after taking the photo, adding a filter, then sharing to the social network, the images produced by Android phone are always coarse. Why? Our team had been working on this issue in the last year. After very deep research, we found that this was a "TINY" mistake made by Google. Although tiny, but the influence was very huge (all Android Apps related to image), and lasted till today. The problem is : libjpeg. We all know that libjpeg is widely used open source JPEG library. Android also uses libjpeg to compress images. After digging into the source code of Android, we can find that instead of using libjpeg directly, Android is based on an open source image engine called Skia. The Skia is a wonderful engine maintained by Google himself, all image functions are implemented in it, and it is widely used by Google and other companies' products (e.g.: Chrome, Firefox, Android......). The Skia has a good encapsulation of libjpeg, you can easily develop image utilites base on this engine. When using libjpeg to compress images, optimize_coding is a very important parameter. In libjpeg.doc, we can find following introductions about this parameter: boolean optimize_coding TRUE causes the compressor to compute optimal Huffman coding tables for the image. This requires an extra pass over the data and therefore costs a good deal of space and time. The default is FALSE, which tells the compressor to use the supplied or default Huffman tables. In most cases optimal tables save only a few percent of file size compared to the default tables. Note that when this is TRUE, you need not supply Huffman tables at all, and any you do supply will be overwritten. As the libjpeg.doc, we now know that because setting the optimize_coding to TRUE may cost a good deal of space and time, the default in libjpeg is FALSE. Everything seems fine about the doc, and libjpeg is very stable. But many people ignored that this document was writen for more than 10 years. At that time, space and computing abilities are very limited. With today's modern computers or even mobile phones, this is not an issue. On the contrary, we should pay more attention to the image quality (retina screens) and image size (cloud services). Google's engineers of skia project did not set this parameter, so the optimize_coding in Skia was remained to FALSE as the default value, and Skia concealed this setting, you could not change the setting outside of Skia. This became to a big problem, we had to endure worse image and bigger file size. Our team had tested optimize_coding for many different images. If you want the same quality of image compressing, the file size are 5-10 times bigger when setting the optimze_coding to FALSE than to TRUE. The difference is quite significant. We also compared the jpeg compressing between iOS and Android (they both concealed the optimize_coding parameter). With the same original images, if you want same quality level, you need 5-10 times file size on Android. The result is clear, Apple does know the importance of optimize_coding and Huffman tables and Google does not. (Apple uses their own Huffman table algorithm, not like libjpeg or libjpeg-turbo. It seems that Apple has done more tuning works on image compressing.) Finally, we decided not to use JPEG compress functions provided by Android, and we compiled our own native library based on libjpeg-turbo (libjpeg-turbo also has performance improvements). Now we can save 5-10 times of image space and enjoy the same or even better image quality. This work is totally worth to do. Thanks for reading, :) Our project on github: https://github.com/bither

优秀的个人博客,低调大师

档案八防一体化系统解耦:环境感知模块与设备控制模块分离设计

档案库房"八防"(防火、防盗、防潮、防光、防尘、防高温、防低温、防虫)一体化系统在实际落地中,普遍存在将传感器采集、逻辑判断、设备驱动全部耦合在单一控制器或单一软件进程中的做法。初期看似简洁,但随着系统规模扩大、设备种类增多、联动逻辑复杂化,耦合架构的隐性代价逐渐暴露:

资源下载

更多资源
腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

Sublime Text

Sublime Text

Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。

WebStorm

WebStorm

WebStorm 是jetbrains公司旗下一款JavaScript 开发工具。目前已经被广大中国JS开发者誉为“Web前端开发神器”、“最强大的HTML5编辑器”、“最智能的JavaScript IDE”等。与IntelliJ IDEA同源,继承了IntelliJ IDEA强大的JS部分的功能。

用户登录
用户注册