'잡동사니'에 해당되는 글 12969건

  1. 2016.07.14 opencv stitch
  2. 2016.07.13 opencv rtsp
  3. 2016.07.12 cpp dlopen / gcc -l
  4. 2016.07.11 그러고 보니 전기가 안부족한 듯?
  5. 2016.07.11 cpp thread.... / pthread
  6. 2016.07.11 객체지향과 if문?
  7. 2016.07.11 cpp 클래스 구성
  8. 2016.07.10 c&c generals - usa 6
  9. 2016.07.10 초음파 거리 + 온/습도 센서
  10. 2016.07.10 초음파 센서 wiring pi 버전
Programming/openCV2016. 7. 14. 11:38

rtsp로 받아서 stitch 한번 해볼까나

(cpu의 온기가 남아있습니다?)


[링크 : http://www.pyimagesearch.com/2016/01/11/opencv-panorama-stitching/]

[링크 : http://study.marearts.com/2013/11/opencv-stitching-example-stitcher-class.html]

[링크 : http://docs.opencv.org/2.4/modules/stitching/doc/stitching.html]

'Programming > openCV' 카테고리의 다른 글

openCV multicore support  (0) 2018.03.19
stitch / opencv / python  (0) 2016.07.18
opencv rtsp  (0) 2016.07.13
openMP + openCV 실패한 이유가..  (0) 2015.11.27
openMP + openCV 미스테리..  (0) 2015.11.09
Posted by 구차니
Programming/openCV2016. 7. 13. 18:37

예제는 mjpeg 같은데 h264 도 되려나?

다만 라즈베리 openmax 지원여부는 별개일 기분?


[링크 : http://blog.daum.net/pg365/195]

'Programming > openCV' 카테고리의 다른 글

stitch / opencv / python  (0) 2016.07.18
opencv stitch  (0) 2016.07.14
openMP + openCV 실패한 이유가..  (0) 2015.11.27
openMP + openCV 미스테리..  (0) 2015.11.09
휴 모멘트?  (0) 2015.10.20
Posted by 구차니
Programming/C++ STL2016. 7. 12. 08:41

dlopen은 c 시절의 녀석이라 class 자체를 끌어올수는 없다.

[링크 : http://www.joinc.co.kr/w/Site/C++/Documents/Dynamic_Class_Loading]


다만.. gcc 에서 컴파일시 -l 링커이름으로 주면 바로 사용가능

[링크 : http://stackoverflow.com/questions/58058/using-c-classes-in-so-libraries]




근데 문득.. 둘다 so인데

dlopen과 -l을 통한것의 차이를 모르겠네?

'Programming > C++ STL' 카테고리의 다른 글

class 기본 접근제한자  (0) 2016.07.18
cpp 매크로 __PRETTY_FUNCTION__  (0) 2016.07.18
cpp thread.... / pthread  (0) 2016.07.11
객체지향과 if문?  (0) 2016.07.11
cpp 클래스 구성  (0) 2016.07.11
Posted by 구차니

원래 이맘때면 미친듯이 전력사정이 어쩌구 하면서

에어컨 끄고 하라는 말이나오는데

조용~



원자력 발전 잘 돌아가던가

민자 화력 발전소가 많이 늘었던가

경제 파탄나서 회사들이 망해서 전기 많이 안쓰던가

가정에서도 돈이 없어서 전기 못쓰던가


아니면 다던가?

'개소리 왈왈 > 정치관련 신세한탄' 카테고리의 다른 글

머 이런꿈을 다꾸게 되냐  (2) 2016.07.22
lg 에어컨(신형) 필터 교체 신청  (0) 2016.07.21
내 새끼 건드리면 빼애애애액  (0) 2016.07.01
6.25  (0) 2016.06.25
영국 브렉시트  (0) 2016.06.24
Posted by 구차니
Programming/C++ STL2016. 7. 11. 13:46

아.. 어렵다 ㅠㅠ


쓰레드 join()

[링크 : http://arer.tistory.com/45]

[링크 : http://linux.die.net/man/3/pthread_cond_wait]

[링크 : http://linux.die.net/man/3/pthread_join]

[링크 : http://www.joinc.co.kr/w/Site/Thread/Beginning/PthreadApiReference#AEN144]

[링크 : http://www.joinc.co.kr/w/man/3/pthread_create]


main()이 return 0;로 되어도

쓰레드가 종료 되기 전에는 main()이 못 죽는 신기한 현상? 이라고 해야하려나?


[링크 : http://www.cplusplus.com/reference/thread/thread/]

[링크 : http://www.cplusplus.com/reference/thread/thread/join/]


[링크 : http://www.morenice.kr/75]

[링크 : http://linux.die.net/man/3/pthread_attr_setdetachstate]


자식쓰레드를 부모쓰레드로 부터 분리하기

pthread_join의 사용으로 발생할 수 있는 문제점을 해결하기 위한, 가장 좋은 방법중의 하나는 pthread_detach 를 이용해서, 자식 쓰레드를 부모쓰레드와 완전히 분리해 버리는 방법이다. 이 경우 자식 쓰레드가 종료되면, 모든 자원이 즉시 반환된다. 반면, 자식 쓰레드의 종료상태를 알 수 없다는 문제가 발생한다. 대게의 경우 자식 쓰레드의 종료상태가 중요한 문제가 되지는 않을 것이다.

[링크 : http://www.joinc.co.kr/w/Site/system_programing/Book_LSP/ch07_Thread]

'Programming > C++ STL' 카테고리의 다른 글

cpp 매크로 __PRETTY_FUNCTION__  (0) 2016.07.18
cpp dlopen / gcc -l  (0) 2016.07.12
객체지향과 if문?  (0) 2016.07.11
cpp 클래스 구성  (0) 2016.07.11
cpp enum in class  (0) 2016.07.01
Posted by 구차니
Programming/C++ STL2016. 7. 11. 13:14

도대체 객체지향이 머길래 IF를 없앨수 있나 라고 글들을 찾아 보니..

객체 타입에 따라서 자동화 되어 버린(?) C로 치면 모델병 미친듯한 if문에서

조금은 해방될 수 있다 정도로 이해하면 되려나?


논리 조거식 조차도 없애야 한다는 줄 알았네 ㄷㄷㄷ


[링크 : https://kldp.org/node/31629]

[링크 : http://alankang.tistory.com/249]

    [링크 : http://silverktk.tistory.com/353]

[링크 : http://www.gpgstudy.com/forum/viewtopic.php?t=7803]

'Programming > C++ STL' 카테고리의 다른 글

cpp dlopen / gcc -l  (0) 2016.07.12
cpp thread.... / pthread  (0) 2016.07.11
cpp 클래스 구성  (0) 2016.07.11
cpp enum in class  (0) 2016.07.01
cpp const  (0) 2016.06.22
Posted by 구차니
Programming/C++ STL2016. 7. 11. 11:28

좋은 내용들이 있어서 저장

Shape::Shape (const Point center,

const int color)

{

_center = center;

_color = color;

}


Shape::Shape (const Pointer center,

const int color)

: _center(center)

, _color (color)

{


[링크 : http://ogoons.tistory.com/59]


상식을 깨는(!)

초기화를 위해 constructor에 너무 많은걸 넣지 말라라던가(객체 생성시 오버헤드로 인해 초기화 연산자로?)

등등?

'Programming > C++ STL' 카테고리의 다른 글

cpp thread.... / pthread  (0) 2016.07.11
객체지향과 if문?  (0) 2016.07.11
cpp enum in class  (0) 2016.07.01
cpp const  (0) 2016.06.22
const 멤버 변수 초기화(member variable initializer)  (0) 2016.06.22
Posted by 구차니
게임/c&c generals2016. 7. 10. 21:04

역시 돈은 위대하다?



아무생각없이 계속하다가 핵 맞음 ㅠㅠ


'게임 > c&c generals' 카테고리의 다른 글

c&c generals zero hour - usa 1  (0) 2016.07.16
c&c generals - usa 7  (0) 2016.07.15
c&c generals - usa 5  (0) 2016.07.09
c&c generals - usa 4  (0) 2016.07.09
c&c generals - usa 3  (0) 2016.07.09
Posted by 구차니
embeded/raspberry pi2016. 7. 10. 16:18

어딜 좀 더 수정해야하려나..


1. 거리가 짧아지면 응답이 빨리 되니 짧을때는 더 빠르게 거리 측정

2. openMP나 thread이용 병렬처리

3. 클래스화?

4. 인터럽트 사용?


$ cat temp_ss.c

/*

 *  dht11.c:

 *      Simple test program to test the wiringPi functions

 *      DHT11 test

 */


#include <wiringpi.h>


#include <stdio.h>

#include <stdlib.h>

#include <stdint.h>

#include <sys/time.h>


#define TRIG_PIN        4

#define ECHO_PIN        5


float mach = 34300.0;


void read_sr04_dat()

{

        int counter = 0;

        struct timeval start_point, end_point;

        double operating_time;

        double len;


        pinMode(TRIG_PIN, OUTPUT);

        pinMode(ECHO_PIN, INPUT);

        digitalWrite(TRIG_PIN, LOW);

//      delay(500); // 500 msec


        digitalWrite(TRIG_PIN, HIGH);

        delayMicroseconds( 10 );

        digitalWrite(TRIG_PIN, LOW);


        while ( digitalRead(ECHO_PIN) == LOW)

        {

                counter++;

                delayMicroseconds( 1 );

                if ( counter == 38000 )

                {

                        return;

                }

        }

        gettimeofday(&start_point, NULL);



        while ( digitalRead(ECHO_PIN) == HIGH)

        {

                counter++;

                delayMicroseconds( 1 );

                if ( counter == 38000 )

                {

                        return;

                }

        }

        gettimeofday(&end_point, NULL);


        operating_time = (double)(end_point.tv_sec)+(double)(end_point.tv_usec)/1000000.0-(double)(start_point.tv_sec)-(double)(start_point.tv_usec)/1000000.0;

        len = operating_time * mach / 2;


        printf("%f sec %4.2f cm %d\n",operating_time, len, counter);

}


#define MAXTIMINGS      85

#define DHTPIN          7

int dht11_dat[5] = { 0, 0, 0, 0, 0 };


void read_dht11_dat()

{

        uint8_t laststate       = HIGH;

        uint8_t counter         = 0;

        uint8_t j               = 0, i;

        float   f; /* fahrenheit */


        dht11_dat[0] = dht11_dat[1] = dht11_dat[2] = dht11_dat[3] = dht11_dat[4] = 0;


        /* pull pin down for 18 milliseconds */

        pinMode( DHTPIN, OUTPUT );

        digitalWrite( DHTPIN, LOW );

        delay( 18 );

        /* then pull it up for 40 microseconds */

        digitalWrite( DHTPIN, HIGH );

        delayMicroseconds( 40 );

        /* prepare to read the pin */

        pinMode( DHTPIN, INPUT );



        /* detect change and read data */

        for ( i = 0; i < MAXTIMINGS; i++ )

        {

                counter = 0;

                while ( digitalRead( DHTPIN ) == laststate )

                {

                        counter++;

                        delayMicroseconds( 1 );

                        if ( counter == 255 )

                        {

                                break;

                        }

                }

                laststate = digitalRead( DHTPIN );


                if ( counter == 255 )

                        break;


                /* ignore first 3 transitions */

                if ( (i >= 4) && (i % 2 == 0) )

                {

                        /* shove each bit into the storage bytes */

                        dht11_dat[j / 8] <<= 1;

                        if ( counter > 16 )

                                dht11_dat[j / 8] |= 1;

                        j++;

                }

        }


        /*

         * check we read 40 bits (8bit x 5 ) + verify checksum in the last byte

         * print it out if data is good

         */

        if ( (j >= 40) &&

             (dht11_dat[4] == ( (dht11_dat[0] + dht11_dat[1] + dht11_dat[2] + dht11_dat[3]) & 0xFF) ) )

        {

                f = dht11_dat[2] * 9. / 5. + 32;

                printf( "Humidity = %d.%d %% Temperature = %d.%d *C (%.1f *F)\n",

                        dht11_dat[0], dht11_dat[1], dht11_dat[2], dht11_dat[3], f );


                printf("%f -> ",mach);

                mach = 33150 + (60 * dht11_dat[2]);

                printf("%f\n",mach);

        }else  {


                f = dht11_dat[2] * 9. / 5. + 32;

                printf( "Humidity = %d.%d %% Temperature = %d.%d *C (%.1f *F) ",

                                                dht11_dat[0], dht11_dat[1], dht11_dat[2], dht11_dat[3], f );


                printf( "- Data not good, skip j[%d] par[%d] calc[%d]\n",

                j, dht11_dat[4], (dht11_dat[0] + dht11_dat[1] + dht11_dat[2] + dht11_dat[3]) & 0xFF

                 );

        }

}


int main( void )

{

        unsigned char tempcount = 0;


        if ( wiringPiSetup() == -1 )

                exit( 1 );


        while ( 1 )

        {

                        if(tempcount % 10 == 0)

                                read_dht11_dat();

                        tempcount++;


                        read_sr04_dat();


                delay( 1000 ); /* wait 1sec to refresh */

        }


        return(0);

}  


'embeded > raspberry pi' 카테고리의 다른 글

freeRTOS on rpi  (0) 2016.07.18
redmine 백업  (0) 2016.07.14
초음파 센서 wiring pi 버전  (0) 2016.07.10
초음파/온습도 센서 데이터 시트 복사  (0) 2016.07.10
rpi gstreamer mux  (0) 2016.06.28
Posted by 구차니
embeded/raspberry pi2016. 7. 10. 12:31

파이썬만 보여서 대충 바꿔봄.

대충.. 2cm ~ 400cm로 제한을 줘야하나..

데이터 시트는 아래 링크 참조해서 작성

[링크 : https://docs.google.com/document/d/1Y-yZnNhMYy7rwhAgyL_pfa39RsB-x2qR4vP8saG73rE/edit]


시간재는건 아래 참조

[링크 : http://hwangdo83.tistory.com/123]


$ cat sr04.c

/*

 *  dht11.c:

 *      Simple test program to test the wiringPi functions

 *      DHT11 test

 */


#include <wiringPi.h>


#include <stdio.h>

#include <stdlib.h>

#include <stdint.h>

#include <sys/time.h>


#define TRIG_PIN        4

#define ECHO_PIN        5


void read_sr04_dat()

{

        int counter = 0;

        struct timeval start_point, end_point;

        double operating_time;

        double len;


        pinMode(TRIG_PIN, OUTPUT);

        pinMode(ECHO_PIN, INPUT);

        digitalWrite(TRIG_PIN, LOW);

//      delay(500); // 500 msec


        digitalWrite(TRIG_PIN, HIGH);

        delayMicroseconds( 10 );

        digitalWrite(TRIG_PIN, LOW);



        while ( digitalRead(ECHO_PIN) == LOW)

        {

                counter++;

                delayMicroseconds( 1 );

                if ( counter == 38000 )

                {

                        return;

                }

        }

        gettimeofday(&start_point, NULL);


        while ( digitalRead(ECHO_PIN) == HIGH)

        {

                counter++;

                delayMicroseconds( 1 );

                if ( counter == 38000 )

                {

                        return;

                }

        }


        gettimeofday(&end_point, NULL);


        operating_time = (double)(end_point.tv_sec)+(double)(end_point.tv_usec)/1000000.0-(double)(start_point.tv_sec)-(double)(start_point.tv_usec)/1000000.0;

        len = operating_time * 34300 / 2;


        printf("%f sec %4.2f cm %d\n",operating_time, len, counter);

}


int main( void )

{

        if ( wiringPiSetup() == -1 )

                exit( 1 );


        while ( 1 )

        {

                read_sr04_dat();

                delay( 100 ); /* wait 1sec to refresh */

        }


        return(0);



한번 보냈는데 못 재면 이상한 값을 뱉는건 왜그럴까나..

'embeded > raspberry pi' 카테고리의 다른 글

redmine 백업  (0) 2016.07.14
초음파 거리 + 온/습도 센서  (0) 2016.07.10
초음파/온습도 센서 데이터 시트 복사  (0) 2016.07.10
rpi gstreamer mux  (0) 2016.06.28
beowulf / openMPI  (0) 2016.06.28
Posted by 구차니