各种抠图动态图片_聊天不用打字图片表情 不打字了动态让图说话

b2720dddb8a0c49ffd724cff2bf0d739.gif

b687d45775f340904b8b50daa7ebaaca.gif

  1、有些压力总是得自己扛过去,说出来就成了充满负能量的抱怨。寻求安慰也无济于事,还徒增了别人的烦恼。而当你独自走过艰难险阻,一定会感激当初一声不吭咬牙坚持着的自己。

cb8c48e2869d3434b1c7182a417cb15c.gif

  2、生活总是这样,不能叫人处处都满意。但我们还要热情地活下去。人活一生,值得爱的东西很多,不要因为一个不满意,就灰心。

d717377db56f3b3bb2a8e0403dd31924.gif

  3、渐渐的知道了,很多东西可遇而不可求,不属于自己的,何必拼了命去在乎。你在意什么,什么就会折磨你。“期待”是所有心痛的根源。

cbc6fba58273dbce896a07b4063c9323.gif

  4、将你的样子刻进脑海,将你的笑意藏在心底,把阳光星辰和白云都送给你,喧嚣和明亮与你一起醒来,也带来新日的欢愉与幸福。早安!

d28a0b72e473d186a3c15b81d96f9d8d.gif

  5、人,不过一捻土;命,不过一瞬间。活着,就要学会放弃,学会珍惜,学会成长;活着,就要生存,就要努力去证明,去不懈的追求,去默默的付出!

3a1d03d39bc8ebddc071239c6ccb6c34.gif

  6、我对自己的要求很低:我活在世上,无非想要明白些道理,遇见些有趣的事。倘能如我愿,我的一生就算成功。

fcfdf4f43cffbe85f8082d2968e1e3e0.gif

  7、岁月会沉淀出美好,当下的努力,是为了酝酿日后的得意,未来你只需要比一个人更好,那个人就是现在的你!抓住当下,让它成为完美时刻。早安!

a500863684e625f122272d09919ffd57.gif

  8、喝着孤独的酒,吹着自由的风,等一个没有归期的人,在余生里做着只有自己的梦。

90aee1f88679dffa98d6da7df74f57d3.gif

  9、从今天开始,不论发生什么事,每天微笑吧,世上除了生死,都是小事。不管遇到了什么烦心事,都不要自己为难自己。

8e7cc55c8c54c061732a5c1f484d4d61.gif

  10、太多的情话让人矫情,太多的哲理让人麻木,太多的现实让我们显得世故,单纯,是多么奢侈。

43dd8b3aeae42fd2e21290c4ae88186f.png

