【发布时间】:2011-11-30 03:20:06
【问题描述】:
我使用 brew 从 phash 创建一个编译库 我已经导入了 CImg.h 文件,一切都编译了,但它不起作用。
我想从图像中生成哈希,但我总是得到相同的输出
NSBundle *bundle = [NSBundle mainBundle];
NSString *path = [bundle pathForImageResource:@"branch.png"];
const char *image = [path cStringUsingEncoding:NSASCIIStringEncoding];
ulong64 hash = 0;
int valid = ph_dct_imagehash(image,hash);
NSLog(@"%i",valid);
NSLog(@"%llu",hash);
有了这个输出
sh: convert: command not found
sh: gm: command not found
sh: convert: command not found
sh: gm: command not found
sh: convert: command not found
sh: gm: command not found
2011-10-03 20:10:22.571 pHashi386[2155:60b] -1
2011-10-03 20:10:22.572 pHashi386[2155:60b] 0
很明显出了点问题,但我不知道找不到的 sh 命令是什么,如果我在正确的轨道上也不知道。
【问题讨论】:
-
你知道它要运行什么脚本吗?转换可能是 ImageMagick 中的转换。
-
是的,它来自 ImageMagick,GM 是 graphicsmagick,我都用 brew 安装了它们。如果我执行“sh”和终端,然后输入转换它可以工作.. 但是如果我在 xcode 中编译我的项目,它会一直唠叨找不到命令.. CImg.h 使用 convert 和 gm 命令
标签: objective-c macos phash