Optical Flow tracking implementation on iPhone 3GS
4月 19th, 2010
Recently I am enthusiastic for developing iPhone app which can capture posters and take panorama photo!
And now its prototype can track optical flow that is distance of moving of camera view.
The hierarchy of UIImagePickerController
3月 30th, 2010
You can get the hierarchy of subviews on UIImagePickerController with this code.
// Recursive enumerate subviews to get hierarchy of camera view.
- (BOOL)enumSubviews:(UIView*)view withNest:(int)idx
{
Class cl = [view class];
char sp[255];
memset(sp, ' ', 255);
sp[idx*4] = 0;
NSLog(@"%s%@\n", sp, NSStringFromClass(cl));
for (int i = 0; i < [view.subviews count]; i++)
{
if ([self enumSubviews:[view.subviews objectAtIndex:i] withNest:idx+1])
return YES;
}
return NO;
}
And here is a result.
PLCameraView
PLPreviewView
PLCameraFocusView
UIImageView
PLCropOverlay
OverlayView
PLCropOverlayBottomBar
UIImageView
PLCropOverlayBottomBarButton
UIImageView
UIButtonLabel
PLCropOverlayBottomBarButton
UIImageView
UIButtonLabel
UIImageView
PLCameraButton
UIView
UIImageView
PLCropOverlayBottomBarButton
UIImageView
UIButtonLabel
UIImageView
One of UIImageView has photo taken. Keep exploring..
[PHP]IMAPでメールの文字コード判定を行うには
11月 3rd, 2009
なぜかimap_headerinfo()の戻り値にはContent-Typeが含まれないので、
直に取得する力技で解決。
When you try to get charset of a mail on IMAP, imap_headerinfo() doesn’t include ‘Content-Type’ in the return value.
Below is a function to get type of charset from a mail header directly by calling imap_fetchheader.
<?
/**
@context IMAPハンドル
@number メールのID
@defcharset 失敗した時に返すデフォルトの文字セット名
@return 文字セット名
*/
function imap_getcharset($context, $number, $defcharset = "iso-2022-jp")
{
// Get charset
$h = imap_fetchheader($context, $number);
$mc = preg_match("/charsets*=s*(.+?)[;\n]/s", $h, $m);
$charset = $m[1] ? strtolower(trim($m[1])) : $defcharset;
}
?>

