我正在使用Java构建一个Web应用程序,如果我将网页的URL作为输入,我需要网页的整个屏幕截图.
我的基本想法是捕获渲染组件的显示缓冲区..我不知道如何做它.. plz帮助..
我必须在每一秒后捕获Desktop的屏幕截图.在Winform应用程序中它运行正常.但在将代码移动到Windows服务后,它没有捕获屏幕截图.知道为什么不这样做吗?
这是代码
public partial class ScreenCaptureService : ServiceBase
{
System.Timers.Timer timer = new System.Timers.Timer();
public ScreenCaptureService()
{
InitializeComponent();
this.timer.Interval = 1000;
this.timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed);
}
void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
CaptureScreen();
}
protected override void OnStart(string[] args)
{
if (!EventLog.SourceExists(this.ServiceName, Environment.MachineName))
{
EventLog.CreateEventSource(
new EventSourceCreationData(
this.ServiceName,
Environment.MachineName
)
);
}
EventLog.WriteEntry(this.ServiceName, "The OnStart event has been called");
this.timer.Enabled = true;
CaptureScreen();
}
protected override void OnStop()
{
EventLog.WriteEntry(this.ServiceName, "The OnStop event has been called");
this.timer.Enabled = false;
} …Run Code Online (Sandbox Code Playgroud) 我之前拍摄的图像是在画廊中出现的,但现在它们不是,我无法弄清楚原因.这是我的代码:
ContentValues values = new ContentValues();
values.put(android.provider.MediaStore.Images.Media.IS_PRIVATE, false);
String name = "ugc_" + String.valueOf(System.currentTimeMillis());
values.put(android.provider.MediaStore.Images.Media.TITLE, name);
imageURI = getContentResolver().insert(android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
Run Code Online (Sandbox Code Playgroud)
我也尝试过:values.put(android.provider.MediaStore.Images.Media.IS_PRIVATE,0); 以及留在那个价值,但现在似乎没有任何作用.
我使用AVCaptureSession拍照并将照片存储到相册.当我点击按钮时,它会拍摄快照并存储到相册.但是当我使用横向模式时,然后单击它存储横向模式的按钮会导致倒置静止图像.

码:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
[self setCaptureSession:[[AVCaptureSession alloc] init]];
[self addVideoInputFrontCamera:NO]; // set to YES for Front Camera, No for Back camera
[self addStillImageOutput];
[self setPreviewLayer:[[AVCaptureVideoPreviewLayer alloc] initWithSession:[self captureSession]] ];
[[self previewLayer] setVideoGravity:AVLayerVideoGravityResizeAspectFill];
CGRect layerRect = [[[self view] layer] bounds];
[[self previewLayer]setBounds:layerRect];
[[self previewLayer] setPosition:CGPointMake(CGRectGetMidX(layerRect),CGRectGetMidY(layerRect))];
[[[self view] layer] addSublayer:[self previewLayer]];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(saveImageToPhotoAlbum) name:kImageCapturedSuccessfully object:nil];
[[self captureSession] startRunning];
camera=[UIButton buttonWithType:UIButtonTypeCustom];
[camera setImage:[UIImage imageNamed:@"button.png"] forState:UIControlStateNormal];
[camera setFrame:CGRectMake(150, 10, 40, …Run Code Online (Sandbox Code Playgroud) 当使用getPicture时,我们得到一个相对URL或base64image.但我想将图像对象发送到Amazon S3.无论如何要这样做?
这是我如何获得base64image
// A button will call this function
//
function capturePhoto() {
// Take picture using device camera and retrieve image as base64-encoded string
navigator.camera.getPicture(onPhotoDataSuccess, onFail, {
destinationType: Camera.DestinationType.DATA_URL,
quality: 50
});
}
Run Code Online (Sandbox Code Playgroud)
[更新]现在我需要获取图像作为对象将其转换为字节数组并使用REST(PUT)调用将其上载到Amazon S3.
我正在尝试在Hololens应用程序中捕获照片。它似乎正在工作,但是将图像保存到我无法访问或查看的晦涩地方。我想将它保存到我的图片库形容这里我想。或者我应该在哪里保存图像,以便可以在Hololens的照片中看到它。
filePath = C:/ Data / Users / JanikJoe / AppData / Local / Packages / HoloToolkit-Unity_pzq3xp76mxafg / LocalState \ CapturedImage10.02831_n.jpg
filePath2 = C:/Data/Users/DefaultAccount/AppData/Local/DevelopmentFiles/HoloToolkit-UnityVS.Debug_x86.janik/Data \ CapturedImage10.02831_n.jpg
using UnityEngine;
using UnityEngine.VR.WSA.WebCam;
using System.Linq;
public class PhotoCaptureFVTC : MonoBehaviour {
UnityEngine.VR.WSA.WebCam.PhotoCapture photoCaptureObject = null;
// Use this for initialization
void Start()
{
Debug.Log("snap pic taken");
PhotoCapture.CreateAsync(false, OnPhotoCaptureCreated);
}
public void OnPhotoCaptureCreated(PhotoCapture captureObject)
{
photoCaptureObject = captureObject;
//Resolution cameraResolution = PhotoCapture.SupportedResolutions.OrderByDescending((res) => res.width * res.height).First();
Resolution cameraResolution = PhotoCapture.SupportedResolutions.OrderByDescending((res) => res.width …Run Code Online (Sandbox Code Playgroud) 我想同时拍摄视频和照片.
我有两个按钮.
1.当用户点击一个时,它必须拍摄视频和
2.另一个按钮然后它必须停止录制视频和拍照.
现在我正在尝试录音机和相机,但它不能正常工作,
也注意不是两个在同一时间我想一个接一个地做反之亦然..
任何人都可以告诉我一个好主意.
谢谢.
我在WPF应用程序中使用web cam.我正在使用Expression Encoder进行视频捕获.对于视频捕获我创建了Job及其正常工作.虽然我想获得与视频分辨率相同的图片.为此,我使用ffmpeg从视频中提取第一帧.但是图像质量很低.优先考虑的是图像质量应该是最好的附加网络摄像头,分辨率应该与视频一样多.
要么我们在Expression Encode中有更好的选择来拍照,要么帮助我任何选择.
我试图直接从我的Windows Phone 8.1商店应用程序中的相机捕获图片.
我已成功初始化MediaCapture设备并拍摄照片,但它们总是黑色或曝光方式.
有人能指出我如何让相机自动曝光,如果可能的话也引发焦点,因为当我打电话时遇到灾难性的失败photoManager.VideoDeviceController.FocusControl.FocusAsync()?
我正在尝试构建一个简短的脚本,用我的立体相机拍摄多张图像,并在我按下按钮时将它们保存到一个目录中。
但出于某种原因,即使我拍了多张照片,我也只能得到最后一张照片。它也没有显示任何错误并打印出我在代码中编写的正确字符串。但我得到的只是最后一个图像对。
我看了几个帖子,但没有一个有同样的问题。
编辑:我没有像这里的每个人建议的那样在图像名称中添加秒数,因此图像在同一分钟拍摄时被覆盖。
如果有人想使用它,这是我现在完成的代码:
import numpy as np
import cv2
import os
import datetime
# shape of wholeFrame: (240, 640, 3)
cap = cv2.VideoCapture(1)
now = 0
imgs_taken = 0
newpath_l = "Recorded_Images/left_imgs"
newpath_r = "Recorded_Images/right_imgs"
newpath = "Recorded_Images/both_imgs"
if not os.path.exists(newpath_l):
os.makedirs(newpath_l)
if not os.path.exists(newpath_r):
os.makedirs(newpath_r)
if not os.path.exists(newpath):
os.makedirs(newpath)
while 1:
cap.grab()
ret, wholeFrame = cap.retrieve()
if ret:
leftFrame = wholeFrame[:, 0:320, :]
rightFrame = wholeFrame[:, 320:640, :]
# Rectifying images here
stereoImage = np.concatenate((leftFrame, rightFrame), axis=1) …Run Code Online (Sandbox Code Playgroud)