2021-6-25 新增 github 源码链接,所以,自行下载,enjoy

https://github.com/AFei19911012/MatlabSamples/tree/master/AppDesigner/SimpleImageToData

目的:提取图片上的曲线数据点。比如,文献中的图表数据。

2021-4-24 更新,代码已修改为 AppDesigner 设计,增加了自动提取功能:https://zhuanlan.zhihu.com/p/347520891

  • 源代码
function varargout = DataExtract(varargin)
% DATAEXTRACT MATLAB code for DataExtract.fig
%      DATAEXTRACT, by itself, creates a new DATAEXTRACT or raises the existing
%      singleton*.
%
%      H = DATAEXTRACT returns the handle to a new DATAEXTRACT or the handle to
%      the existing singleton*.
%
%      DATAEXTRACT('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in DATAEXTRACT.M with the given input arguments.
%
%      DATAEXTRACT('Property','Value',...) creates a new DATAEXTRACT or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before DataExtract_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to DataExtract_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES% Edit the above text to modify the response to help DataExtract% Last Modified by GUIDE v2.5 30-Aug-2017 09:01:43% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...'gui_Singleton',  gui_Singleton, ...'gui_OpeningFcn', @DataExtract_OpeningFcn, ...'gui_OutputFcn',  @DataExtract_OutputFcn, ...'gui_LayoutFcn',  [] , ...'gui_Callback',   []);
if nargin && ischar(varargin{1})gui_State.gui_Callback = str2func(varargin{1});
endif nargout[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
elsegui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT% --- Executes just before DataExtract is made visible.
function DataExtract_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to DataExtract (see VARARGIN)% Choose default command line output for DataExtract
handles.output = hObject;% Update handles structure
guidata(hObject, handles);% UIWAIT makes DataExtract wait for user response (see UIRESUME)
% uiwait(handles.figure1);% --- Outputs from this function are returned to the command line.
function varargout = DataExtract_OutputFcn(hObject, eventdata, handles)
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)% Get default command line output from handles structure
varargout{1} = handles.output;function pushbutton1_Callback(hObject, eventdata, handles)
axes(handles.axes1)
cla reset
axis off
set(handles.uitable1, 'data', []);set(handles.text5, 'string', 'Load a picture !!!');
[FileName, PathName] = uigetfile({'*.bmp'}, 'Load a picture');
if length(PathName) < 3msgbox('Failed to load a picture !!!');return;
end
FilePath = [PathName, FileName];
Img = imread(FilePath);
axes(handles.axes1);
imshow(Img, 'Border', 'tight');set(handles.text5, 'string', 'Input the values in EditBoxs, press Enter to continue !!!');
pause();set(handles.text5, 'string', 'Locate the start point !!!');
currPt = ginput(1);
x0 = currPt(1, 1);
y0 = currPt(1, 2);
line(x0, y0, 'marker', '.', 'color', 'r', 'markersize', 20);set(handles.text5, 'string', 'Locate the x-end point !!!');
currPt = ginput(1);
xend = currPt(1, 1);
y = currPt(1, 2);
line(xend, y, 'marker', '.', 'color', 'r', 'markersize', 20);
line([x0, xend], [y0, y], 'color', 'r');set(handles.text5, 'string', 'Locate the y-end point !!!');
currPt = ginput(1);
x = currPt(1, 1);
yend = currPt(1, 2);
line(x, yend, 'marker', '.', 'color', 'r', 'markersize', 20);
line([x0, x], [y0, yend], 'color', 'r');set(handles.text5, 'string', 'Now you can locate the point, press RightButton to locate the last point !!!');
tableData = cell(0);
con = 1;
i = 1;
xmin = str2double(get(handles.edit1, 'string'));
xmax = str2double(get(handles.edit2, 'string'));
ymin = str2double(get(handles.edit3, 'string'));
ymax = str2double(get(handles.edit4, 'string'));
scale1 = get(handles.radiobutton1, 'value');
scale2 = get(handles.radiobutton3, 'value');
while con == 1    [x, y, con] = ginput(1);line(x, y, 'marker', '.', 'color', 'r', 'markersize', 20);if scale1 == 1xx = (xmax - xmin)*(x - x0)/(xend - x0) + xmin;elsexx = 10^((log10(xmax) - log10(xmin))*(x - x0)/(xend - x0) + log10(xmin));endif scale2 == 1yy = (ymax - ymin)*(y - y0)/(yend - y0) + ymin;else%yy = 10^((log10(ymax) - log10(ymin))*(log10(y) - log10(y0))/(log10(yend) - log10(y0)) + log10(ymin));yy = 10^((log10(ymax) - log10(ymin))*(y - y0)/(yend - y0) + log10(ymin));endtableData{i, 1} = i;tableData{i, 2} = xx;tableData{i, 3} = yy;set(handles.uitable1, 'data', tableData);i = i + 1;
endfunction pushbutton2_Callback(hObject, eventdata, handles)
[FileName, PathName] = uiputfile('*.txt', 'save file name');
tableData = get(handles.uitable1, 'data');
tableData = cell2mat(tableData);
if ~isempty(tableData)dlmwrite([PathName, FileName], tableData(:, 2:end), 'delimiter', '\t', 'precision', '%8.4f');
endfunction pushbutton3_Callback(hObject, eventdata, handles)
close(gcf);function edit1_Callback(hObject, eventdata, handles)function edit1_CreateFcn(hObject, eventdata, handles)% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))set(hObject,'BackgroundColor','white');
endfunction edit2_Callback(hObject, eventdata, handles)function edit2_CreateFcn(hObject, eventdata, handles)% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))set(hObject,'BackgroundColor','white');
endfunction edit3_Callback(hObject, eventdata, handles)function edit3_CreateFcn(hObject, eventdata, handles)% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))set(hObject,'BackgroundColor','white');
endfunction edit4_Callback(hObject, eventdata, handles)function edit4_CreateFcn(hObject, eventdata, handles)% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))set(hObject,'BackgroundColor','white');
end
  • 源代码链接

