Skip to content

Commit

Permalink
Added code documentation and gave variables to more self-explanatory …
Browse files Browse the repository at this point in the history
…names
  • Loading branch information
BloodAxe committed Feb 5, 2013
1 parent 7f10074 commit a7a56c7
Show file tree
Hide file tree
Showing 16 changed files with 1,631 additions and 1,514 deletions.
56 changes: 29 additions & 27 deletions Chapter2_iPhoneAR/Example_MarkerBasedAR/Example_MarkerBasedAR/BGRAVideoFrame.h
100755 → 100644
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 Chapter2_iPhoneAR/Example_MarkerBasedAR/Example_MarkerBasedAR/CameraCalibration.hpp
100755 → 100644
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 Chapter2_iPhoneAR/Example_MarkerBasedAR/Example_MarkerBasedAR/EAGLView.h
100755 → 100644
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
Loading

0 comments on commit a7a56c7

Please sign in to comment.