emotional-analysis-ranking/handson-slide.md at master · jaws-ug-tohoku/emotional-analysis-ranking
- GitHubのmarkdownだと、画像がいちいちダウンロードなのでツラいw
- Lambdaのコード置き場が無い
- GitHubにはzipがアップされている
- 別途作って案内する
- とりあえず自分のS3に置いて試した
emotional-analysis-ranking/handson-slide.md at master · jaws-ug-tohoku/emotional-analysis-ranking
// optionsは適切なものを入れること・・ | |
NSData *imageData = [[NSData alloc]initWithBase64EncodedString:@"base64EncodingStrings" | |
options:NSDataBase64DecodingIgnoreUnknownCharacters]; | |
UIImage *Image = [UIImage imageWithData:imageData]; | |
UIImageView *imageView = [[UIImageView alloc]initWithImage:Image]; | |
imageView.frame = CGRectMake(0, 0, Image.size.width, Image.size.height); | |
[self.view addSubview:imageView]; |
SLASH = / | |
BASE_URL = http:${SLASH}${SLASH}google.com |
// Add a topBorder. | |
CALayer *topBorder = [CALayer layer]; | |
topBorder.frame = CGRectMake(0.0f, 0.0f, textField.frame.size.width, 1.0f); | |
topBorder.backgroundColor = [UIColor blackColor].CGColor; | |
[textField.layer addSublayer:topBorder]; | |
// Add a bottomBorder. | |
CALayer *bottomBorder = [CALayer layer]; | |
bottomBorder.frame = CGRectMake(0.0f, textField.frame.size.height - 1.0f, textField.frame.size.width, 1.0f); | |
bottomBorder.backgroundColor = [UIColor blackColor].CGColor; |
- (NSDate *)createTargetDate:(NSInteger)year month:(NSInteger)month day:(NSInteger)day hour:(NSInteger)hour minute:(NSInteger)minute second:(NSInteger)second { | |
NSCalendar *calendar = [NSCalendar currentCalendar]; | |
NSDateComponents *components = [[NSDateComponents alloc]init]; | |
components.year = year; | |
components.month = month; | |
components.day = day; | |
components.hour = hour; | |
components.minute = minute; | |
components.second = second; |
// 勝手に90度回転するのを元に戻す | |
// cf. http://blog.katty.in/105 | |
- (UIImage *)fixImageRotation:(UIImage *)originalImage | |
{ | |
if(originalImage.imageOrientation != UIImageOrientationUp){ | |
UIGraphicsBeginImageContextWithOptions(originalImage.size, NO, originalImage.scale); | |
[originalImage drawInRect:(CGRect){0, 0, originalImage.size}]; | |
originalImage = UIGraphicsGetImageFromCurrentImageContext(); | |
UIGraphicsEndImageContext(); | |
} |
- (IBAction)pressXibModalButton:(id)sender { | |
// xibでの指定 | |
// XibChildViewController.xibならinitWithNibName:bundleは省略可能 => initでおk | |
XibChildViewController *xibChildViewController = [[XibChildViewController alloc]init]; | |
xibChildViewController.delegate = self; | |
xibChildViewController.modalPresentationStyle = UIModalPresentationOverCurrentContext; | |
[self presentViewController:xibChildViewController animated:YES completion:nil]; | |
} | |
- (IBAction)pressStoryboardModalButton:(id)sender { |
# -*- coding: utf-8 -*- | |
import cv | |
import cv2 | |
def main(): | |
img_bgr = cv2.imread('test_red.png') | |
#img_bgr = cv2.imread('orange.jpeg') | |
#img_bgr = cv2.imread('tomato.jpg') | |
img_hsv = cv2.cvtColor(img_bgr, cv.CV_BGR2HSV) | |
valid_hue_list = [[ hsv[0] for hsv in img_line if hsv[1] > 0] for img_line in img_hsv] |
# -*- coding: utf-8 -*- | |
import cv | |
import cv2 | |
def main(): | |
img = cv2.imread('test_red.png') | |
#img = cv2.imread('orange.jpeg') | |
#img = cv2.imread('tomato.jpg') | |
averages = img.mean(0).mean(0) | |
print averages |