Processing是什么?

Processing是一款开源编程语言和集成开发环境,旨在通过视觉上下文教授计算机编程基础知识。它由Casey Reas和Ben Fry创建,特别适合电子艺术、新媒体艺术和视觉设计领域的教学。Processing简化了Java语法,并提供了丰富的图形编程功能。

在某群里听说了这个软件,百度下它到底能做什么。


/以下内容来自百度/

简介

虽然图形用户界面(GUI)早在二十年前成为主流,但是基础编程语言的教学到今天仍是以命令行接口为主,学习编程语言为什么要那么枯燥呢?人脑天生擅长空间辨识,图形用户界面利用的正是这种优势,加上它能提供各种实时且鲜明的图像式反馈 (feedback),可以大幅缩短学习曲线,并帮助理解抽象逻辑法则。举例来说,计算机屏幕上的一个像素(pixel) 就是一个变量值(the value of a variable) 的可视化表现。Processing将Java的语法简化并将其运算结果“感官化”,让使用者能很快享有声光兼备的交互式多媒体作品。
Processing的源代码是开放的,和近来广受欢迎的Linux 操作系统、Mozilla浏览器、或Perl语言等一样,用户可依照自己的需要自由裁剪出最合适的使用模式。Processing的应用非常丰富,而且它们全部遵守开放源代码的规定,这样的设计大幅增加了整个社群的互动性与学习效率。
Processing的创始者:Casey Reas与Ben Fry是美国麻省理工学院媒体实验室 (M.I.T. Media Laboratory) 旗下美学与运算小组 (Aesthetics & Computation Group) 的成员。美学与运算小组由著名的计算机艺术家John Maeda领导,于一九九六年成立至今,在短时间内声名大噪,以其高度实验性及概念性的作品,既广且深地在艺术及设计的领域里,探索计算机的运算特质及其带来源源不绝的创造性。极少数人能完美结合并平衡艺术家、设计师和计算机工程师的才华于一身,更重要的是Casey和Ben拥有开放源码的胸襟。
Casey Reas目前在加州大学洛杉矶分校Media/Arts系任助理教授,同时在意大利艾维里互动设计学院(Interaction Design Institute Ivrea)任助理教授。Casey作品的主要特色是用processing实现生物体的印象派表现,并将成果呈现为多媒体、传感器艺术、数字雕塑、数字印刷等多种形式。Casey经常参加欧洲、亚洲以及美国各地的演讲和展览。他是本届奥地利的林兹艺术节 (Ars Electronica in Linz︰多媒体艺术界规模最大的年度盛事) 的评审委员之一。
Ben Fry现仍在MIT的媒体实验室攻读博士。他的研究方向是器官(有机体)可视化 (Organic Information Visualization),并创造出能随着不断更新的数据,实时进行形变或质变的电子动态系统。他的博士论文阐述如何用processing语言实现人类基因组工程所揭示的膨大信息量的可视化,Ben为此定义的专用名词为基因制图学(Genomic Cartography)。


相关书籍


新手入门了解可选择《爱上Processing》,英文名《getting started with processing》。


Processing的原作者Casey Reas与Ben Fry写作了唯一一本著作《Processing: A Programming Handbook for Visual Designers and Artists》,该书目前是Processing方面的最权威教程,目前中文译本为《Processing语言权威指南》。


《Processing语言权威指南》封面
《Processing语言权威指南》封面
此外,如果对用代码描述物理世界有兴趣可以看看《The Nature of Code》。


最后推荐的是《Visualing Data》,意思是数据可视化。


以上4本书的所以代码例子都直接包含在processing的example中。


/以下内容来自wiki/


Processing (programming language)

[hide]This article has multiple issues. Please help improve it or discuss these issues on the talk page.This article needs additional citations for verification. (January 2013)

Processing is an open source programming language and integrated development environment (IDE) builtfor the electronic arts, new media art, and visual design communities with the purpose of teaching thefundamentals of computer programming in a visual context, and to serve as the foundation for electronicsketchbooks. The project was initiated in 2001 by Casey Reas and Benjamin Fry, both formerly of theAesthetics and Computation Group at the MIT Media Lab. One of the stated aims of Processing is to act as atool to get non-programmers started with programming, through the instant gratification of visual feedback.The language builds on the Java language, but uses a simplified syntax and graphics programming model.

