Ask Your Question

polenorth1's profile - activity

2016-11-21 04:23:01 -0500 commented question STRICT macro redefinition Error- in file Tserial.cpp, how is that?

yes sure! should I mark it as "closed"? how it works in the forum?

2016-11-21 03:48:10 -0500 commented question STRICT macro redefinition Error- in file Tserial.cpp, how is that?

hi again! I founded this! : http://stackoverflow.com/questions/39..., maybe it is OK now...I changed the properties to Character Set: Not Set

2016-11-21 03:19:19 -0500 commented question STRICT macro redefinition Error- in file Tserial.cpp, how is that?

I have only one now: the last one about the argument C2664 error

2016-11-21 03:15:36 -0500 commented question STRICT macro redefinition Error- in file Tserial.cpp, how is that?

OK.Now it is reduced to 2 errors, thank you! I can´t find a new version of that code... I have a C2664 and a C4496 errors, this last one is about an unsafe function, as you suggested: Severity Code Description Project File Line Suppression State Error C4996 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. OpenCV1 c:\users\user\documents\visual studio 2015\projects\opencv1\opencv1\tserial.cpp 91
Severity Code Description Project File Line Suppression State Error C2664 'HANDLE CreateFileW(LPCWSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE)': cannot convert argument 1 from 'char [10]' to 'LPCWSTR' OpenCV1 c:\users\user\documents\visual studio 2015\projects\opencv1

2016-11-21 02:39:33 -0500 commented question STRICT macro redefinition Error- in file Tserial.cpp, how is that?

berek, thank you.while searching solutions, I saw something about including windows.h, I tried but it didn´t work...also tried to write the Serial lines at the top, but still no success.

2016-11-21 02:36:46 -0500 commented question STRICT macro redefinition Error- in file Tserial.cpp, how is that?

I had been searching for a solution for hours during the WE... LBerger, thanks, I removed Tserial.cpp. I have now 6 errors: LNK 2019, Severity Code Description Project File Line Suppression State Error LNK2019 unresolved external symbol "public: __cdecl Tserial::Tserial(void)" (??0Tserial@@QEAA@XZ) referenced in function main OpenCV1 C:\Users\user\Documents\Visual Studio 2015\Projects\OpenCV1\OpenCV1\Main.obj 1
Are the commands for serial no updated? what is wrong?

2016-11-20 22:26:48 -0500 asked a question STRICT macro redefinition Error- in file Tserial.cpp, how is that?
#include <opencv2\opencv.hpp>
#include "opencv2/objdetect/objdetect.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <iostream>
#include <stdio.h>

#include "tserial.h"
#include "tserial.cpp"

using namespace std;
using namespace cv;

/** Function Headers */
void detectAndDisplay(Mat frame);

/** Global variables */
String face_cascade_name = "haarcascade_frontalface_alt.xml";
String eyes_cascade_name = "haarcascade_eye_tree_eyeglasses.xml";
CascadeClassifier face_cascade;
CascadeClassifier eyes_cascade;
String window_name = "Capture - Face detection";

int arduino_command;
Tserial *arduino_com;
short MSBLSB = 0;
unsigned char MSB = 0;
unsigned char LSB = 0;

/** @function main */
int main(void)
{
    VideoCapture capture;
    Mat frame;

    // serial to Arduino setup 
    arduino_com = new Tserial();
    if (arduino_com != 0) {
        arduino_com->connect("COM7", 57600, spNONE);
    }
    // serial to Arduino setup 


    //-- 1. Load the cascades
    if (!face_cascade.load(face_cascade_name)) { printf("--(!)Error loading face cascade\n"); return -1; };
    if (!eyes_cascade.load(eyes_cascade_name)) { printf("--(!)Error loading eyes cascade\n"); return -1; };

    //-- 2. Read the video stream
    capture.open(1);
    if (!capture.isOpened()) { printf("--(!)Error opening video capture\n"); return -1; }

    while (capture.read(frame))
    {
        if (frame.empty())
        {
            printf(" --(!) No captured frame -- Break!");
            break;
        }

        //-- 3. Apply the classifier to the frame
        detectAndDisplay(frame);

        int c = waitKey(10);
        if ((char)c == 27) { break; } // escape
    }

    // Serial to Arduino - shutdown
    arduino_com->disconnect();
    delete arduino_com;
    arduino_com = 0;
    // Serial to Arduino - shutdown


    return 0;
}

