Looping through a List in Processing

Here is a piece of demonstration code to use various ways to loop through a List or ArrayList in Processing, i.e. Java. The first two examples use for loop and the third one uses the while loop.
 
We initialize the ArrayList with random integers.

ArrayList<Integer> iList = new ArrayList<Integer>();
iList.add(floor(random(10)));
iList.add(floor(random(10)));
iList.add(floor(random(10)));

The first method is the traditional way to loop with an index.

for (int i=0; i<iList.size(); i++) {
    println(iList.get(i));
}

The second method also uses the for loop, but with alternate syntax.

for (int i : iList) {
    println(i);
}

The third method uses the Iterator through the ArrayList.

Iterator<Integer> it = iList.iterator();
while (it.hasNext()) {
    int i = it.next();
    println(i);
}
Posted in Software, Testing | Tagged , | Comments closed

News coverage from The Japan Times

This is the video reportage from The Japan Times about the Japan Media Arts Festival 2015 Award Exhibition.
 

Posted in Arts | Tagged | Comments closed

Japan Media Art Festival 2015

My artwork, 50 . Shades of Grey, won the Grand Prize of the Japan Media Art Festival 2015, Art Division. The award ceremony and exhibition will be held in Tokyo, Feb 2016. Here is the festival website.

 

Posted in Arts | Tagged , | Comments closed

OpenCV 3.1 release Java build

It is the Java build of the new OpenCV 3.1 release. The zipped file contains the Java build for the 64 bit versions of Linux, Mac OSX and Windows. It is available for download at

OpenCV 3.1.0 Java build (64 bit)

Again, you can copy the individual files to your Processing code folder to play with the experiments in this website.

Posted in Research, Software | Tagged , , | Comments closed

Processing with OCR

This is a short Processing sketch to demonstrate the use optical character recognition (OCR) with the Tesseract OCR engine. I used the Mac OSX platform for testing. Here are the steps.

Read More »

Posted in Software, Testing | Tagged , | Comments closed

Processing 3.0 Video library in Ubuntu

I installed the new Processing 3.0 and its video library in Ubuntu and found that the Movie class could not display the digital video. It only played the audio track. The Capture class worked well. Afters some Google researches about the gstreamer package, I concluded that it can be the missing gstreamer0.10-ffmpeg module. By installing it again as described here, the Movie class worked fine.

 

Posted in Research, Software | Tagged , , | Comments closed

Chinese calligraphy in Processing

The following video is from my research project to integrate the writing of Chinese calligraphy, especially the script style with the fighting scenes in Chinese martial art films.
 

Posted in Graphics, Research | Comments closed

Processing 3.0 Beta 1

The new Processing 3.0 beta is available in the Processing website for download. There are some changes in the internal operations that we may need to pay attention to in case our programs depend on them.

Here is a sketch with 2D graphics, I try to list out those internal hidden variables and functions, especially those related to the PSurface class.
Read More »

Posted in Software, Testing | Tagged , | Comments closed

OpenCV and Processing 20

It is a little side tracked from the previous posts. The example demonstrated the use of Kalman Filter in OpenCV with Processing.

Posted in Research, Software | Tagged , , | Comments closed

OpenCV and Processing 19

Similar to the last Hough Line detection, the following example illustrates the use of the new LineSegmentDetector class in the Imgproc module. Instead of using the new command, we have to use the Imgproc.createLineSegmentDetector() function to create a new instance of the class.
 


Read More »

Posted in Research, Software | Comments closed