Skip to content

Commit

Permalink
* Patch to use it with the newest version
Browse files Browse the repository at this point in the history
  • Loading branch information
chrberger committed Jul 28, 2015
1 parent 79d9927 commit 9fbf5e5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
25 changes: 12 additions & 13 deletions CaroloCup-CameraPlayback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@
#include <core/wrapper/SharedMemoryFactory.h>
#include <tools/player/Player.h>

#include <core/data/image/SharedImage.h>
#include <GeneratedHeaders_CoreData.h>

using namespace std;

// We add some of OpenDaVINCI's namespaces for the sake of readability.
using namespace core;
using namespace core::base;
using namespace core::data;
using namespace core::data::image;
using namespace coredata::image;
using namespace core::io;
using namespace core::wrapper;
using namespace tools::player;
Expand Down Expand Up @@ -114,19 +114,18 @@ int32_t main(int32_t argc, char **argv) {

// Check if we could successfully attach to the shared memory.
if (sharedImageMemory->isValid()) {
// Using a shared lock to get exclusive access.
sharedImageMemory->lock();

if (image == NULL) {
// Create the IplImage header data and access the shared memory for the actual image data.
image = cvCreateImageHeader(cvSize(si.getWidth(), si.getHeight()), IPL_DEPTH_8U, si.getBytesPerPixel());

// Let the IplImage point to the shared memory containing the captured image.
image->imageData = static_cast<char*>(sharedImageMemory->getSharedMemory());
// Using a scoped lock to get exclusive access.
{
Lock l(sharedImageMemory);
if (image == NULL) {
// Create the IplImage header data and access the shared memory for the actual image data.
image = cvCreateImageHeader(cvSize(si.getWidth(), si.getHeight()), IPL_DEPTH_8U, si.getBytesPerPixel());

// Let the IplImage point to the shared memory containing the captured image.
image->imageData = static_cast<char*>(sharedImageMemory->getSharedMemory());
}
}

sharedImageMemory->unlock();

// Show the image using OpenCV.
cvShowImage("CaroloCup-CameraPlayback", image);

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
CXX=g++
RM=rm -f
INCLUDES=-I/usr/include/opendavinci
INCLUDES=-I/opt/od/include/opendavinci
CPPFLAGS=-Wall $(INCLUDES)
LDLIBS=-lopendavinci -lpthread -lopencv_core -lopencv_highgui
LDLIBS=-L/opt/od/lib/ -lopendavinci -lpthread -lopencv_core -lopencv_highgui

BIN=CaroloCup-CameraPlayback
SRCS=CaroloCup-CameraPlayback.cpp
Expand Down

0 comments on commit 9fbf5e5

Please sign in to comment.