Skip to content

Commit

Permalink
Made a few changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhijit J. Theophilus committed May 25, 2017
1 parent 7601512 commit d1d8bfd
Show file tree
Hide file tree
Showing 14 changed files with 89 additions and 73 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

enVR is a system designed to generate a 3D model from a sequence of 2D orthogonal projections of an object. These projections may either be read from a file or captured from a camera. The projections involve the front view, the two side planes, the back view and the top view. Once the images have been captured, enVR converts them into a 3D model drawn using OpenGL.

## System Requirements
## Build Requirements

1. OpenCV: version 2.4 or higher
2. FreeGLUT: version 3.0.0
3. _Optional_ Hardware setup with 5 cameras attached equidistant from the object along the plans described above (Top, Front, Left, Back, Right).
3. pkg-config
4. _Optional_ Hardware setup with 5 cameras attached equidistant from the object along the plans described above (Top, Front, Left, Back, Right).

## Installation

Expand Down
Binary file added img/circle/back.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/circle/front.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/circle/left.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/circle/right.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/circle/top.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/sharpener/back.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/sharpener/front.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/sharpener/left.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/sharpener/right.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/sharpener/top.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions include/Generate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@
#include "enVRConsts.hpp"

namespace enVR {
point_set extrapolate_projection(const cv::Mat&, std::string,
uchar, uchar, uchar);
point_set extrapolate_projection(const cv::Mat&,
std::string,
const uchar*,
const uchar*,
const uchar*);
point_set construct_3d_image(point_map&);
}

Expand Down
144 changes: 78 additions & 66 deletions src/Generate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,16 @@ using namespace enVR;

// Declarations for this file.

static point_set extrapolate_front(const cv::Mat&, uchar, uchar, uchar);
static point_set extrapolate_left (const cv::Mat&, uchar, uchar, uchar);
static point_set extrapolate_back (const cv::Mat&, uchar, uchar, uchar);
static point_set extrapolate_right(const cv::Mat&, uchar, uchar, uchar);
static point_set extrapolate_top (const cv::Mat&, uchar, uchar, uchar);
static point_set extrapolate_front(const cv::Mat&, const uchar*,
const uchar*, const uchar*);
static point_set extrapolate_left (const cv::Mat&, const uchar*,
const uchar*, const uchar*);
static point_set extrapolate_back (const cv::Mat&, const uchar*,
const uchar*, const uchar*);
static point_set extrapolate_right(const cv::Mat&, const uchar*,
const uchar*, const uchar*);
static point_set extrapolate_top (const cv::Mat&, const uchar*,
const uchar*, const uchar*);


