序号 标题 代码 编程语言 最后编辑时间 浏览次数
101 作者真懒,题目都不写 ╮(╯_╰)╭ #include <stdio.h> #include "stddef.h" #include <string.h> #include <stdint.h> const int8_t lab_table[98304] = { 0, 0, -1, 0, 3, -9, 1, 8, -21, 2, 16, -31, 4, 27, -41, 6, 35, -48, 8, 41, -55, 11, 45, -61, 14, 50, -67, 16, 54, -73, 19, 58, -79, 22, 62, -84, 24, 66, -90, 27, 70, -95, 29, 74, -101, 31, 78, -106, 1, -1, 0, 1, 2, -8, 2, 7, -19, 3, 15, -30, 4, 25, -39, 6, 32, -47, 9, 38, -54, 12, 43, -60, 14, 48, -66, 17, 52, -72, 19, 57, -78, 22, 61, -84, 24, 65, -89, 27, 70, -95, 29, 74, -100, 31, 78, -106, 2, -2, 0, 2, 0, -7, 3, 5, -18, 4, 13, -29, 5, 23, -38, 7, 30, -46, 10, 36, -53, 12, 41, -59, 15, 47, -66, 17, 51, -71, 20, 56, -78, 22, 60, -83, 25, 64, -89, 27, 69, ... C/C++ 2022-03-03 11:47:57 38
102 作者真懒,题目都不写 ╮(╯_╰)╭ #include <stdio.h> #include "stddef.h" #include <string.h> #include <stdint.h> const int8_t lab_table[98304] = { 0, 0, -1, 0, 3, -9, 1, 8, -21, 2, 16, -31, 4, 27, -41, 6, 35, -48, 8, 41, -55, 11, 45, -61, 14, 50, -67, 16, 54, -73, 19, 58, -79, 22, 62, -84, 24, 66, -90, 27, 70, -95, 29, 74, -101, 31, 78, -106, 1, -1, 0, 1, 2, -8, 2, 7, -19, 3, 15, -30, 4, 25, -39, 6, 32, -47, 9, 38, -54, 12, 43, -60, 14, 48, -66, 17, 52, -72, 19, 57, -78, 22, 61, -84, 24, 65, -89, 27, 70, -95, 29, 74, -100, 31, 78, -106, 2, -2, 0, 2, 0, -7, 3, 5, -18, 4, 13, -29, 5, 23, -38, 7, 30, -46, 10, 36, -53, 12, 41, -59, 15, 47, -66, 17, 51, -71, 20, 56, -78, 22, 60, -83, 25, 64, -89, 27, 69, ... C/C++ 2022-03-03 14:59:49 35
103 作者真懒,题目都不写 ╮(╯_╰)╭ //QVGA分散内存架构计算最大色块,仅支持全图搜索 void find_maxblob_QVGA(unsigned char *pimage1,int height1,unsigned char *pimage2,int height2,int width,int w_stride,int h_stride,const COLOR_LAB_THRESHOLEDS *color_thread,BLOB_INFO *maxblob) { unsigned int SpaceH=0,SpaceW=0; uint8_t *pResult=NULL; int blobmark=0; int ret=0; memset(maxblob,0,sizeof(BLOB_INFO)); //1.检验入参 if(pimage1==NULL||(pimage2==NULL)) { return -1; } if((0!=(w_stride%2))||(0!=(h_stride%2))) { return -1; } SpaceH =(height1+height2)/h_stride; //h1 SpaceW =width/w_stride; //w1 //目标矩阵 pResult=(uint8_t *)malloc(SpaceH*SpaceW); memset(pResult,0,SpaceH*SpaceW); int pix_num1=(height1*width/(h_stride*w_stride)); //目标区域划分和搜索 SEARCH_AREA Area={0,height1,0,width}; ret=SearchCentre(pimage1,width,w_stride,h_stride,color_thread,&Area,pResult); if(ret<0) { return -1; } Area={0,height2,0,width}; ret=Sea ... C/C++ 2022-03-04 15:40:47 52
104 esp8266_wificonfig #include <stdio.h> #include <ESP8266WiFi.h> #include <EEPROM.h> #include <Ticker.h> struct STA_CONFIG { char wifi_ssid[32]; char wifi_password[32]; uint8_t magic; //标志位 } STA_CONFIG sta_config={0}; /** * 加载存储的信息, */ void load_sta_config() { uint8_t *p = (uint8_t*)(&sta_config); EEPROM.begin(512); for (int i = 0; i < sizeof(config); i++) { *(p + i) = EEPROM.read(i); } EEPROM.commit(); p=NULL; delay(2000); } //保存sta信息到eeprom中 void save_sta_config() { EEPROM.begin(512); uint8_t *p = (uint8_t*)(&sta_config); for (int i = 0; i < sizeof(sta_config); i++) { EEPROM.write(i, *(p + i)); } EEPROM.commit(); p=NULL; delay(2000); } Ticker delayTimer; void delayRestart(float t) { delayTimer.attach(t, []() { ESP.restart(); }); } //进入一键配网操作 int do_smart_config() { static int nflag=0; static int time_count=0; static String ... C/C++ 2022-03-10 11:41:38 36
105 esp8266_wificonfig #include <stdio.h> #include <ESP8266WiFi.h> #include <EEPROM.h> #include <Ticker.h> struct STA_CONFIG { char wifi_ssid[32]; char wifi_password[32]; uint8_t magic; //标志位 } STA_CONFIG sta_config={0}; /** * 加载存储的信息, */ void load_sta_config() { uint8_t *p = (uint8_t*)(&sta_config); EEPROM.begin(512); for (int i = 0; i < sizeof(config); i++) { *(p + i) = EEPROM.read(i); } EEPROM.commit(); p=NULL; delay(2000); } //保存sta信息到eeprom中 void save_sta_config() { EEPROM.begin(512); uint8_t *p = (uint8_t*)(&sta_config); for (int i = 0; i < sizeof(sta_config); i++) { EEPROM.write(i, *(p + i)); } EEPROM.commit(); p=NULL; delay(2000); } Ticker delayTimer; void delayRestart(float t) { delayTimer.attach(t, []() { ESP.restart(); }); } //进入一键配网操作 int do_smart_config() { static int nflag=0; static int time_count=0; static String ... C/C++ 2022-03-10 11:42:00 29
106 作者真懒,题目都不写 ╮(╯_╰)╭ #include <stdio.h> #include <ESP8266WiFi.h> #include <EEPROM.h> #include <Ticker.h> struct STA_CONFIG { char wifi_ssid[32]; char wifi_password[32]; uint8_t magic; //标志位 } STA_CONFIG sta_config={0}; //加载存储的信息, void load_sta_config() { uint8_t *p = (uint8_t*)(&sta_config); EEPROM.begin(512); for (int i = 0; i < sizeof(config); i++) { *(p + i) = EEPROM.read(i); } EEPROM.commit(); p=NULL; delay(2000); } // erase STA配置信息 void erase_sta_config() { EEPROM.begin(512); for (int i = 0; i < sizeof(config); i++) { EEPROM.write(i, 0xff); //写入0xff } EEPROM.commit(); delay(2000); } //保存sta信息到eeprom中 void save_sta_config() { EEPROM.begin(512); uint8_t *p = (uint8_t*)(&sta_config); for (int i = 0; i < sizeof(sta_config); i++) { EEPROM.write(i, *(p + i)); } EEPROM.commit(); p=NULL; delay(2000); } Ticker delayTi ... C/C++ 2022-03-10 14:45:45 34
107 作者真懒,题目都不写 ╮(╯_╰)╭ #include <stdlib.h> #include <stdlib.h> const int8_t lab_table[196608/2]={0,} #define TRUE 1 #define FALSE 0 #define COLOR_RGB565_TO_L(pixel) lab_table[(pixel>>1) * 3] #define COLOR_RGB565_TO_A(pixel) lab_table[((pixel>>1) * 3) + 1] #define COLOR_RGB565_TO_B(pixel) lab_table[((pixel>>1) * 3) + 2] typedef struct { unsigned char L; signed char A; signed char B; }COLOR_LAB; typedef struct { unsigned int X_Start; unsigned int X_End; unsigned int Y_Start; unsigned int Y_End; }SEARCH_AREA;//区域 typedef struct { uint8_t LMin, LMax; // or grayscale int8_t AMin, AMax; int8_t BMin, BMax; }COLOR_LAB_THRESHOLEDS; typedef struct { unsigned int x; unsigned int y; unsigned int w; unsigned int h; unsigned int cx; unsigned int cy; }BLOB_INFO; int ColorMatchLAB(unsigned short color,COLOR_ ... C/C++ 2022-03-12 11:35:06 39
108 作者真懒,题目都不写 ╮(╯_╰)╭ /** * Created on: 2022年03月15日 16:14:39 * Author: Guest * Copyright (c) 2022, All Rights Reserved. */ #include <stdio.h> int main() { // 我的第一个 C 程序 printf("Hello, World! \n"); return 0; } C/C++ 2022-03-15 16:14:52 45
109 作者真懒,题目都不写 ╮(╯_╰)╭ ''' SPI openmv4+mengfei_openmv_wifi GPIO NodeMCU Name | openmv =================================== GPIO16 D0 SS | (PB11) 26 GPIO13 D7 MOSI | (PB15) 23 GPIO12 D6 MISO | (PB14) 24 GPIO14 D5 SCK | (PB10) 25 GPIO2 D4 (低电压触发) (PA0) GND (GND) ''' import pyb, ustruct import sensor, image, time from pyb import Pin from machine import SPI ''' 160*120 彩色 2K fps:25 320*480 彩色 6K fps:15 640*480 彩色 15k fps:10 ''' def sendblob(spi,pin,data,frame): # print("Waiting for openmv_wifi...") while(pin.value()): pass print("begin Sent Data!") spi.write(data) spi.write(frame) while(not pin.value()): pass print("end Sent Data!") def sendimage(frame,spi,pin): frame = img.compress(50) print("size=", str(frame.size())) data = ustruct.pack("<bi" , 85, frame.size()) # 85 is a sync char. ... C/C++ 2022-03-21 14:55:36 38
110 作者真懒,题目都不写 ╮(╯_╰)╭ //循环接收SPI数据并采用web发送 #define JPEBUFFLEN 30*1024 int32_t receive_spidata() { byte val=0; int jpg_len=0; int rec_count=0; int rec_number=0; int last_len=0; digitalWrite(spi_ss,LOW); delay(1); val=SPI.transfer(1);//接收一个数据 if(val==85){ SPI.transfer(&jpg_len,4); // Serial.println(String("len=") + String(jpg_len)); if(jpg_len>0) { if(jpg_len<=JPEBUFFLEN) { SPI.transfer(&file_buff, jpg_len); digitalWrite(spi_ss, HIGH); //拉高,停止openmv的数据传输 //delay(1); client.write(file_buff , file_buff_len); //直接发送出去 //发送完成再继续触发图像传输 return jpg_len; } else { if(0!=(jpg_len%JPEBUFFLEN)) { rec_count=(int)(jpg_len/JPEBUFFLEN)+1; } else { rec_count=jpg_len/JPEBUFFLEN; } while(rec_count--) { if(rec_count>1) { SPI.transfer(file_buff, JPEBUFFLEN); client.write(file_buff , JPEBUFFLEN); memse ... C/C++ 2022-03-21 20:33:20 45