forked from MasteringOpenCV/code
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
493 additions
and
493 deletions.
There are no files selected for viewing
38 changes: 19 additions & 19 deletions
38
Chapter2_iPhoneAR/Example_MarkerBasedAR/Example_MarkerBasedAR/AppDelegate.h
100755 → 100644
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
/***************************************************************************** | ||
* AppDelegate.h | ||
* Example_MarkerBasedAR | ||
****************************************************************************** | ||
* by Khvedchenia Ievgen, 5th Dec 2012 | ||
* http://computer-vision-talks.com | ||
****************************************************************************** | ||
* Ch2 of the book "Mastering OpenCV with Practical Computer Vision Projects" | ||
* Copyright Packt Publishing 2012. | ||
* http://www.packtpub.com/cool-projects-with-opencv/book | ||
*****************************************************************************/ | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface AppDelegate : UIResponder <UIApplicationDelegate> | ||
|
||
@property (strong, nonatomic) UIWindow *window; | ||
|
||
@end | ||
/***************************************************************************** | ||
* AppDelegate.h | ||
* Example_MarkerBasedAR | ||
****************************************************************************** | ||
* by Khvedchenia Ievgen, 5th Dec 2012 | ||
* http://computer-vision-talks.com | ||
****************************************************************************** | ||
* Ch2 of the book "Mastering OpenCV with Practical Computer Vision Projects" | ||
* Copyright Packt Publishing 2012. | ||
* http://www.packtpub.com/cool-projects-with-opencv/book | ||
*****************************************************************************/ | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface AppDelegate : UIResponder <UIApplicationDelegate> | ||
|
||
@property (strong, nonatomic) UIWindow *window; | ||
|
||
@end |
128 changes: 64 additions & 64 deletions
128
Chapter2_iPhoneAR/Example_MarkerBasedAR/Example_MarkerBasedAR/AppDelegate.m
100755 → 100644
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,64 @@ | ||
/***************************************************************************** | ||
* AppDelegate.m | ||
* Example_MarkerBasedAR | ||
****************************************************************************** | ||
* by Khvedchenia Ievgen, 5th Dec 2012 | ||
* http://computer-vision-talks.com | ||
****************************************************************************** | ||
* Ch2 of the book "Mastering OpenCV with Practical Computer Vision Projects" | ||
* Copyright Packt Publishing 2012. | ||
* http://www.packtpub.com/cool-projects-with-opencv/book | ||
*****************************************************************************/ | ||
|
||
#import "AppDelegate.h" | ||
|
||
@implementation AppDelegate | ||
|
||
@synthesize window = _window; | ||
|
||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | ||
{ | ||
// Override point for customization after application launch. | ||
return YES; | ||
} | ||
|
||
- (void)applicationWillResignActive:(UIApplication *)application | ||
{ | ||
/* | ||
Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. | ||
Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. | ||
*/ | ||
} | ||
|
||
- (void)applicationDidEnterBackground:(UIApplication *)application | ||
{ | ||
/* | ||
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. | ||
If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. | ||
*/ | ||
} | ||
|
||
- (void)applicationWillEnterForeground:(UIApplication *)application | ||
{ | ||
/* | ||
Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. | ||
*/ | ||
} | ||
|
||
- (void)applicationDidBecomeActive:(UIApplication *)application | ||
{ | ||
/* | ||
Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. | ||
*/ | ||
} | ||
|
||
- (void)applicationWillTerminate:(UIApplication *)application | ||
{ | ||
/* | ||
Called when the application is about to terminate. | ||
Save data if appropriate. | ||
See also applicationDidEnterBackground:. | ||
*/ | ||
} | ||
|
||
@end | ||
/***************************************************************************** | ||
* AppDelegate.m | ||
* Example_MarkerBasedAR | ||
****************************************************************************** | ||
* by Khvedchenia Ievgen, 5th Dec 2012 | ||
* http://computer-vision-talks.com | ||
****************************************************************************** | ||
* Ch2 of the book "Mastering OpenCV with Practical Computer Vision Projects" | ||
* Copyright Packt Publishing 2012. | ||
* http://www.packtpub.com/cool-projects-with-opencv/book | ||
*****************************************************************************/ | ||
|
||
#import "AppDelegate.h" | ||
|
||
@implementation AppDelegate | ||
|
||
@synthesize window = _window; | ||
|
||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | ||
{ | ||
// Override point for customization after application launch. | ||
return YES; | ||
} | ||
|
||
- (void)applicationWillResignActive:(UIApplication *)application | ||
{ | ||
/* | ||
Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. | ||
Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. | ||
*/ | ||
} | ||
|
||
- (void)applicationDidEnterBackground:(UIApplication *)application | ||
{ | ||
/* | ||
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. | ||
If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. | ||
*/ | ||
} | ||
|
||
- (void)applicationWillEnterForeground:(UIApplication *)application | ||
{ | ||
/* | ||
Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. | ||
*/ | ||
} | ||
|
||
- (void)applicationDidBecomeActive:(UIApplication *)application | ||
{ | ||
/* | ||
Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. | ||
*/ | ||
} | ||
|
||
- (void)applicationWillTerminate:(UIApplication *)application | ||
{ | ||
/* | ||
Called when the application is about to terminate. | ||
Save data if appropriate. | ||
See also applicationDidEnterBackground:. | ||
*/ | ||
} | ||
|
||
@end |
136 changes: 68 additions & 68 deletions
136
Chapter2_iPhoneAR/Example_MarkerBasedAR/Example_MarkerBasedAR/CameraCalibration.cpp
100755 → 100644
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,69 @@ | ||
/***************************************************************************** | ||
* CameraCalibration.cpp | ||
* Example_MarkerBasedAR | ||
****************************************************************************** | ||
* by Khvedchenia Ievgen, 5th Dec 2012 | ||
* http://computer-vision-talks.com | ||
****************************************************************************** | ||
* Ch2 of the book "Mastering OpenCV with Practical Computer Vision Projects" | ||
* Copyright Packt Publishing 2012. | ||
* http://www.packtpub.com/cool-projects-with-opencv/book | ||
*****************************************************************************/ | ||
|
||
#include "CameraCalibration.hpp" | ||
|
||
|
||
CameraCalibration::CameraCalibration() | ||
{ | ||
|
||
} | ||
|
||
CameraCalibration::CameraCalibration(float fx, float fy, float cx, float cy) | ||
{ | ||
for (int i=0; i<3; i++) | ||
for (int j=0; j<3; j++) | ||
m_intrinsic.mat[i][j] = 0; | ||
|
||
m_intrinsic.mat[0][0] = fx; | ||
m_intrinsic.mat[1][1] = fy; | ||
m_intrinsic.mat[0][2] = cx; | ||
m_intrinsic.mat[1][2] = cy; | ||
|
||
for (int i=0; i<4; i++) | ||
m_distorsion.data[i] = 0; | ||
} | ||
|
||
CameraCalibration::CameraCalibration(float fx, float fy, float cx, float cy, float distorsionCoeff[4]) | ||
{ | ||
for (int i=0; i<3; i++) | ||
for (int j=0; j<3; j++) | ||
m_intrinsic.mat[i][j] = 0; | ||
|
||
m_intrinsic.mat[0][0] = fx; | ||
m_intrinsic.mat[1][1] = fy; | ||
m_intrinsic.mat[0][2] = cx; | ||
m_intrinsic.mat[1][2] = cy; | ||
|
||
for (int i=0; i<4; i++) | ||
m_distorsion.data[i] = distorsionCoeff[i]; | ||
} | ||
|
||
void CameraCalibration::getMatrix34(float cparam[3][4]) const | ||
{ | ||
for (int j=0; j<3; j++) | ||
for (int i=0; i<3; i++) | ||
cparam[i][j] = m_intrinsic.mat[i][j]; | ||
|
||
for (int i=0; i<4; i++) | ||
cparam[3][i] = m_distorsion.data[i]; | ||
} | ||
|
||
const Matrix33& CameraCalibration::getIntrinsic() const | ||
{ | ||
return m_intrinsic; | ||
} | ||
|
||
const Vector4& CameraCalibration::getDistorsion() const | ||
{ | ||
return m_distorsion; | ||
/***************************************************************************** | ||
* CameraCalibration.cpp | ||
* Example_MarkerBasedAR | ||
****************************************************************************** | ||
* by Khvedchenia Ievgen, 5th Dec 2012 | ||
* http://computer-vision-talks.com | ||
****************************************************************************** | ||
* Ch2 of the book "Mastering OpenCV with Practical Computer Vision Projects" | ||
* Copyright Packt Publishing 2012. | ||
* http://www.packtpub.com/cool-projects-with-opencv/book | ||
*****************************************************************************/ | ||
|
||
#include "CameraCalibration.hpp" | ||
|
||
|
||
CameraCalibration::CameraCalibration() | ||
{ | ||
|
||
} | ||
|
||
CameraCalibration::CameraCalibration(float fx, float fy, float cx, float cy) | ||
{ | ||
for (int i=0; i<3; i++) | ||
for (int j=0; j<3; j++) | ||
m_intrinsic.mat[i][j] = 0; | ||
|
||
m_intrinsic.mat[0][0] = fx; | ||
m_intrinsic.mat[1][1] = fy; | ||
m_intrinsic.mat[0][2] = cx; | ||
m_intrinsic.mat[1][2] = cy; | ||
|
||
for (int i=0; i<4; i++) | ||
m_distorsion.data[i] = 0; | ||
} | ||
|
||
CameraCalibration::CameraCalibration(float fx, float fy, float cx, float cy, float distorsionCoeff[4]) | ||
{ | ||
for (int i=0; i<3; i++) | ||
for (int j=0; j<3; j++) | ||
m_intrinsic.mat[i][j] = 0; | ||
|
||
m_intrinsic.mat[0][0] = fx; | ||
m_intrinsic.mat[1][1] = fy; | ||
m_intrinsic.mat[0][2] = cx; | ||
m_intrinsic.mat[1][2] = cy; | ||
|
||
for (int i=0; i<4; i++) | ||
m_distorsion.data[i] = distorsionCoeff[i]; | ||
} | ||
|
||
void CameraCalibration::getMatrix34(float cparam[3][4]) const | ||
{ | ||
for (int j=0; j<3; j++) | ||
for (int i=0; i<3; i++) | ||
cparam[i][j] = m_intrinsic.mat[i][j]; | ||
|
||
for (int i=0; i<4; i++) | ||
cparam[3][i] = m_distorsion.data[i]; | ||
} | ||
|
||
const Matrix33& CameraCalibration::getIntrinsic() const | ||
{ | ||
return m_intrinsic; | ||
} | ||
|
||
const Vector4& CameraCalibration::getDistorsion() const | ||
{ | ||
return m_distorsion; | ||
} |
Oops, something went wrong.