Features

Processing includes a sketchbook, a minimal alternative to an integrated development environment (IDE) fororganizing projects.

Every Processing sketch is actually a subclass of the PApplet Java class which implements most of theProcessing language's features.

When programming in Processing, all additional classes defined will be treated as inner classes when thecode is translated into pure Java before compiling. This means that the use of static variables and methods inclasses is prohibited unless you explicitly tell Processing that you want to code in pure Java mode.

Processing also allows for users to create their own classes within the PApplet sketch. This allows forcomplex data types that can include any number of arguments and avoids the limitations of solely usingstandard data types such as: int (integer), char (character), float (real number), and color (RGB, ARGB, hex).

ExamplesHello World

The Processing equivalent of a Hello World program is simply to draw a line:[1]

The following code is a better example of the look and feel of the language.

//Hello mouse.

void setup() {size(400, 400);

       stroke(255);
       background(192, 64, 0);

}
void draw() {

}

line(150, 25, mouseX, mouseY);

United States presidential election map

The next example shows a map of the results of the 2008 USA presidential election. Blue denotes states wonby Barack Obama, and red denotes those won by John McCain. (Note: this map does not show the Nebraskadistrict in which Obama won an elector.)

PShape usa;
PShape state;
String [] Obama  = { "HI", "RI", "CT", "MA", "ME", "NH", "VT", "NY", "NJ",
         "FL", "NC", "OH", "IN", "IA", "CO", "NV", "PA", "DE", "MD", "MI",
         "WA", "CA", "OR", "IL", "MN", "WI", "DC", "NM", "VA" };
String [] McCain = { "AK", "GA", "AL", "TN", "WV", "KY", "SC", "WY", "MT",
         "ID", "TX", "AZ", "UT", "ND", "SD", "NE", "MS", "MO", "AR", "OK",
         "KS", "LA" };

void setup() {
size(950, 600);
// The file Blank_US_Map.svg can be found at Wikimedia Commonsusa =

loadShape("http://upload.wikimedia.org/wikipedia/commons/3/32/Blank_US_Map.svg");

smooth(); // Improves the drawing quality of the SVG

noLoop();}

void draw() {
background(255);
// Draw the full map
shape(usa, 0, 0);
// Blue denotes states won by ObamastatesColoring(Obama , color(0, 0, 255));// Red denotes states won by McCainstatesColoring(McCain, color(255, 0, 0));// Save the map as image
saveFrame("map output.png");

}
void statesColoring(String[] states, int c){

for (int i = 0; i < states.length; ++i) {PShape state = usa.getChild(states[i]);
// Disable the colors found in the SVG filestate.disableStyle();
// Set our own coloring
fill(c);
noStroke();
// Draw a single state
shape(state, 0, 0);

}}

Related projectsDesign By Numbers

Processing was based on the original work done on Design By Numbers project in MIT. It shares many of thesame ideas and is a direct child of that experiment.

Wiring, Arduino, and Fritzing

Processing has spawned another project, Wiring, which uses the Processing IDE with a simplified version ofthe C++ language as a way to teach artists how to program microcontrollers. There are now two separatehardware projects, Wiring and Arduino, using the Wiring environment and language. Fritzing is anothersoftware environment of the same sort, which helps designers and artists to document their interactiveprototypes and to take the step from physical prototyping to actual product.

Mobile Processing

Another spin-off project, now defunct, is Mobile Processing by Francis Li, which allowed software writtenusing the Processing language and environment to run on Java powered mobile devices. Today some of the

same functionality is provided by Processing itself.[2]

Processing.js

Main article: Processing.js

In 2008, John Resig ported Processing to JavaScript using the Canvas element for rendering,[3] allowingProcessing to be used in modern web browsers without the need for a Java plugin. Since then, the opensource community including students at Seneca College have taken over the project.

iProcessing

iProcessing was built to help people develop native iPhone applications using the Processing language. It isan integration of the Processing.js library and a Javascript application framework for iPhone.

Spde

Spde (standing for Scala Processing Development Environment) replaces Processing's reduced Java syntaxand custom preprocessor with the off-the-shelf Scala programming language which also runs on the Javaplatform and enforces some of the same restrictions such as disallowing static methods, while also allowing

