forked from hairu/freelss
-
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.
FreeLSS 1.11 - Added the ability to connect to Hidden WiFi access poi…
…nts. Added support for running without the camera being attached.
- Loading branch information
Showing
9 changed files
with
220 additions
and
64 deletions.
There are no files selected for viewing
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
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
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
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 |
---|---|---|
@@ -0,0 +1,104 @@ | ||
/* | ||
**************************************************************************** | ||
* Copyright (c) 2015 Uriah Liggett <[email protected]> * | ||
* This file is part of FreeLSS. * | ||
* * | ||
* FreeLSS is free software: you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation, either version 3 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
* FreeLSS is distributed in the hope that it will be useful, * | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||
* GNU General Public License for more details. * | ||
* * | ||
* You should have received a copy of the GNU General Public License * | ||
* along with FreeLSS. If not, see <http://www.gnu.org/licenses/>. * | ||
**************************************************************************** | ||
*/ | ||
|
||
#include "Main.h" | ||
#include "MockCamera.h" | ||
|
||
|
||
namespace freelss | ||
{ | ||
|
||
MockCamera::MockCamera(int imageWidth, int imageHeight) : | ||
m_imageWidth(imageWidth), | ||
m_imageHeight(imageHeight) | ||
{ | ||
std::cout << "Creating Mock camera, width=" << m_imageWidth << ", height=" << m_imageHeight << std::endl; | ||
} | ||
|
||
Image * MockCamera::acquireImage() | ||
{ | ||
std::auto_ptr<Image> image(new Image(m_imageWidth, m_imageHeight, getImageComponents())); | ||
|
||
// Make the image black | ||
unsigned rowSpacing = image->getWidth() * image->getNumComponents(); | ||
unsigned char * pixels = image->getPixels(); | ||
memset(pixels, 0, image->getPixelBufferSize()); | ||
|
||
int xWidth = ROUND(image->getWidth() / 100.0f); | ||
float aspect = (float)image->getWidth() / (float) image->getHeight(); | ||
for (unsigned y = 0; y < image->getHeight(); y++) | ||
{ | ||
int x = (int)(y * aspect) - xWidth / 2; | ||
int endX = x + xWidth; | ||
while (x < endX) | ||
{ | ||
if (x >= 0 && x < (int)image->getWidth()) | ||
{ | ||
// Diagonal #1 | ||
pixels[x * image->getNumComponents()] = 255; | ||
|
||
// Diagonal #2 | ||
pixels[rowSpacing - x * image->getNumComponents()] = 255; | ||
} | ||
|
||
x++; | ||
} | ||
|
||
pixels += rowSpacing; | ||
} | ||
|
||
return image.release(); | ||
} | ||
|
||
void MockCamera::releaseImage(Image * image) | ||
{ | ||
delete image; | ||
} | ||
|
||
int MockCamera::getImageHeight() const | ||
{ | ||
return m_imageHeight; | ||
} | ||
|
||
int MockCamera::getImageWidth() const | ||
{ | ||
return m_imageWidth; | ||
} | ||
|
||
int MockCamera::getImageComponents() const | ||
{ | ||
return 3; | ||
} | ||
|
||
real MockCamera::getSensorWidth() const | ||
{ | ||
return 3.629; | ||
} | ||
|
||
real MockCamera::getSensorHeight() const | ||
{ | ||
return 2.722; | ||
} | ||
|
||
real MockCamera::getFocalLength() const | ||
{ | ||
return 3.6; | ||
} | ||
} // end ns scanner |
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 |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
**************************************************************************** | ||
* Copyright (c) 2015 Uriah Liggett <[email protected]> * | ||
* This file is part of FreeLSS. * | ||
* * | ||
* FreeLSS is free software: you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation, either version 3 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
* FreeLSS is distributed in the hope that it will be useful, * | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||
* GNU General Public License for more details. * | ||
* * | ||
* You should have received a copy of the GNU General Public License * | ||
* along with FreeLSS. If not, see <http://www.gnu.org/licenses/>. * | ||
**************************************************************************** | ||
*/ | ||
|
||
#pragma once | ||
#include "Image.h" | ||
#include "Camera.h" | ||
|
||
|
||
namespace freelss | ||
{ | ||
|
||
|
||
/** Reads an image use the raspberry pi's MMAL interfaces */ | ||
class MockCamera : public Camera | ||
{ | ||
public: | ||
MockCamera(int imageWidth, int imageHeight); | ||
|
||
Image * acquireImage(); | ||
|
||
void releaseImage(Image * image); | ||
|
||
/** Returns the height of the image that this camera takes. */ | ||
int getImageHeight() const; | ||
|
||
/** Returns the width of the image that this camera takes */ | ||
int getImageWidth() const; | ||
|
||
/** Returns the number of image components */ | ||
int getImageComponents() const; | ||
|
||
/** Returns the width of the sensor in mm */ | ||
real getSensorWidth() const; | ||
|
||
/** Returns the height of the sensor in mm */ | ||
real getSensorHeight() const; | ||
|
||
/** Returns the focal length of the camera in mm */ | ||
real getFocalLength() const; | ||
|
||
private: | ||
|
||
int m_imageWidth; | ||
int m_imageHeight; | ||
}; | ||
|
||
} |
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
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
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
Oops, something went wrong.