Categories
matlab

单目算法研究 matlab

%% 等待 
input('按下回车键继续...');

pause(inf) 

需要0度数图片做校准图片(已完成)

相片参数 640×480 = 307200

代码参数 640×520 = 332800 (reconstruction 通过上下加20px 实现)

iv0 = shstruct.ord_sqgrid

dv1 = shstruct.ord_centres

dv2 = shstruct.E1

77 = shstruct.nspots

Categories
yoto

yoto

倩姨打算做一个仿yoto的产品

插卡后 自动播放音频 读取卡片 用条形码 二维码 RFID等方式

安卓做一个原型

APP流程为 手机读取RFID

播放一段音频(可云端 可本地)

原型 solution

用小章鱼作为底 先加入RFID读取功能

再用原生media player 或者 科大讯飞 语音 播放 一段文字

Categories
matlab

figure

A=imread('calibration.png'); % new 30fps chip
A=imread('calibration.png'); % new 30fps chip
figure("name","图片标题")
imshow(A)
figure()
title('第二个窗口', 'FontSize', 14, 'FontWeight', 'bold', 'Color', 'r');

figure 命令会显示一个窗口

Categories
html

Protected: payment

This content is password protected. To view it please enter your password below:

Categories
android

android 系统打开pdf

android 调用系统注册服务打开PDF

Intent intent  = new Intent("android.intent.action.VIEW");
intent.addCategory("android.intent.category.DEFAULT");
intent.addFlags("intent.FLAG_ACTIVITY_NEW_TASK");
Uri uri = Uri.FromFile(new File(pdfPath));
try{
 startActivity(intent);
}catch(Exception e)
 //error handling
}


Categories
python

heartpy

heartpy python 心电数据通用库

ecg python 处理 心跳信号 python心电图

https://blog.51cto.com/u_12195/6852475

Categories
matlab Uncategorized

MATLAB 图片常用方法

读取图片

matrix = imread("./abc.png")

显示矩阵图片

imshow(matrix)

打开图片后 调用图片工具处理矩阵

imtool(matrix)

RGB转GRAY

gray = rgb2gray(rgb)

图片二值化处理

boolean = img > threhold 

图片膨胀与腐蚀 (去掉图片噪音)

Categories
linux

香橙派 OPI.GPIO

一般GPIO初始化是执行

GPIO.setmode(mode) #来进行引脚定义初始化

GPIO.BOARD = 10
GPIO.BCM = 11
GPIO.SUNXI = 12 
GPIO.CUSTOM = 13  

其实只是一你骄傲的映射关系 没有真正执行任何代码

但是OPI.GPIO 对不同的香橙派版本 引脚定义不充分

CM4为例子

GPIO.setmode(GPIO.BOARD) #会少了很多引脚的映射

C:\Users\15699\AppData\Local\Programs\Python\Python312\Lib\site-packages\OPi\pin_mappings.py

 BOARD: {
        3: 12,
        5: 11,
        7: 6,
        8: 198,
        10: 199,
        11: 1,
        12: 7,
        13: 0,
        15: 3,
        16: 19,
        18: 18,
        19: 15,
        21: 16,
        22: 2,
        23: 14,
        24: 13,
        26: 10
    },

这时候要不更改这个库文件 按照GPIO.readall 补充所有引脚映射

要不执行 自定义引脚映射初始化

GPIO.setmode({
        3: 140,
        5: 141,
        7: 147,
        8: 25,
        10: 24,
        11: 118,
        12: 119,
        13: 128,
        15: 130,
        16: 131,
        18: 129,
        19: 138,
        21: 136,
        22: 132,
        23: 139,
        24: 134,
        26: 135,
        27: 32,
        28: 33,
        29: 133,
        31: 124,
        32: 144,
        33: 127,
        35: 120,
        36: 125,
        37: 123,
        38: 122,
        40: 121
    })

GPIO.getmode 
# 返回CUSTOM 自定义引脚映射
Categories
python

树莓派 香橙派 PWM问题

查看GPIO引脚

gpio readall

用python调用PWM有两种方法

1.RPi.GPIO

import RPi.GPIO  as GPIO


GPIO.setmode(GPIO.BCM)

GPIO.setup(18,GPIO.OUT) #设置引脚为输出
pwm = GPIO.PWM(18,100) #只有12脚 和 18脚 支持硬件PWM   100为100hz
pwm.start(50) #占空比为50并输出

pwm.changeDutyCycle(20) #改变占空比
pwm.stop() #停止PWM波形输出

2OPI.GPIO

PWM is created in the form of an object.

1. First set up OPi.GPIO and create the object

    .. code:: python

       import OPi.GPIO as GPIO
       PWM_Class = GPIO.PWM(PWM_chip, PWM_pin, frequency_Hz, Duty_Cycle_Percent)


