android可见即可说实现方案
- 依赖于科大讯飞的asr识别能力,使用Android无障碍服务获取页面文本作为热词,注册到讯飞api,注册过后语音识别到热词的asr返回,利用WindowManager和无障碍的点击实现可见即可说功能
##  无障碍服务获取需要注册的热词
```
package com..model;import android.accessibilityservice.AccessibilityService;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.graphics.Rect;
import android.os.IBinder;
import android.util.Log;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import androidx.lifecycle.Observer;
import .HotWordsBean;
import .GsonUtil;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;public class MyAccessibilityService extends AccessibilityService implements IAccessibilityHotWord {private String TAG = MyAccessibilityService.class.getSimpleName();private StringBuilder hotWords = new StringBuilder();private VrSpService vrSpeechService;private HotWordsBean hotWordsBean = new HotWordsBean();private AccessibilityNodeInfo rootInActiveWindow;private Set<AccessibilityNodeInfo> accessibilityNodeInfoSet = new HashSet<>();HotWordsBean.UserDataBean userDataBean = new HotWordsBean.UserDataBean();HotWordsBean.UserDataBean.CMD cmd = new HotWordsBean.UserDataBean.CMD();private String hotWordJsonString = "";private Context context;@Overridepublic void onCreate() {super.onCreate();Log.i(TAG, "------------ super.onCreate --------------------: ");bindVrSpeechService();context = this;HotWordReceiver.hotWordLiveData.observeForever( new Observer<String>() {@Overridepublic void onChanged(String hotWord) {Log.d(TAG, "onChanged: ytf ------------ hotWord change :" + hotWord);if (accessibilityNodeInfoSet.size() > 0) {for (AccessibilityNodeInfo nodeInfo : accessibilityNodeInfoSet) {if (nodeInfo.getText() != null && nodeInfo.getText().toString().equalsIgnoreCase(hotWord)) {Log.d(TAG, "ytf, hotWord Shot:" + hotWord);handlePerformAction(hotWord);}}} else {Log.d(TAG, "ytf hotWord Shot: accessibilityNodeInfoSet size = " + accessibilityNodeInfoSet.size());}}});}@Overridepublic void onAccessibilityEvent(AccessibilityEvent accessibilityEvent) {String packageName = accessibilityEvent.getPackageName() == null ? "" : accessibilityEvent.getPackageName().toString();if (!"com.saicmotor.settings".equals(packageName)) {return;}int eventType = accessibilityEvent.getEventType();
// Log.d(TAG, "ytf,onAccessibilityEvent [eventType: " + eventType + "], [ packageName: " + packageName + "]");switch (eventType) {
// case AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED:case AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED:case AccessibilityEvent.TYPE_VIEW_CLICKED:accessibilityNodeInfoSet.clear();hotWords.setLength(0);rootInActiveWindow = getRootInActiveWindow();if (null == rootInActiveWindow) {Log.d(TAG, "ytf, onAccessibilityEvent: rootInActiveWindow == null");return;} else {recycle(rootInActiveWindow);}String[] splitHotWords = hotWords.toString().split(",");//vrSpeechService.notifyHotWordLoad(GsonUtil.HOT_WORD_TEST_1);hotWordsBean.setHotWords(splitHotWords);cmd.setActiveStatus("");userDataBean.setCmd(cmd);hotWordsBean.setUserData(userDataBean);try {hotWordJsonString = GsonUtil.getInstance().getGson().toJson(hotWordsBean);if (hotWordJsonString != null) {vrSpeechService.notifyHotWordLoad(hotWordJsonString);Log.d(TAG, "onAccessibilityEvent: ytf, hotWordJsonString = " + hotWordJsonString);}} catch (Exception e) {Log.e(TAG, "onAccessibilityEvent: ytf, e: " + e.toString());}break;default:break;}}private void recycle(AccessibilityNodeInfo info) {if (info.getChildCount() == 0) {if ("android.widget.SeekBar".equals(info.getClassName())) {
// Class<? extends AccessibilityNodeInfo> aClass = info.getClass();
// Log.d(TAG, "recycle: ytf aClass = " + aClass.getSimpleName());
// SeekBar seekBar = (SeekBar) info.getClassName();
// Log.d(TAG, "recycle: ytf, SeekBar 调节前:" + seekBar.getProgress() + ", getViewIdResourceName:" + info.getViewIdResourceName());
// Bundle bundle = new Bundle();
// bundle.putFloat(AccessibilityNodeInfo.ACTION_ARGUMENT_PROGRESS_VALUE, 50.0f);
// seekBar.performAccessibilityAction(R.id.accessibilityActionSetProgress, bundle);
// Log.d(TAG, "recycle: ytf, SeekBar 调节后:" + seekBar.getProgress() + ", getViewIdResourceName:" + info.getViewIdResourceName());} else if ("android.widget.ScrollView".contentEquals(info.getClassName())) {
// Log.d(TAG, "recycle: ytf, android.widget.ScrollView ACTION_SCROLL_FORWARD");
// info.performAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);}
// Log.i(TAG, "recycle ytf, [ClassName: " + info.getClassName() + "], [Text: " + info.getText() + "], [resId: " + info.getViewIdResourceName() + "]");if (null != info.getText()) {String text = info.getText().toString();hotWords.append(text + ",");accessibilityNodeInfoSet.add(info);}} else {for (int i = 0; i < info.getChildCount(); i++) {if (info.getChild(i) != null) {
// Log.d(TAG, "ytf 容器: [" + info.getClassName() + "], [resId:" + info.getViewIdResourceName() + "]");recycle(info.getChild(i));}}}}private void handlePerformAction(String targetHotWord) {Log.d(TAG, "handlePerformAction: ytf, accessibilityNodeInfoSet.size = " + accessibilityNodeInfoSet.size());for (AccessibilityNodeInfo nodeInfo : accessibilityNodeInfoSet) {
// Log.d(TAG, "ytf handlePerformAction: nodeInfo.getText().toString() = " + nodeInfo.getText().toString() + ", targetHotWord = " + targetHotWord);if (nodeInfo.getText().toString().equalsIgnoreCase(targetHotWord)) {Log.d(TAG, "ytf, 命中可见即可说 handlePerformAction: " + nodeInfo.getText().toString());forceClick(nodeInfo);
// nodeInfo.performAction(AccessibilityNodeInfo.ACTION_CLICK);}}}private void forceClick(AccessibilityNodeInfo nodeInfo) {Log.d(TAG, "forceClick: ytf,------------");try {Rect rect = new Rect();nodeInfo.getBoundsInScreen(rect);Log.d(TAG, "ytf, forceClick: " + rect.left + " " + rect.top + " " + rect.right + " " + rect.bottom);int x = (rect.left + rect.right) / 2;int y = (rect.top + rect.bottom) / 2;String cmd = "input tap " + String.valueOf(x) + " " + String.valueOf(y);ProcessBuilder builder = new ProcessBuilder();String[] order = {"input","tap",String.valueOf(x),String.valueOf(y)};try {builder.command(order).start();Log.d(TAG, "ytf, forceClick: [ " + x + ", " + y + "]");} catch (IOException e) {Log.d(TAG, "ytf, forceClick: error: " + e.toString());}} catch (Exception e) {Log.e(TAG, "ytf,error forceClick: " + e.toString());}}@Overridepublic void onInterrupt() {Log.i(TAG, "ytf, onInterrupt");}private void bindVrSpeechService() {Intent intent = new Intent(getApplicationContext(), VrSpeechService.class);boolean result = bindService(intent, serviceConnection, Context.BIND_AUTO_CREATE);Log.d(TAG, "vrSpeechService: ytf bind result:" + result);}private ServiceConnection serviceConnection = new ServiceConnection() {@Overridepublic void onServiceConnected(ComponentName componentName, IBinder iBinder) {try {vrSpeechService = ((VrSpeechService.LocalBinder) iBinder).getService();Log.d(TAG, "onServiceConnected: ytf, vrSpeechService bind ");vrSpeechService.setAccessibilityHotWord((IAccessibilityHotWord) context);} catch (Exception e) {e.printStackTrace();Log.e(TAG, "ytf, onServiceConnected: " + e.toString() );}}@Overridepublic void onServiceDisconnected(ComponentName componentName) {}};@Overridepublic void hotWordShot(String hotWord) {
// Log.d(TAG, "ytf, hotWordShot: " + hotWord);if (accessibilityNodeInfoSet.size() > 0) {for (AccessibilityNodeInfo nodeInfo : accessibilityNodeInfoSet) {if (nodeInfo.getText().toString().equalsIgnoreCase(hotWord)) {Log.d(TAG, "ytf, hotWordShot:" + hotWord);handlePerformAction(hotWord);}}} else {Log.d(TAG, "ytf hotWordShot: accessibilityNodeInfoSet size = " + accessibilityNodeInfoSet.size());}}
}```
-
清单文件:
<meta-dataandroid:name="android.accessibilityservice"android:resource="@xml/accessibility" /></service><receiver android:name="com.saicmotor.voiceservice.model.HotWordReceiver"android:exported="true"android:enabled="true"><intent-filter android:priority="1000"><action android:name="com.saicmotor.voiceservice.hotword"/></intent-filter></receiver> -
@xml/accessibility
<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"android:accessibilityEventTypes="typeAllMask"android:accessibilityFeedbackType="feedbackGeneric"android:canRetrieveWindowContent="true"android:canPerformGestures="true"android:accessibilityFlags="flagReportViewIds"android:notificationTimeout="2000"/>
-
模拟asr热词命中
/**
* @Author yangtianfu
* @Date 2023/9/15 13:05
* @Describe 监听热词回传执行可见可说
* adb shell am broadcast -a com.saicmotor.voiceservice.hotword -n com.saicmotor.voiceservice/.model.HotWordReceiver --es hotWord “sound”
*/
public class HotWordReceiver extends BroadcastReceiver {
private static final String TAG = “HotWordReceiver”;
private final String ACTION_HOT_WORD_RECEIVER = “com.saicmotor.voiceservice.hotword”;
// private IAccessibilityHotWord iAccessibilityHotWord;
public static MutableLiveData hotWordLiveData = new MutableLiveData<>();@Overridepublic void onReceive(Context context, Intent intent) {String action = intent.getAction();Log.d(TAG, "ytf, onReceive: intent,action = " + action);if (ACTION_HOT_WORD_RECEIVER.equals(action)) {String hotWord = intent.getStringExtra("hotWord");Log.d(TAG, "ytf, onReceive: com.saicmotor.voiceservice.hotword :" + hotWord);hotWordLiveData.postValue(hotWord);}}}
## 科大讯飞注册热词热词格式:public static final String HOT_WORD_TEST_1 = "{\n" +" \"HotWords\":[\"High\"],\n" +" \"UserData\":{\n" +" \"cmd\":{\n" +" \"activeStatus\":\"bg\",\n" +" \"data\":{\n" +"\n" +" },\n" +" \"sceneStatus\":\"default\"\n" +" }\n" +" }\n" +"}";int result = libisssr.uploadData(hotWords, 2);
##  VuiService.java语音Vui服务(带有语音形象的app)
透明activity无法跨应用实现点击穿透效果,会导致可见即可说点击无效果,需要在service中使用WindowManager的addview方法,把语音的app作为view添加到WindowManager中,这样就可以实现语音app全透明状态下识别到asr之后可以利用Android无障碍服务去点击指定位置或者指定控件。public class VoiceVuiService extends Service {private WindowManager.LayoutParams mParams;private WindowManager mWindowManager;private ImageView voiceImage;private TextView textView;@Overridepublic void onCreate() {mParams = new WindowManager.LayoutParams();//设置type.系统提示型窗口,一般都在应用程序窗口之上.mParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
// mParams.type = WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY;//设置效果为背景透明.
// mParams.format = PixelFormat.RGBA_8888;mParams.format = PixelFormat.TRANSLUCENT;//设置flags.不可聚焦及不可使用按钮对悬浮窗进行操控.
// mParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE |
// WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FIRST_SYSTEM_WINDOW;mParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;mParams.alpha = 0.8f;mWindowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);DisplayMetrics dm = new DisplayMetrics();mWindowManager.getDefaultDisplay().getMetrics(dm);mParams.width = 136;mParams.height = 136;
// mParams.x = 100;
// mParams.y = 100;voiceImage = new ImageView(this);voiceImage.setBackground(getResources().getDrawable(R.mipmap.assistant100025));textView = new TextView(this);textView.setTextSize(36);textView.setTextColor(Color.RED);textView.setText("语音形象");// vrView = new HSPortraitVrViewForA11V(getApplicationContext());
// vrView.startFlipping();Log.d(TAG, "initView: ytf, dm.widthPixels = " + dm.widthPixels + ",mParams.height = " + mParams.height);mParams.gravity = Gravity.TOP;LogUtils.i(TAG, "onCreate.....");super.onCreate();-----------------------@Overridepublic int onStartCommand(Intent intent, int flags, int startId) {LogUtils.i(TAG, "onStartCommand,LteService onStartCommand");// Android 8以上特殊处理setNotificationChannel();
// mWindowManager.addView(voiceImage, mParams);
// mWindowManager.addView(textView, mParams);// if(CommonUtils.isUseHalfServiceMode()){
// if(offlineAgentService == null){
// bindHalfEngineService();
// }
// }return START_STICKY;}
-------------------------------@Overridepublic void onDestroy() {// if (voiceImage.getParent() != null) {
// mWindowManager.removeView(voiceImage);
// }
// if (textView.getParent() != null) {
// mWindowManager.removeView(textView);
// }super.onDestroy();}
相关文章:
android可见即可说实现方案
依赖于科大讯飞的asr识别能力,使用Android无障碍服务获取页面文本作为热词,注册到讯飞api,注册过后语音识别到热词的asr返回,利用WindowManager和无障碍的点击实现可见即可说功能 ##  无障碍服务获取需要注册的热词package com..mo…...
Pikachu Burte Force(暴力破解)
一、Burte Force(暴力破解)概述 “暴力破解”是一攻击具手段,在web攻击中,一般会使用这种手段对应用系统的认证信息进行获取。 其过程就是使用大量的认证信息在认证接口进行尝试登录,直到得到正确的结果。 为了提高…...
SpringMVC之JSON返回及异常处理
目录 JSON处理 导入依赖 配置Spring-mvc.xml ResponseBody注解使用 测试 目录 JSON处理 导入依赖 配置Spring-mvc.xml ResponseBody注解使用 测试 Jackson 定义 用法 常用注解 统一异常处理 为什么要全局异常处理? 异常处理思路 SpringMVC异常分类 综…...
SkyWalking快速上手(六)——告警
文章目录 前言一、什么是SkyWalking的告警功能二、为什么要使用SkyWalking的告警功能1. 及时发现异常情况2. 提高故障处理效率3. 避免数据丢失和损坏4. 提升系统性能和稳定性 三、如何使用SkyWalking的告警功能1. 告警规则2. 告警通知3. 告警持续时间 四、注意事项1、合理设置告…...
docker run:--privileged=true选项解析(特权模式:赋予容器几乎与主机相同的权限)
文章目录 Docker的--privilegedtrue选项1. Docker 容器的安全性1.1 Linux Namespace 和 Capabilities1.2 限制和权限 2. Docker的--privilegedtrue选项2.1 --privilegedtrue的作用2.2 --privilegedtrue的风险 3. 结论 Docker的–privilegedtrue选项 Docker在创建和运行容器时&…...
计算机专业毕业设计项目推荐06-工作室管理系统(Java+Vue+Mysql)
工作室管理系统(JavaSpringVueMysql) **介绍****系统总体开发情况-功能模块****各部分模块实现****最后想说的****联系方式** 介绍 本系列(后期可能博主会统一为专栏)博文献给即将毕业的计算机专业同学们,因为博主自身本科和硕士也是科班出生,所以也比较…...
Python 文件的读写操作
文章目录 1. 文件对象1.1 文件打开方式1.1.1 打开文件1.1.2 关闭文件1.1.3 访问模式 1.2文件读取1.2.1 read()1.2.2 readline()1.2.3 readlines() 1.3 文件迭代1.4 文件输入1.4.1 write()1.4.2 writelines() 1. 文件对象 文件读写操作: 把大象放冰箱里,…...
多线程回顾、集合Collection、Set、List等基本知识
多线程回顾 问: 多线程的两种创建方式? 继承Thread类实现Runnable接口线程池Callable 问:多线程通常会遇到线程安全问题? 什么情况下会遇到线程安全问题? 答:一个数据被多个线程访问(有读有写) 解决这个问题的方式? SE:同步锁 synchronized A : 同步代码块 B : 同步方法…...
分享5款用起来很好用的软件,总有一款适合你
很多软件用起来很好用,但是由于这样那样的原因,一直没什么知名度,但是不代表它们不好用,我的任务就是把这些宝藏分享给大家。 1.图像处理——Photoscissors Photoscissors是一款在线图像背景移除工具,可以让你轻松地从…...
大数据学习1.5-单机Hadoop
1.修改主机信息 vi /etc/hosts 2.修改信息如下(这里第三位一定是自己的IP 每个人都不一样) 192.168.216.140 hadoop01 192.168.216.141 hadoop02 192.168.216.142 hadoop033.修改Hadoop配置信息-1进入配置信息文件 cd /usr/local/hadoop/hadoop-2.7.1/etc/hadoop/ 4.修改Had…...
Cesium对实体元素鼠标点击popup div信息框
一、简介 设置div信息框模板,给实体元素绑定事件,同步空间位置,然后在回调函数弹出信息框。 二、示例源码 <!DOCTYPE html> <html lang="en"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" …...
有多条业务线,mysql建多库多表比较好还是一个库多个表比较好呢?
这个问题的答案取决于您的具体需求。以下是一些需要考虑的因素: 数据独立性:如果您的业务线之间的数据是独立的,并且不太可能需要进行跨业务线的查询,那么将它们分成多个数据库可能是有意义的。这样可以使每个业务线的数据更加独…...
C++---异常处理
异常处理 异常处理try语句块和throw表达式异常的抛出和捕获异常的抛出和匹配原则 异常安全异常规范标准异常 异常处理 异常是指存在于运行时的反常行为,这些行为超出了函数正常功能的范围。当程序的某部分检测到一个他无法处理的问题时,需要用到异常处理…...
接口自动化测试(Python+Requests+Unittest)
(1)接口自动化测试的意义、前后端分离思想 接口自动化测试的优缺点: 优点: 测试复用性。 维护成本相对UI自动化低一些。 为什么UI自动化维护成本更高? 因为前端页面变化太快,而且UI自动化比较耗时(比如等待页面元素的…...
驱动开发,IO多路复用(select,poll,epoll三种实现方式的比较)
1.IO多路复用介绍 在使用单进程或单线程情况下,同时处理多个输入输出请求,需要用到IO多路复用;IO多路复用有select/poll/epoll三种实现方式;由于不需要创建新的进程和线程,减少了系统资源的开销,减少了上下…...
大数据-玩转数据-oracel字符串分割转化为多列
一、建表 create table split_string_test(id integer primary key,test_string varchar2(500) );二、插入测试数据 insert into split_string_test values(1, 10,11,12,13,14,22); insert into split_string_test values(2, 22,23,24); insert into split_string_test valu…...
GCP设置Proxy来连接Cloud SQL
在之前的文章用Google CDC来同步Cloud SQL的数据到Bigquery_gzroy的博客-CSDN博客中,我通过在一个VM上设置反向代理的方式,使得Datastream可以通过私用连接连到Cloud SQL数据库进行数据复制。但是这种方式不太方便,主要是VM的状态我们不太方便…...
Python:为何成为当下最热门的编程语言?
文章目录 🍋引言🍋1. 简单易学🍋2. 多领域应用🍋3. 强大的社区支持🍋4. 丰富的库和框架🍋5. 跨平台兼容🍋6. 开源和免费🍋7. 数据科学和人工智能的崛起🍋8. 自动化和脚本…...
【echarts入门】:vue项目中应用echarts
一.安装echarts 在项目集成终端下载echarts npm install echarts --save 二.全局引入 创建/components/echarts/index.js // 引入 echarts 核心模块,核心模块提供了 echarts 使用必须要的接口。 import * as echarts from "echarts/core";/** 引入任…...
Seata 源码篇之AT模式启动流程 - 上 - 02
Seata 源码篇之AT模式启动流程 - 02 自动配置两个关键点 初始化初始化TM初始化RM初始化TC 全局事务执行流程TM 发起全局事务GlobalTransactional 注解处理全局事务的开启 TM 和 RM 执行分支事务IntroductionDelegatingIntroductionInterceptorDelegatePerTargetObjectIntroduct…...
Leetcode 3576. Transform Array to All Equal Elements
Leetcode 3576. Transform Array to All Equal Elements 1. 解题思路2. 代码实现 题目链接:3576. Transform Array to All Equal Elements 1. 解题思路 这一题思路上就是分别考察一下是否能将其转化为全1或者全-1数组即可。 至于每一种情况是否可以达到…...
(二)TensorRT-LLM | 模型导出(v0.20.0rc3)
0. 概述 上一节 对安装和使用有个基本介绍。根据这个 issue 的描述,后续 TensorRT-LLM 团队可能更专注于更新和维护 pytorch backend。但 tensorrt backend 作为先前一直开发的工作,其中包含了大量可以学习的地方。本文主要看看它导出模型的部分&#x…...
1688商品列表API与其他数据源的对接思路
将1688商品列表API与其他数据源对接时,需结合业务场景设计数据流转链路,重点关注数据格式兼容性、接口调用频率控制及数据一致性维护。以下是具体对接思路及关键技术点: 一、核心对接场景与目标 商品数据同步 场景:将1688商品信息…...
Linux简单的操作
ls ls 查看当前目录 ll 查看详细内容 ls -a 查看所有的内容 ls --help 查看方法文档 pwd pwd 查看当前路径 cd cd 转路径 cd .. 转上一级路径 cd 名 转换路径 …...
《通信之道——从微积分到 5G》读书总结
第1章 绪 论 1.1 这是一本什么样的书 通信技术,说到底就是数学。 那些最基础、最本质的部分。 1.2 什么是通信 通信 发送方 接收方 承载信息的信号 解调出其中承载的信息 信息在发送方那里被加工成信号(调制) 把信息从信号中抽取出来&am…...
使用van-uploader 的UI组件,结合vue2如何实现图片上传组件的封装
以下是基于 vant-ui(适配 Vue2 版本 )实现截图中照片上传预览、删除功能,并封装成可复用组件的完整代码,包含样式和逻辑实现,可直接在 Vue2 项目中使用: 1. 封装的图片上传组件 ImageUploader.vue <te…...
vue3 定时器-定义全局方法 vue+ts
1.创建ts文件 路径:src/utils/timer.ts 完整代码: import { onUnmounted } from vuetype TimerCallback (...args: any[]) > voidexport function useGlobalTimer() {const timers: Map<number, NodeJS.Timeout> new Map()// 创建定时器con…...
云原生玩法三问:构建自定义开发环境
云原生玩法三问:构建自定义开发环境 引言 临时运维一个古董项目,无文档,无环境,无交接人,俗称三无。 运行设备的环境老,本地环境版本高,ssh不过去。正好最近对 腾讯出品的云原生 cnb 感兴趣&…...
佰力博科技与您探讨热释电测量的几种方法
热释电的测量主要涉及热释电系数的测定,这是表征热释电材料性能的重要参数。热释电系数的测量方法主要包括静态法、动态法和积分电荷法。其中,积分电荷法最为常用,其原理是通过测量在电容器上积累的热释电电荷,从而确定热释电系数…...
Python Ovito统计金刚石结构数量
大家好,我是小马老师。 本文介绍python ovito方法统计金刚石结构的方法。 Ovito Identify diamond structure命令可以识别和统计金刚石结构,但是无法直接输出结构的变化情况。 本文使用python调用ovito包的方法,可以持续统计各步的金刚石结构,具体代码如下: from ovito…...
