コード例 #1
0
from rascam import Ras_Cam, Joystick_Motion_type, run_command
import time

if __name__ == "__main__":
    try:
        Ras_Cam.camera_start()

        while True:
            button_type = Joystick_Motion_type()
            if button_type == 'left':
                Ras_Cam.photo_effect('sub')  # Left shift switch.
            elif button_type == 'right':
                Ras_Cam.photo_effect('add')  # Right shift switch.
            elif button_type == 'shuttle':
                Ras_Cam.shuttle_button(True)

    finally:
        run_command(
            "sudo kill $(ps aux | grep 'photo_effect.py' | awk '{ print $2 }')"
        )
コード例 #2
0
from rascam import Ras_Cam,power_val,getIP,run_command,ADC
import time


if __name__ == "__main__":
    try:
        adc_channel_1 = ADC("A0")  # only two adc channel ("A0" OR "A1")
        adc_channel_2 = ADC("A1")  
        counter_num = 0            
        content_1_x = 0
        content_1_color = [255,0,255]   # content 1 text color ([R,G,B])
        content_2_color = [0,255,255]   # content 2 text color
        content_3_color = [255,255,0]   # content 3 text color
        font_size = 0.5    # content font size   (The best range is 0.5 ~ 0.8)

        Ras_Cam.camera_start()   # start camera and screen
        content_1 = "IP: " + str(getIP())       # get the ip of Pi

        while True:
            #show content
            Ras_Cam.show_content(1, content_1, (int(content_1_x),15), content_1_color, font_size)   # the first aram must have, and The different content should be sorted in order(start from 1)
            Ras_Cam.show_content(2, "camera power: " + str(power_val()) + "V", (0,35), content_2_color, font_size)
            Ras_Cam.show_content(3, "ADC_1: " + str(adc_channel_1.read()), (0,55), content_3_color, font_size)
            Ras_Cam.show_content(4, "ADC_2: " + str(adc_channel_2.read()), (0,75), content_3_color, font_size)
    finally:
        run_command("sudo kill $(ps aux | grep 'add_content_on_screen.py' | awk '{ print $2 }')")
コード例 #3
0
from rascam import Ras_Cam, Joystick_Motion_type, RGB_Matrix, run_command
# from rgb_matrix import RGB_Matrix
import time

# Eight seconds to the photo.the rgb will move
if __name__ == "__main__":
    try:
        Ras_Cam.camera_start()

        rr = RGB_Matrix(0X74)
        total_time = 8  #set the total time of countdown (uint: second)

        while True:
            button_type = Joystick_Motion_type()
            if button_type == 'shuttle':
                for i in range(9):
                    if i == 8:
                        rr.draw_line((1, 8), fill=(0, 255, 0))
                        rr.display()
                        break
                    rr.draw_point((i), fill=(255, 0, 0))
                    rr.display()
                    time.sleep(float(total_time) / 8)
                Ras_Cam.shuttle_button(True)
                time.sleep(1)
                rr.draw_line((1, 8), fill=(0, 0, 0))
                rr.display()

    finally:
        run_command(
            "sudo kill $(ps aux | grep 'countdown photo.py' | awk '{ print $2 }')"
コード例 #4
0
ファイル: pwm_control.py プロジェクト: sunfounder/rascam
from rascam import Ras_Cam, Joystick_Motion_type, RGB_Matrix, run_command, PWM
import time

if __name__ == "__main__":
    try:

        P1_Channel = PWM("P0")  # only "P0" and "P1" two pwm channels
        Ras_Cam.camera_start()
        # Ras_Cam.human_detect_switch(True)
        # rr = RGB_Matrix(0X74)
        i = 0
        sub_val = 1
        while True:
            i += sub_val
            if i >= 100 or i <= 0:
                sub_val *= -1
            P1_Channel.pulse_width_percent(i)
            time.sleep(0.1)

    finally:
        run_command(
            "sudo kill $(ps aux | grep 'take_picture.py' | awk '{ print $2 }')"
        )
コード例 #5
0
from rascam import Ras_Cam, Joystick_Motion_type, RGB_Matrix, run_command
import time

if __name__ == "__main__":
    try:

        Ras_Cam.camera_start()
        Ras_Cam.human_detect_switch(True)  # open the human_face_detect func.
        rr = RGB_Matrix(0X74)

        while True:
            human_face_num = Ras_Cam.human_detect_object_num()
            # print("detect face number:",)
            if human_face_num > 0:
                print("I find %d people !!!" % human_face_num)
                rr.draw_line((1, 8), fill=(0, 255, 0))
                rr.display()
            else:
                rr.draw_line((1, 8), fill=(255, 0, 0))
                rr.display()

            button_type = Joystick_Motion_type()
            if button_type == 'shuttle':
                Ras_Cam.shuttle_button(True)

    finally:
        run_command(
            "sudo kill $(ps aux | grep 'take_picture.py' | awk '{ print $2 }')"
        )
コード例 #6
0
ファイル: take_picture.py プロジェクト: sunfounder/rascam
from rascam import Ras_Cam, Joystick_Motion_type, run_command
import time

if __name__ == "__main__":
    try:

        Ras_Cam.camera_start()  #start camera screen
        Ras_Cam.watermark(True)  #watermark switch

        content_1_color = [0, 255, 255]  # content_text_1 color
        font_size = 0.6  # content font size
        font_coordinates = (10, 22)
        while True:
            button_type = Joystick_Motion_type()
            if button_type == 'shuttle':
                Ras_Cam.shuttle_button(True)  #control the shutlle
            # elif button_type == 'press':
            #     Ras_Cam.video_flag(False)   #control the shutlle

            Ras_Cam.show_content(
                1, "clarity: " + str(Ras_Cam.clarity_val()), font_coordinates,
                content_1_color, font_size
            )  # show claritysss(you can add this func to onther example,Especially Raspberry Pi High Quality Camera)

    finally:
        run_command(
            "sudo kill $(ps aux | grep 'take_picture.py' | awk '{ print $2 }')"
        )
コード例 #7
0
        'sports', 'snow', 'beach', 'verylong', 'fixedfps', 'antishake',
        'fireworks'
    ],  #Valid values are: 'off', 'auto' (default),'night', 'nightpreview', 'backlight', 'spotlight', 'sports', 'snow', 'beach','verylong', 'fixedfps', 'antishake', or 'fireworks'
    "meter_mode":
    ['average', 'spot', 'backlit', 'matrix'
     ],  #Valid values are: 'average' (default),'spot', 'backlit', 'matrix'.
    "awb_mode": [
        'off', 'auto', 'sunlight', 'cloudy', 'shade', 'tungsten',
        'fluorescent', 'incandescent', 'flash', 'horizon'
    ],  #'off', 'auto' (default), ‘sunlight', 'cloudy', 'shade', 'tungsten', 'fluorescent','incandescent', 'flash', or 'horizon'.
    "drc_strength": ['off', 'low', 'medium', 'high'],
}

if __name__ == "__main__":
    try:
        Ras_Cam.camera_start()

        setting_menu_flag = False
        horizontal_flag = True
        camera_type = 'resolution'
        camera_val = (1920, 1440)  # set the the init resolution
        # content_1_color = [0,255,255]   # content 2 text color
        font_size = 0.6  # content font size
        content_1_color = [0, 255, 255]  # content_text_1 color
        font_coordinates = (10, 22)

        while True:
            press_counter = 0
            # Ras_Cam.show_content(1, "clarity: " + str(Ras_Cam.clarity_val()), font_coordinates, content_1_color, font_size)  # Used for HQ camera

            button_type = Joystick_Motion_type()