一般PWM_chip 为0 第一块 可以通过
 ls -l /sys/class/pwm/ 查看 一般返回 pwmchip0

PWM_pin 就是引脚了 


    Note currently you do not need to specify setmode before creating the class as for a GPIO
    only the PWM_chip number and the PWM_pin.
    The reson for this and how to find what they are is explained in the sysfs PWM section.

2. Begin the PWM cycle

    .. code:: python

        PWM_Class.start_pwm()

3. Change PWM duty Cycle

    .. code:: python
        PWM_Class.duty_cycle(50)

    Note this changes the Duty cycle to 50%

4. Change the frequency

    .. code:: python
        PWM_Class.change_frequency(500)

    Note this changes the Frequency to 500Hz

5. Stop the PWM device

    .. code:: python
        PWM_Class.stop_pwm()

    Note this stops the signal by setting the duty cycle to 0%

6. Change the Polarity of the signal

    .. code:: python
        PWM_Class.pwm_polarity()

    Note this changes swaps the on-off times. For example a duty cycle set to 75% before
    this will result in the signal being on 75% and off 25% of the time. After this is
    called it would be on 25% and off 75%.

7. Remove PWM Object

    .. code:: python
        PWM_Class.pwm_close()

3.wiringpi

import wiringpi

pwm0 =  wiringpi.GPIO(0)        
pwm0.pinMode(1,pwm0.PWM_OUTPUT)
pwm0.pwmSetMode(pwm0.PWM_MODE_MS)
pwm0.pwmSetClock(25)
pwm0.pwmWrite(1,self.brightness)




import wiringpi

PWM_OUTPUT  = 2
PWM_PIN = 1  #指定第二个PWM接口

# 初始化
wiringpi.wiringPiSetup()
wiringpi.pinMode(PWM_PIN, PWM_OUTPUT)  #初始化第二个PWM接口 18  

wiringpi.pwmSetMode(wiringpi.PWM_MODE_MS)  
#设置PWM工作模式 有两个值PWM_MODE_MS PWM_MODE_BAL
#一般选第一个  PWM_MODE_BAL or PWM_MODE_MS(平衡模式/占空比模式)

wiringpi.pwmSetRange(1024)  


#设置总周期默认1024 所以一个周期是 600khz/1024 约等于600hz

wiringpi.pwmSetClock(32)  
#设置分频 默认32 即600khz 总时钟频率是19.2Mhz 

wiringpi.pwmWrite(PWM_PIN,0) #设置占空比 0~1024  512 为一半  
#0的话相当于写入全部低电平 没有波形输出

while 1:
    for bright in range(0, 1000):
        wiringpi.pwmWrite(PWM_PIN, bright)
        wiringpi.delay(1)
    for bright in range(1000, 0, -1):
        wiringpi.pwmWrite(PWM_PIN, bright)
        wiringpi.delay(1)
Categories
linux

树莓派 电源固件升级问题

树莓派论坛提到

https://forums.raspberrypi.com/viewtopic.php?t=361383

升级方法

Tue Dec 12, 2023 5:44 pm

3B+ v1.4 has a new PMIC and needs Sept 2021 or newer firmware.

Follow https://pip.raspberrypi.com/categories/ ... 6-WP-1.pdf to update the firmware in your image.

树莓派更换了新的PMIC(电源管理芯片)

https://pip.raspberrypi.com/categories/685/documents/RP-003476-WP/RP-003476-WP-1.pdf

该PDF有说明最新固件情况

Updating only the firmware

Sometimes, going through the standard upgrade procedure may not be possible. For example, you may have acustomised distribution with no update facilities, or that cannot be upgraded without causing further issues. In thesecircumstances, and possibly others, you will need to update the firmware files in the distribution manually.You can download the firmware files from the following location:

https://github.com/raspberrypi/firmware/archive/refs/heads/stable.zip

This zip file contains a number of items, but the ones we are interested in at this stage are in the boot folder.

The firmwarefiles have names of the form

start*.elf, and their associated support files are fixup*.dat.

The basic principle is to copy the required start and fixup files from this zip file to replace the same named files in thedestination OS image.

The exact process will depend on how the OS has been set up, but this is an example of how itwould be done for a Raspberry Pi OS image:

1. Extract or open the zip file so you can access the required files.

2. Open up the boot folder in the destination OS image (this could be on an SD card, or a disk-based copy).

3. Determine which start.elf and fixup.dat files are present in the destination OS image.

4. Copy those files from the zip archive to the destination image.The image should now be ready for use on the latest Raspberry Pi Ltd hardware.

其实就是下载最新固件包 在压缩包里打开boot目录

替换start*.elf 和 fixup*.dat.

当然命令行系统 用的是start.elf fixup.dat

桌面系统用的是 start_x.elf fixup_x.dat