Raspberry, bottom, and camera, top.Raspberry, bottom, and camera, top.Raspberry, bottom, and camera, top.Raspberry, bottom, and camera, top.라즈베리(하단), 카메라(상단). https://en.wikipedia.org/wiki/Raspberry_Pi 35달러짜리 컴퓨터입니다. 카메라는 25달러를 더 추가합니다. 전원 공급 장치와 인터넷 연결을 추가하면 원격으로 액세스할 수 있습니다. JMP는 어떻게 액세스할 수 있나요?
이 예에서는 플링크 (일부 퍼티 제품군) 및 RunProgram(JMP의 일부)을 사용하여 JMP를 Raspberry Pi의 Linux 명령줄 인터페이스에 연결합니다. JMP는 라스피스틸 Raspberry Pi에 사진 촬영 방법과 사진을 넣을 위치를 알려주는 매개변수를 사용하여 명령을 실행하면 JMP가 연결을 닫고 네트워크의 해당 위치에서 사진을 표시합니다.
보다 https://community.jmp.com/t5/Uncharted/Can-JSL-talk-to-Linux/ba-p/33689 비Raspberry Linux 시스템을 사용하는 유사한 아이디어를 원합니다. 문제 중 하나는 공개/개인 키 쌍을 생성하여 비밀번호 프롬프트를 피하는 것입니다. 저는 puttygen(PuTTY 제품군)을 사용하여 공개/개인 키 쌍(표시되지 않음)을 만들었고, 이름이 putty인 프로필을 저장하여 JSL을 훨씬 더 간단하게 만들었습니다. 카메라 ; 프로필에는 연결 정보가 있습니다.
PuTTY dialog high lighting load/save sessions and AuthPuTTY dialog high lighting load/save sessions and AuthPuTTY dialog high lighting load/save sessions and AuthPuTTY dialog high lighting load/save sessions and AuthPuTTY 대화 상자는 세션 로드/저장 및 인증을 강조합니다.
PuTTY dialog showing private key in AuthPuTTY dialog showing private key in AuthPuTTY dialog showing private key in AuthPuTTY dialog showing private key in Auth인증의 개인 키를 표시하는 PuTTY 대화상자
Login using the public/private keyLogin using the public/private keyLogin using the public/private keyLogin using the public/private key공개/개인 키를 사용하여 로그인
이제 프로필을 다음에서도 사용할 수 있습니다. 플링크 ~처럼 카메라 . 로그인할 JSL은 다음과 같습니다.
rp = RunProgram(
executable( "plink" ), // plink is part of the PuTTY toolset, a bit like SSH
options( "camerapi" ), // this is a saved session in PuTTY
ReadFunction(
Function( {this},
While( this << canread,
Write( this << read ); // stream output to JMP log window
Wait( .01 );
)
)
)
);이 JSL은 떠난다 rp 백그라운드에서 실행되는 RunProgram 객체를 보유하고 Raspberry의 셸 프로그램이 JMP 로그 창에 복사하는 일부 출력을 생성할 때까지 기다립니다.
The first yellow is a message from JMP; the last yellow is a prompt from the RaspberryThe first yellow is a message from JMP; the last yellow is a prompt from the RaspberryThe first yellow is a message from JMP; the last yellow is a prompt from the RaspberryThe first yellow is a message from JMP; the last yellow is a prompt from the Raspberry첫 번째 노란색은 JMP에서 보낸 메시지입니다. 마지막 노란색은 라즈베리의 메시지입니다.
흰색 로그 창에는 검정색 쉘 창과 동일한 로그인 결과가 포함됩니다. ESC 항목은 출력을 색상으로 구분하므로 청록색 프롬프트가 표시됩니다. 그리고 RunProgram 개체는 여전히 일부 명령을 Raspberry Pi에 전달하기를 기다리고 있습니다. 명령을 구성하고 전송합니다.
// filename builds a path known to the linux (raspberry pi) computer; it is
// actually a nfs mount from yet another computer. This filename is where the
// picture will be stored. The windows computer running JMP can access the
// NFS mount via the H: drive, which is being supplied through VirtualBox.
filename = "capture/picNoOptions.jpg";
// raspistill is a raspberry pi-specific linux command to take a picture
// using the camera attached to the raspberry pi. Because this is a
// command line interface the command must end with a newline, as if
// it was typed at the keyboard and ENTER was pressed.
command = "raspistill --timeout 1000 --nopreview --output " ||"/mnt/nfsc/upscale/"|| filename;
rp << Write( command || "\!n" ); // send the raspistill command, via the linux command line
그러면 로그 창에 더 많은 출력이 생성됩니다.
The command is in yellow, it runs silently, and prompts for another commandThe command is in yellow, it runs silently, and prompts for another commandThe command is in yellow, it runs silently, and prompts for another commandThe command is in yellow, it runs silently, and prompts for another command명령은 노란색으로 표시되며 자동으로 실행되며 다른 명령을 묻는 메시지가 표시됩니다.
이 시점에서 RunProgram 연결을 닫을 수 있습니다. 실행 중인 셸에 종료 명령을 보내는 것이 완전히 연결을 끊는 가장 좋은 방법입니다.
// for RunProgram to end cleanly, the shell it is running must terminate
rp << Write( "exit\!n" ); // end the Linux shell session
이번에도 약간의 로그 창 출력이 있습니다.
The shell is now closedThe shell is now closedThe shell is now closedThe shell is now closed이제 쉘이 닫혔습니다.
JSL의 나머지 부분은 필요에 따라 기다린 후 정리됩니다.
// every thing above happened very quickly, but the raspistill and exit
// commands have not finished yet. ask the rp object, over and over, if
// the pipe of data from the shell back to JSL has been closed yet. Until
// the ReadEOF happens, RunProgram will not terminate nicely.
While( !(rp << isReadEOF), write("."); Wait( .25 ) ); // wait patiently while shell output goes to log
If( !(rp << canread) & !(rp << canwrite) & rp << isReadEOF,
rp = 0; // this will really make RunProgram go away
Write( "\!nDone" );
,
// possibly need to restart JMP, and possibly need to restart raspberry
Write( "\!nFailed to release rp" )
);이미 출력을 기다렸기 때문에 "완료"라고만 표시됩니다. 앞에 wait(0.1)을 추가해야 할 수도 있습니다. if( canread/canwrite/isReadEOF ) 매번 완료되도록 테스트하세요.
이제 네트워크에서 사진을 가져와 보여줍니다.
img=newimage("h:/"||filename);
img<<SCALE></SCALE>
1/8 actual size, attic work space1/8 actual size, attic work space1/8 actual size, attic work space1/8 actual size, attic work space실제 크기의 1/8, 다락방 작업 공간
카메라는 매우 기본적이며 최대 해상도는 2592x1944(원래 5M 카메라인 것 같고 8M 버전도 있음)이지만 노출 시간과 아날로그 게인을 제어할 수 있으며 센서에서 원시 픽셀을 검색할 수 있습니다.