Ask Your Question

Bushra's profile - activity

2016-02-29 08:50:46 -0600 asked a question Unable to load my first opencv file
 $ g++ `pkg-config --libs --cflags opencv` -o cv2 cv2.cpp

/tmp/ccuiICVX.o: In function `main':
cv2.cpp:(.text+0x23): undefined reference to `cvLoadImage'
cv2.cpp:(.text+0x36): undefined reference to `cvNamedWindow'
cv2.cpp:(.text+0x47): undefined reference to `cvShowImage'
cv2.cpp:(.text+0x51): undefined reference to `cvWaitKey'
cv2.cpp:(.text+0x5d): undefined reference to `cvReleaseImage'
cv2.cpp:(.text+0x67): undefined reference to `cvDestroyWindow'
collect2: error: ld returned 1 exit status

Can anyone please help me to fix this problem?

2014-07-10 01:59:17 -0600 commented answer I am new to opencv. I tried my first code but certain error is hindering my procession to the completion of my project..

Thank you for replying to my queries. The above errors have been solved. Error was in the line "cvReleaseMemStorage(&p_strStorage); // deallocate necessary storage variable" Now I am not releasing it. But the object is not being detected, rather its detecting multiple objects( even if there are no objects).. It will be very kind of you , if u could help me with this..

2014-07-08 11:49:16 -0600 commented answer I am new to opencv. I tried my first code but certain error is hindering my procession to the completion of my project..

Unhandled exception at at 0x75141D4D in Threshold test.exe: Microsoft C++ exception: cv::Exception at memory location 0x0088BE5C.

2014-07-08 06:27:10 -0600 commented answer I am new to opencv. I tried my first code but certain error is hindering my procession to the completion of my project..

I am making a robot with arduino ..for object tracking purpose

2014-07-08 06:25:33 -0600 commented answer I am new to opencv. I tried my first code but certain error is hindering my procession to the completion of my project..

I have updated my question..now please have a look at the main code.. the images are converted to hsv and then the cvCvtColor has been applied..inspite of this the same error exists..

please help!!!

2014-07-08 06:23:02 -0600 received badge  Editor (source)
2014-07-08 06:17:21 -0600 commented question I am new to opencv. I tried my first code but certain error is hindering my procession to the completion of my project..

sir, actually i m required to do in c-api , as per the demand of my project...and my webcam is set to 640x480.. please suggest me some solution with this..

2014-07-08 05:12:26 -0600 asked a question I am new to opencv. I tried my first code but certain error is hindering my procession to the completion of my project..
#include <iostream>

#include<opencv/cvaux.h>
#include<opencv/highgui.h>
#include<opencv/cxcore.h>

#include<stdio.h>
#include<stdlib.h>

// Need to include this for serial port communication
#include <Windows.h>

///////////////////////////////////////////////////////////////////////////////////////////////////
int main(int argc, char* argv[])
{
// Setup serial port connection and needed variables.
HANDLE hSerial = CreateFile(L"COM3", GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);

if (hSerial !=INVALID_HANDLE_VALUE)
{
    printf("Port opened! \n");

    DCB dcbSerialParams;
    GetCommState(hSerial,&dcbSerialParams);

    dcbSerialParams.BaudRate = CBR_9600;
    dcbSerialParams.ByteSize = 8;
    dcbSerialParams.Parity = NOPARITY;
    dcbSerialParams.StopBits = ONESTOPBIT;

    SetCommState(hSerial, &dcbSerialParams);
}
else
{
    if (GetLastError() == ERROR_FILE_NOT_FOUND)
    {
        printf("Serial port doesn't exist! \n");
    }

    printf("Error while setting up serial port! \n");
}

char outputChars[] = "c";
DWORD btsIO;

// Setup OpenCV variables and structures
CvSize size640x480 = cvSize(640, 480);          // use a 640 x 480 size for all windows, also make sure your webcam is set to 640x480 !!

CvCapture* p_capWebcam;                     // we will assign our web cam video stream to this later . . .

IplImage* p_imgOriginal;            // pointer to an image structure, this will be the input image from webcam
IplImage* p_imgProcessed;           // pointer to an image structure, this will be the processed image
IplImage* p_imgHSV;                 // pointer to an image structure, this will hold the image after the color has been changed from RGB to HSV
                                    // IPL is short for Intel Image Processing Library, this is the structure used in OpenCV 1.x to work with images

CvMemStorage* p_strStorage;         // necessary storage variable to pass into cvHoughCircles()

CvSeq* p_seqCircles;                // pointer to an OpenCV sequence, will be returned by cvHough Circles() and will contain all circles
                                    // call cvGetSeqElem(p_seqCircles, i) will return a 3 element array of the ith circle (see next variable)

float* p_fltXYRadius;               // pointer to a 3 element array of floats
                                    // [0] => x position of detected object
                                    // [1] => y position of detected object
                                    // [2] => radius of detected object

int i;                              // loop counter
char charCheckForEscKey;            // char for checking key press (Esc exits program)

p_capWebcam = cvCaptureFromCAM(0);  // 0 => use 1st webcam, may have to change to a different number if you have multiple cameras

if(p_capWebcam == NULL) {           // if capture was not successful . . .
    printf("error: capture is NULL \n");    // error message to standard out . . .
    getchar();                              // getchar() to pause for user see message . . .
    return(-1);                             // exit program
}

                                                    // declare 2 windows
cvNamedWindow("Original", CV_WINDOW_AUTOSIZE);      // original image from webcam
cvNamedWindow("Processed", CV_WINDOW_AUTOSIZE);     // the processed image we will use for detecting circles

p_imgProcessed = cvCreateImage(size640x480,         // 640 x 480 pixels (CvSize struct from earlier)
                               IPL_DEPTH_8U,        // 8-bit color depth
                               1);                  // 1 channel (grayscale), if this was a color image, use 3

p_imgHSV = cvCreateImage(size640x480, IPL_DEPTH_8U, 3); 

// Variables for Arduino Control
int servoPosition = 90;
int servoOrientation = 0;

// Main program loop
while(1) {                              // for each frame . . .
    p_imgOriginal = cvQueryFrame(p_capWebcam);      // get frame from webcam

    if(p_imgOriginal == NULL) {                 // if frame was not captured successfully . . .
        printf("error: frame is NULL \n");      // error message to std out
        getchar();
        break;
    }

    // Change the color model from RGB (BGR) to HSV. This makes it easier to choose a color based on Hue
    cvCvtColor(p_imgOriginal, p_imgHSV, CV_BGR2HSV);

    cvInRangeS(p_imgHSV,                // function input
               cvScalar(38,  60,  70),          // min filtering value (if color is greater than or equal to this ...
(more)
2014-07-08 05:07:56 -0600 commented question Privileged instruction

Even I am facing the same error.. Please help