/*
Expand All @@ -42,17 +47,19 @@ static point_set extrapolate_top (const cv::Mat&, uchar, uchar, uchar);
* Parameters:
* const cv::Mat& frame := The frame to extrapolate.
* std::string face := The face to extrapolate for.
* uchar rthresh := The red color threshold.
* uchar gthresh := The green color threshold.
* uchar bthresh := The blue color threshold.
* const uchar* rthresh := The red color threshold.
* const uchar* gthresh := The green color threshold.
* const uchar* bthresh := The blue color threshold.
*
* Returns:
* point_set := A set of points that form the projection for the
* corresponding face.
*/
point_set enVR::extrapolate_projection(const cv::Mat& frame, std::string face,
uchar rthresh, uchar gthresh,
uchar bthresh)
point_set enVR::extrapolate_projection(const cv::Mat& frame,
std::string face,
const uchar* rthresh,
const uchar* gthresh,
const uchar* bthresh)
{
point_set pts;
if (face == "front") pts = extrapolate_front(frame, rthresh, gthresh, bthresh);
Expand Down Expand Up @@ -105,8 +112,8 @@ point_set enVR::construct_3d_image(point_map& pmap)


/* Extrapolate the front face. */
static point_set extrapolate_front(const cv::Mat& frame, uchar rthresh,
uchar gthresh, uchar bthresh)
static point_set extrapolate_front(const cv::Mat& frame, const uchar* rthresh,
const uchar* gthresh, const uchar* bthresh)
{
point_set pts;
for (uint i=0; i < dim; ++i) {
Expand All @@ -115,24 +122,25 @@ static point_set extrapolate_front(const cv::Mat& frame, uchar rthresh,
uchar green = *p++;
uchar blue = *p++;
uchar red = *p++;
if (red < rthresh && green < gthresh && blue < bthresh) {
for (uint k=0; k < dim; ++k) {
points pt;
pt[0] = j;
pt[1] = dim - i - 1;
pt[2] = k;
pts.insert(pt);
}
}
if (red > rthresh[0] && red < rthresh[1])
if (green > gthresh[0] && green < gthresh[1])
if (blue > bthresh[0] && blue < bthresh[1])
for (uint k=0; k < dim; ++k) {
points pt;
pt[0] = j;
pt[1] = dim - i - 1;
pt[2] = k;
pts.insert(pt);
}
}
}
return pts;
}


/* Extrapolate the left face. */
static point_set extrapolate_left(const cv::Mat& frame, uchar rthresh,
uchar gthresh, uchar bthresh)
static point_set extrapolate_left(const cv::Mat& frame, const uchar* rthresh,
const uchar* gthresh, const uchar* bthresh)
{
point_set pts;
for (uint i=0; i < dim; ++i) {
Expand All @@ -141,24 +149,25 @@ static point_set extrapolate_left(const cv::Mat& frame, uchar rthresh,
uchar green = *p++;
uchar blue = *p++;
uchar red = *p++;
if (red < rthresh && green < gthresh && blue < bthresh) {
for (uint k=0; k < dim; ++k) {
points pt;
pt[0] = k;
pt[1] = dim - i - 1;
pt[2] = j;
pts.insert(pt);
}
}
if (red > rthresh[0] && red < rthresh[1])
if (green > gthresh[0] && green < gthresh[1])
if (blue > bthresh[0] && blue < bthresh[1])
for (uint k=0; k < dim; ++k) {
points pt;
pt[0] = k;
pt[1] = dim - i - 1;
pt[2] = j;
pts.insert(pt);
}
}
}
return pts;
}


/* Extrapolate the back face. */
static point_set extrapolate_back(const cv::Mat& frame, uchar rthresh,
uchar gthresh, uchar bthresh)
static point_set extrapolate_back(const cv::Mat& frame, const uchar* rthresh,
const uchar* gthresh, const uchar* bthresh)
{
point_set pts;
for (uint i=0; i < dim; ++i) {
Expand All @@ -167,24 +176,25 @@ static point_set extrapolate_back(const cv::Mat& frame, uchar rthresh,
uchar green = *p++;
uchar blue = *p++;
uchar red = *p++;
if (red < rthresh && green < gthresh && blue < bthresh) {
for (uint k=0; k < dim; ++k) {
points pt;
pt[0] = dim - j - 1;
pt[1] = dim - i - 1;
pt[2] = k;
pts.insert(pt);
}
}
if (red > rthresh[0] && red < rthresh[1])
if (green > gthresh[0] && green < gthresh[1])
if (blue > bthresh[0] && blue < bthresh[1])
for (uint k=0; k < dim; ++k) {
points pt;
pt[0] = dim - j - 1;
pt[1] = dim - i - 1;
pt[2] = k;
pts.insert(pt);
}
}
}
return pts;
}


/* Extrapolate the right face. */
static point_set extrapolate_right(const cv::Mat& frame, uchar rthresh,
uchar gthresh, uchar bthresh)
static point_set extrapolate_right(const cv::Mat& frame, const uchar* rthresh,
const uchar* gthresh, const uchar* bthresh)
{
point_set pts;
for (uint i=0; i < dim; ++i) {
Expand All @@ -193,24 +203,25 @@ static point_set extrapolate_right(const cv::Mat& frame, uchar rthresh,
uchar green = *p++;
uchar blue = *p++;
uchar red = *p++;
if (red < rthresh && green < gthresh && blue < bthresh) {
for (uint k=0; k < dim; ++k) {
points pt;
pt[0] = k;
pt[1] = dim - i - 1;
pt[2] = dim - j - 1;
pts.insert(pt);
}
}
if (red > rthresh[0] && red < rthresh[1])
if (green > gthresh[0] && green < gthresh[1])
if (blue > bthresh[0] && blue < bthresh[1])
for (uint k=0; k < dim; ++k) {
points pt;
pt[0] = k;
pt[1] = dim - i - 1;
pt[2] = dim - j - 1;
pts.insert(pt);
}
}
}
return pts;
}


/* Extrapolate the top face. */
static point_set extrapolate_top(const cv::Mat& frame, uchar rthresh,
uchar gthresh, uchar bthresh)
static point_set extrapolate_top(const cv::Mat& frame, const uchar* rthresh,
const uchar* gthresh, const uchar* bthresh)
{
point_set pts;
for (uint i=0; i < dim; ++i) {
Expand All @@ -219,15 +230,16 @@ static point_set extrapolate_top(const cv::Mat& frame, uchar rthresh,
uchar green = *p++;
uchar blue = *p++;
uchar red = *p++;
if (red < rthresh && green < gthresh && blue < bthresh) {
for (uint k=0; k < dim; ++k) {
points pt;
pt[0] = j;
pt[1] = k;
pt[2] = i;
pts.insert(pt);
}
}
if (red > rthresh[0] && red < rthresh[1])
if (green > gthresh[0] && green < gthresh[1])
if (blue > bthresh[0] && blue < bthresh[1])
for (uint k=0; k < dim; ++k) {
points pt;
pt[0] = j;
pt[1] = k;
pt[2] = i;
pts.insert(pt);
}
}
}
return pts;
Expand Down
6 changes: 3 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
#include <iostream>
#include <limits>

const uchar rthresh = 200;
const uchar gthresh = 200;
const uchar bthresh = 200;
const uchar rthresh[] = {0, 200};
const uchar gthresh[] = {0, 200};
const uchar bthresh[] = {0, 200};

int main(int argc, char* argv[])
{
Expand Down

0 comments on commit d1d8bfd

Please sign in to comment.