more concise code, and supporting functional programming.[4][5][6]Quil

Quil (formerly named clj-processing) is a wrapper for Processing in the Clojure language, a Lisp that runs onthe Java platform.[7]

Awards

In 2005 Reas and Fry won the prestigious Golden Nica award from Ars Electronica in its Net Vision categoryfor their work on Processing.

Ben Fry won the 2011 National Design Award given by the Smithsonian Cooper-Hewitt National DesignMuseum in the category of Interaction Design. The award statement says:

"Drawing on a background in graphic design and computer science, Ben Fry pursues a long-held fascinationwith visualizing data. As Principal of Fathom Information Design in Boston, Fry develops software, printedworks, installations, and books that depict and explain topics from the human genome to baseball salaries tothe evolution of text documents. With Casey Reas, he founded the Processing Project, an open-sourceprogramming environment for teaching computational design and sketching interactive-media software. Itprovides artists and designers with accessible means of working with code while encouraging engineers andcomputer scientists to think about design concepts."

License

Processing's core libraries, the code included in exported applications and applets, is licensed under the GNULesser General Public License, allowing users to release their original code with a choice of license.

The IDE is licensed under the GNU General Public License.

Name

Originally, Processing had the URL at proce55ing.net, because the processing domain was taken. EventuallyReas and Fry acquired the domain. Although the name had a combination of letters and numbers, it was stillpronounced processing. They do not prefer the environment being referred to as Proce55ing. Despite thedomain name change, Processing still uses the term p5 sometimes as a shortened name (p5 specifically isused not p55).

See also

Cinder (C++)

page4image19416

OpenFrameworks (C++)JavaFX
Max (software)Processing.js

FootnotesReferences

Bohnacker, Hartmut; Gross, Benedikt; Laub, Julia; Lazzeroni, Claudius (August 22, 2012), GenerativeDesign: Visualize, Program, and Create with Processing (1st ed.), Princeton Architectural Press,
p. 472,
ISBN 978-1616890773
Glassner, Andrew (August 9, 2010), Processing for Visual Artists: How to Create Expressive Imagesand Interactive Art (1st ed.), A K Peters/CRC Press, p. 955, ISBN 1-56881-716-9

Reas, Casey; Fry, Ben (June 17, 2010), Getting Started with Processing (1st ed.), Make, p. 208, ISBN 1-4493-7980-X
Noble, Joshua (July 21, 2009), Programming Interactivity: A Designer's Guide to Processing,Arduino, and Openframeworks (1st ed.), O'Reilly Media, p. 736, ISBN 0-596-15414-3

Terzidis, Kostas (May 11, 2009), Algorithms for Visual Design Using the Processing Language (1sted.), Wiley, p. 384, ISBN 0-470-37548-5
Reas, Casey; Fry, Ben; Maeda, John (September 30, 2007), Processing: A Programming Handbookfor Visual Designers and Artists (1st ed.), The MIT Press, p. 736, ISBN 0-262-18262-9

Fry, Ben (January 11, 2008), Visualizing Data (1st ed.), O'Reilly Media, p. 382, ISBN 0-596-51455-7Greenberg, Ira (May 28, 2007), Processing: Creative Coding and Computational Art (Foundation)(1st ed.), friends of ED, p. 840, ISBN 1-59059-617-X
Shiffman, Daniel (August 19, 2008), Learning Processing: A Beginner's Guide to ProgrammingImages, Animation, and Interaction (1st ed.), Morgan Kaufmann, p. 450, ISBN 0-12-373602-1Faludi, Robert (January 4, 2011), Building Wireless Sensor Networks: with ZigBee, XBee, Arduino,and Processing (1st ed.), O'Reilly Media, p. 320, ISBN 978-0-596-80774-0

Vantomme, Jan (September 20, 2012), Processing 2, Creative Programming Cookbook (1st ed.), PacktPublishing, p. 291, ISBN 9781849517942
Pearson, Matt (June 1, 2011), Generative Art, A practical guide using Processing (1st ed.), Manning,
p. 240,
ISBN 9781935182627

