import processing.core.PShape; //导入方法依赖的package包/类

public void updateAnim(){

if(pg_src_small == null){

createScene();

}

int num_x = pg_src_small.width;

int num_y = pg_src_small.height;

DwFilter.get(context).gaussblur.apply(pg_src, pg_src, pg_src_tmp, 3);

pg_src_small.beginDraw();

pg_src_small.image(pg_src, 0, 0, num_x, num_y);

pg_src_small.endDraw();

opticalflow.update(pg_src);

DwFilter.get(context).copy.apply(opticalflow.frameCurr.velocity, tex_vel_small);

flow = tex_vel_small.getFloatTextureData(flow);

DwFilter.get(context).gaussblur.apply(pg_src_small, pg_src_small, pg_src_small_tmp, 3);

pg_src_small.loadPixels();

float scene_dimx = bounds[3] - bounds[0];

float scene_dimy = bounds[4] - bounds[1];

float scene_dimz = bounds[5] - bounds[2];

float bounds_off = 100;

float dimx = (scene_dimx - bounds_off*2) / num_x;

float dimy = (scene_dimy - bounds_off*2) / num_y;

float dim = min(dimx, dimy);

float tx = -dim * num_x * 0.5f;

float ty = -dim * num_y * 0.5f;

float tz = 10;

for(int y = 0; y < num_y; y++){

for(int x = 0; x < num_x; x++){

int idx = y * num_x + x;

int rgb = pg_src_small.pixels[idx];

int r = (rgb >> 16) & 0xFF;

int g = (rgb >> 8) & 0xFF;

int b = (rgb >> 0) & 0xFF;

int flow_idx = (num_y - y - 1) * num_x + x;

float flows = 3;

float flowx = flow[flow_idx * 2 + 0] * +flows;

float flowy = flow[flow_idx * 2 + 1] * -flows;

float flow_mm = flowx*flowx + flowy*flowy;

float flow_m = (float) Math.pow(flow_mm, 0.5f);

float gray = (r + g + b) / (3f * 255f);

float px = x * dim;

float py = y * dim;

float pz = scene_dimz * gray * 0.25f + +flow_m;

pz = max(pz, 0);

PShape cube = shp_cubes[idx];

cube.resetMatrix();

cube.scale(dim);

cube.translate(tx+px, ty+py, tz+pz);

cube.setFill(rgb);

}

}

}

java shape用法_Java PShape.scale方法代码示例相关推荐

  1. java secretkey用法_Java SecretKeyFactory.generateSecret方法代码示例

    本文整理汇总了Java中javax.crypto.SecretKeyFactory.generateSecret方法的典型用法代码示例.如果您正苦于以下问题:Java SecretKeyFactory ...

  2. java polygon 用法_Java Polygon.getBounds方法代码示例

    import java.awt.Polygon; //导入方法依赖的package包/类 private SelectionShape translatePointsToRealSize(Select ...

  3. java makedir用法_Java Files.makeDir方法代码示例

    import org.nutz.lang.Files; //导入方法依赖的package包/类 protected void download(String openid, String media_ ...

  4. java gettext用法_Java Context.getText方法代码示例

    import android.content.Context; //导入方法依赖的package包/类 /** * Song Details * * @param context * @param t ...

  5. java listview用法_Java ListView.setMultiChoiceModeListener方法代码示例

    import android.widget.ListView; //导入方法依赖的package包/类 @Override public void onActivityCreated(@Nullabl ...

  6. java gettext用法_Java Label.getText方法代码示例

    import javafx.scene.control.Label; //导入方法依赖的package包/类 private void initVBox(){ ClassNode node = (Cl ...

  7. java connection用法_Java Connection.close方法代码示例

    import sun.rmi.transport.Connection; //导入方法依赖的package包/类 /** * handleMessages decodes transport oper ...

  8. java settext用法_Java JFormattedTextField.setText方法代码示例

    import javax.swing.JFormattedTextField; //导入方法依赖的package包/类 /** * Creates a {@link JFormattedTextFie ...

  9. java args包_Java Args.positive方法代码示例

    import org.apache.http.util.Args; //导入方法依赖的package包/类 /** * Creates new instance of BHttpConnectionB ...

最新文章

  1. Linux中的环境变量知多少?
  2. Asp.net中的两种刷新父窗体方法
  3. 计算机题windows如何操作,2015年职称计算机Windows操作系统模拟题(二)
  4. 中yeti不能加载_将 PQ 查询加载到 Excel 中进行分析的三种常用的方式
  5. 阿里云轻应用服务器 宝塔面板 mongodb 配置外网连接 其一 基础配置
  6. 微信小程序实现选项卡
  7. 客户端连接故障检查流程手段
  8. html5画安卓机器人,HTML5用户笔画形状检测机器人
  9. 记录自己的gitlab搭建之旅
  10. Vue 项目在 IE11 中数据更改后页面数据无变化
  11. 阶段3 2.Spring_07.银行转账案例_5 编写业务层和持久层事务控制代码并配置spring的ioc...
  12. 收藏十一种常用简单实用漂亮的HTML表格样式
  13. 如果你热爱编码,就应该少写代码
  14. 穆穆推荐-软件销售行业软件公司销售参考操作手册-之5-软件行业客户分类及销售人员激励
  15. 【DIP/数字图像处理】第二次习题(DCT、DFT、DWT、DHT频谱分布;证明DFT平移性质;ILF与BLF的区别)
  16. Linux 7.9.三台机器机器免密码登录
  17. 【水文模型】04 参数识别与敏感性分析方法
  18. 实时获取浏览器的地址栏的网页地址
  19. 一个屌丝程序猿的人生(一百零四)
  20. 芯洲科技SCT2450Q完全替代TPS54540,车规级芯片

热门文章

  1. tf.squeeze
  2. ./src/cuda.c:36: check_error: Assertion `0‘ failed
  3. ubuntu 安装 postgres
  4. java自定义类怎么比大小_实战:Java 扑克牌比较游戏
  5. 指令流水 一个时钟周期 出一个结果_以SM3算法为例,构建一个软硬协作算法加速器:性能分析与优化...
  6. 文巾解题 46. 全排列
  7. 数学建模太难,如何以Tableau可视化的方式打开?
  8. Flink从入门到精通100篇(二十二)-Apache Flink OLAP引擎性能优化及应用
  9. LeetCode题组:第1162题-地图分析
  10. python的des和3des加解密