https://download.csdn.net/download/u012366767/10593012

【Matlab学习手记】利用Matlab提取图片曲线数据相关推荐

  1. 【Matlab学习手记】Matlab积分问题

    一个程序彻底搞懂Matlab的数值积分.符号积分问题. 数值积分问题,给定被积分函数和积分上下限,使用 integral 函数得到积分值: 符号积分问题,通常结果是解析解,即需要知道被积分函数的原函数 ...

  2. matlab如何取对数坐标,利用Matlab提取图片中曲线数据(线性修正,支持对数坐标)

    利用Matlab提取图片中曲线数据 前一段时间看到一篇文章"利用Matlab提取图图片中的数据",觉得思路挺好,遂下载下来研究了一番,发现作者所编写的程序没有考虑原始图片非水平放置 ...

  3. Matlab学习一本通,matlab基础教程

    链接:https://pan.baidu.com/s/1uTCbiRfIxcrt6lmiy6_QlQ  提取码:f2dn  Matlab学习一本通,matlab基础教程 <MATLAB R201 ...

  4. 基于matlab的绘图设计,matlab课程设计---利用MATLAB仿真软件进行绘图

    matlab课程设计---利用MATLAB仿真软件进行绘图 课程设计任务书课程设计任务书 题题 目目 利用利用 MATLABMATLAB 仿真软件进行绘图仿真软件进行绘图 初始条件初始条件 仿真软件 ...

  5. 第一章 matlab 学习入门之matlab基础

    matlab系列文章目录 第一章 matlab 学习入门之matlab基础 在这一章会学习到: 数据类型(数值,字符串,结构,单元数组,函数句柄,映射容器) 运算符与运算(算术运算符,关系运算符,逻辑 ...

  6. 图片播放器的实现1——利用Image2LCD提取图片数据并显示

    以下内容源于朱有鹏嵌入式课程的学习与整理,如有侵权请告知删除. 参考内容 (1)https://xiefor100.blog.csdn.net/article/details/71941527 (2) ...

  7. matlab 多普勒效应,《利用MATLAB仿真多普勒效应.doc

    <利用MATLAB仿真多普勒效应 利用MATLAB仿真多普勒效应 某某某 摘 要:分析多普勒效应特性,建立数学模型,利用MATLAB软件对其进行仿真试验,进行定量分析,根据仿真试验结果绘制出听者 ...

  8. 用MATLAB编程正弦稳态相量图,matlab课程设计--利用MATLAB对线性电路正弦稳态特性分析...

    matlab课程设计--利用MATLAB对线性电路正弦稳态特性分析 课程设计任务书 学生姓名: 专业班级: 指导教师: 刘 新 华 工作单位:信息工程学院 题 目: 利用MATLAB对线性电路正弦稳态 ...

  9. 怎么把线稿提取出来_如何利用PS提取图片线稿?

    如何利用PS提取图片线稿?很多小伙伴们看上一张图片想提取他的线稿却不知道如何下手.下面,小编就为大家介绍下利用PS提取图片线稿方法. 打开Photoshop软件,导入准备好的图片,复制一个图层.在混合 ...

  10. 【深度学习】利用一些API进行图像数据增广

    [深度学习]利用一些API进行图像数据增广 文章目录 [深度学习]利用一些API进行图像数据增广 1 先送上一份最强的翻转代码(基于PIL) 2 Keras中的数据增强API种类概述 3 特征标准化 ...

最新文章

  1. windows server 2012 dhcp 配置故障转移
  2. python bootstrap 4_Python3.4+Django1.9+Bootstrap3
  3. 好程序员前端分享使用JS开发简单的音乐播放器
  4. lwip-1.4.1文档sys_arch翻译
  5. 看这篇就够了!一文读懂拜占庭将军问题
  6. Ngnix中的fastcgi參数性能优化和解释
  7. 病毒行为分析初探(二)
  8. Feign的工作原理
  9. 中芯国际换帅,事情并不简单
  10. web版Project简介
  11. MySQL索引分析以及相关面试题
  12. 使用局域网为手机部署安装包
  13. 用智能TFT液晶模块这种串口屏做产品界面设计太简单了,大大的节省了开发时间...
  14. 相似图片搜索原理二(phash—c++实现)
  15. 智能小区java_基于B/S模式下的JAVA智能小区规划系统
  16. OSPO 五阶段成熟度模型解析
  17. 中国互联网少了周鸿祎将会怎样?
  18. 如何学好高中数学枢纽章函数(干货目录)
  19. 玩着k3s树莓派集群指南
  20. 工业级5G物联网路由器

热门文章

  1. windows常见dos命令总结
  2. 哥本哈根大学物理学家研制的创新芯片解决了量子难题;高通风投投资量子机器公司 | 全球量子科技与工业快讯第四十二期
  3. 《EfficientDet:Scalable and Efficient Object Detection》论文笔记
  4. Winform分页控件使用详细介绍
  5. [半决赛魔咒] 那些罚失点球的人,恰恰是那些有勇气站在点球前的人。。
  6. Java学习者论坛【申明:来源于网络】
  7. 利用135端口的思路
  8. 同样是VPS,为什么RAKsmart更受欢迎
  9. 黑客使用含病毒的邮件 半年内盗取近20亿卢布
  10. Orange:一个基于 Python 的数据挖掘和机器学习平台