女人自慰AV免费观看内涵网,日韩国产剧情在线观看网址,神马电影网特片网,最新一级电影欧美,在线观看亚洲欧美日韩,黄色视频在线播放免费观看,ABO涨奶期羡澄,第一导航fulione,美女主播操b

0
  • 聊天消息
  • 系統(tǒng)消息
  • 評論與回復(fù)
登錄后你可以
  • 下載海量資料
  • 學(xué)習(xí)在線課程
  • 觀看技術(shù)視頻
  • 寫文章/發(fā)帖/加入社區(qū)
會員中心
創(chuàng)作中心

完善資料讓更多小伙伴認(rèn)識你,還能領(lǐng)取20積分哦,立即完善>

3天內(nèi)不再提示

怎樣用Wekinator和Arduino制作顏色分類器

454398 ? 來源:工程師吳畏 ? 2019-07-31 09:10 ? 次閱讀

電路圖

怎樣用Wekinator和Arduino制作顏色分類器

如何運行程序

首先,在Arduino IDE的文章末尾粘貼為Arduino提供的代碼并上傳代碼。

然后您需要從Wekinator的示例頁面下載草圖。

下載源代碼以進行處理實現(xiàn)10x10顏色網(wǎng)格。解壓縮并在處理中運行代碼。該程序?qū)⑹褂霉P記本電腦的網(wǎng)絡(luò)攝像頭,根據(jù)您在攝像頭前所做的操作,它將為Wekinator提供輸入。

Wekinator的輸出需要另一個草圖。該草圖的代碼在本文末尾。將其粘貼到處理中并運行草圖。該草圖將從Wekinator輸出并將其發(fā)送到Arduino,LED將亮起。

兩個處理窗口應(yīng)如下所示。

現(xiàn)在打開Wekinator并進行如下圖所示的設(shè)置。將輸入設(shè)置為100,將輸出設(shè)置為1.將類型設(shè)置為3的所有分類器,然后單擊下一步。

在前面拿一張彩色紙攝像頭并開始錄制半秒。

現(xiàn)在將班級更改為2.再次,向網(wǎng)絡(luò)攝像頭顯示另一種顏色的紙張,開始錄制半秒鐘。

現(xiàn)在將類更改為3,顯示另一種顏色的紙張,然后開始錄制半秒鐘。

之后,單擊“Train”,然后單擊“Run”。現(xiàn)在連接到Arduino的LED將根據(jù)您在網(wǎng)絡(luò)攝像頭前顯示的顏色亮起。

ArduinoCode

#include //Including the library that will help us in receiving and sending the values from processing

ValueReceiver《1》 receiver; /*Creating the receiver that will receive only one value.

Put the number of values to synchronize in the brackets */

/* The below variable will be synchronized in the processing

and they should be same on both sides. */

int output;

// Initializing the pins for led‘s

int led1 = 8;

int led2 = 9;

int led3 = 10;

void setup()

{

/* Starting the serial communication because we are communicating with the

Arduino through serial. The baudrate should be same as on the processing side. */

Serial.begin(19200);

pinMode(led1, OUTPUT);

pinMode(led2, OUTPUT);

pinMode(led3, OUTPUT);

// Synchronizing the variable with the processing. The variables must be int type.

receiver.observe(output);

}

void loop()

{

// Receiving the output from the processing.

receiver.sync();

// Matching the received output to light up led’s

if (output == 1)

{

digitalWrite(led1, HIGH);

digitalWrite(led2, LOW);

digitalWrite(led3, LOW);

}

else if (output == 2)

{

digitalWrite(led1, LOW);

digitalWrite(led2, HIGH);

digitalWrite(led3, LOW);

}

else if (output == 3)

{

digitalWrite(led1, LOW);

digitalWrite(led2, LOW);

digitalWrite(led3, HIGH);

}

}

處理代碼

import vsync.*; // Importing the library that will help us in sending and receiving the values from the Arduino

import processing.serial.*; // Importing the serial library

// Below libraries will connect and send, receive the values from Wekinator

import oscP5.*;

import netP5.*;

// Creating the instances

OscP5 oscP5;

NetAddress dest;

ValueSender sender;

// This variable will be syncronized with the Arduino and it should be same on the Arduino side.

public int output;

void setup()

{

// Starting the serial communication, the baudrate and the com port should be same as on the Arduino side.

Serial serial = new Serial(this, “COM10”, 19200);

sender = new ValueSender(this, serial);

// Synchronizing the variable as on the Arduino side. The order should be same.

sender.observe(“output”);

// Starting the communication with Wekinator. listen on port 12000, return messages on port 6448

oscP5 = new OscP5(this, 12000);

dest = new NetAddress(“127.0.0.1”, 6448);

}

// Recieve OSC messages from Wekinator

void oscEvent(OscMessage theOscMessage) {

if (theOscMessage.checkAddrPattern(“/wek/outputs”) == true) {

// Receiving the output from Wekinator

float value = theOscMessage.get(0).floatValue();

// Converting the output to int type

output = int(value);

}

}

void draw()

{

// Nothing to be drawn for this example

}

聲明:本文內(nèi)容及配圖由入駐作者撰寫或者入駐合作網(wǎng)站授權(quán)轉(zhuǎn)載。文章觀點僅代表作者本人,不代表電子發(fā)燒友網(wǎng)立場。文章及其配圖僅供工程師學(xué)習(xí)之用,如有內(nèi)容侵權(quán)或者其他違規(guī)問題,請聯(lián)系本站處理。 舉報投訴
  • Arduino
    +關(guān)注

    關(guān)注

    188

    文章

    6491

    瀏覽量

    190103
