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.
Added code documentation and gave variables to more self-explanatory …
…names
- Loading branch information
Showing
16 changed files
with
1,631 additions
and
1,514 deletions.
There are no files selected for viewing
56 changes: 29 additions & 27 deletions
56
Chapter2_iPhoneAR/Example_MarkerBasedAR/Example_MarkerBasedAR/BGRAVideoFrame.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,27 +1,29 @@ | ||
/***************************************************************************** | ||
* BGRAVideoFrame.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 | ||
*****************************************************************************/ | ||
|
||
#ifndef Example_MarkerBasedAR_BGRAVideoFrame_h | ||
#define Example_MarkerBasedAR_BGRAVideoFrame_h | ||
|
||
// A helper struct presenting interleaved BGRA image in memory. | ||
struct BGRAVideoFrame | ||
{ | ||
size_t width; | ||
size_t height; | ||
size_t stride; | ||
|
||
uint8_t * data; | ||
}; | ||
|
||
|
||
#endif | ||
/***************************************************************************** | ||
* BGRAVideoFrame.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 | ||
*****************************************************************************/ | ||
|
||
#ifndef Example_MarkerBasedAR_BGRAVideoFrame_h | ||
#define Example_MarkerBasedAR_BGRAVideoFrame_h | ||
|
||
#include <cstddef> | ||
|
||
// A helper struct presenting interleaved BGRA image in memory. | ||
struct BGRAVideoFrame | ||
{ | ||
size_t width; | ||
size_t height; | ||
size_t stride; | ||
|
||
unsigned char * data; | ||
}; | ||
|
||
|
||
#endif |
81 changes: 41 additions & 40 deletions
81
Chapter2_iPhoneAR/Example_MarkerBasedAR/Example_MarkerBasedAR/CameraCalibration.hpp
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,40 +1,41 @@ | ||
/***************************************************************************** | ||
* CameraCalibration.hpp | ||
* 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 | ||
*****************************************************************************/ | ||
|
||
#ifndef Example_MarkerBasedAR_CameraCalibration_hpp | ||
#define Example_MarkerBasedAR_CameraCalibration_hpp | ||
|
||
//////////////////////////////////////////////////////////////////// | ||
// File includes: | ||
#include "GeometryTypes.hpp" | ||
|
||
/** | ||
* A camera calibraiton class that stores intrinsic matrix and distorsion coefficients. | ||
*/ | ||
class CameraCalibration | ||
{ | ||
public: | ||
CameraCalibration(); | ||
CameraCalibration(float fx, float fy, float cx, float cy); | ||
CameraCalibration(float fx, float fy, float cx, float cy, float distorsionCoeff[4]); | ||
|
||
void getMatrix34(float cparam[3][4]) const; | ||
|
||
const Matrix33& getIntrinsic() const; | ||
const Vector4& getDistorsion() const; | ||
|
||
private: | ||
Matrix33 m_intrinsic; | ||
Vector4 m_distorsion; | ||
}; | ||
|
||
#endif | ||
/***************************************************************************** | ||
* CameraCalibration.hpp | ||
* 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 | ||
*****************************************************************************/ | ||
|
||
#ifndef Example_MarkerBasedAR_CameraCalibration_hpp | ||
#define Example_MarkerBasedAR_CameraCalibration_hpp | ||
|
||
//////////////////////////////////////////////////////////////////// | ||
// File includes: | ||
#include "GeometryTypes.hpp" | ||
|
||
/** | ||
* A camera calibraiton class that stores intrinsic matrix | ||
* and distorsion vector. | ||
*/ | ||
class CameraCalibration | ||
{ | ||
public: | ||
CameraCalibration(); | ||
CameraCalibration(float fx, float fy, float cx, float cy); | ||
CameraCalibration(float fx, float fy, float cx, float cy, float distorsionCoeff[4]); | ||
|
||
void getMatrix34(float cparam[3][4]) const; | ||
|
||
const Matrix33& getIntrinsic() const; | ||
const Vector4& getDistorsion() const; | ||
|
||
private: | ||
Matrix33 m_intrinsic; | ||
Vector4 m_distorsion; | ||
}; | ||
|
||
#endif |
80 changes: 40 additions & 40 deletions
80
Chapter2_iPhoneAR/Example_MarkerBasedAR/Example_MarkerBasedAR/EAGLView.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,40 +1,40 @@ | ||
/***************************************************************************** | ||
* EAGLView.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> | ||
|
||
#import <OpenGLES/ES1/gl.h> | ||
#import <OpenGLES/ES1/glext.h> | ||
#import <OpenGLES/ES2/gl.h> | ||
#import <OpenGLES/ES2/glext.h> | ||
|
||
@class EAGLContext; | ||
|
||
// This class wraps the CAEAGLLayer from CoreAnimation into a convenient UIView subclass. | ||
// The view content is basically an EAGL surface you render your OpenGL scene into. | ||
// Note that setting the view non-opaque will only work if the EAGL surface has an alpha channel. | ||
@interface EAGLView : UIView | ||
{ | ||
@private | ||
// The OpenGL ES names for the framebuffer and renderbuffer used to render to this view. | ||
GLuint defaultFramebuffer, colorRenderbuffer; | ||
} | ||
|
||
@property (nonatomic, retain) EAGLContext *context; | ||
// The pixel dimensions of the CAEAGLLayer. | ||
@property (readonly) GLint framebufferWidth; | ||
@property (readonly) GLint framebufferHeight; | ||
|
||
- (void)setFramebuffer; | ||
- (BOOL)presentFramebuffer; | ||
- (void)initContext; | ||
@end | ||
/***************************************************************************** | ||
* EAGLView.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> | ||
|
||
#import <OpenGLES/ES1/gl.h> | ||
#import <OpenGLES/ES1/glext.h> | ||
#import <OpenGLES/ES2/gl.h> | ||
#import <OpenGLES/ES2/glext.h> | ||
|
||
@class EAGLContext; | ||
|
||
// This class wraps the CAEAGLLayer from CoreAnimation into a convenient UIView subclass. | ||
// The view content is basically an EAGL surface you render your OpenGL scene into. | ||
// Note that setting the view non-opaque will only work if the EAGL surface has an alpha channel. | ||
@interface EAGLView : UIView | ||
{ | ||
@private | ||
// The OpenGL ES names for the framebuffer and renderbuffer used to render to this view. | ||
GLuint defaultFramebuffer, colorRenderbuffer, depthRenderbuffer; | ||
} | ||
|
||
@property (nonatomic, retain) EAGLContext *context; | ||
// The pixel dimensions of the CAEAGLLayer. | ||
@property (readonly) GLint framebufferWidth; | ||
@property (readonly) GLint framebufferHeight; | ||
|
||
- (void)setFramebuffer; | ||
- (BOOL)presentFramebuffer; | ||
- (void)initContext; | ||
@end |
Oops, something went wrong.