我正在尝试保存使用网络摄像头捕获的图片框图像。 我正在使用AForget.NET。
我想做的是,当我单击“确定”按钮并获取已保存到文件夹的路径时,我希望将该图片框图像保存到“项目/特定文件夹”中。
我收到GDI +错误
这是我的代码
RegisterCustomer _regCustomer;
public UpdateImageCapture(RegisterCustomer regCustomer)
{
InitializeComponent();
_regCustomer = regCustomer;
}
ImageHelper img = new ImageHelper();
private void ImageCapture_Load(object sender, EventArgs e)
{
img.ImageSettings
(
img._captureDevice,
img.finalFrame,
cboxWebcamType
);
img.finalFrame.NewFrame += new NewFrameEventHandler(FinalFrame_NewFrame);
btnOk.Hide();
btnCancel.Hide();
}
private void FinalFrame_NewFrame(object sender, NewFrameEventArgs eventArgs)
{
picPreviewImage.Image = (Bitmap)eventArgs.Frame.Clone();
}
这些代码指定当单击按钮捕获时,picCaptureImage(Picturebox2)将获得picPreviewImage(Picturebox1)的克隆副本
注意:Picturebox1通过摄像头显示自己的身影
private void BtnCapture_Click(object sender, EventArgs e)
{
picCapturedImage.Image = (Bitmap)picPreviewImage.Image.Clone();
picCapturedImage.BringToFront();
btnCapture.Hide();
btnOk.Show();
btnCancel.Show();
}
private void BtnOk_Click(object sender, EventArgs e)
{
if (picCapturedImage.Image != null)
{
var bitmap = new Bitmap(picCapturedImage.Image);
var newBitmap = new Bitmap(bitmap);
bitmap.Save(@"C:\Users\dieth\source\repos\SalesInventorySystem\SalesInventorySystem\Resources", ImageFormat.Png);
bitmap.Dispose();
bitmap = null;
}
else {
MessageBox.Show("NULL");
}
}
答案 0 :(得分:0)
我解决了它,但是当我尝试再次捕获图像时,它只是替换了该文件中的图像。
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.common.exceptions import TimeoutException
import sys
reload(sys)
import re
import csv
from time import sleep
sys.setdefaultencoding('utf-8') #added since it would give error for certain values when using str(i)
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--headless')
prefs = {'profile.managed_default_content_settings.images':2}
chrome_options.add_experimental_option("prefs", prefs)
driver = webdriver.Chrome(chrome_options=chrome_options)
maxcr = 1379
listofrows = []
url = "http://biggestbook.com/ui/catalog.html#/itemDetail?itemId=HERY4832YER01&uom=CT"
print(url)
driver.get(url)
wait = WebDriverWait(driver,10)
# Trying to get the table
tableloadwait = (wait.until(EC.presence_of_all_elements_located((By.CSS_SELECTOR, ".panel-body"))))
table = driver.find_elements_by_css_selector(".panel-body")
print(table)
RowsOfTable = table.get_attribute("tr")