收藏 人收藏

    評論

    相關(guān)推薦
    熱點推薦

    PCB顏色代表什么顏色?如何選擇PCB顏色?一文幫你快速搞定

    取決于防焊油墨的顏色。目前市面上比較常見的有綠色PCB,藍(lán)色PCB、黑色PCB、白色PCB、紅色PCB、紫色PCB。不同顏色的PCB在制造工藝會有所不同,比如黑色阻焊層的制作工藝相對復(fù)雜,因此成本也相對
    發(fā)表于 04-08 11:22

    如何用SS1系列顏色傳感示教多通道顏色

    基于白色LED光源的特性,深視智能SS1系列顏色傳感突破了傳統(tǒng)單色RGB、融合光RGB的波長限制,將發(fā)射波長的范圍覆蓋到整個可見光譜,最大支持檢測16種顏色。那么,我們?nèi)绾卫肧S1系列顏色
    的頭像 發(fā)表于 12-23 08:17 ?597次閱讀
    如何用SS1系列<b class='flag-5'>顏色</b>傳感<b class='flag-5'>器</b>示教多通道<b class='flag-5'>顏色</b>?

    如何用SS1系列顏色傳感設(shè)置目標(biāo)顏色

    基于白色LED光源的特性,深視智能SS1系列顏色傳感突破了傳統(tǒng)單色RGB、融合光RGB的波長限制,將發(fā)射波長的范圍覆蓋到整個可見光譜,最大支持檢測16種顏色。那么,我們?nèi)绾卫?b class='flag-5'>顏色
    的頭像 發(fā)表于 11-19 01:04 ?534次閱讀
    如何用SS1系列<b class='flag-5'>顏色</b>傳感<b class='flag-5'>器</b>設(shè)置目標(biāo)<b class='flag-5'>顏色</b>?

    NE555制作點焊機

    NE555制作點焊機,電路簡單,容易制作。需要一個12v的鉛酸蓄電池。實際焊接效果很好。
    發(fā)表于 11-08 15:05 ?30次下載

    請問TAS5706如何用硬件控制I2C?

    TAS5706 的Control Interface可以HW,SW。我想問問怎樣用HW來控制呢?因為我一個板上預(yù)計8個TAS5706,MCU怎樣去識別?
    發(fā)表于 10-23 08:33

    多個TLV320AIC3254一路I2C總線對其配置可行嗎?

    一片CPU3片TLV320AIC3254做音頻處理,想用一路I2C總線對其配置可行嗎? 地址好像是唯一的 0011000沒法設(shè)置,手冊中又提到可使用10位地址但是沒找到說明怎樣用,哪位大俠用過
    發(fā)表于 10-22 07:54

    怎樣用THS3201實現(xiàn)輸出功率可調(diào)?

    怎樣用THS3201實現(xiàn)輸出功率可調(diào)?
    發(fā)表于 08-26 08:28

    OPA735加OPA333,怎樣用TINA TI去仿真?

    當(dāng)輸入信號VG1從7.06V慢慢變化到7.22V時。 輸出電壓Vout的變化必須是接近線性變化的。我想知道我該怎樣用TINA TI去仿真?怎樣設(shè)置那個輸入信號VG1才能達到我的目的。因為這個電壓源好像
    發(fā)表于 08-02 08:39

    怎樣用表測穩(wěn)壓管穩(wěn)壓值

    表是一種常用的電子測量工具,可以用來測量電壓、電流、電阻等多種參數(shù)。在測量穩(wěn)壓管的穩(wěn)壓值時,我們可以使用萬表的直流電壓測量功能。以下是步驟和注意事項: 準(zhǔn)備工具和材料 萬表 穩(wěn)壓管 電源
    的頭像 發(fā)表于 07-31 14:26 ?2873次閱讀

    怎樣用Arduino測試鋰電池容量

    本文詳細(xì)介紹了如何用Arduino測量鋰電池的容量。并附有電路圖和Arduino的程序代碼。
    的頭像 發(fā)表于 07-30 09:14 ?1518次閱讀
    <b class='flag-5'>怎樣用</b><b class='flag-5'>Arduino</b>測試鋰電池容量

    Arduino自制點焊機

    組裝18650電池組,要用到點焊機,本文介紹Arduino控制點焊機的點焊時間。
    發(fā)表于 07-29 10:14 ?9次下載

    Arduino放回了一個空的schetch,重新打開了程序不斷重啟的原因?

    . 我arduino重新加載,就像照片2一樣,但它總是以相同的方式重新啟動。 我將代碼切成兩半,重新加載,它有效。 我恢復(fù)原始代碼,加載它,它有效。 我將相同的程序與加載放回原處,它會不斷重新啟動
    發(fā)表于 07-10 07:22

    ESP32使用Arduino啟用藍(lán)牙后編譯固件過大,怎樣縮減大小呢?

    ESP32使用Arduino啟用藍(lán)牙后編譯固件過大,怎樣縮減大小,日志級別已經(jīng)最低了,分區(qū)不能動,已經(jīng)是1.9M的OTA分區(qū)配置了,怎樣還能縮減大小,藍(lán)牙功能能否裁剪
    發(fā)表于 06-28 11:27

    使用idf.py命令方式編譯,怎樣才能編譯arduino的庫,并且在項目中可調(diào)用?

    在編譯過程中,提示找不到對應(yīng)的頭文件。 請問使用idf.py命令方式編譯,怎樣才能編譯arduino的庫,并且在項目中可調(diào)用。
    發(fā)表于 06-13 06:56

    求助,在esp-idf中使用arduino作為組件后怎樣使用arduino的庫?

    在esp-idf中使用arduino作為組件后怎樣使用arduino的庫,例如我此時需要使用arduino的第三方庫blinker,怎樣使用
    發(fā)表于 06-12 07:21