/** @function detectAndDisplay */
void detectAndDisplay(Mat frame)
{
    std::vector<Rect> faces;
    Mat frame_gray;

    cvtColor(frame, frame_gray, COLOR_BGR2GRAY);
    equalizeHist(frame_gray, frame_gray);

    //-- Detect faces
    face_cascade.detectMultiScale(frame_gray, faces, 1.1, 2, 0 | CASCADE_SCALE_IMAGE, Size(30, 30));

    for (size_t i = 0; i < faces.size(); i++)
    {
        Point center(faces[i].x + faces[i].width / 2, faces[i].y + faces[i].height / 2);
        ellipse(frame, center, Size(faces[i].width / 2, faces[i].height / 2), 0, 0, 360, Scalar(255, 0, 255), 4, 8, 0);

        // send X,Y of face center to serial com port   
        // send X axis
        // read least significant byte 
        LSB = faces[i].x & 0xff;
        // read next significant byte 
        MSB = (faces[i].x >> 8) & 0xff;
        arduino_com->sendChar(MSB);
        arduino_com->sendChar(LSB);

        // Send Y axis
        LSB = faces[i].y & 0xff;
        MSB = (faces[i].y >> 8) & 0xff;
        arduino_com->sendChar(MSB);
        arduino_com->sendChar(LSB);
        // serial com port send 

        Mat faceROI = frame_gray(faces[i]);
        std::vector<Rect> eyes;

        //-- In each face, detect eyes
        eyes_cascade.detectMultiScale(faceROI, eyes, 1.1, 2, 0 | CASCADE_SCALE_IMAGE, Size(30, 30));

        for (size_t j = 0; j < eyes.size(); j++)
        {
            Point eye_center(faces[i].x + eyes[j].x + eyes[j].width / 2, faces[i].y + eyes[j].y + eyes[j].height / 2);
            int radius = cvRound((eyes[j].width + eyes[j].height)*0.25);
            circle(frame, eye_center, radius, Scalar(255, 0, 0), 4, 8, 0);
        }
    }
    //-- Show what you got
    imshow(window_name, frame);
}
2016-11-19 07:38:14 -0500 commented answer I have an error in #import numpy as np, why is that?

OK thank you, but it doesn´t recognize "Python" othingsn Command Prompt Visual Studio 2015... I guess I am mixing too many things, I don´t know the basics also... just learning on my own!

2016-11-19 07:26:07 -0500 commented answer I have an error in #import numpy as np, why is that?

Yes it is in that directory, thanks, yesterday I added a new pythonpath- to there, because I didn´t know I was mixing languages-I am starting learning, on my own. Thanks!

2016-11-19 07:21:49 -0500 commented question I have an error in #import numpy as np, why is that?

yes it is... I understand... thanks for the useful tip!

2016-11-15 20:15:42 -0500 asked a question I have an error in #import numpy as np, why is that?

The code I am trying to run is this one: ( Microsoft Visual Studio Coomunity 2015, Open cv 3.1.0. and numpy is downloaded in directory C:)

PS: how can I copy-paste the code here so you can read it properly?

#import numpy as np
#import cv2

//cargamos la plantilla e inicializamos la webcam :
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_alt.xml')
cap = cv2.VideoCapture(0)

