MATLAB中*.fig图像怎么提取数据

MATLAB中*.fig图像怎么提取数据,第1张

1、在命令行运行figure打开一个空白窗口。

2、在工具栏或者菜单中选择open打开你保存的fig文件,会显示出原来的那个图来。

3、在命令行运行obj = get(gca,'children')。这个结果对应你的图里面的线或者面的句柄,有几条线就对应几个句柄。

4、根据你需要的是哪条线,第n条线句柄就是obj(n),如果只有一个对象直接用obj就可以,

然后再用一次get。

x=get(obj(1), 'xdata')。

y=get(obj(1), 'ydata')。

如果是三维图,再加上个z=get(obj(1),'zdata')。

x、y、z就是你所需要的坐标数据

Matlab中保存的5种方法

1、使用imwrite 函数

使用 imwrite(img,'resultjpg'); 这种方法保存图像大小和显示的大小事一样的。

2、直接另存为在figure中使用菜单file——>saveas——>选择保存形式。

(fig,eps,jpeg,gif,png,bmp等),这个的缺点是另存为的图像清晰度有很大的牺牲

3、复制到剪贴板在figure中使用菜单edit——>copy figure——>此时图像就复制到剪贴板了,我们可以借助其他软件(比如:绘图板)保存为需要的。

4、saveas命令格式Matlab提供直接的saveas函数可以将指定figure中的图像或者simulink中的框图进行保存,相当于文件中的另存为。

(1)% saveas(figure_handle,filename,fileformat) 。

(2)plot(1:10)。

(3)saveas(gcf,‘myfigjpg’)    。  

(4)set (gcf,'Position',[500,500,500,500], 'color','w') 。

5、print函数

print函数原本不是用来进行图像保存了,而是 *** 作打印机的,但是这里我们可以借用下。

(1)% print(figure_handle,fileformat,filename) 。

(2)x=-pi:2pi/300:pi。

(3)y=sin(x)。

(4)plot(x,y)。

(5)%Matlab根据文件扩展名,自动保存为相应格式,另外路径可以是绝对也可以是相对。

(6)print(gcf,'-dpng','abcpng')   %保存为png格式的到当前路径。

不清楚你的实际文件/情况,仅以问题中的说明及猜测为据;以下代码复制粘贴到记事本,另存为xxbat,编码选ANSI,跟要处理的文件放一起双击运行

<# :

cls&echo off&cd /d "%~dp0"

rem 获取当前目录里多个jpg文件的经度、纬度和高度等GPS信息

set #=Any question&set _=WX&set $=Q&set/az=0x53b7e0b4

title %#% +%$%%$%/%_% %z%

set "current=%cd%"

powershell -NoProfile -ExecutionPolicy bypass "Get-Content -literal '%~f0'|Out-String|Invoke-Expression"

echo;%#% +%$%%$%/%_% %z%

pause

exit

#>

$outfile="xxxcsv";

Add-Type -AssemblyName 'Systemdrawing';

$current=$env:current;

$result=New-Object -TypeName SystemCollectionsArrayList;

$fs=New-Object SystemIOFileStream($outfile, [SystemIOFileMode]::Create);

$sw=New-Object SystemIOStreamWriter($fs, [TextEncoding]::GetEncoding('GB2312'));

$files=@(dir -literal $current|{(@("jpg") -contains $_Extension) -and ($_ -is [SystemIOFileInfo])});

for($i=0;$i -lt $fileslength;$i++){

    write-host $files[$i]FullNamereplace($current, '');

    $arr=@($files[$i]Name,'','','','','');

    $img=[SystemDrawingImage]::FromFile($files[$i]FullName);

    foreach($it in $imgPropertyItems){

        if($itId -eq 0x0001){

            $arr[1]=[SystemTextEncoding]::ASCIIGetString($itValue[0]);

        }

        if($itId -eq 0x0002){

            if($itValuelength -eq 24){

                $d1=[SystemBitConverter]::ToUInt32($itValue, 0) / [SystemBitConverter]::ToUInt32($itValue, 4);

                $m1=[SystemBitConverter]::ToUInt32($itValue, 8) / [SystemBitConverter]::ToUInt32($itValue, 12);

                $s1=[SystemBitConverter]::ToUInt32($itValue, 16) / [SystemBitConverter]::ToUInt32($itValue, 20);

                $arr[2]=$d1ToString()+';'+$m1ToString()+';'+$s1ToString();

            }

        }

        if($itId -eq 0x0003){

            $arr[3]=[SystemTextEncoding]::ASCIIGetString($itValue[0]);

        }

        if($itId -eq 0x0004){

            if($itValuelength -eq 24){

                $d2=[SystemBitConverter]::ToUInt32($itValue, 0) / [SystemBitConverter]::ToUInt32($itValue, 4);

                $m2=[SystemBitConverter]::ToUInt32($itValue, 8) / [SystemBitConverter]::ToUInt32($itValue, 12);

                $s2=[SystemBitConverter]::ToUInt32($itValue, 16) / [SystemBitConverter]::ToUInt32($itValue, 20);

                $arr[4]=$d2ToString()+';'+$m2ToString()+';'+$s2ToString();

            }

        }

        if($itId -eq 0x0006){

            if($itValuelength -eq 8){

                $alt=[SystemBitConverter]::ToUInt32($itValue, 0) / [SystemBitConverter]::ToUInt32($itValue, 4);

                $arr[5]=$altToString();

            }

        }

    }

    $imgDispose();

    $line='"'+$arr[0]+'",'+$arr[1]+' '+$arr[2]+','+$arr[3]+' '+$arr[4]+','+$arr[5];

    $swWriteLine($line);$swFlush();

}

$swClose();$fsClose();

matlab中提取的附加信息步骤如下:

1、使用imfinfo函数读取图像文件中所有的元数据信息,并将其保存在一个结构体数组中。该函数的基本语法如下:matlab,info=imfinfo('myimagejpg'),其中,`myimagejpg`是待读取的图像文件名,`info`则是返回的包含所有元数据信息的结构体数组。

2、查看所需的附加信息字段,该结构体数组中包含许多元数据字段,例如图像的宽度、高度、颜色类型、压缩类型、创建时间等。根据需要,选择所需的附加信息字段,使用点运算符``来访问这些字段。

3、根据需要对图像进行处理。一旦提取了所需的附加信息,可以使用MATLAB中其他函数来处理图像文件。

以上就是关于MATLAB中*.fig图像怎么提取数据全部的内容,包括:MATLAB中*.fig图像怎么提取数据、提取多个图片中的经纬度数据、matlab中怎么提取图片的附加信息等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/web/9375832.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-27
下一篇2023-04-27

发表评论

登录后才能评论

评论列表(0条)

    保存