CLEYE Reading Image Pixels Value
Posted: 19 November 2011 05:05 PM   [ Ignore ]
New Member
Rank
Total Posts:  1
Joined  2011-11-08

I am trying to do some Image Pixel Reading, I pulled some of the code off an OpenCV site, however, when I tried to compile it, alone, I get a flash of the console window and then nothing. However, if I tried to integrate it with some code that I pulled from the laboratories, however, I get the following errors:

error C3861: ‘PS3EyeMulticamStart’: identifier not found
error C3861: ‘PS3EyeMulticamGetFrame’: identifier not found
error C3861: ‘PS3EyeMulticamStop’: identifier not found
error C3861: ‘PS3EyeMulticamGetCameraCount’: identifier not found
error C2664: ‘MessageBoxW’ : cannot convert parameter 2 from ‘const char [26]’ to ‘LPCWSTR’
1>      Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
error C2065: ‘VGA’ : undeclared identifier
error C3861: ‘PS3EyeMulticamOpen’: identifier not found
error C2664: ‘MessageBoxW’ : cannot convert parameter 2 from ‘const char [32]’ to ‘LPCWSTR’
1>      Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
error C3861: ‘PS3EyeMulticamLoadSettings’: identifier not found
error C3861: ‘PS3EyeMulticamGetFrameDimensions’: identifier not found
error C2664: ‘MessageBoxW’ : cannot convert parameter 2 from ‘const char [32]’ to ‘LPCWSTR’
1>      Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
error C3861: ‘PS3EyeMulticamClose’: identifier not found
error C3861: ‘PS3EyeMulticamShowSettings’: identifier not found
error C3861: ‘PS3EyeMulticamSaveSettings’: identifier not found
error C3861: ‘PS3EyeMulticamClose’: identifier not found
1>


Here is the code:

[/code]
#include "stdafx.h"
#include "cv.h"
#include "highgui.h"
#include "CLEyeMulticam.h"
 
#define WINDOW_NAME     "Capture Window"
bool bRunning false;
int wh;
 
// Capture thread
DWORD WINAPI Capture(LPVOID)
{
    IplImage 
*grayImage cvCreateImage(cvSize(wh), IPL_DEPTH_8U1);
    
PS3EyeMulticamStart();
    while(
bRunning)
    
{
        PBYTE pBuffer 
NULL;
        
cvGetImageRawData(grayImage, &pBuffer;);
        
PS3EyeMulticamGetFrame(pBuffer);
        
cvShowImage(WINDOW_NAMEgrayImage);
    
}
    PS3EyeMulticamStop
();
    
cvReleaseImage(&grayImage;);
    return 
0;
}
 
void Program
()
{
    
// Query driver for number of connected PS3Eye cameras
    
int camCnt PS3EyeMulticamGetCameraCount();
    
printf("Found %d PS3Eye cameras\n"camCnt);
    if(
camCnt == 0)
    
{
        MessageBox
(NULL,"No PS3Eye camera(s) found","PS3EyeMulticamTest"MB_ICONEXCLAMATION);
        return;
    
}
    
// Open cameras
    
if(!PS3EyeMulticamOpen(camCntVGA30))
    
{
        MessageBox
(NULL,"Could not open PS3Eye camera(s)","PS3EyeMulticamTest"MB_ICONEXCLAMATION);
        return;
    
}
    
// Load the default camera settings 'settings.xml' file
    // If the file is not found it will be created
    
PS3EyeMulticamLoadSettings("settings.xml");
 
    
// Get output image dimensions
    
PS3EyeMulticamGetFrameDimensions(wh);
    
printf("Image dimensions (%d, %d)\n"wh);
 
    
// Create OpenCV main window
    
cvNamedWindow(WINDOW_NAMECV_WINDOW_AUTOSIZE);
    
cvMoveWindow(WINDOW_NAME00);
    
cvResizeWindow(WINDOW_NAMEwh);
 
    
// Start PS3Eye image capture thread
    
HANDLE hThread CreateThread(NULL0CaptureNULL00);
    if(
hThread == NULL)
    
{
        MessageBox
(NULL,"Could not create capture thread","PS3EyeMulticamTest"MB_ICONEXCLAMATION);
        
PS3EyeMulticamClose();
        return;
    
}
    bRunning 
true;
    
// The 's' key will open camera settings dialog
    
while(bRunning)
    
{
        int key 
cvWaitKey(0);
        switch(
key)
        
{
            
case 's':
            case 
'S':
                
// Display settings
                
PS3EyeMulticamShowSettings();
            break;
            case 
0x1b:
                
printf("Exiting...\n");
                
// Stop the capture thread
                
bRunning false;
                
// Wait for thread to exit
                
WaitForSingleObject(hThread3000);
                
printf("Thread exited\n");
            break;
        
}
    }
    
// Save camera settings
    
printf("Saving settings\n");
    
PS3EyeMulticamSaveSettings();
    
printf("Closing OpenCV window\n");
    
cvDestroyWindow(WINDOW_NAME);
    
PS3EyeMulticamClose();
}
 

void
mouseHandler
(int eventint xint yint flagsvoidparam)
{
    IplImage
img0, * img1;
    
CvFont    font;
    
uchar*    ptr;
    
char      label[20];
 
    
img0 = (IplImage*) param;
    
img1 cvCloneImage(img0);
 
    
cvInitFont(&font;, CV_FONT_HERSHEY_PLAIN.8.8018);
 
    if (
event == CV_EVENT_LBUTTONDOWN)
    
{
        
/* read pixel */
        
ptr cvPtr2D(img1yxNULL);
 
        
/*
         * display the BGR value
         */
        
sprintf(label"(%d, %d, %d)"ptr[0]ptr[1]ptr[2]);
 
        
cvRectangle(
            
img1,
            
cvPoint(x12),
            
cvPoint(1004),
            
CV_RGB(25500),
            
CV_FILLED,
            
80
        
);
 
        
cvPutText(
            
img1,
            
label,
            
cvPoint(xy),
            &
font;,
            
CV_RGB(2552550)
        );
 
        
cvShowImage("img"img1);
    
}
}


// This is the program entry if you link with /SUBSYSTEM:CONSOLE option
int main(int argcchar *argv[])
{
Program
();
IplImageimg;
 
    
/* usage: <prog_name> <image> */
    
if (argc != 2{
        printf
("Usage: %s <image>\n"argv[0]);
        return 
1;
    
}
 
    
/* load image */
    
img cvLoadImage(argv[1]1);
 
    
/* always check */
    
assert(img);
 
    
/* create a window and install mouse handler */
    
cvNamedWindow("img"1);
    
cvSetMouseCallback("img"mouseHandler, (void*)img);
 
    
cvShowImage("img"img);
 
    
cvWaitKey(0);
 
    
/* be tidy */
    
cvDestroyAllWindows();
    
cvReleaseImage(&img;);
 
    return 
0;
}

[code] 

how do I fix this?

Profile
 
 
 
 


RSS 2.0     Atom Feed