Jan, Vantomme (September 20, 2012), Processing 2: Creative Programming Cookbook (1st ed.),Packt Publishing, p. 306, ISBN 978-1849517942
Sauter, Daniel (May 2, 2013), Rapid Android Development: Build Rich, Sensor-Based Applicationswith Processing (1st ed.), Pragmatic Bookshelf, p. 300, ISBN 978-1937785062

Gradwohl, Nikolaus (May 20, 2013), Processing 2: Creative Coding Hotshot (1st ed.), PacktPublishing, p. 266, ISBN 978-1782166726

External links

page5image18976page5image19136page5image19296page5image19456page5image19616page5image19776page5image19936page5image20096page5image20256page5image20416page5image20576page5image20736page5image20896page5image21056page5image21216page5image21376page5image21536page5image21696page5image21856

Official website

page5image22504

Processing.js official websiteOfficial wiki
Official forum
OpenProcessing - sketches libraryProcessing.js blog

Processing.js Google group
Working with Processing and Arduino
Website (German) to the book with nice source-codes and examples
Ruby-Processing, which is a ruby wrapper around the Processing code art framework, built usingJRuby

page6image3736page6image3896page6image4056page6image4216page6image4376page6image4536page6image4696page6image4856page6image5016




虽然还是不太懂,不过看样子是可以图形编程的工具,没猜错的话= =

