<div> <div><span style="font-size:9pt;"><a target="_blank" href="http://www.todayhumor.co.kr/board/view.php?table=programmer&no=21379&s_no=13800023&kind=member&page=1&member_kind=total&mn=256661">http://www.todayhumor.co.kr/board/view.php?table=programmer&no=21379&s_no=13800023&kind=member&page=1&member_kind=total&mn=256661</a></span></div></div> <div><br></div> <div><br></div> <div>지난번에 <span style="font-size:9pt;">특정 색깔의 물체를 웹캠과 opencv로 인식 한 후</span></div> <div> <div><span style="font-size:9pt;"><br></span></div> <div><span style="font-size:9pt;">그 물체의 크기와 좌표를 유니티에 전송하는 방법에 대해서 질문을 올렸는데요</span></div></div> <div><span style="font-size:9pt;"><br></span></div> <div><br></div> <div><br></div> <div>답변자 분 중에 dll을 이용하는 방법에 대해서 설명한 링크를 걸어 주신 분이 있더라구요</div> <div><br></div> <div><a target="_blank" href="http://thomasmountainborn.com/2016/09/11/unity-and-opencv-part-one-install/">http://thomasmountainborn.com/2016/09/11/unity-and-opencv-part-one-install/</a></div> <div><a target="_blank" href="http://thomasmountainborn.com/2016/09/12/unity-and-opencv-part-two-project-setup/">http://thomasmountainborn.com/2016/09/12/unity-and-opencv-part-two-project-setup/</a></div> <div><a target="_blank" href="http://thomasmountainborn.com/2017/03/05/unity-and-opencv-part-three-passing-detection-data-to-unity/">http://thomasmountainborn.com/2017/03/05/unity-and-opencv-part-three-passing-detection-data-to-unity/</a></div> <div><br></div> <div>제가 이해한 방식으로 코드를 작성할 경우</div> <div><br></div> <div>과연 제가 생각 한대로 작동 될지가 궁금하네요</div> <div><br></div> <div>가령 아래와 같은 C++ 코드가 있다면</div> <div><br></div> <div>==========================================</div> <div><br></div> <div>int GetInteger()</div> <div>{</div> <div><span style="white-space:pre;"> </span>return i;</div> <div><span style="font-size:9pt;">}</span></div> <div><br></div> <div>int main()</div> <div>{</div> <div><br></div> <div><span style="white-space:pre;"> </span>int i;</div> <div><br></div> <div><span style="white-space:pre;"> </span>while(1)</div> <div><span style="white-space:pre;"> </span>{</div> <div><span style="white-space:pre;"> </span>if (waitKey(1) == 27) break;<span style="white-space:pre;"> </span><span style="white-space:pre;"> </span>//프로그램 종료</div> <div><br></div> <div><span style="white-space:pre;"> </span>if(waitkey(1)=='3') i=3;</div> <div><span style="white-space:pre;"> </span>if(waitkey(1)=='4') i=4;</div> <div><span style="white-space:pre;"> </span>}</div> <div><span style="white-space:pre;"> </span>return 0;</div> <div>}</div> <div><br></div> <div>============================================</div> <div><br></div> <div>위 프로그램은 esc를 누르면 종료되고 3or 4를 누르면 해당 숫자로 정수i가 변하는 프로그램 입니다.</div> <div>무한루프를 돌기 때문에 실시간으로 값이 바뀌면 된다고 보시면 되구요</div> <div><br></div> <div><br></div> <div>그러면 유니티 스크립트에서</div> <div><br></div> <div><br></div> <div>==================</div> <div>void update()</div> <div>{</div> <div><span style="white-space:pre;"> </span>Input.GetButtonDown(특정 키가 눌러 젔을 경우)</div> <div><span style="white-space:pre;"> </span>{</div> <div><span style="white-space:pre;"> </span>//C++ 프로그램의 정수 i의 값을 GetInteger 함수로 가져 올 수 있다.</div> <div><br></div> <div><span style="white-space:pre;"> </span>}</div> <div><span style="font-size:9pt;">}</span></div> <div>==========================</div> <div><br></div> <div>이런 코드를 작성하면 실시간으로 C++ 프로그램에 있는 정수i 를 확인 할 수 있는건가요??</div> <div><br></div> <div><span style="font-size:9pt;">저런 발상으로 작성하면 충분할까요??</span></div> <div><span style="font-size:9pt;"><br></span></div> <div><span style="font-size:9pt;"><br></span></div> <div><span style="font-size:9pt;"><br></span></div> <div><span style="font-size:9pt;"><br></span></div> <div><span style="font-size:9pt;"><br></span></div> <div><span style="font-size:9pt;">아무래도 C++프로그램이 빠른속도로 무한 루프를 돌면서 실시간으로 값을 변화시키는 프로그램이다보니</span></div> <div><span style="font-size:9pt;"><br></span></div> <div><span style="font-size:9pt;">유니티 프로그램과 opencv 프로그램 간의 동기화? 같은거는 필요 없는건지 궁금하네요.... </span></div>
댓글 분란 또는 분쟁 때문에 전체 댓글이 블라인드 처리되었습니다.