This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mechanize | |
import cookielib | |
from bs4 import BeautifulSoup | |
import re | |
import io | |
import sys | |
import csv | |
reload(sys) | |
sys.setdefaultencoding("utf8") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UIImageView *img=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.view.frame), 330)]; | |
[img setContentMode:UIViewContentModeScaleAspectFill]; | |
[img setTag:2]; | |
[img setImage:[UIImage imageNamed:@"sda"]]; | |
UITableView *table=[[UITableView alloc]initWithFrame:CGRectMake(0, 80, CGRectGetWidth(self.view.frame), CGRectGetHeight(self.view.frame))]; | |
[self.view addSubview:table]; | |
[table setDataSource:self]; | |
[table setDelegate:self]; | |
[table registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section | |
{ | |
if (section==0) { | |
return 1; | |
} | |
else | |
{ | |
return [self.data count]; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void)scrollViewDidScroll:(UIScrollView *)scrollView | |
{ | |
UIImageView *img=(UIImageView *)[self.view viewWithTag:2]; | |
CGFloat y=-scrollView.contentOffset.y; | |
if (y>0) | |
{ | |
[img setFrame:CGRectMake(0, 0, CGRectGetWidth(self.view.frame)+y*CGRectGetWidth(self.view.frame)/330,y+330 )]; | |
[img setCenter:CGPointMake(self.view.center.x, img.center.y)]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (cv::Mat)cvMatFromUIImage:(UIImage *)image | |
{ | |
CGColorSpaceRef colorSpace = CGImageGetColorSpace(image.CGImage); | |
CGFloat cols = image.size.width; | |
CGFloat rows = image.size.height; | |
cv::Mat cvMat(rows, cols, CV_8UC4); // 8 bits per component, 4 channels (color channels + alpha) | |
CGContextRef contextRef = CGBitmapContextCreate(cvMat.data, // Pointer to data | |
cols, // Width of bitmap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int threshold_value = 0; | |
int const max_BINARY_value = 2147483647; | |
cv::Mat src_gray=[self cvMatFromUIImage:img.image]; | |
cv::Mat dst; | |
dst=src_gray; | |
cv::cvtColor(src_gray, dst, cv::COLOR_RGB2GRAY); | |
cv::Mat canny_output; | |
std::vector<std::vector<cv::Point> > contours; | |
std::vector<cv::Vec4i> hierarchy; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int const max_BINARY_value = 2147483647; | |
cv::Mat src_gray=[self cvMatFromUIImage:img.image]; | |
cv::Mat dst; | |
dst=src_gray; | |
cv::cvtColor(src_gray, dst, cv::COLOR_RGB2GRAY); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int const max_BINARY_value = 2147483647; | |
cv::Mat src_gray=[self cvMatFromUIImage:img.image]; | |
cv::Mat dst; | |
dst=src_gray; | |
cv::cvtColor(src_gray, dst, cv::COLOR_RGB2GRAY); | |
cv::Mat canny_output; | |
std::vector<std::vector<cv::Point> > contours; | |
std::vector<cv::Vec4i> hierarchy; | |
cv::RNG rng(12345); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brew install opencv3 --with-python3 | |
echo /usr/local/opt/opencv3/lib/python3.4/site-packages >> /usr/local/lib/python3.4/site-packages/opencv3.pth | |
mkdir -p /Users/<insert your username here>/Library/Python/3.4/lib/python/site-packages | |
echo 'import site; site.addsitedir("/usr/local/lib/python3.4/site-packages")' >> /Users/<insert your username here>/Library/Python/3.4/lib/python/site-packages/homebrew.pth |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), { () -> Void in | |
let img = getImageWithColor(colorToSet, CGSizeMake(100, 100)) | |
dispatch_async(dispatch_get_main_queue(), { () -> Void in | |
self.navigationController?.navigationBar.setBackgroundImage(img,forBarMetrics: .Default) | |
self.pageIndicatorContainer.backgroundColor = colorToSet | |
}) | |
}) |
OlderNewer