MATLAB【四】 ————批量适配图片信息与excel/txt等文档信息,批量移动拷贝图片,批量存图片中点和方框
1、批量读取图片,批量读取文件
2、适配文件与excel、txt等文档信息
3、获取显示图片ROI、Point、rect、更改像素值
4、批量移动拷贝图片,批量显示
5、保存显示图片或者图片中的点和方框。
clear;
clc;
close all;%% crop the im into 256*256
num = 0; %% num=1 内缩3个像素 num =2 内缩6个像素 load('qualitydata1.mat')
load('qualitydata2.mat')[data1_m,data1_n] = size(qualitydata1);
[data2_m,data2_n] = size(qualitydata2);%% read image_name in filepath% file_path = 'D:\matlab\motive_vs_exe\data\cg\30\15\';% 图像文件夹路径
% img_path_list_bmp = dir(strcat(file_path,'*.png'));%获取该文件夹中所有bmp格式的图像
% img_num = length(img_path_list_bmp);%获取图像总数量
% I=cell(1,img_num);
% if img_num > 0 %有满足条件的图像
% for j = 1:img_num %逐一读取图像
% image_name = img_path_list_bmp(j).name;% 图像名
% image = imread(strcat(file_path,image_name));
% I{j}=image;
% fprintf('%d %d %s\n',i,j,strcat(file_path,image_name));% 显示正在处理的图像名
% %图像处理过程 省略
% %这里直接可以访问细胞元数据的方式访问数据
% end
% end
%% readme suitable for three layers of the file like cg/30/1 cg/30/2 ... cg/30/10 .....cg/100/1 ...cg/100/10
%%
oriDataPath = 'D:\matlab\motive_vs_exe\data\';
saveDirPath = 'D:\matlab\motive_vs_exe\we_chat_data\';imgDataDirList = dir(oriDataPath); % 遍历所有文件
layer_1_list = imgDataDirList(3:end);
%
for i = 1:length(layer_1_list)layer_1_list_folder =layer_1_list(i,:).folder; layer_1_list_name =layer_1_list(i,:).name; layer_2_list = dir( fullfile(layer_1_list_folder,layer_1_list_name));layer_2_list = layer_2_list(3:end); for i2 = 1:length(layer_2_list)layer_2_list_folder=layer_2_list(i2,:).folder; layer_2_list_name =layer_2_list(i2,:).name; layer_3_list = dir( fullfile(layer_2_list_folder,layer_2_list_name));layer_3_list = layer_3_list(3:end); for i3 = 1:length(layer_3_list)layer_3_list_folder=layer_3_list(i3,:).folder; layer_3_list_name =layer_3_list(i3,:).name; layer_4_list = dir( fullfile(layer_3_list_folder,layer_3_list_name));layer_4_list = layer_4_list(3:end); % for i4 = 1:1
% layer_4_list_folder=layer_4_list(i4,:).folder; layer_4_list_folder=layer_4_list.folder;layer_4_list_name =layer_4_list(2,:).name;
% layer_5_list = fullfile(layer_3_list_folder,layer_3_list_name);for j = 1:data1_mkey = qualitydata1(j,:).key;key_fore = split(key,'.');str_key = key_fore(1); %%%% get excel strstr_key = replace(str_key,'/','\');%%%%%%%%%%%%%%%%%judge whether the%%%%%%%%%%%%%%%%%same depth and then deal with it str_aim = replace(layer_4_list_folder,oriDataPath,''); if(isequal(str_aim,str_key))rect_x = qualitydata1(j,:).rect_x;rect_y = qualitydata1(j,:).rect_y;rect_width = qualitydata1(j,:).rect_width;rect_height = qualitydata1(j,:).rect_height;point_0_x = qualitydata1(j,:).point_0_x;point_0_y = qualitydata1(j,:).point_0_y;point_1_x = qualitydata1(j,:).point_1_x;point_1_y = qualitydata1(j,:).point_1_y;point_2_x = qualitydata1(j,:).point_2_x;point_2_y = qualitydata1(j,:).point_2_y;point_3_x = qualitydata1(j,:).point_3_x;point_3_y = qualitydata1(j,:).point_3_y;point_4_x = qualitydata1(j,:).point_4_x;point_4_y = qualitydata1(j,:).point_4_y;%% change roi rect_x = rect_x + 3*num ;rect_y = rect_y + 3*num ;rect_width = rect_width - 2*3*num;rect_height = rect_height - 2*3*num;%% roi = [rect_x,rect_y,rect_width,rect_height];path_depth = fullfile(layer_4_list_folder,'depth.png');depth_image = imread(path_depth);path_ir = fullfile(layer_4_list_folder,'auto_rectified_ir.png');ir_image = imread(path_ir);path_rgb = fullfile(layer_4_list_folder,'rgb.jpg');rgb_image = imread(path_rgb);% figure, imshow(depth_image*255, 'border', 'tight') % Point = roi;% hold on;% rectangle('Position', roi, 'LineWidth', 2, 'EdgeColor', 'r') %%% rectangle('Position', Point, 'LineWidth', 2, 'EdgeColor', 'r')[image_h,image_w] = size(depth_image); for jj = 1:1:image_hfor ii = 1:1:image_wif ((jj>rect_y)&&(jj<rect_y + rect_height))if ((ii>rect_x)&&(ii<rect_x + rect_width))continue;elsedepth_image(jj,ii) = 0;endelsedepth_image(jj,ii) = 0;end endend%% imwshow(roi_depth,)
% figure, imshow(depth_image*255, 'border', 'tight') %%depth show figure, imshow(rgb_image, 'border', 'tight') %%rgb show Point = roi;hold on;rectangle('Position', roi, 'LineWidth', 2, 'EdgeColor', 'r') %%rectangle('Position', Point, 'LineWidth', 2, 'EdgeColor', 'r')text(point_0_x,point_0_y,'o','color','g'); %%key point show on rgbtext(point_1_x,point_1_y,'o','color','g');text(point_2_x,point_2_y,'o','color','g');text(point_3_x,point_3_y,'o','color','g');text(point_4_x,point_4_y,'o','color','g');%% save depth roinew_str_aim = split(str_aim,'\');savePathDepth = fullfile(saveDirPath,char(new_str_aim(1)),char(new_str_aim(2)),'depth\');mkdirDepthDir = mkdir(savePathDepth); imwrite(depth_image,[savePathDepth,char(new_str_aim(3)),'.png']);%%%remove rgb and ir pic and change its name%% saveas(figure(num2str((char(new_str_aim(3))))), [savePathDepth,char(new_str_aim(3)),'.png'])savePathIr = fullfile(saveDirPath,char(new_str_aim(1)),char(new_str_aim(2)),'ir\');mkdirIrDir = mkdir(savePathIr); imwrite(ir_image,[savePathIr,char(new_str_aim(3)),'.png']);savePathRgb = fullfile(saveDirPath,char(new_str_aim(1)),char(new_str_aim(2)),'rgb\');mkdirRgbDir = mkdir(savePathRgb);imwrite(rgb_image,[savePathRgb,char(new_str_aim(3)),'.jpg']);%% saveas(figure(), [savePathRgbKeyPoint,char(new_str_aim(3)),'.jpg']);savePathRgbKeyPoint = fullfile(saveDirPath,'rgbKeyPointDir',char(new_str_aim(2)));mkdirRgbKeyPointDir = mkdir(savePathRgbKeyPoint);frame = getframe(gcf);result = frame2im(frame);imwrite(result,[savePathRgbKeyPoint,char(new_str_aim(3)),'.jpg']);endend% end endend
end 1
getframe
捕获坐标区或图窗作为影片帧
frame2im
返回与影片帧关联的图像数据
捕获显示在屏幕上的当前坐标区作为影片帧。
F
= getframeF
是一个包含图像数据的结构体。getframe
按照屏幕上显示的大小捕获这些坐标区。它并不捕获坐标区轮廓外部的刻度标签或其他内容
相关文章:

mysql日志文件相关的配置【2】
1、二进制日志是什么? mysql 的二进制日志用于记录数据库上做的变更、 2、二进制日志什么时间写到磁盘 1、总的来说二进制日志会在释放锁之前就写入磁盘、也就是说在commit完成之前;client还没发送commit这个时候mysql并不把binlog写入磁盘、 别一方面my…

【PAT (Basic Level) 】1028 人口普查 (20 分)
某城镇进行人口普查,得到了全体居民的生日。现请你写个程序,找出镇上最年长和最年轻的人。这里确保每个输入的日期都是合法的,但不一定是合理的——假设已知镇上没有超过 200 岁的老人,而今天是 2014 年 9 月 6 日,所以…

SW6206超级华为快充5V5A,全协议OPPO闪充、自带电量计量、LED 灯/数码管显示
深圳市展嵘电子有限公司有需要的上帝可联系小陈:136-6225-3950 : 3412-1522-98SW6206 是一款高集成度的多协议双向快充移动电源专用多合一芯片,支持AABCL 口任意口快充。其集成了5A高效率开关充电,20W高效率同步升压输出,PPS/PD/Q…

bash脚本【一】——批量处理文件
Bash脚本2.0 #!/bin/bashoutput_root_dir"0723weixin" data_root_dir"D:/data/"$output_root_dir config_dir"config"# speckle_name"SPEACKLEIMAGE.bmp" # ir_name"IRIMAGE.bmp" # rgb_name"RGBIMAGE.jpg" # co…

【PAT (Basic Level) 】1030 完美数列 (25 分)
给定一个正整数数列,和正整数 p,设这个数列中的最大值是 M,最小值是 m,如果 M≤mp,则称这个数列是完美数列。 现在给定参数 p 和一些正整数,请你从中选择尽可能多的数构成一个完美数列。 【输入格式】&…

运营商劫持处理
测试URL:因近期发现长宽资源经常出现被劫持和转发错误的现象。解决办法如下:1、把转发列表写到named.conf文件里,更新我们的转发ip2、然后编写策略针对我们要去的域名从BGP出口出去,防止NAT。x.x.x.x.com,(…

oracle维护数据的完整性
转自:https://www.cnblogs.com/roger112/p/7722376.html 介绍: 数据的完整性用于确保数据库数据遵从一定的商业的逻辑规则。在oracle中,数据完整性可以使用约束、触发器、应用程序(过程、函数)三种方法来实现,在这三种方法中&…

MATLAB【五】———— matlab 调用C++生成exe文件,高斯核函数
两种方式调用C生成的exe文件, 语法: status system(command) [status,cmdout] system(command) [status,cmdout] system(command,-echo) 说明 status system(command) 调用操作系统执行指定的命令。操作会等待命令执行完毕,然后再将命令…

REACT day 1
https://facebook.github.io/react/ A JAVASCRIPT LIBRARY FOR BUILDING USER INTERFACES Declarative views make your code more predictable and easier to debug. React是Facebook在2013年发布的一个前端框架,而如今的React俨然已经演变成一个前端生态ÿ…

win10+Chrome浏览器截长图方法
本方法亲测可行,操作系统为win10,其他操作系统没有试过。 部分内容基于https://blog.csdn.net/ianly123/article/details/80565614并进行修正。 打开 Chrome 浏览器,进入需要截图的网站页面。打开开发者工具:在页面任何地方点击…

如何打造一流的视觉AI技术
本次分享主要分以下几个部分:首先简要介绍一下计算机视觉技术的相关背景,然后结合格灵深瞳的实践,从算法研发、训练平台、智能数据处理、异构计算等几个方面着重介绍如何打造一流的视觉AI技术,最后介绍格灵深瞳在相关技术落地方面…

MATLAB【六】 ———— matlab 随机散斑模拟
%% %input for image size(NX,NY) <散斑图大小(像素)> NX 1280; NY 800; %input for numble of speckles(S)<散斑数量> S 9226; %输入的散斑大小 a 4; %input for peak intensity of each speckle(I0)<散斑峰值强度> I0 1; %input …

【Python】zip函数
zip()函数用于将可迭代对象作为参数,将对象中对应的元素打包成一个个元组,然后返回这些由元组组成的列表。 如果各个迭代器的元素不一致,则返回列表长度与最短的对象相同。 利用*号操作符,可将元组解压为列表。 >>> a …

CentOS 7.0,启用iptables防火墙
CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙。1、关闭firewall:systemctl stop firewalld.service #停止firewallsystemctl disable firewalld.service #禁止firewall开机启动2、安装iptables防火墙yum install iptables-services…

手撸 webpack4.x 配置(一)
现在的前端开发框架 ,都绕不开 webpack 打包 。 但绝大数前端开发人员 基本都是用 脚手架 自动生成 一套开发环境 如: vue-cli , create-react-app等 , 但开发中总会遇到各种问题 ,基本都是 webpack 配置问题 , 每次遇到基本都是…

MATLAB【七】———— matlab 高斯核使用,超像素图像模拟,矩阵转图像,深度相机模型实践实现
深度模型,图片转稀疏矩阵,稀疏矩阵转图片 %% mat to 2array temp_speckle ref_speckle; [row_index,col_index,v]find(temp_speckle); obj_matrix [row_index,col_index]; [obj_matrix_height,obj_matrix_width] size(obj_matrix);%% depth camera m…

jsp 出现cannot be resolved to a type问题解决办法
(1)检查<% page import>是否导入了相关的包。若是没有则需导入 (2)若导入相应的包后问题仍然存在则需创建相关的servlet转载于:https://www.cnblogs.com/wth21-1314/p/6126655.html

U盘中毒了?教你如何删除System Volume Information这个顽固文件夹
不得不说cmd命令很好用呢。最近我的U盘中毒了,格式化都删除不了System Volume Information这个顽固的文件夹,真心伤不起哇!还好现在解决了问题。看来以后得好好对待U盘,不能乱用了。本篇文章教大家如何删除System Volume Informat…

69亿美元英伟达史上最大收购!这家基金又赢了
。另一方面,在虚拟货币的浪潮告一段落之后,英伟达需要给增速放缓的数据中心业务注入一枚强心剂。 有意思的是,英伟达对Mellanox的收购也成就了国际知名维权对冲基金Starboard Value LP的又一次投资胜利。 击败微软、英特尔,交易…

基础数据结构【一】————数组
二维数组相乘,矩阵相乘, #include <iostream> using namespace std;void MatrixMultiply(int*, int*, int*, int, int, int); int main() {int M, N, P;int i, j;//矩阵A部分 cout << "请输入矩阵A的维数(M,N): " << endl;…

Fragment 和 FragmentActivity的使用
Fragment 和 FragmentActivity的使用 http://blog.csdn.net/izy0001989624/article/details/17072211转载于:https://www.cnblogs.com/as3lib/p/6126761.html

win10 VMware15 安装 CentOS6.4 64位(慢慢弄吧,别急)
参考:CentOS 6.4安装(超级详细图解教程) 可以都不勾,有需要,以后使用中有需要再手动安装 除了KDE,其他都选就可以了 系统管理、虚拟化、负载平衡器、高可用性可以都不选

Nginx网站常见的跳转配置实例
相信大家在日常运维工作中如果你用到nginx作为前端反向代理服务器的话,你会对nginx的rewrite又爱又恨,爱它是因为你搞定了它,完成了开发人员的跳转需求后你会觉得很爽,觉得真的很强大,恨它是因为当一些稀奇古怪跳转的需…

基础数据结构【二】————动态数组,单向链表及链表的反转
DEMO1: 动态分配变量(链表,而静态数组是线性表,意味着动态数组访问和遍历复杂度为O(n),而插入和删除复杂度为O(1),而静态数组线性表则完全相反) int* in…

VMware15克隆虚拟机Centos
在克隆虚拟机之前,我们需要了解以下文件: 1、/etc/udev/rules.d/70-persistent-net.rules 这是网卡有关信息的配置文件,我们可以先查看一下master的网卡信息(当然也可以用ifconfig命令查看) 要注意的是网卡名称以及…

EXPDP 时ORA-27054 问题处置
现象:[oracleoracle1 ~]$ expdp xian/xian schemasxian directorydumpdir dumpfilexian.dmp LOGFILExian.logExport: Release 10.2.0.5.0 - 64bit Production on Friday, 02 December, 2016 20:19:48Copyright (c) 2003, 2007, Oracle. All rights reserved.Connec…

OSC源创会往期图文回顾链接地址收藏
为什么80%的码农都做不了架构师?>>> 格式:源创会报名链接地址 - 源创会结束后图文回顾链接地址 【深圳】第1期】- 图文回顾【广州】第2期】- 图文回顾【北京】第3期】- 图文回顾【珠海】第4期】- 图文回顾【深圳】第5期】- 图文回顾--------…

ionic + cordova+angularJs 搭建的H5 App完整版总结
为期半个月的项目实践开发,已完整告一段落,团队小组获得第一名,辛苦总算没有白费,想起有一天晚上,整个小组的人,联调到12点才从公司回去,真是心酸。这里总结一下,项目过程中遇到的问…

基础数据结构【三】————老鼠走迷宫问题————堆栈应用
假设:老鼠在一个二维地图中i行走,地图中大部分路径被墙阻断,无法前进。老鼠可以按照尝试错误的方法找到出口。只是,这只老鼠必须具备走错路时候就退回来,并且把走过的路记下来,避免下次走重复路,…

eclipse Debug中step into功能失灵的问题
step into 和 step over功能一样,无法进入方法内部,解决方法如下: 需要使用jdk中的jre,而不是独立安装的jre 再次Debug,当运行到断点的时候,点击step into(F5)就可以看见println函数…