while (True) :
    //leemos un frame y lo guardamos
    ret, img = cap.read()

    //convertimos la imagen a blanco y negro
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

    //buscamos las coordenadas de los rostros(si los hay) y
    //guardamos su posicion
    faces = face_cascade.detectMultiScale(gray, 1.3, 5)

    //Dibujamos un rectangulo en las coordenadas de cada rostro
    for (x, y, w, h) in faces :
cv2.rectangle(img, (x, y), (x + w, y + h), (125, 255, 0), 2)

//Mostramos la imagen
cv2.imshow('img', img)

//con la tecla 'q' salimos del programa
if cv2.waitKey(1) & 0xFF == ord('q') :
    break
    cap.release()
    cv2 - destroyAllWindows()
2016-11-14 20:22:20 -0500 commented question simple question:starting with open cv

OK thank you! Open cv 3 with Ubuntu was great.Now 2.3.1 version with windows, it only gives me one problem after another... The main reason for using that version is because I was working with a code ( Arduino and C++ ) already written on that version. Will keep on trying!

2016-11-14 13:26:49 -0500 asked a question simple question:starting with open cv

Hi, I am testing open cv with this simple code:

#include <stdio.h>  
// A Simple Camera Capture Framework 
int main() {
  CvCapture* capture = cvCaptureFromCAM( CV_CAP_ANY );
  if ( !capture ) {
    fprintf( stderr, "ERROR: capture is NULL \n" );
    getchar();
    return -1;
  }
 // Create a window in which the captured images will be presented
 cvNamedWindow( "mywindow", CV_WINDOW_AUTOSIZE );
 // Show the image captured from the camera in the window and repeat
 while ( 1 ) {
   // Get one frame
   IplImage* frame = cvQueryFrame( capture );
   if ( !frame ) {
     fprintf( stderr, "ERROR: frame is null...\n" );
     getchar();
     break;
   }
   cvShowImage( "mywindow", frame );
   // Do not release the frame!
   //If ESC key pressed, Key=0x10001B under OpenCV 0.9.7(linux version),
   //remove higher bits using AND operator
   if ( (cvWaitKey(10) & 255) == 27 ) break;
 }
 // Release the capture device housekeeping
 cvReleaseCapture( &capture );
 cvDestroyWindow( "mywindow" );
 return 0;
}

I build it, then I get this message:

1> stdafx.cpp 1> aver.cpp 1>aver.obj : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification 1> aver.vcxproj -> C:\Users\user\Documents\Visual Studio 2010\Projects\aver_FULL - copia\Debug\aver.exe ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

Then I press F5+Ctrl and the console windows opens, and shows a message: press to continue, I press and it stops... Why is that? Is it a problem with my PC? Thanks!

2016-11-13 13:24:09 -0500 asked a question LINK : fatal error LNK1104: cannot open file 'opencv_nonfree231d.lib'

I can´t find this opencv_nonofree231.lib on my PC... should I look for it and add it to my project directory?

2016-11-11 12:53:58 -0500 asked a question fatal error C1083

I am trying a Camera Capture Code, and I get this error:

1>c:\users\user\documents\visual studio 2010\projects\displaycamera\displaycamera\displaycamera.cpp(6): fatal error C1083: Cannot open include file: 'opencv2/objdetect/objdetect.hpp': No such file or directory

2016-11-11 12:52:26 -0500 answered a question Fatal error LNK1123

Hi, thanks a lot...

I changed to x64 in the include directories recently and it seemed to work...THANKS.

(Sorry I didn´t write to you before, but, as I am trying lots of differents codes, examples, and trying to fix errors on my own, I barely remember the changes I have been doing and the codes I have been trying now. It really helps, thank you. It is that I am a bit tired I had to re-install everything to a new PC because the other was K.O.)

2016-11-06 09:31:34 -0500 asked a question Fatal error LNK1123

LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I would like to know if there is a simple solution for this error...

I am using:

Open cv 2.4.7. Visual Studio 2010 Express Microsoft Visual C++ Express

Thank you,