<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
      <title>Tagged with #ketai - Processing 2.x and 3.x Forum</title>
      <link>https://forum.processing.org/two/discussions/tagged/feed.rss?Tag=%23ketai</link>
      <pubDate>Sun, 08 Aug 2021 21:05:49 +0000</pubDate>
         <description>Tagged with #ketai - Processing 2.x and 3.x Forum</description>
   <language>en-CA</language>
   <atom:link href="/two/discussions/tagged%23ketai/feed.rss" rel="self" type="application/rss+xml" />
   <item>
      <title>Ketai Library Release Date Question</title>
      <link>https://forum.processing.org/two/discussion/28031/ketai-library-release-date-question</link>
      <pubDate>Wed, 30 May 2018 22:39:11 +0000</pubDate>
      <dc:creator>Gwak</dc:creator>
      <guid isPermaLink="false">28031@/two/discussions</guid>
      <description><![CDATA[<p>Good morning.</p>

<p>I am a user who makes an application through processing.</p>

<p>Once again, I sincerely appreciate the processing program tools. I also love you.</p>

<p>I use KETAI libraries the most in processing.</p>

<p>So I ask.</p>

<p>When is the KETAI library release date?</p>

<p>I wonder when the plan was taken.
I also want to see you soon.</p>

<p>If you have any information, please post it.
Thanks.</p>
]]></description>
   </item>
   <item>
      <title>New release Ketai sensor library v11 for Processing 3.0</title>
      <link>https://forum.processing.org/two/discussion/10455/new-release-ketai-sensor-library-v11-for-processing-3-0</link>
      <pubDate>Wed, 22 Apr 2015 14:17:27 +0000</pubDate>
      <dc:creator>sauter</dc:creator>
      <guid isPermaLink="false">10455@/two/discussions</guid>
      <description><![CDATA[<p>We just released Ketai v11 with updated sensors</p>

<p>Find it at <a rel="nofollow" href="http://ketai.org">http://ketai.org</a> along with an all new reference site and github repo.
The processing library script hasn't picked up the update yet to use Add library... in the Processing IDE.</p>
]]></description>
   </item>
   <item>
      <title>Odd bug with replacing pixels in image from camera</title>
      <link>https://forum.processing.org/two/discussion/15106/odd-bug-with-replacing-pixels-in-image-from-camera</link>
      <pubDate>Thu, 25 Feb 2016 02:24:29 +0000</pubDate>
      <dc:creator>CantSayIHave</dc:creator>
      <guid isPermaLink="false">15106@/two/discussions</guid>
      <description><![CDATA[<p>Hey, so I'm trying to make a sort of "real time" green screen app with the Ketai library. The end goal of this project is to be able to select a color in the camera view and replace all of that color (within a range) with a preselected background image. Currently, it just replaces a color you tap with green.</p>

<p>The odd thing I'm running into is it only replaces colors selected toward the bottom of the screen, while the method for replacing the image scans left to right, top to bottom.</p>

<p>I've uploaded an example to YouTube:
<span class="VideoWrap"><span class="Video YouTube" id="youtube-3NhmQ407a9M"><span class="VideoPreview"><a href="http://youtube.com/watch?v=3NhmQ407a9M"><img src="http://img.youtube.com/vi/3NhmQ407a9M/0.jpg" width="640" height="385" border="0" /></a></span><span class="VideoPlayer"></span></span></span></p>

<p>I filmed it with an external camera because a screen recording would just further slow down the app. You can see the current color selected in the top left corner of the screen.</p>

<p>Here's the code:</p>

<pre><code>import ketai.camera.*;

final float SHADELIM = 5; //specifies range +or- to compare to other color

color chosenColor;
color defaultColor = color(0,255,0);
boolean ColorSelected = false;

KetaiCamera cam;

void setup () {
  orientation(LANDSCAPE);
  rectMode(CORNER);
  imageMode(CENTER);
  cam = new KetaiCamera(this, width, height, 24);
}

void draw () {
  if(ColorSelected) {
    replaceColor(cam, chosenColor, defaultColor);
    fill(chosenColor);
    rect(0, 0, 50, 50);
  }
  image(cam, width/2, height/2);
}

void onCameraPreviewEvent () {
  cam.read();
}

void mousePressed () {
  if(!cam.isStarted()) {
   cam.start();
  }
  else {
    ColorSelected = true;
    chosenColor = findColor(cam);
  }
}

void replaceColor (KetaiCamera camIn, color target, color payload) {
  camIn.loadPixels();
  for(int yPlace = 0; yPlace &lt; camIn.height; yPlace++) {
    for(int xPlace = 0; xPlace &lt; camIn.width; xPlace++) {
      if(compareColors(camIn.pixels[singleCoord(xPlace, yPlace, camIn.width)], target)) {
        camIn.pixels[singleCoord(xPlace, yPlace, camIn.width)] = payload;
      }
    }
  }
  camIn.updatePixels();
}

int singleCoord (float xin, float yin, float widin) {
  return int(xin + (yin * widin));
}

boolean compareColors (color c1, color c2) {
  float red1 = red(c1);
  float red2 = red(c2);
  float green1 = green(c1);
  float green2 = green(c2);
  float blue1 = blue(c1);
  float blue2 = blue(c2);
  if(red1 &gt; (red2 - SHADELIM) &amp;&amp; red1 &lt; (red2 + SHADELIM)) {
    if(green1 &gt; (green2 - SHADELIM) &amp;&amp; green1 &lt; (green2 + SHADELIM)) {
      if(blue1 &gt; (blue2 - SHADELIM) &amp;&amp; blue1 &lt; (blue2 + SHADELIM)) {
        return true;
      }
    }
  }
  return false;
}

color findColor (KetaiCamera camIn) {
  camIn.loadPixels();
  float camXStart = (width / 2) - (camIn.width / 2);
  float camXEnd = (width / 2) + (camIn.width / 2);
  float camYStart = (height / 2) - (camIn.height / 2);
  float camYEnd = (height / 2) + (camIn.height / 2);
  float xPlace = map(mouseX, camXStart, camXEnd, 0, camIn.width);
  float yPlace = map(mouseY, camYStart, camYEnd, 0, camIn.height);
  return camIn.pixels[singleCoord(xPlace, yPlace, camIn.width)];
}
</code></pre>

<p>Anyone have an idea as to what's going on here?</p>
]]></description>
   </item>
   <item>
      <title>Storing picture</title>
      <link>https://forum.processing.org/two/discussion/9495/storing-picture</link>
      <pubDate>Wed, 18 Feb 2015 21:35:18 +0000</pubDate>
      <dc:creator>f_ilippo</dc:creator>
      <guid isPermaLink="false">9495@/two/discussions</guid>
      <description><![CDATA[<p>Hi,
I would like to know if it's possible to store a picture taken on an androïd phone (ketai library) directly on a wifi connected computer hard disk instead of storing it on the phone  sdcard. 
Any ideas? What would be the library to do it.
Filippo</p>
]]></description>
   </item>
   <item>
      <title>onLocationEvent() seems that this method is never called</title>
      <link>https://forum.processing.org/two/discussion/7063/onlocationevent-seems-that-this-method-is-never-called</link>
      <pubDate>Sun, 07 Sep 2014 12:04:06 +0000</pubDate>
      <dc:creator>rgorazd</dc:creator>
      <guid isPermaLink="false">7063@/two/discussions</guid>
      <description><![CDATA[<p>Hi, I copy/pasted this code from the book Rapid Android Development, but it seems that the onLocationEvent method is never called/happening. I just added a counter, to see if it fires. The onOrientationEvent fires a few times per second.</p>

<p>Here's the code:</p>

<pre><code>import ketai.sensors.*;
import android.location.Location;
KetaiLocation location;
KetaiSensor sensor;
Location destination;
PVector locationVector = new PVector();
float compass;
int locEvent=0, compEvent=0;


void setup() {
  destination = new Location("Hrenova ulica 11");
  destination.setLatitude(45.959448);
  destination.setLongitude(-14.528655);
  location = new KetaiLocation(this);
  sensor = new KetaiSensor(this);
  sensor.start();
  orientation(PORTRAIT);
  textAlign(CENTER, CENTER);
  textSize(28);
  smooth();
}

void draw() {
  background(78, 93, 75);
  float bearing = location.getLocation().bearingTo(destination);
  float distance = location.getLocation().distanceTo(destination);
  if (mousePressed) {
    if (location.getProvider() == "none")
      text("Location data is unavailable. \n" +
        "Please check your location settings.", 0, 0, width, height);
    else
      text("Location:\n" +
      "locEvent: " + locEvent + "\n" + 
      "compEvent: " + compEvent + "\n" + 
      "Latitude: " + locationVector.x + "\n" +
      "Longitude: " + locationVector.y + "\n" +
      "Compass: "+ round(compass) + " deg.\n" +
      "Destination:\n" +
      "Bearing: " + bearing + "\n" +
      "Distance: "+ distance + " m\n" +
      "Provider: " + location.getProvider(), 20, 0, width, height);
  } else {
    translate(width/2, height/2);
    rotate(radians(bearing) - radians(compass));
    stroke(255);
    triangle(-width/4, 0, width/4, 0, 0, -width/2);
    text((int)distance + " m", 0, 50);
    text(nf(distance*0.000621, 0, 2) + " miles", 0, 100);
  }
}

void onLocationEvent(Location _location)
{
  println("onLocation event: " + _location.toString());
  locationVector.x = (float)_location.getLatitude();
  locationVector.y = (float)_location.getLongitude();
  locEvent++;
}

void onOrientationEvent(float x, float y, float z, long time, int accuracy)
{
  compass = x;
  compEvent++;
  // Azimuth angle between the magnetic north and device y-axis, around z-axis.
  // Range: 0 to 359 degrees
  // 0=North, 90=East, 180=South, 270=West
}
</code></pre>

<p>So, if any one sees what's wrong, please let me know :)</p>

<p>Regards.</p>
]]></description>
   </item>
   <item>
      <title>Need an optimization for this code...</title>
      <link>https://forum.processing.org/two/discussion/5831/need-an-optimization-for-this-code</link>
      <pubDate>Mon, 16 Jun 2014 17:17:47 +0000</pubDate>
      <dc:creator>aewsb</dc:creator>
      <guid isPermaLink="false">5831@/two/discussions</guid>
      <description><![CDATA[<p>Hello everyone,</p>

<p>I would appreciate if someone could help me to optimize this code. This code takes reads from arduino code which is an array separated by , and then splits and use each number to color a rectangle. The screen has 32 rectangles. This code runs too slow on android phones\tablets and I don't know the problem. I've tried HTC One/Samsung S4/Tegra Note 7.</p>

<p>Here is the code:</p>

<pre><code>    import android.content.Intent;
    import android.os.Bundle;
    import ketai.net.bluetooth.*;
    import ketai.ui.*;
    import ketai.net.*;

    PFont fontMy;
    boolean bReleased = true; //no permament sending when finger is tap
    KetaiBluetooth bt;
    boolean isConfiguring = true;
    String info = "";
    float num[] = new float[32];
    int i = 0;
    int x = 0;
    int y = 0;
    int Height = 0;
    int Width = 0;
    KetaiList klist;
    ArrayList devicesDiscovered = new ArrayList();

    //********************************************************************
    // The following code is required to enable bluetooth at startup.
    //********************************************************************

    void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      bt = new KetaiBluetooth(this);
    }

    void onActivityResult(int requestCode, int resultCode, Intent data) {
      bt.onActivityResult(requestCode, resultCode, data);
    }

    void setup() {
      size(displayWidth, displayHeight, JAVA2D);
      frameRate(30);
      orientation(LANDSCAPE);
      background(0);

      //start listening for BT connections
      bt.start();
      //at app start select device…
      isConfiguring = true;
      //font size
      fontMy = createFont("SansSerif", 40);
      textFont(fontMy);
      Height = (displayHeight - (displayHeight % 4));
      Width = (displayWidth - (displayWidth % 8));
    }

    void draw() {
      //at app start select device
      if (isConfiguring)
      {
        ArrayList names;
        background(0, 0, 0);
        klist = new KetaiList(this, bt.getPairedDeviceNames());
        isConfiguring = false;
      }
      else
      {
        //    background(0, 50, 0);
        //  if((mousePressed) &amp;&amp; (bReleased == true))
        //  {
        // //send with BT
        //  byte[] data = {'s','w','i','t','c','h','\r'};
        //  bt.broadcast(data);
        // //first tap off to send next message
        //  bReleased = false;
        //  }
        //  if(mousePressed == false)
        //  {
        //  bReleased = true; //finger is up
        //  }
        //print received data
        //    fill(255);
        //      textAlign(LEFT);
        //     text(info.length(), 20, 104);
        //       text(w,20,104);
        //       text(h,20,130);
        num = float(split(info, ','));
        if (num.length == 32) {
          //      info = "";
          fill(255);
          noStroke();
          i = 0;
          for (int y=0; y&lt;Height; y+=Height/4) {
            for (int x=0; x&lt;Width; x+=Width/8) {
              fill(num[i]);
              rect(x, y, Width/8, Height/4);
              i++;
            }
          }
          num = new float [32];
        }
      }
    }

    void onKetaiListSelection(KetaiList klist) {
      String selection = klist.getSelection();
      bt.connectToDeviceByName(selection);
      //dispose of list for now
      klist = null;
    }

    //Call back method to manage data received
    void onBluetoothDataEvent(String who, byte[] data) {
      if (isConfiguring)
        return;
      //received

      if (info.length() &gt;= 62)
        info = "";

      info += new String(data);
    }

    // Arduino+Bluetooth+Processing 
    // Arduino-Android Bluetooth communication
</code></pre>

<p>Thank you in advance :)</p>
]]></description>
   </item>
   </channel>
</rss>