<think>我们正在讨论ROS 2中的`image_processing`。根据用户的问题,他想了解`image_processing`在ROS 2中的含义及其作用。注意,用户之前遇到了一个关于`image_processing`包未找到的错误,但现在的问题转向了概念层面。 首先,需要明确:`image_processing`在ROS 2中通常不是一个特定的官方包,而是一个通用术语,指代与图像处理相关的功能包或节点集合。它可能包括: 1. 图像获取(如从摄像头、ROS话题) 2. 图像转换(如ROS图像消息与OpenCV图像之间的转换) 3. 图像处理算法(如滤波、特征检测、目标识别等) 4. 处理结果的发布(如检测后的图像、识别结果等) 在ROS 2中,常见的图像处理相关包有: - `image_transport`:用于传输图像,支持压缩和多种传输方式[^3]。 - `cv_bridge`:提供ROS 2图像消息(`sensor_msgs/msg/Image`)与OpenCV图像(`cv::Mat`)之间的转换[^2]。 - 各种视觉算法包,如OpenCV集成、YOLO等(如用户引用中提到的`yolov5_ros2`)[^1]。 用户之前遇到的`image_processing`包未找到的错误,可能是因为他试图运行一个名为`image_processing`的自定义包,但该包尚未编译或环境未设置正确。现在,我们专注于解释这个概念。 ### ROS 2中的图像处理流程 1. **图像获取**:通过摄像头驱动(如`realsense2_camera`)发布图像话题(如`/image_raw`)[^5]。 2. **图像转换**:使用`cv_bridge`将ROS图像消息转换为OpenCV图像进行处理。 3. **图像处理**:应用OpenCV或其他库(如TensorFlow、PyTorch)进行图像处理。 4. **结果发布**:将处理后的图像(通过`cv_bridge`转换回ROS消息)或识别结果发布到新话题。 ### 示例:图像处理节点 一个典型的图像处理节点可能包含以下步骤: ```cpp // 创建订阅者,订阅原始图像话题 auto sub = image_transport::create_subscription( node, "in_image_topic", [](const sensor_msgs::msg::Image::ConstSharedPtr& msg) { // 使用cv_bridge转换为OpenCV图像 cv_bridge::CvImagePtr cv_ptr; try { cv_ptr = cv_bridge::toCvCopy(msg, sensor_msgs::image_encodings::BGR8); } catch (cv_bridge::Exception& e) { RCLCPP_ERROR(rclcpp::get_logger("image_processor"), "cv_bridge exception: %s", e.what()); return; } // 图像处理(例如灰度化) cv::Mat gray; cv::cvtColor(cv_ptr->image, gray, cv::COLOR_BGR2GRAY); // 将处理后的图像转换回ROS消息并发布 cv_bridge::CvImage out_img; out_img.header = msg->header; out_img.encoding = sensor_msgs::image_encodings::MONO8; out_img.image = gray; pub.publish(out_img.toImageMsg()); }, "raw"); ``` ### 常见问题与解决 - **`cv_bridge`未找到**:确保安装`ros-<distro>-cv-bridge`(如`ros-humble-cv-bridge`)[^2]。 - **Python 3兼容性**:ROS 2(Foxy及以后)默认使用Python 3,无需担心版本问题[^4]。 - **深度图像处理**:如引用[5]所示,可同时订阅RGB和深度图像进行融合处理。 ### 总结 `image_processing`在ROS 2中泛指处理图像数据的一系列技术和包。它依赖于核心包(如`image_transport`和`cv_bridge`)以及用户自定义的处理节点。正确配置工作环境和依赖是运行图像处理应用的关键。 §§相关问题§§ 1. ROS 2中如何实现图像话题的压缩传输? 2. 如何使用`cv_bridge`在ROS 2和OpenCV之间转换图像? 3. ROS 2中如何处理深度图像与RGB图像的同步? 4. 如何部署深度学习模型(如YOLO)到ROS 2中进行实时目标检测?</think>### `image_processing` 在 ROS 2 中的含义与作用 在 ROS 2 中,**`image_processing` 是一个通用的功能包命名**,用于处理与计算机视觉相关的图像数据操作。它不是一个官方标准包,而是开发者根据需求自定义实现的图像处理功能集合,主要作用包括: #### 核心功能 1. **图像获取与传输** - 订阅相机节点发布的图像话题(如 `/image_raw`) - 支持多种传输协议(包括压缩传输)[^3][^5] 2. **图像格式转换** - 使用 `cv_bridge` 实现 `sensor_msgs/Image` 与 OpenCV `cv::Mat` 的相互转换 - 支持不同色彩空间转换(RGB/BGR/灰度等)[^2] 3. **基础图像处理** ```cpp // 示例:ROS 2 图像处理回调函数 void imageCallback(const sensor_msgs::msg::Image::ConstSharedPtr& msg) { cv_bridge::CvImagePtr cv_ptr = cv_bridge::toCvCopy(msg, "bgr8"); cv::Mat processed; cv::cvtColor(cv_ptr->image, processed, cv::COLOR_BGR2GRAY); // 灰度化 // 发布处理后的图像 } ``` 4. **高级视觉处理** - 目标检测(如 YOLO 集成)[^1] - 深度图与 RGB 图像融合[^5] - 特征提取与匹配 #### 典型应用场景 1. **机器人视觉系统** - 实时处理摄像头数据 - 物体识别与位姿估计 2. **传感器数据融合** - 对齐深度图与彩色图(如 `/aligned_depth_to_color/image_raw`)[^5] - 点云生成(`sensor_msgs/PointCloud2`)[^2] 3. **算法验证平台** - 快速部署新算法原型 - 可视化中间处理结果 #### 技术栈依赖 | 组件 | 作用 | 安装命令 | |------|------|----------| | **OpenCV** | 核心图像处理库 | `sudo apt install libopencv-dev` | | **cv_bridge** | ROS-OpenCV 桥接 | `sudo apt install ros-<distro>-cv-bridge` | | **image_transport** | 高效图像传输 | `sudo apt install ros-<distro>-image-transport` | > 💡 **最佳实践**:在 Python 环境中使用时,需确保 Python 版本(ROS 2 Foxy+/Humble 默认支持 Python 3)与 OpenCV 版本兼容,避免出现 `import cv_bridge` 错误[^4]。 --- ### 常见实现模式 1. **处理流水线架构** ``` 相机驱动 → 原始图像话题 → image_processing节点 → 结果话题 → 控制节点 ``` 2. **多节点协同** ```bash ros2 run image_processing image_subscriber # 订阅图像 ros2 run image_processing edge_detector # 边缘检测 ros2 run image_processing object_tracker # 目标跟踪 ``` 3. **参数动态配置** ```bash ros2 run image_processing yolo_detector \ --ros-args -p device:=gpu -p confidence_threshold:=0.7 # 引用[1] ``` --- ### 调试建议 若出现 `Package 'image_processing' not found`: 1. 确认工作空间已编译且 sourced: ```bash colcon build --packages-select image_processing source install/setup.bash ``` 2. 检查 `package.xml` 的 `<name>` 标签是否匹配 3. 验证 `CMakeLists.txt` 包含: ```cmake find_package(OpenCV REQUIRED) find_package(cv_bridge REQUIRED) ```
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值