正在加载图片...
中国科学技术大学电子工程与信息科学系©2018 CameraRequest参数进行设置。CameraRequest.Builder则负责生成CameraRequest 对象。 4、android..hardware.ImageReader类 与播放声音不同,在使用摄像头的时候,我们需要把摄像头捕获的图像进行 显示。示例程序中使用ImageReader类完成摄像头捕获的图像数据到界面上显示 控件的显示。类ImageReader支持图像数据的着色(The ImageReader class allows direct application access to image data rendered into a Surface). 表3 android.hardware.ImageReader类的成员函数[3] 函数返回值类型 成员函数名称 Image acquireLatestImage() Acquire the latest Image from the ImageReader's queue,dropping older images. Image acquireNextlmage() Acquire the next Image from the ImageReader's queue. void close( Free up all the resources associated with this ImageReader. int getHeight() The height of each Image,in pixels. int getlmageFormat() The image format of each Image. int getMaxlmages() Maximum number of images that can be acquired from the ImageReader by any time (for example,with acquireNextlmage()). Surface getSurface() Get a Surface that can be used to produce Images for this ImageReader. int getWidth() The width of each Image,in pixels. static ImageReader newInstance(int width,int height,int format,int maxlmages) Create a new reader for images of the desired size and format. void setOnlmageAvailableListener(ImageReader.OnlmageAvailableListener listener.Handler handler) Register a listener to be invoked when a new image becomes available from the ImageReader. 表4 android.hardware.ImageReader类的回调接口[3] interface ImageReader.OnlmageAvailableListener Callback interface for being notified that a new image is available. 5、回调函数 回调函数就是一个通过函数指针调用的函数。如果你把函数的指针(地址) 作为参数传递给另一个函数,当这个指针被用来调用其所指向的函数时,我们就 说这是回调函数。回调函数不是由该函数的实现方直接调用,而是在特定的事件 或条件发生时由另外的一方调用的,用于对该事件或条件进行响应。 多媒体操作往往需要回调函数的支持,例如,我们通过摄像头捕获图像,启 动摄像头后,会通知摄像头数据采集有关的函数,等采集完一帧图像后,你要做 一些处理(回调函数中就是这些处理的具体代码)。 如果您在阅读过程中发现疏漏和错误,请联系《多媒体技术基础》课程组{network,.cxh}@ustc.edu.cn中国科学技术大学电子工程与信息科学系© 2018 如果您在阅读过程中发现疏漏和错误,请联系《多媒体技术基础》课程组{network,cxh}@ustc.edu.cn CameraRequest 参数进行设置。CameraRequest.Builder 则负责生成 CameraRequest 对象。 4、android.hardware.ImageReader 类 与播放声音不同,在使用摄像头的时候,我们需要把摄像头捕获的图像进行 显示。示例程序中使用 ImageReader 类完成摄像头捕获的图像数据到界面上显示 控件的显示。类 ImageReader 支持图像数据的着色(The ImageReader class allows direct application access to image data rendered into a Surface)。 表 3 android.hardware.ImageReader 类的成员函数[3] 函数返回值类型 成员函数名称 Image acquireLatestImage() Acquire the latest Image from the ImageReader's queue, dropping older images. Image acquireNextImage() Acquire the next Image from the ImageReader's queue. void close() Free up all the resources associated with this ImageReader. int getHeight() The height of each Image, in pixels. int getImageFormat() The image format of each Image. int getMaxImages() Maximum number of images that can be acquired from the ImageReader by any time (for example, with acquireNextImage()). Surface getSurface() Get a Surface that can be used to produce Images for this ImageReader. int getWidth() The width of each Image, in pixels. static ImageReader newInstance(int width, int height, int format, int maxImages) Create a new reader for images of the desired size and format. void setOnImageAvailableListener(ImageReader.OnImageAvailableListener listener, Handler handler) Register a listener to be invoked when a new image becomes available from the ImageReader. 表 4 android.hardware.ImageReader 类的回调接口[3] interface ImageReader.OnImageAvailableListener Callback interface for being notified that a new image is available. 5、回调函数 回调函数就是一个通过函数指针调用的函数。如果你把函数的指针(地址) 作为参数传递给另一个函数,当这个指针被用来调用其所指向的函数时,我们就 说这是回调函数。回调函数不是由该函数的实现方直接调用,而是在特定的事件 或条件发生时由另外的一方调用的,用于对该事件或条件进行响应。 多媒体操作往往需要回调函数的支持,例如,我们通过摄像头捕获图像,启 动摄像头后,会通知摄像头数据采集有关的函数,等采集完一帧图像后,你要做 一些处理(回调函数中就是这些处理的具体代码)
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有