a171e9df542b5e3759cfef912ab69759.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Java 本身并没有提供抠图的相关功能,需要借助第三方库或者自己实现算法来实现抠图。 一种常见的抠图方法是基于 ACRush 的 GrabCut 算法,通过手动标记前景和背景区域,算法能够根据这些标记自动分割像。 Java 中可以使用 OpenCV 提供的 Java 接口来实现 GrabCut 算法。具体步骤如下: 1. 加载需要抠图图片。 2. 创建一个和图片大小相同的掩码,用来标记前景和背景区域(0 表示背景,1 表示前景,2 表示未确定区域)。 3. 手动使用鼠标在图片上标记前景和背景区域,将标记信息保存到掩码中。 4. 调用 OpenCV 提供的 GrabCut 方法,输入原始图片和掩码,得到分割结果。 5. 根据分割结果,将前景区域保留,其他区域设置为透明,输出抠图结果。 以下是示例代码: ``` import org.opencv.core.Core; import org.opencv.core.Mat; import org.opencv.core.Rect; import org.opencv.core.Scalar; import org.opencv.highgui.HighGui; import org.opencv.imgcodecs.Imgcodecs; import org.opencv.imgproc.Imgproc; import org.opencv.photo.Photo; import java.awt.*; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; public class ImageCut { static { System.loadLibrary(Core.NATIVE_LIBRARY_NAME); } private static final Scalar RECT_COLOR = new Scalar(0, 255, 0); private static final Scalar BG_COLOR = new Scalar(0, 0, 255); private static final Scalar FG_COLOR = new Scalar(255, 0, 0); private static Point startPoint = new Point(0, 0); private static Point endPoint = new Point(0, 0); private static boolean isDrawing = false; public static void main(String[] args) { Mat img = Imgcodecs.imread("input.jpg"); Mat mask = new Mat(); Mat bgdModel = new Mat(); Mat fgdModel = new Mat(); Mat result = new Mat(); Imgproc.cvtColor(img, img, Imgproc.COLOR_BGR2RGB); grabCut(img, mask, bgdModel, fgdModel, result, 5); showResult(img, result); Imgcodecs.imwrite("output.png", result); } private static void grabCut(Mat img, Mat mask, Mat bgdModel, Mat fgdModel, Mat result, int iterCount) { Mat bgd = new Mat(); Mat fgd = new Mat(); Imgproc.cvtColor(img, img, Imgproc.COLOR_RGB2BGR); Rect rect = newRect(img.width(), img.height()); Imgproc.grabCut(img, mask, rect, bgdModel, fgdModel, iterCount, Imgproc.GC_INIT_WITH_RECT); Core.compare(mask, new Scalar(Imgproc.GC_PR_FGD), bgd, Core.CMP_EQ); Core.compare(mask, new Scalar(Imgproc.GC_FGD), fgd, Core.CMP_EQ); Mat bgModel = new Mat(), fgModel = new Mat(); Photo.estimateNewBackgroundModel(img, bgd, mask, bgModel); Imgproc.grabCut(img, mask, rect, bgModel, fgModel, iterCount, Imgproc.GC_INIT_WITH_MASK); Core.compare(mask, new Scalar(Imgproc.GC_PR_FGD), bgd, Core.CMP_EQ); Core.compare(mask, new Scalar(Imgproc.GC_FGD), fgd, Core.CMP_EQ); result.setTo(new Scalar(0, 0, 0, 0)); img.copyTo(result, fgd); } private static Rect newRect(int w, int h) { int x = w * 2 / 5; int y = h * 2 / 5; int w1 = w * 4 / 5; int h1 = h * 4 / 5; return new Rect(x, y, w1, h1); } private static void showResult(Mat img, Mat result) { HighGui.imshow("Input Image", img); HighGui.setMouseCallback("Input Image", new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { switch (e.getButton()) { case MouseEvent.BUTTON1: if (!isDrawing) { startPoint = getPoint(e); } else { endPoint = getPoint(e); drawRect(img, result); } isDrawing = !isDrawing; break; case MouseEvent.BUTTON3: splitImage(img, result); break; default: break; } } }); HighGui.imshow("GrabCut", result); HighGui.waitKey(); } private static Point getPoint(MouseEvent e) { return new Point(e.getX(), e.getY()); } private static void drawRect(Mat img, Mat result) { Rect rect = new Rect(startPoint, endPoint); Imgproc.rectangle(img, rect.tl(), rect.br(), RECT_COLOR, 2, Imgproc.LINE_AA, 0); Rect sub = new Rect(rect.x, rect.y, rect.width, rect.height); Core.subtract(new Scalar(1.0), new Mat(result, sub), new Mat(result, sub)); result.setTo(FG_COLOR, new Mat(result, sub)); HighGui.imshow("Input Image", img); } private static void splitImage(Mat img, Mat result) { for (int i = 0; i < result.rows(); i++) { for (int j = 0; j < result.cols(); j++) { if (result.get(i, j)[0] == Imgproc.GC_BGD || result.get(i, j)[0] == Imgproc.GC_PR_BGD) { result.put(i, j, new double[]{0, 0, 0, 0}); } } } Imgproc.cvtColor(result, result, Imgproc.COLOR_RGBA2RGB); HighGui.imshow("Input Image", img); HighGui.imshow("GrabCut", result); } } ``` 运行结果如下: ![](https://img-blog.csdnimg.cn/2021100601182538.png)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值