如果不包含在工作目录中,也可以在Matlab中从其绝对路径加载图像(Load an image from its absolute path in Matlab also if is not included in working directory)
我有一个图像myabspath的绝对路径
D:\myimages\venus\surface\im0012.jpg
我试过了
im=imread(myabspath);
但是没有用,因为似乎imread只接受当前工作目录中的文件名。
我也试过了
f=load(myabspath);
但是得到一个错误“ Argument必须包含一个字符串 ”。
似乎是一个非常基本的操作,但遗憾的是我还没有找到解决方案。
编辑似乎问题是由myabspath不是常规字符串而不是cell ,我试图使用myabspath=cellstr(myabspath)但是我继续收到错误,告诉我myabspath不是字符串,但是如果我打电话
display(myabspath)
我看到了正确的道路。 有解决方案吗
I have the absolute path of an image myabspath
D:\myimages\venus\surface\im0012.jpg
I have tried
im=imread(myabspath);
but doesn't work because seems that imread accept only the name of a file in the current working directory.
I have also tried
f=load(myabspath);
But get an error "Argument must contain a string".
Seems a pretty basilar operation but unfortunately I haven't found the solution.
EDIT Seems that the problem is caused by the fact myabspathis not a regular String but a cell, I have tried to use myabspath=cellstr(myabspath) but I continue to receive the error that tell me that myabspath is not a string, but if I call
display(myabspath)
I see the right path. Any solution?
原文:https://stackoverflow.com/questions/30833046
2019-12-01 06:12
满意答案
如果您有一个包含String路径的cell ,则不需要任何转换,只需使用{index}访问单元格的内容即可。
例如,如果必须使用myabspath{1}获取第一个元素
imread能够从绝对路径读取图像
If you have a cell that contains the String path, you don't need any conversion, is enough access the content of the cell using {index}.
Eg if you have to get the first element use myabspath{1}
imread is able to read images from absolute paths
2015-06-14
相关问答
Dir.pwd似乎做的伎俩。 http://ruby-doc.org/core/Dir.html#method-c-pwd Dir.pwd seems to do the trick. http://ruby-doc.org/core/Dir.html#method-c-pwd
fopen()可以将绝对路径作为参数。 您是在基于unix / linux的操作系统还是在Windows上工作? 可能发生的事情是你错了路。 如果您使用的是Mac,它看起来就像您一样,可能是正确的路径 ~/Documents/projects/cs50_radio/broadcast/source/deadinside.mp3
但是你可以通过cd进入目录并输入pwd 如果你在Windows上,你的路径肯定是错的,因为windows看起来更像是这样: C:\Documents\projects\c...
应用程序/ autoloader.php 包含: /**
* Shortcut constant for the root directory
*/
define('BP', dirname(__DIR__));
人们可以这样做: $mediaPath = BP.'/pub/media/';
也就是说,Magento \ Framework \ Filesystem通过依赖注入是我的首选方法 app/autoloader.php contains: /**
* Shortcut cons...
引用将来自js文件的位置; 而不是从应用程序根目录。 假设你的根目录下有一个js目录,请尝试在图像路径(../images/image.jpg)中添加一个.. .. The references will be from the location of the js files; not from the application root. Assuming you have a js directory off your root, try adding a .. in the path to ...
您可以将图像放在资源文件夹中(例如,在YOUR_PROJECT/web-app/images ),然后通过资源标签在gsp中访问它。 这样你就不会有绝对路径问题。 举一个具体的例子,你可以参考这个问题 。 You can put your images in resource folder (for example, in YOUR_PROJECT/web-app/images) then access it in gsp by resource tag. By this way you won'...
DOCUMENT_ROOT将输出类似“c:/ wamp / www”的内容,因此您将丢失一个/那里。 您当前的代码实际上会输出类似“c:/ wamp / wwwgeo15 /”的内容。 另外,请确保'geo15 /'位于实际的www目录中,而不是别名。 如果它是别名,那么你肯定会得到一个断开的链接。 此外,您可能会发现以下内容: 目录名($ _ SERVER [ 'SCRIPT_FILENAME']) 会输出类似'x:/ path / to / the current / execution / ...
abspath基于getcwd 。 最有可能的是,您当前的工作目录根本不是您所期望的。 您可以更改启动脚本的代码,手动更改目录,或者只使用Python中的chdir 。 abspath is based on getcwd. Most likely, your current working directory simply isn't what you expect. You can change the code that launches your script, change direct...
您可以使用GetFullPath() ,但是您需要使用“hack”使其使用当前位置作为当前目录(以解析相对路径)。 在使用此修复程序之前,.NET方法的当前目录是进程的工作目录,而不是您在PowerShell进程中指定的位置。 请参阅为什么PowerShell中的.NET对象不使用当前目录? #Hack to make .Net methods use the shells current directory instead of the working dir for the process
[...
使用以下PHP全局变量来构建路径 $_SERVER['DOCUMENT_ROOT']
获取基本路径。 然后你只需将它附加到你想要的文件名/目录。 例如 echo $_SERVER['DOCUMENT_ROOT'];
=> /User/trev/Sites/testsite/public_html/
include $_SERVER['DOCUMENT_ROOT'].'/include/func.php';
Use the following PHP global var to build yo...
如果您有一个包含String路径的cell ,则不需要任何转换,只需使用{index}访问单元格的内容即可。 例如,如果必须使用myabspath{1}获取第一个元素 imread能够从绝对路径读取图像 If you have a cell that contains the String path, you don't need any conversion, is enough access the content of the cell using {index}. Eg if you ha...
相关文章
中文名: MATLAB及应用 作者: 胡鹤飞 图书分类: 软件 资源格式: PDF
...
出现bad interpreter:No such file or directory的原因 是文件格
...
user6@das0 Hadoop-0.20.203.0]$ bin/hadoop namenode
...
谁能告诉我这个方法的具体用法我是这样写的Image.FromFile("1.jpg"
...
中文名: 数字图像处理与机器视觉:Visual C++与Matlab实现 作者: 张铮 图
...
中文名: MATLAB智能算法30个案例分析 作者: 史峰 王辉 郁磊 胡斐
...
中文名: 模式识别与智能计算:MATLAB技术实现(第2版) 作者: 杨淑莹 图书分类:
...
今天在第一次对Solr的UI Console进行Add Core操作的时候,用了默认选项,提交后页面无
...
This was written in December, 1999 Lots of programm
...
最新问答
如果启用了复制处理程序,请确保将其置于其中一个安全角色之后。 我见过人们做的另一件事是在不同的端口上运行admin。 最好在需要auth的页面上使用SSL,这样你就不会发送明确的密码,因此管理和复制将发生在8443上,而常规查询将在8080上发生。 如果您要签署自己的证书,请查看此有用的SO页面: 如何在特定连接上使用不同的证书? I didn't know that /admin was the context for SOLR admin because /admin does not re
第一:在您的样本中,您有: 但是你在询问 //td[@class=‘CarMiniProfile-TableHeader’] (注意TableHeader中的大写'T')。 xpath区分大小写。 第二:通过查询// td [@ class ='CarMiniProfile-TableHeader'] / td,你暗示你在外部td中有一个'td'元素,而它们是兄弟姐妹。 有很多方法可以在这里获得制作和模型
这是你的答案: http://jsfiddle.net/gPsdk/40/ .preloader-container { position: absolute; top: 0px; right: 0px; bottom: 0px; left: 0px; background: #FFFFFF; z-index: 5; opacity: 1; -webkit-transition: all 500ms ease-out;
问题是,在启用Outlook库引用的情况下, olMailItem是一个保留常量,我认为当您将Dim olMailItem as Outlook.MailItem ,这不是问题,但是尝试设置变量会导致问题。 以下是完整的解释: 您已将olMailItem声明为对象变量。 在赋值语句的右侧,在将其值设置为对象的实例之前,您将引用此Object 。 这基本上是一个递归错误,因为你有对象试图自己分配自己。 还有另一个潜在的错误,如果之前已经分配了olMailItem ,这个语句会引发另一个错误(可能是
我建议使用wireshark http://www.wireshark.org/通过记录(“捕获”)设备可以看到的网络流量副本来“监听”网络上发生的对话。 当您开始捕获时,数据量似乎过大,但如果您能够发现任何看起来像您的SOAP消息的片段(应该很容易发现),那么您可以通过右键单击并选择来快速过滤到该对话'关注TCP Stream'。 然后,您可以在弹出窗口中查看您编写的SOAP服务与Silverlight客户端之间的整个对话。 如果一切正常,请关闭弹出窗口。 作为一个额外的好处,wireshar
Android默认情况下不提供TextView的合理结果。 您可以使用以下库并实现适当的aligntment。 https://github.com/navabi/JustifiedTextView Android Does not provide Justified aligntment of TextView By default. You can use following library and achieve proper aligntment. https://github.com/
你的代码适合我: class apples { public static void main(String args[]) { System.out.println("Hello World!"); } } 我将它下载到c:\ temp \ apples.java。 以下是我编译和运行的方式: C:\temp>javac -cp . apples.java C:\temp>dir apples Volume in drive C is HP_PAV
12个十六进制数字(带前导0x)表示48位。 那是256 TB的虚拟地址空间。 在AMD64上阅读wiki(我假设你在上面,对吗?)架构http://en.wikipedia.org/wiki/X86-64 12 hex digits (with leading 0x) mean 48 bits. That is 256 TB of virtual address space. Read wiki on AMD64 (I assume that you are on it, right?) ar
这将取决于你想要的。 对象有两种属性:类属性和实例属性。 类属性 类属性对于类的每个实例都是相同的对象。 class MyClass: class_attribute = [] 这里已经为类定义了MyClass.class_attribute ,您可以使用它。 如果您创建MyClass实例,则每个实例都可以访问相同的class_attribute 。 实例属性 instance属性仅在创建实例时可用,并且对于类的每个实例都是唯一的。 您只能在实例上使用它们。 在方法__init__中定