Buy class 10 It was 1480 yen for a set of 2 Gigastones (August 11, 2020) Amazon sales floor Your purchase is already FAT32 formatted and will be recognized as a disc on your Windows 10 PC.
Click the NOOBS icon and the screen will change as follows
Click the "Download ZIP" label under "NOOBS" to download the ZIP file.
Unzip the downloaded file "NOOBS_v3_4_0.zip (2,379,232KB)" and move the files and holder inside to the SD card removal disk.
Select "Japanese", select "Raspbian" as the OS, and proceed with the installation to start Rasbian.
Reference page I tried connecting to Raspberry Pi 4 with SSH and VNC
Please refer to the e-book for details Amazon sales floor of books
Via WiFi on Windows 10 PC
Qiita posted on December 11, 2019 Easy to put OpenCV on Raspberry Pi4 To the street.
I installed it on August 15, 2020, but the prepared version was the same as Qiita above. I have installed Ver 4.1.0.25.
pip3 install opencv-contrib-python==4.1.0.25
The latest version of Raspbian has a built-in Mu editor, so you can run python programs with this editor. Click the mu icon to launch the editor
Please refer to the following HP for the operation method of Mu editor https://codewith.mu/
I connected two types of two types of USB cameras I had to the USB connector.
Simply two captures failed. So I decided to change the screen size and FPS. Here is the HP that I used as a reference https://dev.classmethod.jp/articles/opencv-webcam-setting/
Set the screen size to 800 x 600 pixels 15FPS seems to exceed the ability of RasPi4 due to an error or mouse not moving Cascus continuous operation is possible at 10 Fps At 5FPS, the screen display of the two cameras did not cause an error even after 10 hours.
It is a code that can be displayed on the screen for a long time in the end
#===============================
# Raspi4 conect to two USBCam
#
# Ver1 2020/08/16 T.F.
#===============================
# -*- coding: utf-8 -*-
import cv2
#-------------------------------
#Webcam
#-------------------------------
WIDTH = 800
HEIGHT = 600
#ID:0 FPS:5,7.5,10,15 //20
#ID:2 FPS:5 ,10,15 //20
FPS = 5
#-------------------------------
#
#-------------------------------
def cam_set(DEVICE_ID,WIDTH,HEIGHT,FPS):
# video capture
cap = cv2.VideoCapture(DEVICE_ID)
#Format / resolution / FPS settings
#cap.set(cv2.CAP_PROP_FOURCC, cv2.VideoWriter_fourcc('M','J','P','G'))
cap.set(cv2.CAP_PROP_FOURCC, cv2.VideoWriter_fourcc('Y','U','Y','V'))
cap.set(cv2.CAP_PROP_FRAME_WIDTH, WIDTH)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, HEIGHT)
cap.set(cv2.CAP_PROP_FPS, FPS)
#Acquisition of format / resolution / FPS
fourcc = decode_fourcc(cap.get(cv2.CAP_PROP_FOURCC))
width = cap.get(cv2.CAP_PROP_FRAME_WIDTH)
height = cap.get(cv2.CAP_PROP_FRAME_HEIGHT)
fps = cap.get(cv2.CAP_PROP_FPS)
print("ID:{} fourcc:{} fps:{} width:{} height:{}".format(DEVICE_ID, fourcc, fps, width, height))
return cap
#-------------------------------
#
#-------------------------------
def decode_fourcc(v):
v = int(v)
return "".join([chr((v >> 8 * i) & 0xFF) for i in range(4)])
#-------------------------------
#
#-------------------------------
def main():
#--------------------------------------
DEVICE_ID = 0
cap1=cam_set(DEVICE_ID,WIDTH,HEIGHT,FPS)
#--------------------------------------
DEVICE_ID = 2
cap2=cam_set(DEVICE_ID,WIDTH,HEIGHT,FPS)
#--------------------------------------
while True:
#-----------------------
#Camera image acquisition
ret1, frame1 = cap1.read()
if(frame1 is None):
continue
#-----------------------
#Camera image acquisition
ret2, frame2 = cap2.read()
if(frame2 is None):
continue
#---------------------------
im_h=cv2.hconcat([frame1,frame2])
#---------------------------
#Image display
cv2.imshow('frame1', im_h)
#--------------------------------------
#Queue input judgment(1ms wait)
#without waitKey, imshow()Cannot be displayed
# 'q'Exit the loop when typed
if cv2.waitKey(1) & 0xFF == ord('q'):
break
#------------------------------
#Destroy VideoCapture object
cap1.release()
cap2.release()
cv2.destroyAllWindows()
#-------------------------------
if __name__ == '__main__':
main()
Displayed screen
With the following code, the camera images were arranged horizontally and combined and displayed in one frame.
im_h=cv2.hconcat([frame1,frame2])
A stereo camera is constructed using two inexpensive USB cameras, and the distance from the "object detected" position shift to the object is calculated and used as the control eye of the robot arm.
Next, consider a light "object detection" program on RasPi4.
Recommended Posts