我是openCV的新手,因此在过去的3到4天里一直在努力,我已经检测到纸张边界,现在我想在角落上绘制4个圆圈.
我从这段代码中画出边界
const cv::Point* p = &squares[i][0];
int n = (int)squares[i].size();
polylines(image, &p,&n, 1, true, Scalar(255,255,0), 5, CV_AA);
Run Code Online (Sandbox Code Playgroud)
我是openCV的新手,所以在我看来我有左上角点p-> x和p-> y,但是我如何得到其他角落,我也对这个折线方法中的参数&n感到困惑,这个折线方法怎么样绘制完整的矩形?
当我使用边界矩形时,它并不完美,它给纸张侧面留下了一点空间.
任何帮助都非常感谢
代码是:
- (cv::Mat)finshWork:(cv::Mat &)image
{
// read in the apple (change path to the file)
Mat img0 =image;// imread("/home/philipp/img/apple.jpg", 1);
Mat img1;
cvtColor(img0, img1, CV_RGB2GRAY);
// apply your filter
Canny(img1, img1, 100, 200);
// find the contours
vector< vector<cv::Point> > contours;
findContours(img1, contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_NONE);
/////for SQUARE CODE
std::vector<std::vector<cv::Point> > squares;
std::vector<cv::Point> approx;
for( size_t i = …Run Code Online (Sandbox Code Playgroud) 什么是长型?这是一个占用8个字节的整数,对吗?我想将long long类型转换为NSString,如下所示.
long long fbid = [[friend objectForKey:@"id"]longLongValue];
Run Code Online (Sandbox Code Playgroud)
我想要的价值fbid在我的NSString *str变量.我能做什么?
我在IOS中使用开放式CV.我已经在图像中检测到纸张的边界,如图所示,现在我必须在触摸时拖动这些边界线以调整裁剪框.我们如何调整边界线以及如何在边界内裁剪图像?
这可以在openCV中使用或者我使用openGL吗?
@moosgummi:我用下面的方法调用你的方法
- (cv::Mat)finshWork:(cv::Mat &)image
{
Mat img0 =image;
Mat img1;
cvtColor(img0, img1, CV_RGB2GRAY);
// apply your filter
Canny(img1, img1, 100, 200);
// find the contours
vector< vector<cv::Point> > contours;
findContours(img1, contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_NONE);
// you could also reuse img1 here
Mat mask = Mat::zeros(img1.rows, img1.cols, CV_8UC1);
// CV_FILLED fills the connected components found
drawContours(mask, contours, -1, Scalar(255), CV_FILLED);
// let's create a new image now
Mat crop(img0.rows, img0.cols, CV_8UC3);
// set background to green
crop.setTo(Scalar(0,255,0));
// and copy …Run Code Online (Sandbox Code Playgroud) 关于performSelector,我有点困惑.我已经在谷歌搜索了.但我不清楚.任何人都可以解释performSelector的作用.
谢谢
[self btnClicked];
Run Code Online (Sandbox Code Playgroud)
和
[self performSelector:@selector(btnClicked)];
-(void)btnClicked
{
NSLog(@"Method Called";
}
Run Code Online (Sandbox Code Playgroud)
对我来说都很好.这两者有什么区别.[self btnClicked]和[self performSelector:@selector(btnClicked)];
可能重复:
Objective-C中的NULL与nil
Objective-C:NULL,nil和@""之间有什么区别?
我有一个简单的问题,我的目标变量中有NULL值.它只需输入if条件.我必须检查如果变量目标长度大于零且没有空值则输入条件.
而当我使用NULL或零比较?
谢谢

我想从NSString中删除特定字符或组子字符串.
意思
NSString*str = @" 你好我是#39;做解析所以#39;我在&响应中得到很多符号 ";
我想删除#39; 和#39; 和&(大多数这三个字符串作为回应)
输出应该是:你好我正在做解析所以我在我的回答中得到了很多符号
方问:我不能写' 这里没有空格,因为它转换为'< - 这个符号.所以我在我的问题中使用$代替&.
我正在使用Bing Api,我的问题非常基础.我已经生成了App密钥,但是我在控制台的输出中出错了.
我正在使用它来进行JSON响应
NSString *urlString=[NSString stringWithFormat:@"%@%@%@%@",
@"http://api.search.live.net/json.aspx?Appid=xxxxxxxaxkOatx66TB+CX8qJUIZw=&query=",
text,@"sources=web&web.offset=",offValue];
NSLog(@"%@",urlString);
NSURL *url=[NSURL URLWithString:urlString];
NSData *data=[NSData dataWithContentsOfURL:url];
Run Code Online (Sandbox Code Playgroud)
当我打印respose时输出
SearchResponse = {
Errors = (
{
Code = 1002;
HelpUrl = "http://msdn.microsoft.com/en-us/library/dd251042.aspx";
Message = "Parameter has invalid value.";
Parameter = "SearchRequest.AppId";
Value = "zKHS8Fm WcwlhCFh8oYWcs VyUYddig=";
}
);
Query = {
SearchTerms = iphone;
};
Version = "2.2";
};
Run Code Online (Sandbox Code Playgroud)
}
这个错误背后的原因是什么?
谢谢大家.
我想从NSString中提取子字符串.怎么可能.
示例:字符串为 abcdefwww.google.comabcdef
输出:www.google.com
在主String中,它没有预定义哪个url来,可能是google.com或yahoo.com等.
所以我必须在www中找到w的开始位置 以及.com中m的最后位置.
所以我的问题是,我怎么能找到的起始位置W¯¯在WWW和位置米在.COM,所以我抽出这部分
由于问题而编辑:
我们如何从这个字符串中提取www.mywebsite.co.uk asdfwww.mywebsite.co.ukasdfajsf
谢谢
我是iPhone应用程序开发的新手,我想在我的项目中使用OpenCV.我是谷歌搜索从最近几个小时,但没有找到OpenCV的启动教程,大部分链接解释高级编程,所以我需要帮助
请为初学者提供很好的教程链接.
我收到服务器的加密数据(BLOWFISH ALGORITHM),我必须在IOS中使用blowfish算法解密它.
你可以从这里下载我的代码:https://www.dropbox.com/s/nswsm7des7isgd5/BlowfishTest-4.zip
我在这项任务的2天内苦苦挣扎,我尝试了很多链接并找到了一些有用的东西:
在第三个链接中,我得到了ECB(我必须使用ECB解密).但是这段代码在解密后也没有给出正确的输出.
我正在使用在线工具进行测试,这显示了正确的输出:http://www.tools4noobs.com/online_tools/decrypt/
Key = 20zE1E47BE57$51
Input value is = aed5c110d793f850521a4dd3a56a70d9
Algorithm = BLOWFISH
Mode = ECB
Decode the input using= Hexa
output = aYzY1380188405 ( this is correct output which i want)
Run Code Online (Sandbox Code Playgroud)
我得到了:¹àÀhÒ¢º¹iF
这是我的代码:
//Mode selected by default in nib: “ECB”
NSString *modeString = [encryptionModeControl titleForSegmentAtIndex:encryptionModeControl.selectedSegmentIndex];
BlowfishAlgorithm *blowFish = [BlowfishAlgorithm new];
[blowFish setMode:[BlowfishAlgorithm buildModeEnum:modeString]];
[blowFish setKey:key];
[blowFish setInitVector:initVector];
[blowFish setupKey];
NSString *cipherText = cipherTextView.text;
NSString *plainText = [blowFish …Run Code Online (Sandbox Code Playgroud) 我必须缩放图像UIScrollView和缩放后我想裁剪可见的图像UIImageView.我有以下问题:
1)图像不缩放,viewForZoomingInScrollView方法未调用.
2)这是关于裁剪的第二个问题,第一个问题就在这里.如何在缩放后裁剪缩放图像?
我的代码是:
@interface ViewController : UIViewController<UIScrollViewDelegate>
{
UIImageView *imageView1;
UIScrollView *scroll;
}
@property(nonatomic,retain) UIImageView *imageView1;
@end
Run Code Online (Sandbox Code Playgroud)
并在.m文件中
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
CGRect frame1 = CGRectMake(10,10,190,200);
self.imageView1.userInteractionEnabled = YES;
imageView1=[[UIImageView alloc]initWithFrame:frame1];
imageView1.contentMode = UIViewContentModeScaleToFill;
imageView1.image= [UIImage imageNamed:@"back.jpeg"];
CGRect frame = CGRectMake(10,10,190,200);
scroll = [[UIScrollView alloc] initWithFrame:frame];
scroll.contentSize = CGSizeMake(240, 260);
scroll.showsHorizontalScrollIndicator = YES;
scroll.showsVerticalScrollIndicator = YES;
scroll.clipsToBounds …Run Code Online (Sandbox Code Playgroud) 我正在努力解决我的程序中的错误.最后我明白了.这里整数在声明时显示值1.我再次清洁和建造.但它显示1个值?
请任何人解释我为什么会这样?

我正在我的应用程序中进行JSON解析,当我使用responseData = [NSMutableData data]; 它在[responseData setLength:0]上崩溃;
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
[responseData setLength:0]; // CRASH HERE
}
Run Code Online (Sandbox Code Playgroud)
当我使用responseData = [[NSMutableData alloc] init]时; 我的程序运行正常.我已经在.h文件中创建了属性
@property (strong, nonatomic) NSMutableData* responseData;
Run Code Online (Sandbox Code Playgroud)
并在.m文件中合成
@synthesize responseData;
Run Code Online (Sandbox Code Playgroud)
问题:[NSMutableData data]和[[NSMutableData alloc] init]之间有什么区别;
谢谢
ios ×13
iphone ×11
objective-c ×6
opencv ×3
nsstring ×2
bing ×1
blowfish ×1
cocoa ×1
nsinteger ×1
scrollview ×1